[plt-scheme] Macro rule selection

From: Grant Rettke (grettke at acm.org)
Date: Fri Jan 30 13:12:57 EST 2009

Hi James,

On Fri, Jan 30, 2009 at 11:53 AM, James Coglan <jcoglan at googlemail.com> wrote:
> Just ran into some puzzling macro behaviour that I was hoping someone could
> explain. I have the following code:

Try running it in R5RS mode like this:

#lang r5rs

(define-syntax !
  (syntax-rules ()
    ((_ x (fn arg ...))
     (set! x (fn x arg ...)))
    ((_ x fn)
     (set! x (fn x)))))

(define-syntax square!
  (syntax-rules ()
    ((square! x)
     (! x (* x)))))

(define a 6)

(square! a)

Posted on the users mailing list.