Node:Enumerations, Next:Strings, Previous:Truncation, Up:Sequences
first for count | Function |
The for operator returns a sequence containing
a sub-range of the integers:
Q1> 1 for 10 1 for 10 Q2> (1 for 10)+100 101 102 103 104 105 106 107 108 109 110 |
init by step | Function |
Returns an infinite sequence of integers starting with init, increasing by step. |
Q upto Limit | Function |
Same as: Q while {<= Limit}
Example: 2 upto 5 == [2 3 4 5] .
I upto Limit == (I by 1) upto Limit .
Example: 1 by 2 upto 10 == [1 3 5 7 9]
|
Q downto Limit | Function |
Same as: Q while {>= Limit}
I downto Limit == (I by -1) downto Limit .
Example: 5 downto 2 == [5 4 3 2] .
|
I to J | Function |
I to J is like I upto J-1 .
That is, the upper bound J is not included.
Furthermore, the result is recognized specially by indexing.
Thus for a sequence X, the expression X (I to J)
select the sub-sequence of X between the indexes I and J.
One or both of I and J can be negative, meaning
indexing from the end of X.
For example, X (I to -1) is the same as X drop I , if I>=0.
|