code for unevaluated Boolean and conditional expressions



Hello,

I have written some code to handle unevaluated Boolean and
conditional expressions. Please help me by testing the code
and/or giving constructive criticism.

In the absence of known errors and stated opposition,
I am hoping to merge this code into src/.

I find that load ("boolsimp.lisp"); run_testsuite (); => no unexpected errors
(and one expected error now gives the correct result).
Also batch ("rtest_boolsimp.mac", test); => no unexpected errors.

The code is in cvs in share/contrib/boolsimp/.
Temporarily it has been copied to the web site:
http://maxima.sf.net/misc/boolsimp.lisp
http://maxima.sf.net/misc/rtest_boolsimp.mac

There is an exposition in the comment header of boolsimp.lisp.

Since the last time I brought it up, I've revised the code to
refrain from evaluating alternatives when the corresponding
conditions don't evaluate to true/false. Alternatives are
simplified, however.

Here are some examples suggested by Stavros:

pp: if x > 0 then print(1) else print(2);
  =>  if x > 0 then print(1) else print(2)

''pp, x=1;  =>  prints 1 and returns 1

''pp, x= -1;  =>  prints 2 and returns 2

f (x, y) := if equal (y, 0) then 0 else 1/x $
f (8, n);  =>  if equal(n, 0) then 0 else 1/8
f (m, 7);  =>  1/m
f (0, y);  =>  error: simplification of 1/0

f(x) := if x <= 0 then 1 else x*f(x - 1) $
fy : f (y);  =>  if y <= 0 then 1 else y f(y - 1)
''fy, y=8;  =>  40320

if equal (x, 0) then 1 else 1/x, x=0;
  => 1


I look forward to your comments.

Robert Dodier