[Grace-core] Range weirdness

Kim Bruce kim at cs.pomona.edu
Tue Jul 1 11:44:03 PDT 2014


The construct (a..b) provides a list of numbers from a to b.  Thus 1..4 gives [1,2,3,4].

The question is what should happen if a and b are non-integers.  Here are some options, illustrated by 1.2 .. 5.5
1.  Return an error -- this is only supposed to give ranges of integers
2.  Return [1.2,2.2,3.2,4.2,5.2].  I.e, start with the initial value and go up to the last value <= upper bound.
3.  Return [1.2,2.2,3.2,4.2] ????

The third is what currently happens in Grace. It only picks up the 5.2 when the upper bound reaches 6.

Either 1 or 2 is acceptable, though I'd have a very slight preference for 1 just because it is simpler.

What do we want the answer to be and then can we make the correction?

Kim






More information about the Grace-core mailing list