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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top