[Maxima] makelist vs create_list
macrakis at alum.mit.edu
Mon Apr 9 13:16:05 CDT 2007
On 4/9/07, van Nek <van.nek at arcor.de> wrote:
> I believe, map(lambda([x], expr), L) is a hard piece of code for newbies.
> Is expr, x : L in top level or ev( expr, x : L ) in programs equivalent
> to map(lambda([x], expr), L) resp. makelist(expr, x, L) or are there some
No, ev(expr,x:l) is very roughly equivalent to block([x:l],expr) or
equivalently lambda([x],expr)(l) or map(lambda([x], [expr]). It does
not map over lists.
But actually ev does some other things as well, notably substituting
values of variables before the main evaluation; its behavior is really
rather complicated and messy. For example:
var1 => var2
block(,var1) => var2
lambda([x],var1)(3) => var2
so far so good. Now, with ev:
var1, x=3 => var3
block(,var1),x=3 => var2
lambda([x],var1)(3),x=3 => var2
That is why I recommend avoiding ev, *especially* in programs. It is
primarily a convenience feature for top-level use.
More information about the Maxima