w=: 'STOP' 3 2 0 1 { w POST 2 3 1 0 { w OPTS 3 0 2 1 { w PSOT上述 { 的左引數本身就是條列 i.4 的排列;排列向量的範例,用來以p&{的形式表達排列函數。
]c=: C. p=: 2 4 0 1 3 +---+-----+ |2 0|4 3 1| +---+-----+ c C. 'ABCDE' C. c CEABD 2 4 0 1 3Each of boxed 分子 of a cycle specify a list of positions that cycle among mselves; 在example above, 分子 from position 3 moves to position 4 , 分子 1 moves to 3 ,and 分子 4 to 1 .
1 A. 'ABCDE' A. 0 1 2 4 3 ABCED 1 (i.!3) A. i.3 (i.!3) A. 'ABC' 0 1 2 ABC 0 2 1 ACB 1 0 2 BAC 1 2 0 BCA 2 0 1 CAB 2 1 0 CBA
練習
25.1 | Use following as exercises in reading與writing (try
on a=:'abcdef' and b=: i. 6 and c=: i. 6 6): f=: 1&A. Interchange last two items g=: 3&A. Rotate last three items h=: 5&A. Reverse last three items i=: <:@!@[ A. ] k i a reverses last k items |
25.2 | Experiment with following expressions與ors
like m to determine 規則for using abbreviated引數
to C. and compare your conclusions with
dictionary定義: 2 1 4 C. b=:i.6 (<2 1 4) C. b (3 1;5 0) C. b |
25.3 | Make a program ac that produces a 表格of cycle
representations of all 排列of order of its引數,
as in ac 3 . 解答: ac=: C.@(i.@! A. i.) |