summaryrefslogtreecommitdiff
path: root/tests/general/fncs.std
blob: 65658dd893aa22953478c7a1ddae0ed4e30ea412 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
 ----> &null
copy(1) ----> 1
copy("abc") ----> "abc"
copy('aabbcc') ----> 'abc'
copy(main) ----> procedure main
copy([1,2,3]) ----> list_2(3)
copy(table(0)) ----> table_2(0)
copy() ----> &null
copy(&input) ----> &input
w := copy(write) ----> function write
function write
w(image(w)) ----> "function write"
copy(array()) ----> record array_2(7)
copy := copy(copy) ----> function copy
x := copy(array) ----> record constructor array
x := x(1,2,3,4,5,6,7) ----> record array_3(7)
x[-4] ----> 4
v := copy(c) ----> &null
x := repl("123",4) ----> "123123123123"
t := table() ----> table_3(0)
every i := 1 to 100 do t[i] := i ----> none
x := sort(t) ----> list_3(100)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
every write((!x)[2]) ----> none
d
d
d
cd
cd
cd
cde
cde
cde
bcde
bcde
bcde
bcdef
bcdef
bcdef
abcdef
abcdef
abcdef
abcdef 
abcdef0
abcdef-
 abcdef 
0abcdef0
=abcdef-
 abcdef  
0abcdef00
=abcdef=-
  abcdef  
00abcdef00
=-abcdef=-
  abcdef   
00abcdef000
=-abcdef-=-
   abcdef   
000abcdef000
=-=abcdef-=-
   abcdef    
000abcdef0000
=-=abcdef=-=-
    abcdef    
0000abcdef0000
=-=-abcdef=-=-
    abcdef     
0000abcdef00000
=-=-abcdef-=-=-
     abcdef     
00000abcdef00000
=-=-=abcdef-=-=-
     abcdef      
00000abcdef000000
=-=-=abcdef=-=-=-
      abcdef      
000000abcdef000000
=-=-=-abcdef=-=-=-
      abcdef       
000000abcdef0000000
=-=-=-abcdef-=-=-=-
       abcdef       
0000000abcdef0000000
=-=-=-=abcdef-=-=-=-
every write(center("abcdef",1 to 20," " | "0" | "=-")) ----> none
a
a
a
ab
ab
ab
abc
abc
abc
abcd
abcd
abcd
abcde
abcde
abcde
abcdef
abcdef
abcdef
abcdef 
abcdef0
abcdef-
abcdef  
abcdef00
abcdef=-
abcdef   
abcdef000
abcdef-=-
abcdef    
abcdef0000
abcdef=-=-
abcdef     
abcdef00000
abcdef-=-=-
abcdef      
abcdef000000
abcdef=-=-=-
abcdef       
abcdef0000000
abcdef-=-=-=-
abcdef        
abcdef00000000
abcdef=-=-=-=-
abcdef         
abcdef000000000
abcdef-=-=-=-=-
abcdef          
abcdef0000000000
abcdef=-=-=-=-=-
abcdef           
abcdef00000000000
abcdef-=-=-=-=-=-
abcdef            
abcdef000000000000
abcdef=-=-=-=-=-=-
abcdef             
abcdef0000000000000
abcdef-=-=-=-=-=-=-
abcdef              
abcdef00000000000000
abcdef=-=-=-=-=-=-=-
every write(left("abcdef",1 to 20," " | "0" | "=-")) ----> none
f
f
f
ef
ef
ef
def
def
def
cdef
cdef
cdef
bcdef
bcdef
bcdef
abcdef
abcdef
abcdef
 abcdef
0abcdef
=abcdef
  abcdef
00abcdef
=-abcdef
   abcdef
000abcdef
=-=abcdef
    abcdef
0000abcdef
=-=-abcdef
     abcdef
00000abcdef
=-=-=abcdef
      abcdef
000000abcdef
=-=-=-abcdef
       abcdef
0000000abcdef
=-=-=-=abcdef
        abcdef
00000000abcdef
=-=-=-=-abcdef
         abcdef
000000000abcdef
=-=-=-=-=abcdef
          abcdef
0000000000abcdef
=-=-=-=-=-abcdef
           abcdef
00000000000abcdef
=-=-=-=-=-=abcdef
            abcdef
000000000000abcdef
=-=-=-=-=-=-abcdef
             abcdef
0000000000000abcdef
=-=-=-=-=-=-=abcdef
              abcdef
00000000000000abcdef
=-=-=-=-=-=-=-abcdef
every write(right("abcdef",1 to 20," " | "0" | "=-")) ----> none
center("",20,repl("x.",30)) ----> "x.x.x.x.x.x.x.x.x.x."
left("",20,repl("x.",30)) ----> "x.x.x.x.x.x.x.x.x.x."
right("",20,repl("x.",30)) ----> "x.x.x.x.x.x.x.x.x.x."
a
aa
aaa
aaaa
aaaaa
ab
abab
ababab
abababab
ababababab
ba
baba
bababa
babababa
bababababa
every write(repl("a" | "ab" | "ba",1 to 5)) ----> none
repl("",0) ----> ""
repl(&cset,0) ----> ""
trim(&lcase) ----> "abcdefghijklmnopqrstuvwxyz"
trim(&lcase,&lcase) ----> ""
image(2) ----> "2"
image('cab') ----> "'abc'"
image(&lcase) ----> "&lcase"
image('abcdefghijklmnopqrstuvwxyz') ----> "&lcase"
image(&input) ----> "&input"
image() ----> "&null"
image(&null) ----> "&null"
image([1,2,3]) ----> "list_104(3)"
image([]) ----> "list_105(0)"
image([,]) ----> "list_106(2)"
image(table()) ----> "table_4(0)"
image(table(3)) ----> "table_5(0)"
image(list(0)) ----> "list_107(0)"
image(set()) ----> "set_1(0)"
image(set([1,2,3,3,3,3,3,4])) ----> "set_2(4)"
image(repl) ----> "function repl"
image(main) ----> "procedure main"
image(repl(&lcase,10)) ----> "\"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\""
image(array) ----> "record constructor array"
image(a) ----> "&null"
image(array) ----> "record constructor array"
image(image) ----> "function image"
string(2) ----> "2"
string("2") ----> "2"
string(" 2") ----> " 2"
string("2 ") ----> "2 "
string("+2") ----> "+2"
string("-2") ----> "-2"
string("- 2") ----> "- 2"
string(" -    2 ") ----> " -    2 "
string("") ----> ""
string("--2") ----> "--2"
string(" ") ----> " "
string("-") ----> "-"
string("+") ----> "+"
string("22222222222222222222222222222222222222222222222222222222222") ----> "22222222222222222222222222222222222222222222222222222222222"
string("7r4") ----> "7r4"
string("4r7") ----> "4r7"
string("4r 7") ----> "4r 7"
string("7r 4") ----> "7r 4"
string("16rff") ----> "16rff"
string("36rcat") ----> "36rcat"
string("36Rcat") ----> "36Rcat"
string("36rCAT") ----> "36rCAT"
string("1r1") ----> "1r1"
string("2r0") ----> "2r0"
type(0) ----> "integer"
type("abc") ----> "string"
type('aba') ----> "cset"
type() ----> "null"
type(&null) ----> "null"
type([]) ----> "list"
type(table()) ----> "table"
type(main) ----> "procedure"
type(write) ----> "procedure"
type(array()) ----> "array"
type(array) ----> "procedure"
type(f) ----> "null"
cset(2) ----> '2'
cset("2") ----> '2'
cset(" 2") ----> ' 2'
cset("2 ") ----> ' 2'
cset("+2") ----> '+2'
cset("-2") ----> '-2'
cset("- 2") ----> ' -2'
cset(" -    2 ") ----> ' -2'
cset("") ----> ''
cset("--2") ----> '-2'
cset(" ") ----> ' '
cset("-") ----> '-'
cset("+") ----> '+'
cset("22222222222222222222222222222222222222222222222222222222222") ----> '2'
cset("7r4") ----> '47r'
cset("4r7") ----> '47r'
cset("4r 7") ----> ' 47r'
cset("7r 4") ----> ' 47r'
cset("16rff") ----> '16fr'
cset("36rcat") ----> '36acrt'
cset("36Rcat") ----> '36Ract'
cset("36rCAT") ----> '36ACTr'
cset("1r1") ----> '1r'
cset("2r0") ----> '02r'
1
2
3
4
5
6
7
8
9
10
every write(seq()) \ 10 ----> none
2
3
4
5
6
7
8
9
10
11
every write(seq(2)) \ 10 ----> none
-10
-9
-8
-7
-6
-5
-4
-3
-2
-1
every write(seq(-10)) \ 10 ----> none
1
4
7
10
13
16
19
22
25
28
every write(seq(,3)) \ 10 ----> none