| 符號 | s: _ _ _ | 符號 |
單邊 s: 得到符號陣列。多種型態的引數為 accep表格:
雙邊 s: 採用純量整數左引數,且計算各種函數:
inverse of k&s: is (-k)&s:,for non-zero 整數 k between _6 and 6. |
] t=: s: ' zero one two three four five'
`zero `one `two `three `four `five
$ t 6 符號的條列
6
3 5 $ t 符號矩陣
`zero `one `two `three `four
`five `zero `one `two `three
`four `five `zero `one `two
1 3 5 3 1 { t
`one `three `five `three `one
|. t
`five `four `three `two `one `zero
_2 |. t
`four `five `zero `one `two `three
1 0 2 0 4 0 # t
`zero `two `two `four `four `four `four
<"0 t 符號可以封裝
+-----+----+----+------+-----+-----+
|`zero|`one|`two|`three|`four|`five|
+-----+----+----+------+-----+-----+
(2|i.#t) </. t
+----------------+-----------------+
|`zero `two `four|`one `three `five|
+----------------+-----------------+
<:/~ t 關係可用在符號
1 0 0 0 0 0
1 1 1 1 0 0
1 0 1 0 0 0
1 0 1 1 0 0
1 1 1 1 1 0
1 1 1 1 1 1
t + t 算術函數 不能用在符號
|domain error
| t +t
/: t 符號可以分級/排序
5 4 1 3 2 0
5 s: t 轉換符號成封裝字串
+----+---+---+-----+----+----+
|zero|one|two|three|four|five|
+----+---+---+-----+----+----+
(/: t) -: /: 5 s: t
1
/:~ t
`five `four `one `three `two `zero
<:/~ /:~ t
1 1 1 1 1 1
0 1 1 1 1 1
0 0 1 1 1 1
0 0 0 1 1 1
0 0 0 0 1 1
0 0 0 0 0 1
t i. s: ' three one four one five nine'
3 1 4 1 5 6
t e.~ s: ' three one four one five nine'
1 1 1 1 1 0
10{. t 填充 的符號為 0-長度 符號
`zero `one `two `three `four `five ` ` ` `
_10{.t
` ` ` ` `zero `one `two `three `four `five
0 s: 0 cardinality (當前# of unique 符號s)
8
a=: ;:'A AAPL AMAT AMD AMZN ATT BA CRA CSCO DELL F GE GM HWP IBM INTC'
a=: a,;:'JDSU LLY LU MOT MSFT NOK NT PFE PG QCOM RMBS T XRX YHOO'
b=: ;:'NY SF LDN TOK HK FF TOR'
c=: ;:'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'
d=: <;._1 ' 00 01 02 03 04 05 06 07 08 09'
e=: ;:'開啟high low close'
t=: }.@;&.>{' ',&.>&.>a;b;c;d;<e
$t
30 7 12 10 4
*/ $t
100800
2 4 ($,) t
+----------------+----------------+---------------+-----------------+
|A NY Jan 00開啟|A NY Jan 00 high|A NY Jan 00 low|A NY Jan 00 close|
+----------------+----------------+---------------+-----------------+
|A NY Jan 01開啟|A NY Jan 01 high|A NY Jan 01 low|A NY Jan 01 close|
+----------------+----------------+---------------+-----------------+
y=: s: t 制訂眾多符號
$y
30 7 12 10 4
2 4 ($,) y
`A NY Jan 00 開啟`A NY Jan 00 high `A NY Jan 00 low `A NY Jan 00 close
`A NY Jan 01 開啟`A NY Jan 01 high `A NY Jan 01 low `A NY Jan 01 close
0 s: 11 系統整合檢驗
1
0 s: 0 cardinality
100808
(+/ % #) 0 s: 12 mean # of queries per 符號
1.31213
h=: 100808 {. 2 {"1 ] 0 s: 2 hash values
(+/ ~: h) % #h fraction of distinct hash values
0.999821
(+/ ~: h |~ #0 s: 4) % #h fraction with respect to hash表格
0.831005
Space與Time
| query (new) | O((len y) * ^. 0 s: 0) | |
| query (old) | O(len y) | |
| /:y | O(*/$y) | |
| i{y | O((*/$i) * */}.$y) | |
| x < y etc. | O(x >.&(*/@$) y) | |
| x i. y | O(x + &(*/@$) y) |
| ((3!:1) 0 s: 10) 1!:2 <'symb.dat' | to store global 符號s data |
| 10 s: (3!:2) 1!:1 <'symb.dat' | to restore global 符號s data |