[GAP Forum] Negative entries in positive ranges
Steve Linton
sal at dcs.st-and.ac.uk
Wed Oct 6 11:41:42 BST 2004
Dear GAP Forum,
Anvita reported:
> I have run into the following peculiar behavior of GAP:
> ----------------------------------------------------
> gap> -1 in [1..2];
> true
> gap> Position([1..2],-1);
> -1
> ----------------------------------------------------
>
> On the other hand:
> ----------------------------------------------------
> gap> l:=[1..2];;
> gap> l[-1];
> List Element: <position> must be positive (not a -1)
> ----------------------------------------------------
>
> Is it supposed to be this way?
>
Of course it is not supposed to be this way. This is a bug in GAP and will be
fixed in the next bugfix. The problem is in the kernel, so there is no simple
workaround. It arises only when a negative integer is tested for membership in
a range consisting entirely of positive integers.
Steve Linton
--
Steve Linton School of Computer Science &
Centre for Interdisciplinary Research in Computational Algebra
University of St Andrews Tel +44 (1334) 463269
http://www.dcs.st-and.ac.uk/~sal Fax +44 (1334) 463278
More information about the Forum
mailing list