[plt-scheme] elementary macro question

From: nusret (nbalci_l at yahoo.com)
Date: Mon Jun 5 11:28:18 EDT 2006

Hi all, 
I review basics of scheme using Dybvig's book (The
Scheme Programming Language), and noticed that people
here discussing macros. On page 60, the author gives
an incorrect version of *and macro*:

(define-syntax and
   (syntax-rules ()
     ((_) #t)
     ((_ e1 e2 e3 ...)
      (if e1 (and e2 e3 ...) #f))))

Then he goes on to explain why this is wrong. Namely,
it's claimed in the book that this macro expands as
follows in the case we call (and (not (= x 0)) (/ 1
x)):

(if (not (= x 0)) (and (/ 1 x)) #f)
....
etc. 

I don't understand how this can happen, as there is no
pattern taking exactly one parameter: so how can (and
(/ 1 x)) not trigger an error? Namely, I believe the
author that this macro is incorrect, but the reason he
gives...  :/ ?? Most probably I am missing something
very basic and elementary, but...

Could someone please help me, what am I missing here?
Thank you!
Nusret

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Posted on the users mailing list.