diff options
Diffstat (limited to 'src/macros.lisp')
-rw-r--r-- | src/macros.lisp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/macros.lisp b/src/macros.lisp index 0d941b6..fe2c6cc 100644 --- a/src/macros.lisp +++ b/src/macros.lisp @@ -47,3 +47,15 @@ first mapped with the PARSER function." collect `(,name (when ,name (funcall ',(second (assoc name params)) ,name)))) ,@body)))) +(defmacro let-body ((&rest var-names) &body body) + (let ((key (gensym "key")) + (val (gensym "val")) + (var (gensym "var"))) + `(derrida:with-plist + ,var-names + (loop :for (,key ,val) :on (request-body) :by #'cddr + :for ,var := (find ,key ',var-names :test #'string-equal) + :when ,var :collect ,var :and :collect ,val) + ,@body))) + + |