>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Primer

# A few more primitives

The monad `i.` (integers) result is the list of integers from 0 up to its right argument.

       i. 2
    0 1

       i. 4
    0 1 2 3

       i. 6
    0 1 2 3 4 5

The dyad `$` is called shape.

       5 $ 7	NB. a list of 5 7's
    7 7 7 7 7
       8 $ 23	NB. a list of 8 23's
    23 23 23 23 23 23 23 23

The monad `?` (roll) generates a random number in the range 0 up to 1 less than the argument. The answers vary depending on how the die rolls.

       ? 10
    6

       ? 10
    0
       ? 10 10 10 10	NB. 4 numbers in range 0 to 9
    3 0 4 6

       ? 5 $ 100	NB. 5 numbers in range 0 to 99
    58 93 84 52 9

       ? i. 5
    ¦domain error
    ¦       ?i.5

The `? i. 5` fails because the `?` on `0` fails because there are no integers in the range 0 to _1 and so there is no answer for the argument of 0. If you add 1 to the result of `i.` we will get an answer.

       ? 1 + i. 20
    0 1 0 1 0 3 3 2 2 4 7 3 0 13 1 5 16 6 3 19

The dyad `^` (power) result is the left argument multiplied by itself the number of times given by the right argument.

       3 ^ 2	NB. 3 * 3
    9

       2 ^  3	NB. 2 * 2 * 2
    8

       2 ^ 4	NB. 2 * 2 * 2 * 2
    16

       2 2 2 2 2 2 ^ 0 1 2 3 4 5
    1 2 4 8 16 32

       2 ^ 0 1 2 3 4 5
    1 2 4 8 16 32

       2 ^ i. 6
    1 2 4 8 16 32

The dyad `o.` (circle) is the letter `o` inflected with a dot, and it provides the circular (trigonometric) functions. In particular, the `o.` verb with a left argument of 1 gives the sine of the right argument.

       1 o. i.7
    0 0.841471 0.909297 0.14112 _0.756802 _0.958924 _0.279415

It is hard to tell whether this makes sense or not and it would be better to see this data with a plot.

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Primer