How many arguments to a macro transformer? Keith Wright 23 Jul 2005 05:37 UTC

First I want to say that this SRFI feels like a major
breakthrough.  Finally, somebody has swept away the
distractions and gotten to the heart of the matter.
I am disappointed at the lack of discussion, I hope
it doesn't mean this is being ignored, but that all
the knights of the lambda calculus have fallen
silent at a glimpse of the grail.

But enough flattery!  I think I have found a big
blunder or minor typo.  I have been playing with
the reference implementation, trying to run it
through MzScheme.  Both the SRFI text and the
simple-macro-tests.scm file contain the following:

   (define-syntax swap!
     (lambda form
       (let ((a (cadr  form))
             (b (caddr form)))
         (quasisyntax
           (let ((temp ,a))
             (set! ,a ,b)
             (set! ,b temp))))))

but it seems to work better if written as

   (define-syntax swap!
     (lambda (form)
         etc...))

in addition, the define-syntax forms in the

 (primitive-repl '( etc...))

part of simple-macros.scm look like this

  (define-syntax let
    (lambda (t) etc...))

with one argument.  So the minimal change to get it
to work seems to be to put parentheses around the
argument form in the swap! macro.

On the other hand, it seems more consistant if

  (define-syntax (swap! a b) <body)

were the same as

  (define-syntax swap! (lambda ( _ a b) <body> ))

which implies that swap! is right and the rest of
the program is wrong.  Well, maybe not the whole
rest of the program, but only macro-apply and the
definitions of the let family of macros.

--
     -- Keith Wright

Programmer in Chief, Free Computer Shop
 ---  Food, Shelter, Source code.  ---