In his e-mail message of 1993/02/24, Jean Michel writes The new ranges are an improvement, but... I find the fact that <high>-<low> must be divisible (the error message says divisable which is a misspelling) by <inc> to be slightly annoying. I had in my code thinks like: [1..QuoInt(n+1,2)]*2-1 to specify the odd integers smaller than n, and [1..QuoInt(n,2)]*2 to specify the even integers less than n. I hoped to be able to rewrite these as [1,3..n] and [2,4..n] but the first one works only for n odd and the second for n even! One has to use [1,3..n-1+(n mod 2)] and [2,4..n-(n mod 2)] which is less pleasant and efficient.
What is the rationale for the restriction?
The rationale is that a construct such as
for i in [1,3..n] do ...
has a visual clue that <n> is in fact a member of the range, and that it
will be the last value of <i>. That is a programmer might
(unconsciously) follow that <n> is in the range (in the membership
sense), because it is in the range literal (in a textual sense). But
this visual clue could be misleading if GAP would be silently rounding,
because then in the above example <n> would be a member of the range only
if it is odd.
I have to admit that this is a somewhat weak argument. If one would
apply it consequently, '[<i>,<j>..<k>]' would also have to generate an
error if '<k> < <j>', because in this case <j> is not in the range, even
though it is in the range literal.
Actually, I don't really care one way or the other. If other users would
also prefer silent rounding, I am quite willing to change the definition
and the code accordingly (which is not a big deal).
Martin.
-- .- .-. - .. -. .-.. --- ...- . ... .- -. -. .. -.- .- Martin Sch"onert, Martin.Schoenert@Math.RWTH-Aachen.DE, +49 241 804551 Lehrstuhl D f"ur Mathematik, Templergraben 64, RWTH, D 51 Aachen, Germany