Skip to content

Instantly share code, notes, and snippets.

@AlejandroCatalina
Created November 13, 2015 10:28
Show Gist options
  • Save AlejandroCatalina/7faaaee84cbda9884600 to your computer and use it in GitHub Desktop.
Save AlejandroCatalina/7faaaee84cbda9884600 to your computer and use it in GitHub Desktop.
Lists comprehensions macro for lisp, and a pattern-matching macro
(defmacro @ (value bind list test)
(let ((newlist (gensym)))
`(let ((,newlist nil))
(dolist (,bind ,list)
(when ,test
(push ,value ,newlist)))
(nreverse ,newlist))))
(defmacro pattern (bind l &rest body)
`(destructuring-bind ,bind ,l
,@body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment