Allen's lambda syntax proposal

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Tue Dec 2 13:25:59 PST 2008


Maciej Stachowiak wrote:
> As long as we're giving the bikeshed a few more coats of paint,
> Objective-C is adding block-like closures with ^ as the prefix, so we
> could take inspiration from that:
> 
> ^(a, b, c) { ... }
> 
> I'm not sure if this would introduce ambiguities in the grammar since
> "^" is already an operator; I tend to think not, because "+" and "-"
> manage to be both unary and binary operators without ambiguity.

Correct, it would be grammatically unambiguous. It might still be
mildly confusing, though (unlike unary minus, which is related to
subtraction by -x = 0-x, lambda abstraction is unrelated to bitwise
exclusive-or). But any notation for lambdas is likely to be mildly
confusing to the uninitiated.

> "^" also has a slight resemblance to the greek lambda, which is the
> reason Haskell uses "\".

"^" also has some historical relevance:

Felice Cardone, J. Roger Hindley,
History of Lambda-calculus and Combinatory Logic
2006, Swansea University Mathematics Department
Research Report No. MRRS-05-06.
<http://www-maths.swan.ac.uk/staff/jrh/papers/JRHHislamWeb.pdf>

# (By the way, why did Church choose the notation "λ"? In [Church, 1964, §2]
# he stated clearly that it came from the notation "x̂" used for
# class-abstraction by Whitehead and Russell, by first modifying "x̂" to
# "∧x" to distinguish function-abstraction from class-abstraction, and
# then changing "∧" to "λ" for ease of printing. This origin was also
# reported in [Rosser, 1984, p.338]. On the other hand, in his later years
# Church told two enquirers that the choice was more accidental: a symbol
# was needed and "λ" just happened to be chosen.)

[Church, 1964] A. Church, 7 July 1964. Unpublished letter to Harald Dickson.

[Rosser, 1984] J. B. Rosser. Highlights of the history of the lambda
calculus. Annals of the History of Computing, 6:337–349, 1984.


[If your email client doesn't display the above correctly:
  "x̂" is an x with a hat operator (similar to a circumflex) above it.
  "∧" is an upward-pointing wedge.
  "λ" is a lowercase Greek lambda.]

-- 
David-Sarah Hopwood




More information about the Es-discuss mailing list