|
From: sfeam <sf...@us...> - 2016-09-18 00:01:18
|
On Saturday, 17 September 2016 08:09:09 PM pl...@pi... wrote:
> On 17/09/16 18:12, sfeam wrote:
> > gnuplot> set for [a in "11 13 17"] arrow from a,0 to a,1
>
>
> Many thanks Ethan. , I have to admit I did not try that since I consult
> the doc when I don't know syntax and do not waste time doing other
> things than what is documented in the wild hope of discovering
> undocumented features.
>
> So we have a documentation bug , that syntax is not proposed for intvar
> and apparently it should be.
Not exactly. It's more of an unintended (but useful) consequence of
promotion from string to integer wherever the program knows that a
number is expected.
In the above example a is a string variable not an integer variable.
But the "set arrow" command is looking for a number, not a string,
so it does the conversion silently. Just as the following both work
plot foo lt 2
plot foo lt "2"
This does _not_ work for floating point number however.
That's why I think it might be a good idea to allow iteration over
the elements in an array. Then you could have something like
array value[3] = [1.11, 2.22, 3.33]
plot for [V in value] f(V)
> I did do a fair bit of searching trying to find a work around or a trick
> and did not find anything. So it looks like most people like me believe
> what they read and are not profiting form this excellent feature.
>
> Regards. Peter.
|