Re: Was there a particular reason for "begin"?



dillogimp@xxxxxxxxx wrote:
On Apr 5, 4:24 pm, Nils M Holm <before-2007-07...@xxxxxxxxx> wrote:
(define (d x) (display x) x)
(define (b . x) (car (reverse x)))

Both B and BEGIN evaluate all of their arguments and both return the
normal form of their last argument.

But:

(b (d 1) (d 2) (d 3))

may display any permutation of {1,2,3} as its side effect while

(begin (d 1) (d 2) (d 3))

will always display 123.

Wow, does that I mean I don't need a special syntax case for
begin...cool.

Actually, you do have to implement BEGIN as syntax, because
B is /not/ equal to BEGIN.

(begin x y z)

is in fact equal to

((lambda (ignore) z) ((lambda (ignore) y) x))

--
Nils M Holm <n m h @ t 3 x . o r g> -- http://t3x.org/nmh/
.



Relevant Pages


Loading