3 ms·
I'd of like to seen the lambda calculus way of defining conditionals. Let True = (λ x y => x) Let False = (λ x y => y) Then to do an if, you just apply the co
by Tyr42 14y ago
I'd of like to seen the lambda calculus way of defining conditionals.
Let True = (λ x y => x)
Let False = (λ x y => y)
Then to do an if, you just apply the conditional
((λ x y => x) 1 2) ---> 1
((λ x y => y) 1 2) ---> 2
It's funny, really. Pure lambda calculus can feel a lot like a object oriented message passing style.
- ufo 14y agoAnd Smalltalk does just that, by the way. Booleans have an `ifTrue: ifFalse:` method that receives two callbacks as parameters.