| 1 | rebol[ |
|---|
| 2 | ] |
|---|
| 3 | print m:"remove-each, block, head:" |
|---|
| 4 | res: remove-each val probe blk: [1 2 3 4 5][ |
|---|
| 5 | prin[m "testing" mold val "->" mold blk] |
|---|
| 6 | probe 4 = val |
|---|
| 7 | ] |
|---|
| 8 | print [m "result" mold head res] |
|---|
| 9 | |
|---|
| 10 | print m:"remove-each, block, non-head:" |
|---|
| 11 | res: 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 | ] |
|---|
| 15 | print [m "result" mold head res] |
|---|
| 16 | |
|---|
| 17 | print m:"remove-each, string, head:" |
|---|
| 18 | res: remove-each val probe blk: "12345"[ |
|---|
| 19 | prin[m "testing" mold val "->" mold blk] |
|---|
| 20 | probe #"4" = val |
|---|
| 21 | ] |
|---|
| 22 | print [m "result" mold head res] |
|---|
| 23 | |
|---|
| 24 | print m:"remove-each, string, non-head:" |
|---|
| 25 | res: remove-each val next next probe blk: "12345"[ |
|---|
| 26 | prin[m "testing" mold val "->" mold blk] |
|---|
| 27 | probe #"4" = val |
|---|
| 28 | ] |
|---|
| 29 | print [m "result" mold head res] |
|---|
| 30 | |
|---|
| 31 | print "nested remove block, practical use?" |
|---|
| 32 | blk: [1 2 3 4 5 6] |
|---|
| 33 | remove-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 | ] |
|---|
| 41 | print ["res=" mold blk] |
|---|
| 42 | |
|---|
| 43 | print "nested remove string, practical use?" |
|---|
| 44 | blk: "123456" |
|---|
| 45 | remove-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 | ] |
|---|
| 53 | print ["res=" mold blk] |
|---|
| 54 | |
|---|
| 55 | print "^/nested remove string, practical use?" |
|---|
| 56 | blk: "123456" |
|---|
| 57 | remove-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 | ] |
|---|
| 65 | print ["res=" mold blk] |
|---|
| 66 | |
|---|