next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > operators > ..

.. -- a binary operator, uses include ranges; sequence of consecutive items

Synopsis

Description

i1 : 1..5

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

o1 : Sequence
i2 : toList(1..5)

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

o2 : List
i3 : a..f

o3 = (a, b, c, d, e, f)

o3 : Sequence
i4 : p_(1,1) .. p_(2,3)

o4 = (p   , p   , p   , p   , p   , p   )
       1,1   1,2   1,3   2,1   2,2   2,3

o4 : Sequence

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.

i5 : {10..10}

o5 = {1 : (10)}

o5 : List
i6 : {10..8}

o6 = {()}

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

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

o7 : List
i8 : splice {3..5,8..10}

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

o8 : List

Sequences of symbols and index variables for use as variables in polynomial rings

i9 : a..i

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

o9 : Sequence
i10 : x_0 .. x_9

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

o10 : Sequence
i11 : x_(t_0) .. x_(t_5)

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

o11 : Sequence
i12 : x_a .. x_e

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

o12 : Sequence

Rectangular lists

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

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

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

o13 : Sequence
i14 : p_(0,a) .. p_(1,c)

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

o14 : Sequence
i15 : p_(1,1) .. p_(2,3)

o15 = (p   , p   , p   , p   , p   , p   )
        1,1   1,2   1,3   2,1   2,2   2,3

o15 : Sequence

See also

Ways to use .. :

For the programmer

The object .. is a keyword.

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.