| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Begin doesn't introduce new "block" like let, that is,
you can't place "internal define" at the beginning of forms
generally. Semantically begin behaves as if forms
are spliced into the surrounding context.
For example, topleve expression like the following is the same
as two toplevel definitions:
(begin (define x 1) (define y 2)) |
Here's a trickier example:
(let ()
(begin
(define x 2)
(begin
(define y 3)
))
(+ x y))
==
(let ()
(define x 2)
(define y 3)
(+ x y))
|
prog1 in CommonLisp.
Unlike begin, this does creates a "block",
for the begin0 form is expanded as follows.
(receive tmp exp0 exp1 ... (apply values tmp)) |