[Next] [Up] [Previous] [Contents]
Next: Reduction operators Up: Vectors and vector operators Previous: Vectors as inputs and

Iteratively constructing vectors

A vector may be constructed iteratively using the construction [f(i):i=l..r], where f(i) is some expression containing the parameter i, and l, r are integers. This expands to the vector [f(l),...,f(r)]. For example, the expression:

        [ i*i : i = 1..5 ]
is equivalent to:
        [1,4,9,16,25]
On the other hand:
        [ i*i : i = 5..1 ]
is equivalent to:
        [25,16,9,4,1]



Ken McMillan
Sat Jun 6 21:41:59 PDT 1998