Fw: [plt-scheme] Is it possible to define ' ` , like syntax?
Forgot to cc PLT
----- Original Message -----
From: "Jos Koot" <jos.koot at telefonica.net>
To: "Majorinc, Kazimir" <kazimir at chem.pmf.hr>
Sent: Monday, December 10, 2007 10:36 AM
Subject: Re: [plt-scheme] Is it possible to define ' ` , like syntax?
> Yes, by customizing the readtable:
>
> (define read-odd-char
> (case-lambda
> ((ch port src line col pos)
> #`(dance #,(read/recursive port #f (current-readtable))))
> ((ch port)
> (list 'lazy (read/recursive port #f (current-readtable))))))
>
> (current-readtable
> (make-readtable #f
> #\° 'terminating-macro read-odd-char))
>
> (define dance list)
> (define samba 'rumba)
> (define (rumba x) (cons x 'samba))
> °(rumba samba) --> ((rumba . samba))
>
> ((((lambda(x)((((((x x)x)x)x)x)x))
> (lambda(x)(lambda(y)(x(x y)))))
> (lambda(x)(write x)x))
> 'greeting)
>
> ----- Original Message -----
> From: "Majorinc, Kazimir" <kazimir at chem.pmf.hr>
> To: "plt-scheme" <plt-scheme at list.cs.brown.edu>
> Sent: Monday, December 10, 2007 7:33 AM
> Subject: [plt-scheme] Is it possible to define ' ` , like syntax?
>
>
>> I'd like something like
>>
>> °(rumba samba)
>>
>> instead of
>>
>> (dance (rumba samba))
>>
>> Is it possible?
>>
>> Thank you,
>> Kazimir Majorinc
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>