Skip to content

Instantly share code, notes, and snippets.

@rigidus
Created October 29, 2015 10:23
Show Gist options
  • Save rigidus/c4dd64c81881e339626b to your computer and use it in GitHub Desktop.
Save rigidus/c4dd64c81881e339626b to your computer and use it in GitHub Desktop.
(defmacro -> (forms)
(let ((forms (reverse forms)))
(if (null (cdr forms))
(car forms)
(let ((base (car forms)))
(unless (listp base)
(setf base (list base)))
(list* (car base)
(test (reverse (cdr forms)))
(cdr base))))))
(macroexpand-1 '(-> ((handler/site app-routes)
(wrap-resource "web")
(wrap-file-info)
(wrap-params)
(wrap-keyword-params))))
=> (WRAP-KEYWORD-PARAMS
(WRAP-PARAMS
(WRAP-FILE-INFO
(WRAP-RESOURCE
(HANDLER/SITE APP-ROUTES)
"web")))), T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment