[REBOL] Re: reduction
From: carl:cybercraft at: 6-Oct-2001 10:25
How about...
replacepl: func [str [string!] /local r][r: func [s][replace
str rejoin ["^-" s "^-"] "^":^""]r "12" r "F7" r "B8" r "AT"]
(And what's with the no indenting? :)
On 06-Oct-01, Ryan Cole wrote:
> And arguably slightly more reduction...
> replacepl: func [str [string!]] [foreach [a b] ["^-12^-" {":"}
> "^-F7^-" {":"} "^-B8^-" {":"} "^-AT^-" {":"}] [replace str a b]]
> --Ryan
> Ryan Cole wrote:
>> A tad shorter...
>> replacepl: func [str [string!]] [replace replace replace replace
>> str
>> "^-12^-" "^":^"" "^-F7^-" "^":^" "^-B8^-" "^":^"" "^-AT^-"
>> "^":^""]
>> --Ryan
>> Lim Hwee Kwang wrote:
>>> hi,
>>>
>>> i have a function like this:
>>>
>>> replacepl: func [str [string!]] [replace str "^-12^-" "^":^""
>> replace
>>> str "^-F7^-" "^":^"" replace str "^-B8^-" "^":^"" replace str
>> "^-AT^-"
>>> "^":^""]
>>>
>>> may i know how to reduce it?
>>>
>>> thanks.
>>>
>>> regards
>>> hk
--
Carl Read