3 ms·
> you can’t write OR because if the first case is true the second case is not evaluated — you can’t write that as a function. I used to think that was true, bu
by lisper 4y ago
> you can’t write OR because if the first case is true the second case is not evaluated — you can’t write that as a function.
I used to think that was true, but it turns out not to be. It's true if lambda is strict, but there is no reason lambda has to be strict. If you have a lazy lambda as your primitive you can write OR as a function. [EDIT: I see Tromp already pointed this out earlier.]
Even with a non-lazy lambda you can write OR as a function if you impose a programmer discipline that you have to pass it closures as arguments.
> there may really be a finite set of them (interesting philosophical question)
Not really. IF and WHILE are, together, Turing-complete. (So are any number of other small sets of primitives, including LAMBDA). But of course the sky is the limit in terms of complicated constructs you can invent to layer on top of these primitives.
There may be a finite number of these things that turn out to be useful, but that's not a philosophical question, it's an engineering question.