New version of makelist



Unlike create_list, makelist allows for so-called subscripted
variables:

 (%i1) makelist(x[i],x[i],-1,8); (%o1) [-1,0,1,2,3,4,5,6,7,8]

 (%i2) makelist('x[i],x[i],-1,8); 

 (%o2) [x[i],x[i],x[i],x[i],x[i],x[i],x[i],x[i],x[i],x[i]]

 (%i3) makelist('(x[i]),x[i],-1,8); 
 (%o3) [-1,0,1,2,3,4,5,6,7,8]

My first effort to fix minimakelist to duplicate (%o3) failed 
(substitute a gensym for the subscripted variable). Maybe it's
not so easy to do away with the explicit call to $ev in makelist?

--Barton


-----maxima-bounces at math.utexas.edu wrote: -----


>(defmspec?$minimakelist?(x)
>??(let?((f?(second?x))
>????	(x?(third?x))
>????	(lo?(meval?(fourth?x)))
>????	(hi?(meval?(fifth?x)))
>????	(l?nil))
>????(setq?f?`((lambda)?((mlist)?,x)?,f))
>????(while?(<=?lo?hi)
>??????(push?(mfuncall?f?lo)?l)
>??????(incf?lo))
>????(simplifya?(cons?'(mlist)?(reverse?l))?t)))