..
expressions of type range

Description


•

An expression of type range (also called type $\mathrm{..}$) has two operands, the lefthand side expression and the righthand 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{`\$`}\left(1..3\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.



Thread Safety


•

The .. operator is threadsafe as of Maple 15.



Examples


>

$\mathrm{add}\left(i\,i\=1..3\right)$

>

${\mathrm{`\$`}\left(1..3\right)}}$

${1}{\,}{2}{\,}{3}$
 (3) 
>

$\mathrm{cat}\left(a\,1..3\right)$

${\mathrm{a1}}{\,}{\mathrm{a2}}{\,}{\mathrm{a3}}$
 (4) 
>

$A\u2254\left[1\,2\,3\,4\right]$

${A}{\u2254}\left[{1}{\,}{2}{\,}{3}{\,}{4}\right]$
 (5) 
>

${A}_{\left(\right)..2}$

$\left[{1}{\,}{2}\right]$
 (6) 
>

${A}_{3..\left(\right)}$

$\left[{3}{\,}{4}\right]$
 (7) 






Download Help Document
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.