[Maxima] makelist vs create_list

Stavros Macrakis macrakis at alum.mit.edu
Mon Apr 9 17:18:11 CDT 2007


On 4/9/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> I guess that makes create_list redundant with cartesian_product
> or maybe outermap in the multiple argument case (not map).

Not quite.

create_list( [i,j],i,[i1,i2],j,[j1,j2])  => [    [i1,j1], ...
cartesian_product({i1,i2},{j1,j2})       => {    [i1,j1], ...
create_list(f(i,j),i,[i1,i2],j,[j1,j2])  => [  f( i1,j1 ), ...
map(f,cartesian_product({i1,i2},{j1,j2}))=> {  f([i1,j1]), ...
     (note sets and list argument)
outermap(f,[i1,i2],[j1,j2])              => [[ f( i1,j1 ), ...
     (note nesting)

> But now I'm wondering --- is makelist w/ multiple arguments
> supposed to be like map or like cartesian_product or outermap?
> Or something else?

They all seem useful.  It would, on the other hand, be nice if we had a
systematic approach to all this using fewer primitives which would combine
nicely, or at least had systematic names.

Example:

map_cartesian == map( fapply(f), cartesian_product(...) )

where fapply converts a function of N arguments to a function of a *list of*
N arguments:

fapply(f):=
   buildq( [f, args:?gensym()], lambda([[args]],apply(f,args))
(buildq and gensym needed because we don't have lexical scoping :-( )


          -s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070409/f7e30bcf/attachment.htm 


More information about the Maxima mailing list