I have a module to overload the * operator for the function f such that:
a*f(b,c,d) = f(a*b,a*c,a*d)
FPackage := module()option package; export `*`; `*` := overload ( [ proc(a::algebraic, b::specfunc(anything, f)) option overload; map2(:-`*`, a, b); end proc , proc(b::specfunc(anything, f), a::algebraic) option overload; map2(:-`*`, a, b); end proc ] ); end module:
However, I would like this to work if the function f is nested i.e.
a*f(b,c,d,f(e,g)) = f(a*b,a*c,a*d,f(a*e,a*g))
However, my current implementation returns
a*f(b,c,d,f(e,g)) = f(a*b,a*c,a*d,a*f(e,g))
Mapping the eval function onto the result does not seem to cause the d*f(e,g) to get applied.
Any help would be greatly appreciated, many thanks.