
From: Tomasz Zielonka
To: Henning Thielemann CC: Branimir Maksimovic , haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mode Date: Sat, 10 Dec 2005 15:36:57 +0100 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 where repl input = dst ++ repl (drop (length src) input) repl (x:xs) = x : repl xs repl [] = []
which should be infinite list friendly.
Nice code. But it takes lot of ram (1GB is not enough )and can't execute my test. Other versions don't take that much ram. Actually just 2mb each but yours somehow didn't work well with optimiser. I don't know why. Greetings, Bane. _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/