[Maxima] unevaluated boolean / conditional expressions, take 2
Robert Dodier
robert.dodier at gmail.com
Mon Mar 13 21:16:52 CST 2006
Hello,
I've revised the stuff I made for unevaluated boolean / conditional expressions.
See http://cvs.sf.net/viewcvs.py/maxima/maxima/share/contrib/boolsimp .
The comments in boolsimp.lisp state the policies I'm trying to implement.
rtest_boolsimp.mac has some examples.
I've fixed the code so that function calls are executed only when they
need to be executed. (However operands are always simplified.
That has the potential to trigger errors in simplification, such as 1/0
and 0^0. I haven't decided what to do about that.)
The quit function has a side effect which doesn't happen in these examples --
2 > 1 or quit(); => true
1 > 2 and quit(); => false
if foo(x) then quit() else quit(); => if foo(x) then quit() else quit()
Other examples --
(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
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
Anyway why not take a look and let me know what you think.
Robert Dodier
More information about the Maxima
mailing list