|
Calling Sequence
|
|
expr $ i = m .. n
expr $ m .. n
expr $ n
$ i = m .. n
$ m .. n
$ n
`$`( expr, i = m .. n )
`$`( expr, m .. n )
`$`( expr, n )
`$`( i = m .. n )
`$`( m .. n )
`$`( n )
|
|
Parameters
|
|
expr
|
-
|
expression
|
i
|
-
|
unevaluated name
|
m, n
|
-
|
expressions
|
|
|
|
|
Description
|
|
•
|
In its most general form, expr $ i = m..n, the $ operator returns the expression sequence produced by substituting for i in expr the values m, m+1, ..., n (or up to the last value not exceeding n if n-m is not an integer)
|
•
|
If m > n then the NULL (empty) expression sequence is returned.
|
•
|
If expr does not refer to i, the right operand of the $ operator can be written as just m..n.
|
|
Furthermore, if expr does not refer to i and if m is 1, m..n can be specified as just n. Thus, expr $ n produces a sequence of n occurrences of expr.
|
•
|
The left operand of $ may be omitted when generating simple sequences of numbers:
|
–
|
The forms $ i = m..n and $ m..n are equivalent to i $ i = m..n, and produce the sequence m, m+1, ..., n (or up to the last value not exceeding n).
|
–
|
The form $ n is equivalent to i $ i = 1..n when n is of type algebraic.
|
–
|
The form $ n when n is a string is equivalent to n[i] $ i = 1..length(n), returning a sequence of the individual characters within the string.
|
•
|
The $ operator can also be invoked in function call form, using the name `$`.
|
|
Note: Some of these calling sequences are not currently supported in 2-D input in the Standard interface. However, equivalent forms work. You can always use the forms expr $ i = m .. n, expr $ n, and $ m .. n.
|
|
Note: It is recommended (and often necessary) that both expr and i be enclosed in single quotes to prevent premature evaluation. For example, if i had been assigned a value, the i in the expression would be evaluated to its value, and so could not be used as a counting variable. The most common usage is 'expr' $ 'i' = m..n.
|
|
The seq function, which has many of the same capabilities as the $ operator, has special evaluation rules that make this quoting unnecessary.
|
•
|
In a procedure parameter declaration section, $ is used as the end-of-parameters marker. For more information on this use of $, see Parameter Declarations.
|
|
|
Thread Safety
|
|
•
|
The $ operator is thread-safe as of Maple 15.
|
|
|
Examples
|
|
|
|
Compatibility
|
|
•
|
The $ operator was updated in Maple 2021.
|
|
|
|