comparison test/gsp2.ijs @ 0:e0bbaa717f41 draft default tip

lol J
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 25 Nov 2013 11:56:30 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e0bbaa717f41
1 NB. ^ -------------------------------------------------------------------
2
3 (scheck ^ $.x), (^ -: ^&.$.) x=: _10+? 405$2
4 (scheck ^ $.x), (^ -: ^&.$.) x=: _10+? 3 4 5$21
5 (scheck ^ $.x), (^ -: ^&.$.) x=: o._10+? 3 4 5$21
6 (scheck ^ $.x), (^ -: ^&.$.) x=:j./o._10+?2 3 4 5$21
7
8 1 -: 3 $. ^ $. 0 1 0
9 1 -: 3 $. ^ $. 2 3 4
10 1 -: 3 $. ^ $. 2 3.4
11 1 -: 3 $. ^ $. 2 3j4
12
13 f=: 4 : '(p^q) -: ((2;x)$.p) ^ (2;y)$.q'
14
15 p=: ?4 3 5 2$2
16 q=: ?4 3 5 2$2
17 c=: ; (i.1+r) <"1@comb&.>r=:#$p
18 f&>/~c
19
20 p=: ?4 3 5 2$4
21 q=: ?4 3 5 2$4
22 c=: ; (i.1+r) <"1@comb&.>r=:#$p
23 f&>/~c
24
25 p=: o.?3 5 2$4
26 q=: o.?3 5 2$4
27 c=: ; (i.1+r) <"1@comb&.>r=:#$p
28 f&>/~c
29
30 p=: j./?2 3 5 2$4
31 q=: j./?2 3 5 2$4
32 c=: ; (i.1+r) <"1@comb&.>r=:#$p
33 f&>/~c
34
35
36 NB. ^. ------------------------------------------------------------------
37
38 (scheck ^. $.x), (^. -: ^.&.$.) x=: _10+? 405$2
39 (scheck ^. $.x), (^. -: ^.&.$.) x=: _10+? 3 4 5$21
40 (scheck ^. $.x), (^. -: ^.&.$.) x=: o._10+? 3 4 5$21
41 (scheck ^. $.x), (^. -: ^.&.$.) x=:j./o._10+?2 3 4 5$21
42
43 __ -: 3 $. ^. $. 0 1 0
44 __ -: 3 $. ^. $. 2 3 4
45 __ -: 3 $. ^. $. 2 3.4
46 __ -: 3 $. ^. $. 2 3j4
47
48 f=: 4 : '(p^.q) -: ((2;x)$.p) ^. (2;y)$.q'
49
50 p=: ?3 5 2$2
51 q=: ?3 5 2$2
52 c=: ; (i.1+r) <"1@comb&.>r=:#$p
53 (<'NaN error') = f etx &.>/~c
54
55
56 NB. $ -------------------------------------------------------------------
57
58 d=: ?3 4 5 2$4
59 c=: ; (i.1+r) <"1@comb&.>r=:#$d
60
61 f=: 4 : 0
62 a=: 5,(-x){.$d
63 s=: a ($,)"(1,x) (2;y)$.d
64 *./ (scheck s), s-: a ($,)"(1,x) d
65 )
66
67 (i.>:r) f&>/ c
68
69 f=: 4 : 0
70 a=: 2
71 s=: a ($,)"(1,x) (2;y)$.d
72 *./ (scheck s), s-: a ($,)"(1,x) d
73 )
74
75 (i.>:r) f&>/ c
76
77 f=: 4 : 0
78 a=: 1+?>.1.5*(>.1.2*x){.($d),r$2
79 s=: (2;y)$.d
80 t=: a ($,)"(1,x) s
81 b=. t -: a ($,)"(1,x) d
82 if. 0=#$t do. b else. *./ (scheck t), b end.
83 )
84
85 (i.>:r) f&>/ c
86
87 f=: 4 : 0
88 b=. ('' ($,)"(1,x) d) -: t=. '' ($,)"(1,x) (2;y)$.d
89 if. 4096=type t do. b=. b*. scheck t end.
90 )
91
92 (i.>:r) f&>/ c [ d=: (?3 4 5$2) * ?3 4 5 2$4
93 (i.>:r) f&>/ c [ d=: 0*d
94
95 'length error' -: '' ($,) etx $. i.2 3 0
96
97
98 NB. | -------------------------------------------------------------------
99
100 (scheck | $.x), (| -: |&.$.) x=: _10+? 405$2
101 (scheck | $.x), (| -: |&.$.) x=: _10+? 3 4 5$21
102 (scheck | $.x), (| -: |&.$.) x=: o._10+? 3 4 5$21
103 (scheck | $.x), (| -: |&.$.) x=:j./o._10+?2 3 4 5$21
104
105 (scheck | $.x), (| -: |&.$.) x=: (_10+?60$21),<.-2^31
106
107 0 -: 3 $. | $. 0 1 0
108 0 -: 3 $. | $. 2 3 4
109 0 -: 3 $. | $. 2 3.4
110 0 -: 3 $. | $. 2 3j4
111
112 f=: 4 : '(p|q) -: ((2;x)$.p) | (2;y)$.q'
113
114 p=: ?6 5 2$2
115 q=: ?6 5 2$2
116 c=: ; (i.1+r) <"1@comb&.>r=:#$p
117 f&>/~c
118
119 p=: ?6 5 2$4
120 q=: ?6 5 2$4
121 c=: ; (i.1+r) <"1@comb&.>r=:#$p
122 f&>/~c
123
124 p=: o.?3 5 2$4
125 q=: o.?3 5 2$4
126 c=: ; (i.1+r) <"1@comb&.>r=:#$p
127 f&>/~c
128
129 p=: j./?2 3 5 2$4
130 q=: j./?2 3 5 2$4
131 c=: ; (i.1+r) <"1@comb&.>r=:#$p
132 f&>/~c
133
134
135 NB. |: ------------------------------------------------------------------
136
137 x=: ?7 6 5 4 3 2$3
138
139 f=: 3 : 0 " 0
140 r=: #$x
141 c=: (1+?r)?r
142 p=: ?~r
143 (p|:x) -: p|:(2;c)$.x
144 )
145
146 f"0 i.4 10
147
148
149 4!:55 ;:'a c d f g i p q r s t x y'
150
151