Procedure bodies have an implicit begin
. Thus
(lambda ()
(foo)
(bar))
is treated as if the same as
(lambda ()
(begin
(foo)
(bar)))
See Sequencing in the Racket guide for more details.
Question
The Racket Docs state that the lambda
function can be invoked with multiple arguments after the body
argument, e.g.:
((lambda () (display "foo") (display "bar")))
prints foobar
.
How exactly does this work? I didn't find any explanation in the racket documentation. Did I miss something?
Solution
Procedure bodies have an implicit begin
. Thus
(lambda ()
(foo)
(bar))
is treated as if the same as
(lambda ()
(begin
(foo)
(bar)))
See Sequencing in the Racket guide for more details.