|
From: Arun P. <ape...@lb...> - 2012-05-03 20:00:01
|
Hi
> R> for (i in 4:1) { print(i) }
> [1] 4
> [1] 3
> [1] 2
> [1] 1
>
> So that's a third option to consider.
> It's not too late to consider adopting this behavior for gnuplot also:
> for [i = start : end {: increment}]
> where increment defaults to -1 if (start > end) and +1 otherwise.
>
> Ethan
My preferred choice would be that you need to specify the -1 increment
explicitly.
If you leave it with an increment of +1 unless otherwise specified, I
also would prefer if "do for [i=5:4] {" does no iterations at all.
My application was that I had a data file with 33 columns and I wanted
to plot column i:j for the first 10 columns using
do for [i=:10] {
do for[j=(i+1):10] {
...
}
}
which plots something like an upper triangle matrix of plots, but with
an extra plot for 11:10, which I didn't expect. Can't really think of
other good examples where this would be relevant at the moment though.
An automatic switch to an increment of -1 would also be OK for me,
although I wouldn't expect it ;)
Arun
|