From: Stavros M. <mac...@al...> - 2014-04-21 02:55:35
|
See Technical Issues of Separation in Function Cells and Value Cells<http://www.nhplace.com/kent/Papers/Technical-Issues.html> (often called "Lisp 1 vs. Lisp 2") by R.P. Gabriel for a discussion of the issues in Lisp. Maxima, with its "variables without values represent themselves" policy, adds another twist to the story. In short, this is not a "bug", but a design choice, and whether you are surprised by it depends on what you're familiar with.... Personally, I would support the syntax (f)(x) to indicate that the 'f' is to be evaluated. This doesn't currently work, but i(f)(x), where i(q):=q, does. -s On Sun, Apr 20, 2014 at 6:07 AM, Helmut Jarausch < jar...@ig...> wrote: > On 04/19/2014 09:04:06 PM, Barton Willis wrote: > > Maybe your function works perfectly. But consider: > > > > (%i1) gen_rhs(Ex,Vars)::= block([n:length(Ex),m:length(Vars)], > > Exs:subst(makelist(Vars[i]=y[i,1],i,m),Ex),print(Exs), > > MList:ev(makelist(makelist(Exs[i]),i,m)),print(MList), > > buildq([MList],lambda([t,y],matrix(splice(MList)))))$ > > > > (%i2) george : gen_rhs([sin(a+b),cos(a*b)],[a,b])$ > > [sin(y[2,1]+y[1,1]),cos(y[1,1]*y[2,1])] > > [[sin(y[2,1]+y[1,1])],[cos(y[1,1]*y[2,1])]] > > > > (%i3) george(5,z); > > (%o3) matrix([sin(z[2,1]+z[1,1])],[cos(z[1,1]*z[2,1])]) > > > > (%i4) y[2,7] : 42$ > > > > (%i5) george(5,z); > > (%o5) matrix([sin(y[2,1]+y[1,1])],[cos(y[1,1]*y[2,1])]) > > > > Are you certain this is what you want? > > > > Of course not, but I am helplessly exposed to this > sickness of Maxima. Similarly I have to call > apply(rhs,[x,y]) instead of just rhs(x,y) if rhs > comes from the parameter list of the function where this call occurs. > This means I cannot work with vector-valued functions > except when using this ugly hack mentioned by Robert. > > In comparison to many other languages I have worked with > Maxima is just broken in this respect. > It violates the principle of least surprise. > > Since the assignment y[2,7]:42 might occur anywhere, far away > from that call george(5,z), it's very hard to debug programs > in Maxima. > > Thanks for this heads up, it's a really bad surprise. > > Perhaps, I should have a close look at Fricas and Yacas before > I continue struggling with Maxima. > > That's really sad news, > Helmut > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/NeoTech > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |