Mercurial > hg > jgplsrc
comparison test/gsp422.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. /: monad ------------------------------------------------------------ | |
2 | |
3 f=: 4 : 0 | |
4 assert. (/: x) -: /: y | |
5 assert. (/:"1 x) -: /:"1 y | |
6 assert. (/:"2 x) -: /:"2 y | |
7 for_i. i.#y do. assert. (/: i{x) -: /: i{y end. | |
8 1 | |
9 ) | |
10 | |
11 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$1 0 0) * ? 5 10 3$2 | |
12 x f y [ x=: (2;0)$.y | |
13 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$1 0 0) * _2 +? 5 10 3$5 | |
14 x f y [ x=: (2;0)$.y | |
15 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$1 0 0) * o. _2 +? 5 10 3$5 | |
16 x f y [ x=: (2;0)$.y | |
17 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$1 0 0) * j./ _2 +? 2 5 10 3$5 | |
18 x f y [ x=: (2;0)$.y | |
19 | |
20 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$0 0 1) * ? 5 10 3$2 | |
21 x f y [ x=: (2;0)$.y | |
22 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$0 0 1) * _2e5+? 5 10 3$5e5 | |
23 x f y [ x=: (2;0)$.y | |
24 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$0 0 1) * o. _2e5+? 5 10 3$5e5 | |
25 x f y [ x=: (2;0)$.y | |
26 x f y [ x=: $. y=: ((?10$2), 0, 1, 0 ,: 10$0 0 1) * j./ _2e5+? 2 5 10 3$5e5 | |
27 x f y [ x=: (2;0)$.y | |
28 | |
29 f=: 4 : '(/:"x xx) -: /:"x s=: (2;y)$.xx' | |
30 c=: ; (i.1+r) <"1@comb&.>r=:4 | |
31 | |
32 (1+i.r) f&>/ c [ xx=: ? 7 11 13 17$2 | |
33 (1+i.r) f&>/ c [ xx=: _2 +? 7 11 13 17$5 | |
34 (1+i.r) f&>/ c [ xx=: o. _2 +? 7 11 13 17$5 | |
35 (1+i.r) f&>/ c [ xx=: j./_2 +?2 7 11 13 17$5 | |
36 | |
37 (1+i.r) f&>/ c [ xx=: _2e5+? 7 11 13 17$2e5 | |
38 (1+i.r) f&>/ c [ xx=: o. _2e5+? 7 11 13 17$5e5 | |
39 (1+i.r) f&>/ c [ xx=: j./_2e5+?2 7 11 13 17$5e5 | |
40 | |
41 (1+i.r) f&>/ c [ xx=: 7 11 13 17$0 | |
42 | |
43 | |
44 NB. /: dyad ------------------------------------------------------------- | |
45 | |
46 f=: 4 : 0 | |
47 assert. (a/:y) -: a/:(2;x)$.y | |
48 1 | |
49 ) | |
50 | |
51 n=: 100 | |
52 y=: (?(n,2)$2) * ?(n,2 3)$1000 | |
53 c=: ; (i.1+r) <"1@comb&.>r=: #$y | |
54 | |
55 c f&> <y [ a=: ?(n,4)$1000 | |
56 c f&> <y [ a=: $.?(n,4)$1000 | |
57 | |
58 y=: (?(n,2)$2) * o.?(n,2 3)$1000 | |
59 c f&> <y [ a=: ?(n,4)$1000 | |
60 c f&> <y [ a=: $.?(n,4)$1000 | |
61 | |
62 y=: (?(n,2)$2) * ?(n,2 3)$2 | |
63 c f&> <y [ a=: ?(n,4)$1000 | |
64 c f&> <y [ a=: $.?(n,4)$1000 | |
65 | |
66 | |
67 4!:55 ;:'a c f n r s xx y' | |
68 |