[Haskell-cafe] Differences in optimisiation with interactive and compiled mode

Tomasz Zielonka tomasz.zielonka at gmail.com
Sat Dec 10 09:36:57 EST 2005

On Sat, Dec 10, 2005 at 03:29:49PM +0100, Tomasz Zielonka wrote:
> On Sat, Dec 10, 2005 at 03:24:56PM +0100, Tomasz Zielonka wrote:
> >     *SearchRepl> replace "ab" "ba" "aaaaaaaaab"
> >     "baaaaaaaaa"
> It also shows that your implementation is not lazy, so it couldn't be
> used for infinite lists. In some situations, even for short patterns, it
> just has to check the whole input list to produce the first element of
> output list.

Here is my implementation

    replace src dst = repl
        repl input = dst ++ repl (drop (length src) input)
        repl (x:xs) = x : repl xs
        repl [] = []

which should be infinite list friendly.

Best regards

I am searching for a programmer who is good at least in some of
[Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland

More information about the Haskell-Cafe mailing list