Skip to content

Instantly share code, notes, and snippets.

@youz
Created October 3, 2010 14:20
Show Gist options
  • Save youz/608606 to your computer and use it in GitHub Desktop.
Save youz/608606 to your computer and use it in GitHub Desktop.
Gauche's debug-print macro for CL
;;; ref. http://practical-scheme.net/gauche/man/gauche-refj_16.html#SEC18
(defmacro debug-print (form)
`(progn
(format t "#?=~S~%" ',form)
(let ((#1=#:values (multiple-value-list ,form)))
(format t "#?- ~{~S~%~^#?+ ~}" #1#)
(values-list #1#))))
(set-dispatch-macro-character #\# #\?
#'(lambda (s c n)
(declare (ignore c n))
(read-char s t)
`(debug-print ,(read s t nil t))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment