Skip to content

Instantly share code, notes, and snippets.

@cades
Created February 23, 2014 02:29
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 cades/9165799 to your computer and use it in GitHub Desktop.
Save cades/9165799 to your computer and use it in GitHub Desktop.
Solution to lisp-koan's final koan of macros.lsp
(defmacro log-form-with-value (&body body)
"records the body form, and the form's return value
to the list *log-with-value* and then evalues the body normally"
`(let ((logform nil)
(retval ,@body))
;; 有沒有不需要list的解法? 試不出來QQ
(push (list :form ',@body :value retval) *log-with-value*)
retval))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment