create_list makelist possible bugs



On Tuesday 09 September 2008 05:50:04 am Stavros Macrakis wrote:
> On Mon, Sep 8, 2008 at 8:35 PM, Robert Dodier <robert.dodier at gmail.com>
>
> wrote:
> > (2) Are you really going to call inpart ? I don't know what you are
> > trying to do, but part hacking is rarely necessary. If you just want the
> > first and second arguments of expr, why not first(expr) and second(expr)
> > ?
>
> If expr is a list, then expr[1] and expr[2] are the best way to get its
> first and second elements.

I changed it to inpart when I noticed the following. There is probably a 
reasonable
explanation for it, but I couldn't figure it out.

(%i1) f([x]):=if x[1] > 2 then x[1] else 0$

(%i2) f1([x]) := if inpart(x,1) > 2 then inpart(x,1) else 0$

(%i3) apply('create_list, [f(i),i,1,4]);

(%o3) [0,0,x[1],x[1]]
(%i4) apply('create_list, [f1(i),i,1,4]);

(%o4) [0,0,3,4]
(%i5) 

So, in (%i3) it looks like the value of x[1] is used in "x[1] > 2",
but not in "then x[1]".

--John