² Reverse


Reverses the order of the numbers or letters in the right-hand argument. (See also ³, the transpose function.)

             ² 1 2 3 4 5 6
       6 5 4 3 2 1
             ²(1 2) (3 4) (5 6)      (The three element are reversed, but not
       5 6  3 4 1 2                   their contents)
             ² 'BOB WON POTS'
       STOP NOW BOB
             TABLE
       1 2 3 4 5
       6 7 8 9 0
             ² TABLE                 (When applied to a matrix, it
       5 4 3 2 1                      reverses the order within each
       0 9 8 7 6                      row. You can use the operator []-
             ²[1]TABLE                'axis' to make the rotation apply
       6 7 8 9 0                      to a different dimension.)
       1 2 3 4 5

By default reverse, ², applies to the last dimension. Thus, above, TABLE was reversed about its columns. The first axis reverse, ´, behaves exactly as ² but operates by default about the first axis. Both will respond in the same way to the axis operator. The axis operator will depend on the setting of ŒIO.


Topic: APLX Help : Help on APL language : APL Primitives : ² Reverse
[ Previous | Next | Contents | Index ]