Skip to content

Instantly share code, notes, and snippets.

@nforrester
Created November 14, 2009 05:36
Show Gist options
  • Save nforrester/234398 to your computer and use it in GitHub Desktop.
Save nforrester/234398 to your computer and use it in GitHub Desktop.
(defmacro preval (&rest stuff) `(print ,stuff))
;;;; This Common Lisp macro is useful for debugging.
;;;; Rather than turning a statement like
;;;; (+ 2 3 (* 2 5))
;;;; into
;;;; (+ 2 3 (print (* 2 5)))
;;;; and back again for debugging, you can do this
;;;; (+ 2 3 (preval * 2 5))
;;;; which is much easier, since you only have to change one place in the code
;;;; (the front of the sexp) rather than two places (the front and back).
;;;; Do whatever you want with this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment