comparison test/g7x.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. 7!: -----------------------------------------------------------------
2
3 NB. Testing malloc/free; try f 200 or g 40000, etc.
4
5 sp =: 7!:0
6 space=:7!:2
7
8 pr =: [ NB. for silent iteration
9 NB. pr =: 1!:2&2 NB. to see each iteration
10
11 f =: 3 : 0
12 old=.sp ''
13 whilst. y=.<:y do.
14 pr y
15 end.
16 old,sp ''
17 )
18
19 g =: 3 : 0
20 old=.sp ''
21 whilst. y=.<:y do.
22 t=.(?20000)$a.
23 pr y
24 end.
25 old,sp ''
26 )
27
28 h =: 3 : 0
29 old=.sp ''
30 whilst. y=.<:y do.
31 n=.>:?50
32 a=. (n,n) ?@$ 5000
33 b=.%.a
34 d=.>./|,(=i.n)-a+/ . *b
35 pr y,n,d
36 end.
37 old,sp ''
38 )
39
40 x=:20
41 y=:20
42 s=: 2 3
43
44 x =: sp ''
45 s =: f 30+?200
46 y =: sp ''
47 x -: y
48
49 x =: sp ''
50 s =: g 30+?200
51 y =: sp ''
52 x -: y
53
54 x =: sp ''
55 s =: h 3+?7
56 y =: sp ''
57 x -: y
58
59 t =: sp ''
60 0 = $$t
61 t = <.t
62 0<:t
63
64 0<space 't=:i.100'
65 t-:i.100
66 (IF64{1064 2500)>|(n*IF64{4 8)-space 'i.n' [ n=:1000
67 (IF64{1064 2500)>|(n*IF64{4 8)-space 'i.n' [ n=:2000
68
69 'domain error' -: 7!:2 etx 0 1
70 'domain error' -: 7!:2 etx 3 4 _5
71 'domain error' -: 7!:2 etx 3j4
72 'domain error' -: 7!:2 etx 3;4 5
73
74
75 NB. 7!:3 ----------------------------------------------------------------
76
77 t=:7!:3 ''
78 t -: <.t
79 0 < t
80 2 -: #$t
81 2 -: {:$t
82 t -: /:~t
83 *./~:{."1 t
84
85
86 4!:55 ;:'f g h n old pr s sp space t x y '
87
88