Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

By the way, why do you need a backslash to define a lambda? Apparently it doesn't give any additional information. All you need to know that's a lambda is the presence of the -> operator. Is that a way to make the compiler faster?


That was a pretty late change to the syntax actually — I really, really wanted Javascript-style lambdas but with a skinny arrow, like `(x, y) -> x + y`. But it made parsing and compiling really finicky, so I settled on the backslash syntax, which I've seen in a couple other languages. It almost looks like a "λ"!


Alternatively, we can go the other way, and dispense with the arrow:

  \x \y x + y
rather closer to the lambda notation in maths, and works well for compact expressions such as S from the SKI combinator calculus:

  \x \y \z x z (y z)
This looks much better with syntax highlighting (hard to demonstrate here of course), being both trivial to implement and informative - just have the back slashed tokens in blue or whatever.

Cassette looks really nice - great intro page, and a great name too! Making something simple is much harder and more valuable than making something complicated.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: