I'm taking a SCHEME course, and I was wandering if there's any difference between writing "λ" or "lambda". To clarify, is there a functional difference between these two snippets ?
Using λ
(define foo
(λ (x)
(...)))
Using lambda
(define bar
(lambda (x)
(...)))
Lambda is the name of a special form that generates procedures. It takes some information about the function you want to create as arguments and it returns the procedure. It'll be easier to explain the details after you see an example.
Scheme begin expressions aren't just code blocks, though, because they are expressions that return a value. A begin returns the value of the last expression in the sequence. For example, the begin expression above returns the value returned by the call to bar . The bodies of procedures work like begin s as well.
λ
is the lowercase symbol with the name lambda
but most Scheme implementations doesn't have λ
defined as a synonym for lambda
. This the difference is that lambda
is guaranteed to work while λ
certainly is shorter for a teacher to write.
As an example I can mention that the wizards used λ
quite often in the SICP videos even though the symbol wasn't supported. Whenever you see it you need to write lambda
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With