up previous next
1.3.5 Range Operator
If M and N are of type INT , then the expression: M .. N returns

* the list [M, M+1, ... , N] if M <= N;

* the empty list, [] , otherwise.

NOTE: see example for how to select a sub-range of a list

NOTE: CoCoA does not allow N..M to produce lists longer than 10^7 values.

If x and y are indeterminates in a ring, then x .. y gives the indeterminates between x and y in the order they appear in the definition of the ring.

Example
/**/  1..10;
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

/**/  use R ::= QQ[x,y,z,a,b,c,d];
/**/  z..c;
[z, a, b, c]

/**/ L := [11, 22, 33, 44, 55];
/**/ PartOfL := L[2]..L[4];  --> probably *NOT* what you want!
/**/ PartOfL := [ L[k] | k in 2..4 ]; --> OK, this is RIGHT!