outermap



"Stavros Macrakis" <macrakis at gmail.com> writes:

> I think simple "map" does what you want:
>
> map(append,[[1,2],[3,4]],[[a,b],[c,d]]);
>                =>  [[1,2,a,b],[3,4,c,d]]

OK, I gave too little information.  I want to obtain the result
 [[a, b, 1, 2], [a, b, 3, 4], [c, d, 1, 2], [c, d, 3, 4]]

I solved this now with

apply(append,  maplist (lambda([phi],
      maplist(lambda([psi],append(phi,psi)),
              [[1,2],[3,4]])),
                  [[a,b],[c,d]]));

But I wonder why outermap descends recursively.  As much as I understand
the doc it should not.

Thanks, Nicolas

> On 9/12/06, Nicolas Neuss <neuss at mathematik.uni-karlsruhe.de> wrote:
>
>> outermap(append,[[1,2],[3,4]],[[a,b],[c,d]]);
>> I want to obtain [[1,2,a,b], ...

-- 
PD Dr. Nicolas Neuss  University Karlsruhe
Email: neuss at mathematik.uni-karlsruhe.de
WWW: <http://www.mathematik.uni-karlsruhe.de/~neuss>;