[top][index]
search for:

.. -- sequence of consecutive items

m .. n -- produces a sequence of integers in the range from m to n inclusive. If n is less than m then the result is an empty sequence.

i1 : 1..5

o1 = (1, 2, 3, 4, 5)

o1 : Sequence
i2 : {1..5}

o2 = {(1, 2, 3, 4, 5)}

o2 : List
i3 : toList(1..5)

o3 = {1, 2, 3, 4, 5}

o3 : List

The most confusing thing about this operator is that it is not a syntactic construction, and so the resulting sequences do not splice themselves into enclosing lists, as in each of the following examples. Use splice to fix that.

i4 : {10..10}

o4 = {singleton 10}

o4 : List
i5 : {10..8}

o5 = {()}

o5 : List
i6 : {3..5,8..10}

o6 = {(3, 4, 5), (8, 9, 10)}

o6 : List
i7 : splice {3..5,8..10}

o7 = {3, 4, 5, 8, 9, 10}

o7 : List

a .. i -- produces a sequence of symbols for use as variables in polynomial rings.

i8 : a .. i

o8 = (a, b, c, d, e, f, g, h, i)

o8 : Sequence

x_0 .. x_9 -- produces a sequence of indexed variables for use in polynomial rings.

i9 : x_0 .. x_9

o9 = (x , x , x , x , x , x , x , x , x , x )
       0   1   2   3   4   5   6   7   8   9

o9 : Sequence
i10 : x_(t_0) .. x_(t_5)

o10 = (x  , x  , x  , x  , x  , x  )
        t    t    t    t    t    t
         0    1    2    3    4    5

o10 : Sequence
i11 : x_a .. x_e

o11 = (x , x , x , x , x )
        a   b   c   d   e

o11 : Sequence

This operator can be used with sequences or lists to produce rectangular intervals.

i12 : (0,0)..(1,3)

o12 = ((0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3))

o12 : Sequence
i13 : p_(0,a) .. p_(1,c)

o13 = (p   , p   , p   , p   , p   , p   )
        0,a   0,b   0,c   1,a   1,b   1,c

o13 : Sequence

This operator may be used as a binary operator in an expression like x .. y. The user may install binary methods for handling such expressions with code such as

              X .. Y := (x,y) -> ...
where X is the class of x and Y is the class of y.

Methods for .. :

  • Sequence .. Sequence
  • List .. List
  • IndexedVariable .. IndexedVariable
  • Symbol .. Symbol
  • Thing .. Thing

  • [top][index]
    search for: