[Prev][Next][Index][Thread]

Re: small Q



In article <87lmy7o7is.fsf@qiwi.uncommon-sense.net>, Boris Schaefer 
<boris@uncommon-sense.net> wrote:

> Bruce Hoult <bruce@hoult.org> writes:
> 
> | The debate over what is essential and what is mere convenience is 
> | impossible to decide.  When it comes down to it, you don't *need* 
> | anything more than raw lambda and applicative order evaluation.  You 
> | don't *need* objects, you don't *need* numbers, you don't even *need* 
> | "if".
> 
> How do you branch without "if"?
> In case you mean that you don't need "if" as a special form, I agree.

By making True and False be functions of two arguments ("then" and 
"else") that each evaluate only one of them.  You define your comparison 
operators to return one of these two functions, and you define "if" to 
simply pass the then and else parts to the function returned by the 
comparison.


Doing without built-in numbers is far more tedious (and inefficient) 
than doing without "if".

-- Bruce



Follow-Ups: References: