Created
September 13, 2016 00:56
-
-
Save spacebat/4f0c6b0fd30b534671eed3946954fb99 to your computer and use it in GitHub Desktop.
Clojure's definline in CL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defmacro definline (name args &body body) | |
| `(progn | |
| (defmacro ,name ,args ,@body) | |
| (setf ,name (lambda ,args (,name ,@args))))) | |
| CL-USER> (definline myor (a b) `(or ,a ,b)) | |
| #<anonymous interpreted function 40500011FC> | |
| CL-USER> (myor t (error "boom!")) | |
| T | |
| CL-USER> (apply myor '(nil t)) | |
| T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment