question about additive



Hi Barton,

> (%i1) declare(f,additive)$
> (%i2) f(x) := if mapatom(x) then 5 else funmake(f,[x])$
> (%i3) f(a+b);
> (%o3) f(b)+f(a)
> (%i4) ev(%);
> (%o4) 10

I'm inclined to think this is a bug.
I don't think there is a general policy that function calls are
not evaluated after simplification. Certainly no such policy
is in evidence in the following example, although I don't
have any other examples at the moment.

(%i1) matchdeclare ([x, y], all);
(%o1)                         done
(%i2) tellsimpafter (f (A (x, y)), A (f(x), f(y)));
(%o2)                    [frule1, false]
(%i3) f(x) := if mapatom(x) then 5 else funmake (f, [x]);
(%o3)   f(x) := if mapatom(x) then 5 else funmake(f, [x])
(%i4) f (A (a, b));
(%o4)                        A(5, 5)

If f were not evaluated, the last line would be A(f(a), f(b)).

Unfortunately, looping endlessly through simplification
and/or evaluation is a real possibility here, so we have
to tread lightly.

FWIW
Robert