aboutsummaryrefslogtreecommitdiff
path: root/helper.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'helper.lisp')
-rw-r--r--helper.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/helper.lisp b/helper.lisp
new file mode 100644
index 0000000..d2b9d77
--- /dev/null
+++ b/helper.lisp
@@ -0,0 +1,12 @@
+; read a stream into a string
+(defun read-all-stream (stream)
+ (let ((line (read-line stream nil)))
+ (if line (concatenate 'string line '(#\linefeed) (read-all-stream stream)) "")))
+
+
+; convert variable arguments into variable keyword arguments
+(defun rest-keys (&rest args)
+ (if (null args)
+ '()
+ (destructuring-bind (key value &rest args) args
+ (cons (list key value) (apply #'rest-keys args)))))