<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>.. -- a binary operator, used for sequences of consecutive items</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_.._lt.html">next</a> | <a href="__co.html">previous</a> | <a href="_.._lt.html">forward</a> | <a href="__co.html">backward</a> | <a href="_operators.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_operators.html" title="">operators</a> > <a href="_...html" title="a binary operator, used for sequences of consecutive items">..</a></div> <hr/> <div><h1>.. -- a binary operator, used for sequences of consecutive items</h1> <div class="single"><h2>Description</h2> <div><p>The most confusing thing about this operator, in all its guises, 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.</p> <table class="examples"><tr><td><pre>i1 : {10..10} o1 = {1 : (10)} o1 : List</pre> </td></tr> <tr><td><pre>i2 : {10..8} o2 = {()} o2 : List</pre> </td></tr> <tr><td><pre>i3 : {3..5,8..10} o3 = {(3, 4, 5), (8, 9, 10)} o3 : List</pre> </td></tr> </table> <p> Use <a href="_splice.html" title="remove subsequences">splice</a> to fix that.</p> <table class="examples"><tr><td><pre>i4 : splice {3..5,8..10} o4 = {3, 4, 5, 8, 9, 10} o4 : List</pre> </td></tr> </table> <p>If a type of list, instead of a sequence, is desired, use <a href="_to__List.html" title="list of elements">toList</a> or the operator <a href="_new.html" title="new objects and new types">new</a>.</p> <table class="examples"><tr><td><pre>i5 : 0..5 o5 = (0, 1, 2, 3, 4, 5) o5 : Sequence</pre> </td></tr> <tr><td><pre>i6 : toList (0..5) o6 = {0, 1, 2, 3, 4, 5} o6 : List</pre> </td></tr> <tr><td><pre>i7 : new Array from 0..5 o7 = [0, 1, 2, 3, 4, 5] o7 : Array</pre> </td></tr> <tr><td><pre>i8 : new Sum from 0..5 o8 = 0 + 1 + 2 + 3 + 4 + 5 o8 : Expression of class Sum</pre> </td></tr> </table> <p>The operator can be used with sequences or lists, whose elements are of various types, to produce rectangular intervals.</p> <table class="examples"><tr><td><pre>i9 : (0,0)..(1,3) o9 = ((0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3)) o9 : Sequence</pre> </td></tr> <tr><td><pre>i10 : p_(0,a) .. p_(1,c) o10 = (p , p , p , p , p , p ) 0,a 0,b 0,c 1,a 1,b 1,c o10 : Sequence</pre> </td></tr> <tr><td><pre>i11 : p_(1,1) .. q_(2,2) o11 = (p , p , p , p , q , q , q , q ) 1,1 1,2 2,1 2,2 1,1 1,2 2,1 2,2 o11 : Sequence</pre> </td></tr> </table> <p>Use <a href="_.._lt.html" title="a binary operator, used for sequences of consecutive items, not including the endpoint">..<</a> instead to get a sequence that stops short of the endpoint.</p> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_ranges_spand_sprepetitions.html" title="">ranges and repetitions</a></span></li> <li><span><a href="_polynomial_springs.html" title="">polynomial rings</a></span></li> <li><span><a href="_subscripted_spvariables.html" title="">subscripted variables</a></span></li> <li><span><a href="_.._lt.html" title="a binary operator, used for sequences of consecutive items, not including the endpoint">..<</a> -- a binary operator, used for sequences of consecutive items, not including the endpoint</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>..</tt> :</h2> <ul><li><span><a href="___Indexed__Variable_sp.._sp__Indexed__Variable.html" title="sequences of consecutive indexed variables">IndexedVariable .. IndexedVariable</a> -- sequences of consecutive indexed variables</span></li> <li><span><tt>IndexedVariableTable .. IndexedVariableTable</tt> (missing documentation<!-- tag: (..,IndexedVariableTable,IndexedVariableTable) -->)</span></li> <li><span><tt>IndexedVariableTable .. Thing</tt> (missing documentation<!-- tag: (..,IndexedVariableTable,Thing) -->)</span></li> <li><span><a href="___List_sp.._sp__List.html" title="rectangular sequences of consecutive lists and sequences">List .. List</a> -- rectangular sequences of consecutive lists and sequences</span></li> <li><span>Sequence .. Sequence, see <span><a href="___List_sp.._sp__List.html" title="rectangular sequences of consecutive lists and sequences">List .. List</a> -- rectangular sequences of consecutive lists and sequences</span></span></li> <li><span><tt>MonoidElement .. MonoidElement</tt> (missing documentation<!-- tag: (..,MonoidElement,MonoidElement) -->)</span></li> <li><span><tt>MonoidElement .. Thing</tt> (missing documentation<!-- tag: (..,MonoidElement,Thing) -->)</span></li> <li><span><a href="___Ring__Element_sp.._sp__Ring__Element.html" title="a sequence of consecutive generators of a polynomial ring">RingElement .. RingElement</a> -- a sequence of consecutive generators of a polynomial ring</span></li> <li><span><tt>RingElement .. Thing</tt> (missing documentation<!-- tag: (..,RingElement,Thing) -->)</span></li> <li><span><a href="___String_sp.._sp__String.html" title="a sequence of consecutive strings">String .. String</a> -- a sequence of consecutive strings</span></li> <li><span><tt>Subscript .. Subscript</tt> (missing documentation<!-- tag: (..,Subscript,Subscript) -->)</span></li> <li><span><tt>Subscript .. Thing</tt> (missing documentation<!-- tag: (..,Subscript,Thing) -->)</span></li> <li><span><a href="___Symbol_sp.._sp__Symbol.html" title="sequences of consecutive symbols">Symbol .. Symbol</a> -- sequences of consecutive symbols</span></li> <li><span><tt>Thing .. IndexedVariableTable</tt> (missing documentation<!-- tag: (..,Thing,IndexedVariableTable) -->)</span></li> <li><span><tt>Thing .. MonoidElement</tt> (missing documentation<!-- tag: (..,Thing,MonoidElement) -->)</span></li> <li><span><tt>Thing .. RingElement</tt> (missing documentation<!-- tag: (..,Thing,RingElement) -->)</span></li> <li><span><tt>Thing .. Subscript</tt> (missing documentation<!-- tag: (..,Thing,Subscript) -->)</span></li> <li><span><a href="___Z__Z_sp.._sp__Z__Z.html" title="sequences of consecutive integers">ZZ .. ZZ</a> -- sequences of consecutive integers</span></li> </ul> </div> <div class="waystouse"><h2>For the programmer</h2> <p>The object <a href="_...html" title="a binary operator, used for sequences of consecutive items">..</a> is <span>a <a href="___Keyword.html">keyword</a></span>.</p> <div><div><p>This operator may be used as a binary operator in an expression like <tt>x..y</tt>. The user may install <a href="_binary_spmethods.html" title="">binary methods</a> for handling such expressions with code such as</p> <pre> X .. Y := (x,y) -> ...</pre> <p>where <tt>X</tt> is the class of <tt>x</tt> and <tt>Y</tt> is the class of <tt>y</tt>.</p> </div> </div> </div> </div> </body> </html>