Create a list from 2 others, like tuples



Hi Henry,

> Suppose I have two lists, say [1,2,3] and the other made from doubling
> each value of the first, i.e., [2,4,6].
> So, the list I'd like returned would be: [[1,2],[2,4],[3,6]]

Maybe this --

(%i1) map (lambda ([x], [x, 2*x]), [1, 2, 3]);
(%o1)                      [[1, 2], [2, 4], [3, 6]]

or this --

(%i2) a : [1, 2, 3];
(%o2)                              [1, 2, 3]
(%i3) b : 2 * a;
(%o3)                              [2, 4, 6]
(%i4) map (lambda ([x, y], [x, y]), a, b);
(%o4)                      [[1, 2], [2, 4], [3, 6]]

Given multiple list arguments, map walks down all lists in parallel.

HTH
Robert Dodier