[gambit-list] Quasiquote syntax question.

Marc Feeley feeley at iro.umontreal.ca
Fri Feb 1 18:47:05 EST 2008


On 1-Feb-08, at 4:07 PM, Blake Winton wrote:

> Hello everyone,
>
> I'm using Gambit on an iPod Touch, and have run into a small hitch  
> when trying
> to write a macro.  The hitch is that I have no way of typing in a `  
> on the
> device.  It's just not on the keyboard.
>
> I realize that I could use (quasiquote a) instead, but I'm really  
> kind of lazy,
> and would far prefer to write something like $(a b c).  I asked  
> Guillaume
> Cartier on IRC, and he suggested that it was non-standard but  
> possible.  He also
> mentioned it was undocumented, and so instead of trolling through  
> the code, I
> thought it might be worth while to ask here first for some pointers.
>
> Are there any examples of adding syntax like this to Gambit  
> available?  Do I
> need to edit and recompile the interpreter, or can I hook in to the  
> reader somehow?
>
> (I'ld even live with ($ a b c), but I can't seem to get that working  
> either.)

Beware, fiddling with Gambit's internal routines will void the  
warranty...

 > (begin
     (##readtable-char-class-set!
       (current-readtable)
       #\$  ;; the character to dispatch on
       #t   ;; this character is a delimiter
       (lambda (re c) (##read-quotation re #\`)))  ;; handler
     #f)
 > $(1 ,(+ 2 3) 4)
(1 5 4)

Marc





More information about the Gambit-list mailing list