Re:If-then-else had to be invented
by fanf2 on Sunday December 13, 2020 @12:30PM
(#25408232)
I wondered whether there was a conscious link in the minds of early language designers to Church encoding of booleans. (well, other than McCarthy and Lisp)
A Church boolean is either:
true = λt.λf.t
false = λt.λf.f
So instead of writing an expression with keywords like
if bool then yep else nope
Just use the boolean as a function and apply it to the then and else clauses like
bool yep nope
So the shape is very similar to modern languages, but with less syntactic scaffolding.
A Church boolean is either:
So instead of writing an expression with keywords like Just use the boolean as a function and apply it to the then and else clauses like So the shape is very similar to modern languages, but with less syntactic scaffolding.