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