Skip to content

Instantly share code, notes, and snippets.

@1ambda
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1ambda/9510951 to your computer and use it in GitHub Desktop.
Save 1ambda/9510951 to your computer and use it in GitHub Desktop.
lisp macro example
CL-USER> (defun sample ()
`#'(lambda ()
(+ 3 5)))
CL-USER> (defmacro sample2 ()
`#'(lambda ()
(+ 3 5)))
CL-USER> (sample)
#'(LAMBDA () (+ 3 5))
CL-USER> (sample2)
#<FUNCTION (LAMBDA ()) {259C50C5}>
CL-USER> (eval (sample))
#<FUNCTION (LAMBDA ()) {259EF9C5}>
CL-USER> (funcall (eval (sample)))
8
CL-USER> (funcall (sample2))
8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment