[racket] Macros and literal-id

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Aug 9 09:40:13 EDT 2011

Notice that the program below works in our primary language, #lang racket, just as well. -- Matthias



On Aug 9, 2011, at 2:40 AM, Marco Maggi wrote:

> #!r6rs
> (import (except (rnrs) else))
> 
> (define-syntax if*
>  (syntax-rules (then else)
>    ((_ ?test (then ?consequent) (else ?alternate))
>     (if ?test ?consequent ?alternate))))
> 
> (define-syntax then (syntax-rules ()))
> (define-syntax else (syntax-rules ()))
> 
> (let ((a 2))
>  (if* (< 1 a)
>       (then (display "yeah"))
>       (else (display "nay"))))
> --| yeah
> 
> (let ((a 2))
>  (if* (< 1 a)
>       (123 (display "yeah"))
>       (456 (display "nay"))))
> ---> syntax error




Posted on the users mailing list.