[REBOL] Re: En Masse block operations
From: greggirwin:mindspring at: 16-Oct-2001 11:18
Hi Tim,
I think map will do what you want.
; Larry Palmiter's version but Ladislav and Andrew also have them
map: func [fn blk args /local result][
result: copy []
repeat el blk [append/only result fn :el args]
return result
]
>> test: [[1 2 3 4] [5 6 7 8] [9 10 11 12] [13 14 15 16 17] "one"]
== [[1 2 3 4] [5 6 7 8] [9 10 11 12] [13 14 15 16 17] "one"]
>> map :next test none
== [[2 3 4] [6 7 8] [10 11 12] [14 15 16 17] "ne"]
>> map :head test none
== [[1 2 3 4] [5 6 7 8] [9 10 11 12] [13 14 15 16 17] "one"]
--Gregg