5 ms·
Lambdas aren't single expression functions in Lisp.
by another-cuppa 8y ago
Lambdas aren't single expression functions in Lisp.
- bunderbunder 8y agoHaha, I had assumed someone would mention that. But most Lisps are pretty rough-and-ready about these sorts of things. IIRC, Scheme requires the body of the lambda to be a single expression, doesn't it? And then you just cheat your way out of it with (begin ...).
- lispm 8y ago> IIRC, Scheme requires the body of the lambda to be a single expression, doesn't it? No, it doesn't require it.
- kbp 8y agoIt used to, though. From the original Scheme paper: Note that in SCHEME, unlike MacLISP, the body of a LAMBDA expression is not an implicit PROGN.
- lispm 8y agoChanged in the early/mid 80s I think. AI Memo 848 (Revised Revised Report) from 1985 has it already as an 'essential special form': (lambda (var1 ...) expr1 expr2 ...) R1RS does not permit it. And: In the the R1RS syntax BNF there is a (DEFINE (<identifier> <identifier list>) <form>) with one form. But later in the document it is a '<form list>'... Then the LAMBDA syntax has a BODY, but it is only a FORM...
- another-cuppa 8y agoIf it did it would be annoying to type progn all the time and someone would make a macro...