From: Eduardo O. <edu...@gm...> - 2024-07-11 20:32:32
|
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... |