-
-
Save bowbow99/632516 to your computer and use it in GitHub Desktop.
This file contains 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
;;; ref. http://practical-scheme.net/gauche/man/gauche-refj_16.html#SEC18 | |
(defmacro debug-print (form stream) | |
`(progn | |
(format t "~&#?=~S:~S:~S~%" | |
,(or *load-pathname* | |
(when (buffer-stream-p stream) | |
(buffer-name (buffer-stream-buffer stream))) | |
stream) | |
,(si:*stream-line-number stream) | |
',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) ,s))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
form が何か出力した時のために #?=... と #?- の前で fresh-line しておいた。