>> << 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. An argument of 0 gives a random floating point number greater than or egual to 0 and less than 1. 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
       ? 0 0 0
    0.708477 0.553165 0.00766673

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