[REBOL] Re: newlines
From: lmecir:mbox:vol:cz at: 8-Nov-2001 15:26
Ladislav Mecir wrote:
> Hi Joel,
>
> I will try to add my 0,02 CZK.
>
~LOL! Pardon my ignorance, but can you expand the acronym?
CZK = is an international (AFAIK) shortcut for Czech Crown (Ceska Koruna,
alias Kc)
> a) there is another disadvantage to the COPY algorithm you
> didn't mention. It is not an in-place algorithm and that
> is why it needs more memory.
>
Thanks for pointing that out. I usually work on big-memory
boxen and don't think of that often enough.
Yet another classic time-vs-space tradeoff!
Actually, there is an easy way how to change it to an in-place algorithm. A
Finite State Machine might be ideally suited for that.
> b) Some algorithms are complicated, that is why a different
> approach (not using REPLACE) should be considered too:
>
> while [s: find s #"."] [
> parse next s [any #"." t:]
> s: either (index? s) + 2 < (index? t) [
> remove/part skip s 2 t
> ] [t]
> ]
>
Thanks! I'll add this to the benchmark, along with Brett's
latest versions, and report results when done.
-jn-
--
We say "gestalt" when things combine to act in ways we can't
explain.
-- Marvin Minsky
joel/dot/neely/at/fedex/FIX/PUNCTUATION/dot/com