-
Notifications
You must be signed in to change notification settings - Fork 1
/
j.txt
65 lines (41 loc) · 1.28 KB
/
j.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
J: atom, list, table
math: scalar, vector, matrix
Ranks #$
i.2 3 4
0 1 2 3
4 5 6 7
8 9 10 11 NB. 2 planes
NB. 3 rows
12 13 14 15 NB. 4 columns
16 17 18 19
20 21 22 23
"0 is the same as "+ since + 0 0 0
Compositions
@: at
[: f g capped fork, useful in building long trains
(f @: g) y = f (g y) monad and monad
x (f @: g) y = f (x g y) monad and dyad
&: appose
(f &: g) y = f (g y) monad and monad
x (f &: g) y = (g x) f (g y) dyad and monad
@ atop
& compose
are used for tracking: applications of f track the applications of g
&. under
(f &. g) y = g inv f g y NB. inv is ^:_1
Trains
(f g) y = y f (g y) monadic hook
x (f g) y = x f (g y) dyadic hook
(f g h) y = (f y) g (h y) monadic fork
x (f g h) y = (x f y) g (x h y) dyadic fork
4-train (e f g h) => hook: (e (f g h)) NB. (verb fork)
5-train (d e f g h) => fork: (d e (f g h)) NB. (verb verb fork)
_9: to 9: - constant functions are useful because they can occur in trains
Operators: adverbs and conjunctions
Verbs
1 2 <- fret (negate to not include the fret)
<;._2 '-aa-bb-cc 11-22-33 '
cut, using the fret as a separator, then box the results
Puzzles
f(y) if y > 1, else y
f ^: (>&1) <=> ] ` f @. (>&1)