SCHEME | lambda vs λ?
Asked Answered
G

1

6

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)
  (...)))
Ganesha answered 1/12, 2014 at 20:28 Comment(0)
K
8

λ 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.

Kaciekacy answered 1/12, 2014 at 20:45 Comment(2)
So to get this straight in my head - "λ" in Dr.Racket is some kind of "IDE sugar" ?Ganesha
No, more like syntax sugar in the #!racket language, the default language of racket application. In both #!r5rs and #!r6rs, even when running in racket, it's not defined and you get λ: unbound identifierKaciekacy

© 2022 - 2024 — McMap. All rights reserved.