help
[1/3] from: brett::codeconscious::com at: 24-Apr-2004 17:20
[2/3] from: carl:cybercraft at: 24-Apr-2004 19:39
How? :-)
[3/3] from: reblist:codeconscious at: 24-Apr-2004 18:18
> How? :-)
Numerous ways but not necessarily REBOL related :-)
Anyway, just to make this silly post have some REBOL relevance - here's a
little function to play with.
change-each: func[
"Change each value in a series using an editor function."
[throw]
editor [any-function! block!] {Function or function body with SERIES and
VALUE as parameters.}
series [series!]
/skip "Treat the series as records of fixed size."
size [integer!] "Size of each record."
][
if block? :editor [editor: func [series value] editor]
if not skip [size: 1]
forskip series size [change/only series editor series first series]
series
]
E.g
>> change-each [value * 3] b: [1 2 3 4]
== []
>> b
== [3 6 9 12]
Regards,
Brett.