- labels: 460522 --> Lisp Core - Simplification
tellsimp and tellsimpafter are somewhat confused about
the noun/verb distinction. The same rule name is
constructed for both the noun and verb form of a
function. (E.g., the rule is namd $FOORULE1 for both
$FOO and %FOO.) However, the rule is associated with
the operator name ($FOO or %FOO). I ran into this
problem trying to make rules for "integrate".
This has following observable effect:
simp: false; tellsimpafter (foo(x), fooverb(x));
simp: true;
foo(x); => fooverb(x); /* OK */
'foo(x); => 'foo(x) /* Hmm ... */
simp: false; tellsimpafter ('foo(x), foonoun(x));
simp: true;
foo (x); => foonoun(x) /* Hmm ...*/
'foo(x); => foonoun(x) /* OK */
Either the noun and verb forms should (a) always be
treated the same, or (b) always separately. (Behavior
consistent with (a) is 'foo(x) => 'foo(x) in the first
example, and foo(x) => foo(x) in the second. Behavior
consistent with (b) is 'foo(x) => fooverb(x) in the
first example, and foo(x) => foonoun(x) in the second.)
My recommendation at this point is to treat noun and
verb forms by the same rule always. This can be
effected by adding code to tellsimp and tellsimpafter
to construct the verb or noun form from the noun or
verb (resp), and assign the rule to both.
(The noun form of built-in operators is a little messy
-- nounify ("+") => MPLUS, nounify("*") => MTIMES,
etc. However, I recommend against special-casing
built-in operators here.)