Subject: Re: A (BEGINners question, actually
From: (Rob Warnock)
Date: 2000/07/17
Newsgroups: comp.lang.scheme
Message-ID: <8kujd8$65ah2$>
Colin Walters  <> wrote:
| "felix" <> writes:
| > Is '(begin)' an error or not?
| If you look at R5RS, Section 7.1.3, you can see that
|     <expression> -> <derived expression> -> (begin <sequence>)
| and <sequence> must have at least one <expression>, as far as I can tell.
| Thus, the answer is yes.

Well, in an "<expression>", yes, it's illegal. But from section
7.1.6 "Programs and definitions", you can derive the following:

	<program> ->
	  <command or definition>* ->
	    <definition> ->
	      (begin <definition>*) ->
		(begin)			; by the definition of "*"

So I'd say that at the top level of a program *or* the beginning of
a "body" (that is, wherever a "definition" may appear), it's legal.

And MzScheme (which someone else complained about) actually does it
right, IMHO:

	> (begin)
	> (begin (begin (begin (begin (begin)))))
	> (begin (begin) (+ 2 3))
	> (+ 2 (begin (begin) 3))
	begin: bad syntax (empty form) in: (begin)


Rob Warnock, 41L-955
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043