[REBOL] Re: functional replace function?
From: carl::cybercraft::co::nz at: 2-Nov-2002 0:15
On 01-Nov-02, bryan wrote:
> I suppose this is possible but my Rebol is not good enough yet to
> see the solution, (I say suppose because I am also worried that my
> mode of thinking about the problem is colored by other languages)
> I want to have two blocks, one block contains values to replace in a
> string, the other block contains values that will be replaced
> These values should be accessed from a function which I run against
> the string. The string comes out the other end with values replaced.
> This seems to me to be the smarter(more functional) structure,
> unfortunately can't quite see my way to implementing it.
> The dumber structure, which I can see but don't want to do cause it
> seems dumber,
> Would be to iterate through the block of values to be replaced, with
> each iteration get the answering index number from the block of
> values that shall do the replacing and then run it against the
> replace/all string val1 val2
> block1: next block1
> any suggested readings, links?
It's late for me to attempt an example, but the reading I'd suggest
would be on parsing. See...
Not that iteration wouldn't work, but parsing may be faster.