Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top