[gambit-list] Read macros in Scheme?

James Cash james.nvc at gmail.com
Tue Feb 27 19:38:28 EST 2007

I've been using Gambit Scheme as my primary language for about a
year now, and I'm finding it pretty much the best for what
I'm doing. However, the one thing that I find lacking is read-
macros: Why doesn't Scheme have an equivalent to CL's set-macro-char
and the like? It seems to me that you can do lots of interesting
things with them that you couldn't do otherwise.

Does anyone know of a way to do something equivalent
to the following CL in Gambit?  I suspect that there's some way to do
it using readtables...but I have no idea how..

(set-macro-character #\] (get-macro-character #\)))

(set-dispatch-macro-character #\# #\[
#'(lambda (stream char1 char2)
(let ((accum nil)
(pair (read-delimited-list #\] stream t)))
(do ((i (ceiling (car pair)) (1+ i)))
((> i (floor (cadr pair)))
(list 'quote (nreverse accum)))
(push i accum)))))

Thanks for your time, any help is appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20070227/ae6af43a/attachment.htm>

More information about the Gambit-list mailing list