Subject: Re: R5RS is available
From: (Rob Warnock)
Date: 1998/03/11
Newsgroups: comp.lang.scheme
Message-ID: <6e54em$>

Bengt Kleberg <> wrote:
| I have a question about 5.3 Syntax Definitions. 5.3 the
| (define-syntax <keyword> <transformer spec>)
| "template" is never explained with an example.

Probably because it was considered too simple to need an example,
since Section 4.3.1 "Binding constructs for syntactic keywords" had
already given several examples of "let-syntax", and it really *is* the
case that "define-syntax" is to "let-syntax" as "define" is to "let"[*].

In any event, here's a corresponding "define-syntax" for the first
"let-syntax" example given in 4.3.1:

	(define-syntax when (syntax-rules ()
			      ((when test stmt1 stmt2 ...)
			       (if test
				 (begin stmt1 stmt2 ...)))))

As you see, all of the complexity is in the definition of
"<transformer spec>" (Section 4.3.2 "Pattern language"),
which is the same whether it's in a "define-syntax" or
a "let-syntax" or a "letrec-syntax".

| Instead there is a (let-syntax ....) example.

Actually, there's a "let-syntax" *NON*-example,  ;-}  ;-}
because it's specifically stated to be an example
of an error (erroneous shadowing of a keyword).


[*] O.k., o.k., "define" is closer to "letrec" than to "let". So sue me.

Rob Warnock, 7L-551
Silicon Graphics, Inc.		Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA