-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathchars.txt
105 lines (95 loc) · 2.71 KB
/
chars.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
fns:
dyadic monadic
+ add; identity (no complex numbers)
- sub; negate / swap case
× mul; sign / case (i.e. ×'Hi ' → 1 ¯1 0) / ×|map
÷ div; 1÷⍵
* pow; e*⍵
⍟ log; e⍟⍵
√ root; 2√⍵
⌈ max; ceil / uppercase
⌊ min; floor / lowercase
| mod; abs / map size
∧ lcm; lcm (aka every; all 1)
∨ gcd; gcd (aka some; contains 1)
⍲ nand; not all / contains 0
⍱ nor; none / all 0
⊥ from; 2⊥⍵; aka decode, pack
⊤ to; 2⊤⍵; aka encode, unpack
○ trig; pi×⍵
! nCk; factorial
monadic dyadic
∊ in; enlist
⍷ NYI; find
⌷ map k&v; select cell
⍳ indexes; where
~ without; negate
⍸ where; NYI; where can contain >1; also ⍸⍣¯1 is useful
⍴ shape; reshape
, ravel; concat
⍮ ,⊂; {⍺⍵}
≢ tally; not equal
≡ depth; equal
⊢ ⍵; ⍵
⊣ ⍵; ⍺
↑ merge; take; merge as in merge dimensions
↓ split; drop; split off last dimension as arrays
? rand; deal
⍪ table; vertical concat
⊖ flip; vertical rotate
⌽ reverse; horizontal rotate
… NYI; range
⍕ format; NYI
⍎ eval; eval arrayified (`-⍎4)
⌿ NYI; replicate
⍀ NYI; expand
∪ unique; union
∩ NYI; intersection
⊂ enclose; split
⊃ first; get single item ('ab'≡1 1⊃2 2⍴⊂'ab')
⊇ NYI; multi-select (subject to ⎕VI)
% NYI; merge - 1 2 2 3%4↑¨⎕a⎕l⎕d → 'Abc3'
⍋ grade up; NYI
⍒ grade down; NYI
⍉ transpose; NYI
⍧ unique mask; count
< lt; sort asc
≤ le; NYI
= eq; NYI
≥ ge; NYI
> gt; sort desc
≠ ne; NYI (⍧ is unique mask)
monadic ops:
/ reduce
\ left scan
¨ for each
⍨ selfie; commute
⌾ table (aka ∘.⍺⍺)
⌸ key; also get/set map keys (e.g. 'x'(map⌸)5; map⌸'x')
ᐵ each-left (A fᐵ B ≡ A f¨ ⊂B)
ᑈ each-right (A fᑈ B ≡ (⊂A) f¨ B)
dyadic ops
∘ compose (←→ {⍶ ⍹ ⍵} or {⍺ ⍶ ⍹ ⍵})
⍛ left-compose (←→ {(⍶ ⍺) ⍹ ⍵})
. NYI (well, ←→ {⍶/ ⍺ ⍹ ⍵})
⍣ repeat
⍡ cumulative repeat
⍥ over (←→ {(⍹⍺) ⍶ ⍹⍵} )
⍤ atop (←→ {⍺⍺ ⍺ ⍵⍵ ⍵} )
⍢ under (←→ {⍺←{⍺⍺⋄⍵}⋄(⍹⍣¯1) (⍹⍺) ⍶ ⍹⍵}; also is structural under; ⍺⍺ can be an array)
⍫ obverse - define inverse: ⍶ - regular function, ⍹ - inverse
@ at; right op = indices or function giving boolean array, left op = replacement array or function
⍁ for each diagonal
nilads:
⍬ 0⍴0
⎕ console (println; exec input line)
⍞ console (print ; input as string)
⍺ left arg
⍵ right arg
⍶ left operand
⍹ right operand
∇ this function
dfns:
{A ⋄ B} → B (also executing A)
{C:A ⋄ B} → B (also executing A if C was true)
{C:←A ⋄ B} → A if C, else B