Created
November 14, 2009 05:36
-
-
Save nforrester/234398 to your computer and use it in GitHub Desktop.
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 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