Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r6993]: sandbox / jlf / samples / pipeline / pipe_extension_test.output.txt Maximize Restore History

Download this file

pipe_extension_test.output.txt    577 lines (523 with data), 15.4 kB

  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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
-- The coactivity yields two results.
-- The hello outputs are not in the pipeline flow (not displayed by the .displayer).
.coactivity~new("echo hello ; .yield[a] ; say hello ; .yield[b]")~pipe(.upper|.displayer)
HELLO
1 : A
HELLO
2 : B
-- A collection can be sorted by value (default)
.array~of(b, a, c)~pipe(.sort byValue | .displayer)
2 : A
1 : B
3 : C
-- ...or by index
.array~of(b, a, c)~pipe(.sort byIndex | .displayer)
1 : B
2 : A
3 : C
-- ...ascending (default)
-- The order of options is important : a value option is impacted only by the preceding options
-- This is because several value options can be specified, and a sort is made for each.
.array~of(b, a, c)~pipe(.sort ascending byValue | .displayer)
2 : A
1 : B
3 : C
-- ...descending
.array~of(b, a, c)~pipe(.sort descending byValue | .displayer)
3 : C
1 : B
2 : A
-- ...by index descending
-- The order of options is important : an index option is impacted only by the preceding options.
-- This is because several index options can be specified, and a sort is made for each.
.array~of(b, a, c)~pipe(.sort descending byIndex | .displayer)
3 : C
2 : A
1 : B
-- ...caseless (stable by default)
.array~of("bb", "AA", "bB", "Aa", "Bb", "aA", "BB", "aa")~pipe(.sort caseless byValue | .displayer)
2 : AA
4 : Aa
6 : aA
8 : aa
1 : bb
3 : bB
5 : Bb
7 : BB
-- ...caseless quickSort (unstable)
.array~of("bb", "AA", "bB", "Aa", "Bb", "aA", "BB", "aa")~pipe(.sort caseless quickSort byValue | .displayer)
2 : AA
4 : Aa
6 : aA
8 : aa
1 : bb
3 : bB
5 : Bb
7 : BB
-- Sort descending with a comparator.
-- The DescendingComparator use the default CompareTo, which is made on values.
.array~of(b, a, c)~pipe(.sortWith[.DescendingComparator~new] | .displayer)
3 : C
1 : B
2 : A
-- Sort by column with a comparator.
.array~of("c:2", "b:2", "A:2", "c:1", "a:1", "B:1", "C:3")~pipe(,
.sortWith[.InvertingComparator~new(.CaselessColumnComparator~new(3,1))] |,
.sortWith[.CaselessColumnComparator~new(1,1)] |,
.displayer,
)
3 : A:2
5 : a:1
2 : b:2
6 : B:1
7 : C:3
1 : c:2
4 : c:1
-- Do something for each item (no returned value).
.array~of(1, 2, 3)~pipe(.do["say 'value='value 'index='index"] | .displayer)
value=1 index=an Array
1 : 1
value=2 index=an Array
2 : 2
value=3 index=an Array
3 : 3
-- Do something for each item (the returned result replaces the value).
.array~of(1, 2, 3)~pipe(.do["return 2*value"] | .displayer)
1 : 2
2 : 4
3 : 6
-- Inject a value for each item. The index of the injected value is made of two indexes.
.array~of(1, 2, 3)~pipe(.inject["value+1"] | .displayer)
1 : 1
1.1 : 2
2 : 2
2.1 : 3
3 : 3
3.1 : 4
-- Inject two values for each item (each item of the returned collection is written in the pipe).
.array~of(1, 2, 3)~pipe(.inject[".array~of(value+1, value+2)"] | .displayer)
1 : 1
1.1 : 2
1.2 : 3
2 : 2
2.1 : 3
2.2 : 4
3 : 3
3.1 : 4
3.2 : 5
-- Each injected value can be used as input to inject a new value, recursively.
-- If the recursion is infinite, must specify a limit (here 10).
.array~of(1, 2, 3)~pipe(.inject["value+1"] recursive.10 | .displayer)
1 : 1
1.1 : 2
1.1.1 : 3
1.1.1.1 : 4
1.1.1.1.1 : 5
1.1.1.1.1.1 : 6
1.1.1.1.1.1.1 : 7
1.1.1.1.1.1.1.1 : 8
1.1.1.1.1.1.1.1.1 : 9
1.1.1.1.1.1.1.1.1.1 : 10
1.1.1.1.1.1.1.1.1.1.1 : 11
2 : 2
2.1 : 3
2.1.1 : 4
2.1.1.1 : 5
2.1.1.1.1 : 6
2.1.1.1.1.1 : 7
2.1.1.1.1.1.1 : 8
2.1.1.1.1.1.1.1 : 9
2.1.1.1.1.1.1.1.1 : 10
2.1.1.1.1.1.1.1.1.1 : 11
2.1.1.1.1.1.1.1.1.1.1 : 12
3 : 3
3.1 : 4
3.1.1 : 5
3.1.1.1 : 6
3.1.1.1.1 : 7
3.1.1.1.1.1 : 8
3.1.1.1.1.1.1 : 9
3.1.1.1.1.1.1.1 : 10
3.1.1.1.1.1.1.1.1 : 11
3.1.1.1.1.1.1.1.1.1 : 12
3.1.1.1.1.1.1.1.1.1.1 : 13
-- Factorial, no value injected for -1
.array~of(-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)~pipe(.inject[,
"use arg n;",
"if n < 0 then return;",
"if n == 0 then return 1;",
"return n * .context~executable~call(n - 1)"] | .displayer)
1 : -1
2 : 0
2.1 : 1
3 : 1
3.1 : 1
4 : 2
4.1 : 2
5 : 3
5.1 : 6
6 : 4
6.1 : 24
7 : 5
7.1 : 120
8 : 6
8.1 : 720
9 : 7
9.1 : 5040
10 : 8
10.1 : 40320
11 : 9
11.1 : 362880
-- Select files whose name contains "rexx" in c:\program files\oorexx
.file~new("c:\program files\oorexx")~listFiles~pipe(,
.select["value~name~caselessPos('rexx') <> 0"] |,
.displayer,
)
11 : c:\program files\oorexx\ooRexxTry.rex
12 : c:\program files\oorexx\orexxole.cls
13 : c:\program files\oorexx\orexxole.dll
14 : c:\program files\oorexx\rexx.dll
15 : c:\program files\oorexx\rexx.exe
16 : c:\program files\oorexx\rexx.ico
17 : c:\program files\oorexx\rexx.img
18 : c:\program files\oorexx\rexxapi.dll
19 : c:\program files\oorexx\rexxc.exe
20 : c:\program files\oorexx\rexxhide.exe
21 : c:\program files\oorexx\rexxpaws.exe
22 : c:\program files\oorexx\rexxtry.rex
23 : c:\program files\oorexx\rexxutil.dll
-- Select files whose name contains "rexx" in c:\program files\oorexx, sorted by file size.
-- The "length" message is sent to the value.
.file~new("c:\program files\oorexx")~listFiles~pipe(,
.select["value~name~caselessPos('rexx') <> 0"] |,
.sortWith[.MessageComparator~new("length/N")] |,
.displayer,
)
16 : c:\program files\oorexx\rexx.ico
12 : c:\program files\oorexx\orexxole.cls
22 : c:\program files\oorexx\rexxtry.rex
11 : c:\program files\oorexx\ooRexxTry.rex
20 : c:\program files\oorexx\rexxhide.exe
19 : c:\program files\oorexx\rexxc.exe
15 : c:\program files\oorexx\rexx.exe
21 : c:\program files\oorexx\rexxpaws.exe
13 : c:\program files\oorexx\orexxole.dll
18 : c:\program files\oorexx\rexxapi.dll
23 : c:\program files\oorexx\rexxutil.dll
17 : c:\program files\oorexx\rexx.img
14 : c:\program files\oorexx\rexx.dll
-- Same as above, but simpler... You can sort directly by length, no need of MessageComparator
.file~new("c:\program files\oorexx")~listFiles~pipe(,
.select["value~name~caselessPos('rexx') <> 0"] |,
.sort "value~length" |,
.displayer,
)
16 : c:\program files\oorexx\rexx.ico
12 : c:\program files\oorexx\orexxole.cls
22 : c:\program files\oorexx\rexxtry.rex
11 : c:\program files\oorexx\ooRexxTry.rex
20 : c:\program files\oorexx\rexxhide.exe
19 : c:\program files\oorexx\rexxc.exe
15 : c:\program files\oorexx\rexx.exe
21 : c:\program files\oorexx\rexxpaws.exe
13 : c:\program files\oorexx\orexxole.dll
18 : c:\program files\oorexx\rexxapi.dll
23 : c:\program files\oorexx\rexxutil.dll
17 : c:\program files\oorexx\rexx.img
14 : c:\program files\oorexx\rexx.dll
-- Sort by file size, then by file extension (with only one .sort pipestage)
.file~new("c:\program files\oorexx")~listFiles~pipe(,
.select["value~name~caselessPos('rexx') <> 0"] |,
.sort "value~length" "filespec('e', value~name)" |,
.displayer,
)
12 : c:\program files\oorexx\orexxole.cls
13 : c:\program files\oorexx\orexxole.dll
18 : c:\program files\oorexx\rexxapi.dll
23 : c:\program files\oorexx\rexxutil.dll
14 : c:\program files\oorexx\rexx.dll
20 : c:\program files\oorexx\rexxhide.exe
19 : c:\program files\oorexx\rexxc.exe
15 : c:\program files\oorexx\rexx.exe
21 : c:\program files\oorexx\rexxpaws.exe
16 : c:\program files\oorexx\rexx.ico
17 : c:\program files\oorexx\rexx.img
22 : c:\program files\oorexx\rexxtry.rex
11 : c:\program files\oorexx\ooRexxTry.rex
-- All instance methods of the context.
-- Notice that the default sort by value is useless here... Must sort by index.
.context~instanceMethods~pipe(.sort byIndex | .displayer)
: a Method
: a Method
<> : a Method
= : a Method
== : a Method
>< : a Method
ARGS : a Method
CLASS : a Method
CONDITION : a Method
COPY : a Method
COPY : a Method
DEFAULTNAME : a Method
DIGITS : a Method
DUMP2 : a Method
EXECUTABLE : a Method
FORM : a Method
FUZZ : a Method
HASHCODE : a Method
HASMETHOD : a Method
IDENTITYHASH : a Method
INIT : a Method
INSTANCEMETHOD : a Method
INSTANCEMETHODS : a Method
ISA : a Method
ISINSTANCEOF : a Method
LINE : a Method
OBJECTNAME : a Method
OBJECTNAME= : a Method
PACKAGE : a Method
PIPE : a Method
PP2 : a Method
PPINDEX2 : a Method
REQUEST : a Method
RS : a Method
RUN : a Method
SEND : a Method
SENDWITH : a Method
SETMETHOD : a Method
START : a Method
STARTWITH : a Method
STRING : a Method
UNSETMETHOD : a Method
VARIABLES : a Method
\= : a Method
\== : a Method
|| : a Method
-- All private methods of the context.
.context~instanceMethods~pipe(,
.select["value~isPrivate"] |,
.sort byIndex |,
.displayer,
)
RUN : a Method
SETMETHOD : a Method
UNSETMETHOD : a Method
-- Instance methods of the specified classes (not including those inherited).
-- Each class is written in the pipeline, followed by the returned methods.
.array~of(.RexxContext, .Package, .Method)~pipe(,
.inject["value~instanceMethods(value~class)"] |,
.sort byIndex |,
.displayer,
)
1 : The RexxContext class
1.<> : a Method
1.= : a Method
1.== : a Method
1.>< : a Method
1.BASECLASS : a Method
1.DEFAULTNAME : a Method
1.DEFINE : a Method
1.DELETE : a Method
1.ENHANCED : a Method
1.HASHCODE : a Method
1.ID : a Method
1.INHERIT : a Method
1.ISSUBCLASSOF : a Method
1.METACLASS : a Method
1.METHOD : a Method
1.METHODS : a Method
1.MIXINCLASS : a Method
1.QUERYMIXINCLASS : a Method
1.SUBCLASS : a Method
1.SUBCLASSES : a Method
1.SUPERCLASS : a Method
1.SUPERCLASSES : a Method
1.UNINHERIT : a Method
1.\= : a Method
1.\== : a Method
2 : The Package class
2.<> : a Method
2.= : a Method
2.== : a Method
2.>< : a Method
2.BASECLASS : a Method
2.DEFAULTNAME : a Method
2.DEFINE : a Method
2.DELETE : a Method
2.ENHANCED : a Method
2.HASHCODE : a Method
2.ID : a Method
2.INHERIT : a Method
2.ISSUBCLASSOF : a Method
2.METACLASS : a Method
2.METHOD : a Method
2.METHODS : a Method
2.MIXINCLASS : a Method
2.QUERYMIXINCLASS : a Method
2.SUBCLASS : a Method
2.SUBCLASSES : a Method
2.SUPERCLASS : a Method
2.SUPERCLASSES : a Method
2.UNINHERIT : a Method
2.\= : a Method
2.\== : a Method
3 : The Method class
3.!DEFINE_CLASS_METHOD : a Method
3.!DEFINE_METHODS : a Method
3.!REXXDEFINED : a Method
3.<> : a Method
3.= : a Method
3.== : a Method
3.>< : a Method
3.BASECLASS : a Method
3.DEFAULTNAME : a Method
3.DEFINE : a Method
3.DELETE : a Method
3.ENHANCED : a Method
3.HASHCODE : a Method
3.ID : a Method
3.INHERIT : a Method
3.ISSUBCLASSOF : a Method
3.METACLASS : a Method
3.METHOD : a Method
3.METHODS : a Method
3.MIXINCLASS : a Method
3.QUERYMIXINCLASS : a Method
3.SUBCLASS : a Method
3.SUBCLASSES : a Method
3.SUPERCLASS : a Method
3.SUPERCLASSES : a Method
3.UNINHERIT : a Method
3.\= : a Method
3.\== : a Method
-- Methods (not inherited) of all the classes whose id starts with "R".
.environment~pipe(,
.select["value~isA(.class)"] |,
.select["value~id~caselessAbbrev('R') <> 0"] |,
.inject["value~methods(value)"] |,
.sort byIndex |,
.displayer,
)
RELATION : The Relation class
RELATION.ALLAT : a Method
RELATION.ALLINDEX : a Method
RELATION.ALLINDEXES : a Method
RELATION.ALLITEMS : a Method
RELATION.AT : a Method
RELATION.DIFFERENCE : a Method
RELATION.EMPTY : a Method
RELATION.HASINDEX : a Method
RELATION.HASITEM : a Method
RELATION.INDEX : a Method
RELATION.INTERSECTION : a Method
RELATION.ISEMPTY : a Method
RELATION.ITEMS : a Method
RELATION.MAKEARRAY : a Method
RELATION.PUT : a Method
RELATION.READOBJECT : a Method
RELATION.REMOVE : a Method
RELATION.REMOVEALL : a Method
RELATION.REMOVEITEM : a Method
RELATION.SUBSET : a Method
RELATION.SUPPLIER : a Method
RELATION.UNION : a Method
RELATION.WRITEOBJECT : a Method
RELATION.XOR : a Method
RELATION.[] : a Method
RELATION.[]= : a Method
REXXCONTEXT : The RexxContext class
REXXCONTEXT.ARGS : a Method
REXXCONTEXT.CONDITION : a Method
REXXCONTEXT.COPY : a Method
REXXCONTEXT.DIGITS : a Method
REXXCONTEXT.EXECUTABLE : a Method
REXXCONTEXT.FORM : a Method
REXXCONTEXT.FUZZ : a Method
REXXCONTEXT.LINE : a Method
REXXCONTEXT.PACKAGE : a Method
REXXCONTEXT.RS : a Method
REXXCONTEXT.VARIABLES : a Method
REXXQUEUE : The RexxQueue class
REXXQUEUE.DELETE : a Method
REXXQUEUE.EMPTY : a Method
REXXQUEUE.GET : a Method
REXXQUEUE.INIT : a Method
REXXQUEUE.LINEIN : a Method
REXXQUEUE.LINEOUT : a Method
REXXQUEUE.MAKEARRAY : a Method
REXXQUEUE.PULL : a Method
REXXQUEUE.PUSH : a Method
REXXQUEUE.QUEUE : a Method
REXXQUEUE.QUEUED : a Method
REXXQUEUE.SAY : a Method
REXXQUEUE.SET : a Method
ROUTINE : The Routine class
ROUTINE.CALL : a Method
ROUTINE.CALLWITH : a Method
ROUTINE.PACKAGE : a Method
ROUTINE.SETSECURITYMANAGER : a Method
ROUTINE.SOURCE : a Method
-- All packages that are visible from current context, including the current package (source of the pipeline).
-- The .displayer is not useful here (will be extended to let choose the values to display)...
.context~package~pipe(,
.inject["value~importedPackages"] recursive |,
.sort |,
.displayer,
)
1 : a Package
1.1 : a Package
1.1.1 : a Package
1.1.1.1 : a Package
1.1.2 : a Package
1.1.2.1 : a Package
1.1.2.1.1 : a Package
1.2 : a Package
1.2.1 : a Package
1.3 : a Package
1.3.1 : a Package
1.3.2 : a Package
1.3.2.1 : a Package
1.3.2.1.1 : a Package
1.3.2.2 : a Package
1.3.2.2.1 : a Package
1.3.2.3 : a Package
1.3.3 : a Package
1.3.3.1 : a Package
1.3.4 : a Package
1.3.4.1 : a Package
1.4 : a Package
1.4.1 : a Package
-- ...In the meantime, use the .do pipeStage to display the useful values.
-- The package names are indented to highlight the dependency between packages.
-- The index is always an array.
-- Notice the circular dependency between packages (supported by inject - the recursion is stopped) :
-- extensions.cls --> doers.cls --> extensions.cls
-- This is because of Doers.AddVisibilityFrom
.context~package~pipe(,
.inject["value~importedPackages"] recursive |,
.sort |,
.do["say ' '~copies(index~items) value~name"],
)
D:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\pipeline\pipe_extension_test.rex
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\extensions.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\doers.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\extensions.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\functionals.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\doers.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\extensions.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\concurrency\coactivity.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\concurrency\activity.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\pipeline\pipe_extension.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\pipeline\pipe.rex
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\doers.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\extensions.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\extension\doers.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\concurrency\coactivity.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\concurrency\activity.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\pipeline\pipe_extension.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\concurrency\coactivity.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\concurrency\activity.cls
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\rgf_util2\rgf_util2_wrappers.rex
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\rgf_util2\rgf_util2.rex
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\rgf_util2\rgf_util2_wrappers.rex
d:\local\Rexx\ooRexx\svn\sandbox\jlf\samples\rgf_util2\rgf_util2.rex