This was posted to sci.math.symbolic in response to the same question.
Is this what funmake is used for?
Dan Stanger
From: "Marie Donnelly-Harten" <mariedonnellyhar at earthlink>
Newsgroups: sci.math.symbolic
Subject: Re: array functions
Date: Fri, 21 Mar 2003 16:09:33 GMT
The problem with h1[1]([1,2]) is that
h1[1] is simply lambda([x],x) in
the latest sourceforge version.
The problem appears to persist in such further
attempts as
h2[k]:=lambda([x],print("x=",x),x);
but if you do
h3[k]:=lambda([x],funmake(print,["x=",x]),x);
then h3[2]([4,5]); prints a line
x= [4,5]
and returns value [4,5].
I suspect that the issue is the amount of evaluation that
is performed when the array element h1[2] is calculated
before the application to the argument(s). This appears
to differ from my recollection of the original DOE-Macsyma requirements.
Leo Harten
marie@priority1.net (use my wife's PC for this NG)
"Dan Stanger" <dan.stanger@ieee.org> wrote in message
news:3E7B2219.47FD5A09@ieee.org...
> If I declare the array function h1[k](x):=block(print(x));
> and execute h1[1]([1,2]);
> it prints x, not [1,2] but the function returns [1,2].
> Shouldnt it print [1,2], not x?
> I see this behavior in maxima 5.5, and Macsyma 2.4.
> Can anyone think of a work around for this or explain this behavior?
> Dan Stanger
>
>