Reverse | |. _ 1 _ | Rotate |
|. y reverses the order of the items of y .
For example:|. t=: 'abcdefg' gfedcbaThe right shift is the monad |.!.f , equivalent to the dyad |.!.f with a left argument _1 . For example: |.!.'#' t #abcdef |.!.10 i.3 3 10 10 10 0 1 2 3 4 5 |
x|.y rotates successive axes of y by
successive elements of x . Thus: 1 2 |. i. 3 5 7 8 9 5 6 12 13 14 10 11 2 3 4 0 1The phrase x |.!.f y produces a shift: the items normally brought around by the cyclic rotation are replaced by the atom f unless f is empty (0=#f), in which case they are replaced by the normal fill defined under Take ({.): 2 _2 |.!.'#'"0 1 t cdefg## ##abcde |
y=: a.{~ (a. i. 'A') + i. 5 6 (] ; 2&|. ; _2&|. ; 2&|."1 ; 2&(|.!.'*'"1)) y +------+------+------+------+------+ |ABCDEF|MNOPQR|STUVWX|CDEFAB|CDEF**| |GHIJKL|STUVWX|YZ[\]^|IJKLGH|IJKL**| |MNOPQR|YZ[\]^|ABCDEF|OPQRMN|OPQR**| |STUVWX|ABCDEF|GHIJKL|UVWXST|UVWX**| |YZ[\]^|GHIJKL|MNOPQR|[\]^YZ|[\]^**| +------+------+------+------+------+ (] ; |. ; |."1 ; |.!.'*'"1 ; (2: |. ])) y +------+------+------+------+------+ |ABCDEF|YZ[\]^|FEDCBA|*ABCDE|MNOPQR| |GHIJKL|STUVWX|LKJIHG|*GHIJK|STUVWX| |MNOPQR|MNOPQR|RQPONM|*MNOPQ|YZ[\]^| |STUVWX|GHIJKL|XWVUTS|*STUVW|ABCDEF| |YZ[\]^|ABCDEF|^]\[ZY|*YZ[\]|GHIJKL| +------+------+------+------+------+ 1 _2 |. !. '*' 3{. y **GHIJ **MNOP ******