root/trunk/orca/tests/working/remove-each.r

Revision 80, 1.4 kB (checked in by volker, 3 years ago)

nested remove-each works.

Line 
1rebol[
2]
3print m:"remove-each, block, head:"
4res: remove-each val probe blk: [1 2 3 4 5][
5 prin[m "testing" mold val "->" mold blk]
6 probe 4 = val
7]
8print [m "result" mold head res]
9
10print m:"remove-each, block, non-head:"
11res: remove-each val next next probe blk: [1 2 3 4 5][
12 prin[m "testing" mold val "->" mold blk]
13 probe 4 = val
14]
15print [m "result" mold head res]
16
17print m:"remove-each, string, head:"
18res: remove-each val probe blk: "12345"[
19 prin[m "testing" mold val "->" mold blk]
20 probe #"4" = val
21]
22print [m "result" mold head res]
23
24print m:"remove-each, string, non-head:"
25res: remove-each val next next probe blk: "12345"[
26 prin[m "testing" mold val "->" mold blk]
27 probe #"4" = val
28]
29print [m "result" mold head res]
30
31print "nested remove block, practical use?"
32blk: [1 2 3 4 5 6]
33remove-each val blk[
34 print "-"
35 remove-each val2 blk[
36  print["inner" 2 '= val 3 '= val2 mold blk]
37  val2 = 3
38 ]
39 val = 2
40]
41print ["res=" mold blk]
42
43print "nested remove string, practical use?"
44blk: "123456"
45remove-each val blk[
46 print "-"
47 remove-each val2 blk[
48  print["inner" #"2" '= val #"3" '= val2 mold blk]
49  val2 = #"3"
50 ]
51 val = #"2"
52]
53print ["res=" mold blk]
54
55print "^/nested remove string, practical use?"
56blk: "123456"
57remove-each val blk[
58 print "-"
59 remove-each val2 blk[
60  print["inner" #"2" '= val #"3" '= val2 mold blk]
61  val2 = #"3"
62 ]
63 val = #"2"
64]
65print ["res=" mold blk]
66
Note: See TracBrowser for help on using the browser.