From: Stavros M. <mac...@gm...> - 2024-07-11 22:21:33
|
This seems like an awfully convoluted way of proceeding. I would strongly recommend trying to do it without macros at all. But maybe I don't understand what you're trying to do. On Thu, Jul 11, 2024 at 4:32 PM Eduardo Ochs <edu...@gm...> wrote: > Hi list, > > can anyone help me to understand what is happening in the program > below? > > mkmatrix0(xs, ys, expr) := > buildq([xs,ys,expr], > apply(matrix, > makelist(makelist(expr, splice(xs)), > splice(ys))))$ > > mkmatrix (xs, ys, expr) ::= mkmatrix0 (xs, ys, expr)$ > > Dx : x - x0; > Dy : y - y0; > [x0,y0] : [3,2]; > mkmatrix ([x,0,x0+1], [y,y0+1,0,-1], [x,y]); > mkmatrix ([x,0,x0+1], [y,y0+1,0,-1], ev([Dx,Dy])); > a : mkmatrix ([x,x0-1,x0+1], [y,y0+1,y0-1,-1], [x,y]); > b : mkmatrix ([x,x0-1,x0+1], [y,y0+1,y0-1,-1], ev([Dx,Dy])); > > aroundx0y0(expr) ::= mkmatrix ([x,x0-1,x0+1], [y,y0+1,y0-1,-1], expr)$ > > c : aroundx0y0([x,y]); > d : aroundx0y0(ev([Dx,Dy])); > > I was expecting that a and c would return the same matrix, and b and d > would return the same (other) matrix, but no... in the lines that > calculate a and b the symbols x and y are become bound variables > inside the two "makelist"s, but in the lines that calculate c and d > the x and the y don't change... > > Thanks in advance! > [[]], Eduardo... > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |