.. - Maple Help

..

expressions of type range

Description

 • expr .. expr
 • An expression of type range (also called type $\mathrm{..}$) has two operands, the left-hand side expression and the right-hand side expression.
 • A range is represented externally using the binary operator $\mathrm{..}$ which simply acts as a placeholder in the same manner as the relational operators. For example, the range $1..3$ is not equivalent to the expression sequence 1, 2, 3, but the sequence operator \$ may be used in the form $\mathrm{Typesetting}:-\mathrm{_Hold}\left(\left[\mathrm{}\left(1..3\right)\right]\right)$ to yield the expression sequence.
 • Note that more than two dots in succession are also parsed as the range ($\mathrm{..}$) operator.
 • The range construct can also be used in combination with the concatenation operator to form an expression sequence, using the form cat(name, (range)) where the operands in range must be integers. The result is an expression sequence consisting of the names formed by concatenating name to each integer in the specified range.
 • Inside (), {}, [], and <>, ranges can be parsed without a beginning or end value. Literally, A[..] is evaluated to A[NULL..NULL], but if A is an Array, list, set, sequence, or string, A[..] is interpreted as the full range of data.  Similarly A[..n] indicates the first n elements in A, and A[n..] indicates the range of data starting from n to the end of A.

 • The .. operator is thread-safe as of Maple 15.

Examples

 > $\mathrm{add}\left(i,i=1..3\right)$
 ${6}$ (1)
 > $1..3$
 ${1}{..}{3}$ (2)
 > $\mathrm{}\left(1..3\right)$
 ${1}{,}{2}{,}{3}$ (3)
 > $\mathrm{cat}\left(a,1..3\right)$
 ${\mathrm{a1}}{,}{\mathrm{a2}}{,}{\mathrm{a3}}$ (4)
 > $A≔\left[1,2,3,4\right]$
 ${A}{≔}\left[{1}{,}{2}{,}{3}{,}{4}\right]$ (5)
 > $A\left[..2\right]$
 $\left[{1}{,}{2}\right]$ (6)
 > $A\left[3..\right]$
 $\left[{3}{,}{4}\right]$ (7)