declaration foo distributes over bar



On 6/9/07, Gosei Furuya <go.maxima at gmail.com> wrote:

> your program is nice program.
> but I can not find where to use.
> you shoud teach us where to use it,more precisely.

Well, what I want to express is that foo(bar(x, y, z))
=> bar(foo(x), foo(y), foo(z)). This is analogous to stuff
like 5*(a + b + c) => 5*a + 5*b + 5*c. Maybe "distributes_over"
is still not the best name.

The immediate use that I see is to get expression-manipulation
functions (e.g. trigrat) to apply to each element of a
composite object (e.g. matrix, list, or set) without adding
code to the function in question.

> In mathematica,Distribute[{{a,b,c},{a,b,c}},List] is often
> useful,I think
> but we obtain same result,outermap("[",[a,b,c],[a,b,c]);
> nflatten(%,1).

Yes, you can get the same result with sufficient application
of map & friends, but the goal is to make it happen
automatically.

best
Robert