[REBOL] Re: reduction
From: limhk:acm at: 7-Oct-2001 9:36
hi,
the one i use has a deep refinement:
===============CODE===============
REBOL [
Title: "Map Function"
Date: "24-November-1999"
Author: "Larry Palmiter"
Purpose: { Maps a function of one arg
onto a (nested) block of values.
}
]
map: func [
Maps a function onto elements of a block
:f "function (use parens for literal)"
b [block!] "block of values"
/deep "maps function into nested blocks"
/local out
][
out: make block! length? b
if paren? :f [f: f]
foreach el b [
either block? el [
either deep [
append/only out map/deep f el
][
append/only out el
]
][
append out f el
]
]
]
===========END OF CODE=============
works beautifully. many thanks to Larry Palmiter for a great function!
regards
hk
Gregg Irwin wrote: