On 6/26/07, praimon <praimon at gmail.com> wrote:
> (%i6) myouter(f,lists):=apply(outermap,cons(f,lists))$
> (%i7) myouter(h,[[c,d],[e,f]]);
> (%o7) [[h(c, e), h(c, h)], [h(d, e), h(d, h)]]
After redefining apply and outermap via defun (i.e. to evaluate
their arguments like most Maxima functions instead of relying on
their own evaluation policy), I see the following:
(%i15) myouter(f,lists):=apply(outermap,cons(f,lists))$
(%i16) myouter(h,[[c,d],[e,f]]);
(%o16) [[h(c, e), h(c, f)], [h(d, e), h(d, f)]]
which, I believe, is what one would hope to see.
Also, changing apply and outermap to defuns doesn't appear
to introduce any new bugs (the test suite reports a
couple of errors which aren't related sfaict).
So I'll consider committing this change unless someone wants
to make an argument against it.
> (%i8) myouter(f,lists):=block([f],apply(outermap,cons(f,lists)))$
> (%i9) myouter(h,[[c,d],[e,f]]);
> (%o9) [[f(c, e), f(c, f)], [f(d, e), f(d, f)]]
That can't be right: surely you want the operator for elements of the
result to be h.
FWIW
Robert Dodier