force evaluation of the first argument of the functionwith_stdout
Subject: force evaluation of the first argument of the functionwith_stdout
From: Miquel Cabanas
Date: Wed, 30 Nov 2005 14:33:11 +0100
hi,
write the filename between "". For further details check
describe(with_stdout)
which includes an example of using with_stdout inside a function, i.e.
mygnuplot(f,var,range,number_ticks):=
block([numer:true,display2d:false],
with_stdout("/tmp/gnu",
for x:range[1] thru range[2] step
(range[2]-range[1])/number_ticks
do (print(x,at(f,var=x)))),
system("echo \"set data style lines; set title '",
f,"' ;plot '/tmp/gnu'
;pause 10 \" | gnuplot"));
Miquel
On Wed, 2005-11-30 at 13:14 +0100, jcano wrote:
> Hi,
>
> How can I do force evaluation of the first argument of the function
> with_stdout.
>
> More precisely, I am trying to write a function to write a geomview file
> in order to plot a parametric curve. The code is this:
>
> geomview_curve(list,range,nticks,file_name):=block(
> [t,numer:true,display2d:false],
> with_stdout(file_name,
> print("VECT"),
> print("1 ",nticks," 1"),
> print(nticks),
> print("1"),
> for t:range[2] thru range[3] step (range[3]-range[2])/nticks do
> print( ev(subst(t,range[1],list[1]),float),
> ev(subst(t,range[1],list[2]),float),
> ev(subst(t,range[1],list[3]),float)),
> print("1 0 0 1")
> ));
>
> For any call, for instance geomview_curve(...,"curva"),
> it always write a file named "$file_name" and not "curva".
>
> I have seen a similar question in the mailing list but no answer.
>
> Thanks in advances,
> jose cano
>
> _______________________________________________
> Maxima mailing list
> Maxima@math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima