Colin Walters <firstname.lastname@example.org> wrote:
| "felix" <email@example.com> 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:
<command or 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
> (begin (begin (begin (begin (begin)))))
> (begin (begin) (+ 2 3))
> (+ 2 (begin (begin) 3))
begin: bad syntax (empty form) in: (begin)
Rob Warnock, 41L-955 firstname.lastname@example.org
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043