On Mon, Dec 28, 2009 at 8:15 AM, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> These days, regular 'if' returns an expression if the condition cannot be
> evaluated, e.g.
>
> (%i2) if a>0 then 1 else 0;
> (%o2)??????????????????????? if a > 0 then 1 else 0
For the record, the result of such a partial evaluation is
a verb expression (operator = MCOND).
"if" nouns (operator = %MCOND) are recognized and handled
regularly as other nouns.
The distinction might be useful for formal treatment of
conditional expressions.
expr1 : if a > 0 then 1 else 0;
=>
a : 1;
''expr1;
=> 1
kill (a);
expr2 : 'if a > 0 then 1 else 0;
=> if a > 0 then 1 else 0
a : 1;
''expr2;
=> if 1 > 0 then 1 else 0
ev (expr2, nouns);
=> 1
ev (expr2, ?mcond);
=> 1
FWIW
Robert Dodier