20. 秩

以下以一名詞 report 來舉例說明形狀($)、記數(#)與(#@$)等函數,名詞可看作是兩個每年有四季每季有三個月的年的報表:
   ]report=: i. 2 4 3
 0  1  2
 3  4  5
 6  7  8
 9 10 11

12 13 14
15 16 17
18 19 20
21 22 23

   ($ ; # ; #@$) report        形狀、個數與秩
+-----+-+-+
|2 4 3|2|3|
+-----+-+-+
最後 k  軸為一個名詞的 k-單元;報表report的 0維單元為原子 (諸如 4 14),一維單元為有三原子的季報,而二維單元(或主要單元項目) 為該二個4x3的年報。

秩連接詞 " 用在片語 f"k ,將函數 f 套用在其引數的每個 k 維單元。例如:
   ,report
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

   ,"2 report
 0  1  2  3  4  5  6  7  8  9 10 11
12 13 14 15 16 17 18 19 20 21 22 23

   <@i. s=: 2 5 
+---------+ 
|0 1 2 3 4|
|5 6 7 8 9|
+---------+
   <@i."0 s
+---+---------+
|0 1|0 1 2 3 4|
+---+---------+
雙邊詞的左與右方都有秩。因此
   10 11 12 (,"0 1 ; ,"1 1 ; ,"1) 0 1 2
+--------+--------------+--------------+
|10 0 1 2|10 11 12 0 1 2|10 11 12 0 1 2|
|11 0 1 2|              |              |
|12 0 1 2|              |              |
+--------+--------------+--------------+
基礎特徵副詞 b. 非常便於分析函數 (或者定義式)有關的秩 例如:
   (# b. 0) ; (+/\ b. 0) ; (+/\ % #) b. 0
+-----+-----+-----+
|_ 1 _|_ 0 _|_ _ _|
+-----+-----+-----+

練習

20.1   Observe results of following uses of 單邊 produced by rank 連接詞,與comment on m:
a=: i. 3 4 5
<"0 a
<"1 a
<"2 a
<"3 a
< a
<"_1 a
<"_2 a
mean=: +/ % #
mean a
mean"1 a
mean"2 a
解答: <"k applies < to each 框格 of rank k ,with <"(#$a) a being equivalent to <a .Moreover, a negative value of k specifies a complementary rank that is effectively |k less than rank of 引數 a .

20.2   Use results of following experiments to state relation between 連接詞 @ (Atop) and @: (At),與compare your conclusions with dictionary定義:
(g=: <"2) a=: i. 3 4 5
|. @: g a
|. @ g a
|: @: (<"1) a
|: @ (<"1) a
解答:rank of 函數 |. @: g is itself infinite and |. refore 應用於entire list result of g a ,consequently reversing it. On or hand, 函數 f @ g inherits rank of g ,and |. refore applies individually to 原子 produced by g , producing no effect.

20.3   Use results of following experiments to comment on use of rank 連接詞 in 雙邊s:
b=: 'ABC'
c=: 3 5 $ 'abcdefghijklmno'
c
b,c
b ,"0 1 c
b ,"1 1 c
b ,"1 c

下個前個字彙索引主選單