view test/gsp120.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
line wrap: on
line source

NB. - monad -------------------------------------------------------------

f=: 3 : '(scheck q) *. (-xx) -: q=. -s=:         (2;y)$.xx'

f&> c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:         ?    405$2
f&> c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:     _10+?  3 4 5$21
f&> c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:   o._10+?  3 4 5$21
f&> c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:j./o._10+?2 3 4 5$21
f&> c=: ; (i.1+r) <"1@comb&.>r=:#$xx=: (_10+?60$21),<.-2^31

g=: 4 : '(scheck q) *. (-$.^:_1 s) -: q=. -s=: (3;x)$.(2;y)$.xx'

1      g&>/ c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:       ?    405$2
_5 6 7 g&>/ c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:    _10+?  3 4 5$21
_5 6.7 g&>/ c=: ; (i.1+r) <"1@comb&.>r=:#$xx=:  o._10+?  3 4 5$21
_5 6j7 g&>/ c=: ; (i.1+r) <"1@comb&.>r=:#$xx=: j./_10+?2 3 4 5$21


0 -: 3 $. - $. 0 1 0
0 -: 3 $. - $. 2 3 4
0 -: 3 $. - $. 2 3.4
0 -: 3 $. - $. 2 3j4

NB. - dyad --------------------------------------------------------------

f=: 4 : '(scheck t) *. (p-q) -: t=: ((2;x)$.p) - (2;y)$.q'
g=: 4 : '(scheck t) *. (p-x) -: t=: ((2;y)$.p) - x'
h=: 4 : '(scheck t) *. (x-p) -: t=: x - ((2;y)$.p)'

p=: (?7 5$2) * ?7 5 3$2
q=: (?7 5$2) * ?7 5 3$2
c=: ; (i.1+r) <"1@comb&.>r=:#$p
f&>/~c
(1;2;_2.3;2j3) g&>/c
(1;2;_2.3;2j3) h&>/c

p=: (?4 2 5$2) * ?4 2 5 3$4
q=: (?4 2 5$2) * ?4 2 5 3$4
a=: ?2e6
c=: ; (i.1+r) <"1@comb&.>r=:#$p
f&>/~c
(1;2;_2.3;2j3) g&>/c
(1;2;_2.3;2j3) h&>/c

p=: (?4 2 5$2) * o.?4 2 5 3$4
q=: (?4 2 5$2) * o.?4 2 5 3$4
c=: ; (i.1+r) <"1@comb&.>r=:#$p
f&>/~c
(1;2;_2.3;2j3) g&>/c
(1;2;_2.3;2j3) h&>/c

p=: (?7 5$2) * j./?2 7 5 3$4
q=: (?7 5$2) * j./?2 7 5 3$4
a=: j./?2e6 2e6
c=: ; (i.1+r) <"1@comb&.>r=:#$p
f&>/~c
(1;2;_2.3;2j3) g&>/c
(1;2;_2.3;2j3) h&>/c

f=: 4 : 0
 s=: (2;x)$.xx
 t=: (2;y)$.yy
 q=. s -"2 t
 (q-: xx-"2 yy) *. scheck q
)

c=: ; (i.1+r) <"1@comb&.>r=:4
d=: ; (i.1+r) <"1@comb&.>r=:3

xx=: (?5 4 2$2) * ?5 4 2 6$100
yy=: (?5   2$2) * ?5   2 6$100
c f&>/d

xx=: (?5 4 2$2) * ?5 4 2 6$100
yy=: ( 5   2$0) * ?5   2 6$100
c f&>/d

xx=: ( 5 4 2$0) * ?5 4 2 6$100
yy=: (?5   2$2) * ?5   2 6$100
c f&>/d

xx=: ( 5 4 2$0) * ?5 4 2 6$100
yy=: ( 5   2$0) * ?5   2 6$100
c f&>/d

xx=: (?5   2$2) * ?5   2 6$100
yy=: (?5 4 2$2) * ?5 4 2 6$100
d f&>/c

xx=: (?5   2$2) * ?5   2 6$100
yy=: ( 5 4 2$0) * ?5 4 2 6$100
d f&>/c

xx=: ( 5   2$0) * ?5   2 6$100
yy=: (?5 4 2$2) * ?5 4 2 6$100
d f&>/c

xx=: ( 5   2$0) * ?5   2 6$100
yy=: ( 5 4 2$0) * ?5 4 2 6$100
d f&>/c


4!:55 ;:'a c d f g h p q r s t xx yy'