Is it possible to get this to work?
h1[k](x):=block(map(print,x))
Stavros Macrakis wrote:
> > h1[k](x):=block(print(x));
> > h1[1]([1,2]);
> > prints x, not [1,2]
>
> The body of subscripted functions is evaluated twice, once when
> evaluating the function part (h1[1] in this case), and once when
> applying it to its argument ([1,2] in this case).
>
> I believe this is intentional. This does not mean that it is
> reasonable, and it is certainly confusing, but I don't think it counts
> as a bug (for now at least).
>
> Here is a simple demonstration:
>
> (C1) f[a](x):=[a,'a,'('a),x,'x,'('x)];
>
> /* Careful about syntax: ''x is NOT the same as '('x) or ' 'x */
>
> (D1) f (x) := [a, 'a, '('a), x, 'x, '('x)]
> a
> (C2) f[34];
> (D2) LAMBDA([x], [34, a, 'a, x, x, 'x])
> (C3) f[34](56);
> (D3) [34, a, a, 56, 56, x]
>
> /* Now set some global values for a and x */
>
> (C4) a:900$
> (C5) x:1000$
> (C6) f[34];
> (D6) LAMBDA([x], [34, a, 'a, x, x, 'x])
> (C7) f[34](90);
> (D7) [34, 900, a, 90, 90, x]
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima