Next: , Previous: , Up: Answers to Exercises   [Contents][Index]

2.7.19 List Tutorial Exercise 1

We can use v x to build a vector of integers. This needs to be adjusted to get the range of integers we desire. Mapping ‘-’ across the vector will accomplish this, although it turns out the plain ‘-’ key will work just as well.

2:  2                              2:  2
1:  [1, 2, 3, 4, 5, 6, 7, 8, 9]    1:  [-4, -3, -2, -1, 0, 1, 2, 3, 4]
    .                                  .

    2  v x 9 RET                       5 V M -   or   5 -

Now we use V M ^ to map the exponentiation operator across the vector.

1:  [0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16]
    .

    V M ^