Unfortunately JMP does not offer a zip()
function for lists, but you can easily make one as a solution to your first item:
zip = Function( {list a, list b},
{zipped, i},
zipped = {};
Summation( i = 1, Min( Length( list a ), Length( list b ) ),
zipped[i] = Eval List( {list a[i], list b[i]} );
0
);
zipped
);
EX = Associative Array( {"Blue", "Green", "Red"}, zip( {1, 2, 3}, {"Bear", "Gecko", "Rabbit"} ) );
Show( ex )
For your second item, see the function Name Expr()
-- it should do what you want. Note however that due to limitations of the JSL parser, you will have to first set a temporary variable for the function to land in, then call from that temporary variable.
zip = Function( {list a, list b},
{zipped, i},
zipped = {};
Summation( i = 1, Min( Length( list a ), Length( list b ) ),
zipped[i] = Eval List( {list a[i], list b[i]} );
0
);
zipped
);
EX = [=>];
EX["zip"] = Name Expr( zip );
func = ex["zip"];
Show( func( {1, 2, 3}, {"Bear", "Gecko", "Rabbit"} ) )
Jordan