[plt-scheme] Understanding begin

From: Grant Rettke (grettke at acm.org)
Date: Thu Jun 19 04:31:00 EDT 2008

While studying Scheme, I had wondered how 'begin' might reduce to
something simpler.

While reading "Lambda: The Ultimate Imperative", I see that  in
Scheme, because of eager evaluation (aka call-by-value aka applicative
order), lambda can be used to model imperative statements. So, these
expressions are equivalent (each prints 'abc'):

(begin
  (display 'a)
  (display 'b)
  (display 'c))

((lambda (x) ((lambda (x) (display 'c)) (display 'b))) (display 'a))

Is this the right way to understand begin? To implement it?


Posted on the users mailing list.