code for unevaluated Boolean and conditional expressions
Subject: code for unevaluated Boolean and conditional expressions
From: Robert Dodier
Date: Fri, 5 May 2006 11:33:19 -0600
Hi Mario,
> Question: is Macavity responsible for the crime?
I'm glad to see Maxima is capable of handling this
oh-so-very-important problem ... 8^)
The "=>" function is susceptible to a kind error which exists
without boolsimp, but for better or worse boolsimp makes it easier
to bump into it. With the declaration
"=>"(r,s):= not r or s $
then something like (not r) => foo causes a stack overflow.
A simpler example of the same phenomenon without boolsimp:
foo (x) := not x;
foo ('(not x)); => stack overflow
This behavior is a consequence of dynamic binding --
the symbol x is bound to an expression containing x, and the attempt
to evaluate it leads to an bottomless recursion.
A work around is to avoid name collisions, e.g define the function
with an unlikely argument name like x% instead of x.
That's not a very satisfactory solution.
best,
Robert