> (%i1) prederror : false$
> OK more or less:
> (%i2) if f(k) then 0 else %pi;
> (%o2) if unknown then 0 else %pi
No, this is worse than useless -- it seems that the unevaluated
conditional experimentation has leaked into the production version.
Why is it useless:
1) if this if-statement was being executed for side-effects, it would
be a silent no-op. This is the main reason I object to conflating
programming if-statements and expression conditional expressions.
2) if there are going to be unevaluated conditionals, then they should
*preserve* things that cannot be evaluated completely, not replace
them by less-informative conditions. After all, abs(x) where the sign
of x is unknown does not and should not simplify to UND.
> But not OK:
> (%i3) if f(k) + 1 then 0 else %pi;
> Incorrect syntax: Found algebraic expression where logical expression
> expected
This is as designed. The protasis must be a boolean expression. "+"
cannot return a boolean result, so the syntax prevents this.
> I see no reason for the syntax error. Definitely not OK:
> (%i3) if (f(k) + 1) then 0 else %pi;
> Maxima encountered a Lisp error:
> Error in PROGN [or a callee]: Bad plist ($K)
Now this one is clearly a bug.
-s