I figured it out, it is just very slow. I think I will keep iif() around anyway as using %if has a different purpose.
Rich
From: Richard Hennessy
Sent: Tuesday, September 14, 2010 1:37 PM
To: Maxima List ; Barton Willis
Subject: How not to bash the simplifier
I want to add features to %if but could not. I came up with iif() instead. iif has a different simplifier that %if.
load("simplifying.lisp");
simpiif(__cnd, __a, __b):=
block(
[prederror:false],
if is(__cnd)=true then
__a
elseif is(__cnd)=false then
__b
else
/* simp_assuming does not work right here for some reason, it leaves facts on the facts list without removing them
all. Don't know why. */
simpfuncall('iif, __cnd, assuming(__a, __cnd), assuming(__b, not __cnd))
)$
simplifying(iif, simpiif);
but if I want to add this to existing simplifier for %if but I get an error.
load("simplifying.lisp"),
simpif(__cnd, __a, __b):=
block(
[prederror:false],
if is(__cnd)=true then
__a
elseif is(__cnd)=false then
__b
else
/* simp_assuming does not work right here for some reason, it leaves facts on the facts list without removing them
all. Don't know why. */
simpfuncall('iif, __cnd, assuming(__a, __cnd), assuming(__b, not __cnd))
)$
simplifying(%if, simpif);
Warning: simpif is overriding built-in simplifier for %if
Is there any plans to add this simplification to %if?
Rich
--------------------------------------------------------------------------------
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima