[Haskell-cafe] Re: Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Daniel Fischer
Am Donnerstag, 8. Dezember 2005 19:17 schrieb Branimir Maksimovic: From: Henning Thielemann [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mode Date: Thu, 8 Dec

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

2005-12-10 Thread Tomasz Zielonka
On Thu, Dec 08, 2005 at 06:38:45PM +0100, Henning Thielemann wrote: On Thu, 8 Dec 2005, Branimir Maksimovic wrote: program performs search replace on a String http://www.haskell.org/pipermail/haskell-cafe/2005-April/009692.html Neat! However, it breaks the following nice (but perhaps

[Haskell-cafe] HXT : need to retrieve a part of a document by a XPath expression

2005-12-10 Thread Simon Odou
Hi everyone, I am using the HXT (Haskell XML Toolbox) library to parse XML documents. And I would like to be able to retrieve a part of a document by a XPath expression. I saw the getXPath function which nearly does the work but not exactly: if you have the xpath //grandfather/father/son,

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

2005-12-10 Thread Tomasz Zielonka
On Sat, Dec 10, 2005 at 03:24:56PM +0100, Tomasz Zielonka wrote: *SearchRepl replace ab ba ab ba 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

Re: [Haskell-cafe] Re: Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Lemmih
On 12/10/05, Daniel Fischer [EMAIL PROTECTED] wrote: Am Donnerstag, 8. Dezember 2005 19:17 schrieb Branimir Maksimovic: From: Henning Thielemann [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in

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

2005-12-10 Thread Tomasz Zielonka
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 ab ba It also shows that your implementation is not lazy, so it couldn't be used for infinite lists. In some

[Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Christophe Plasschaert
First, i'd like to say good day to everybody. I didn't find enough information to anwser this question: Being interesting in learning another way of programming besides C and perl i started watching other languages. These are my candidates: - ada; - erlang; - clisp or scheme; and of course -

[Haskell-cafe] Re: Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Branimir Maksimovic
From: Daniel Fischer [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: Haskell-Cafe@haskell.org Subject: Re: Differences in optimisiation with interactive and compiled mo Date: Sat, 10 Dec 2005 15:11:31 +0100 Am Donnerstag, 8. Dezember 2005 19:17 schrieb Branimir Maksimovic:

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Branimir Maksimovic
From: Tomasz Zielonka [EMAIL PROTECTED] To: Henning Thielemann [EMAIL PROTECTED] CC: Branimir Maksimovic [EMAIL PROTECTED], 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

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Tomasz Zielonka
On Sat, Dec 10, 2005 at 04:14:20PM +, Branimir Maksimovic wrote: Nice code. But incorrect. I have broken it when refactoring :-/ Here is the correct version: replace2 src dst = repl where repl input | src `isPrefixOf` input = dst ++ repl (drop (length src) input) repl (x:xs) = x

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Branimir Maksimovic
From: Tomasz Zielonka [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: [EMAIL PROTECTED], haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo Date: Sat, 10 Dec 2005 18:14:58 +0100 On Sat, Dec 10, 2005 at

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Sebastian Sylvan
On 12/10/05, Christophe Plasschaert [EMAIL PROTECTED] wrote: First, i'd like to say good day to everybody. Good Day. I didn't find enough information to anwser this question: Being interesting in learning another way of programming besides C and perl i started watching other languages.

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Lennart Augustsson
Have you tried using any of the standard string searching algorithms to speed up the search? Like BM or KMP? -- Lennart Branimir Maksimovic wrote: From: Tomasz Zielonka [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: [EMAIL PROTECTED], haskell-cafe@haskell.org

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Christophe Plasschaert
Hi and thanks for the answer, On Sat, Dec 10, 2005 at 06:44:22PM +0100, Sebastian Sylvan wrote: On 12/10/05, Christophe Plasschaert [EMAIL PROTECTED] wrote: [] - erlang; Isn't strongly typed, isn't pure, and isn't lazy. However, it IS functional so that makes it quite pleasant to

[Haskell-cafe] Re: [Newbie] Why or why not haskell ?

2005-12-10 Thread Peter Simons
Christophe Plasschaert writes: With erlang or haskell, can we play with or implement lower network fuction (routing daemon interacting with a kernel) [...] I can't speak for Erlang, but in Haskell you can. Through the Foreign Function Interface, you can access arbitrary 3rd-party libraries

[Haskell-cafe] Tail-call optimization

2005-12-10 Thread Joel Reymont
I always wandered, does ghc do tail-call optimization? Would it optimize the two variants of the function below or just the first one? --- Proper? writeLoop :: (Event a - IO ()) - Handle - (SSL, BIO, BIO) - IO () writeLoop post h ssl = do handle (\e - post $ NetworkError e) $

Re[2]: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Bulat Ziganshin
Hello Branimir, Saturday, December 10, 2005, 8:29:09 PM, you wrote: Can you check this version? and this: replace from to = repl where repl s | Just remainder - start_from from s = to ++ repl remainder repl (c:cs) = c : repl cs repl [] = [] start_from (x:xs) (y:ys) | x==y

Re: [Haskell-cafe] Re: Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Cale Gibbard
On 10/12/05, Daniel Fischer [EMAIL PROTECTED] wrote: Am Samstag, 10. Dezember 2005 15:34 schrieben Sie: On 12/10/05, Daniel Fischer [EMAIL PROTECTED] wrote: snip That's probably because Lemmih's is polymorphic. Didn't Henning Thielemann write it? -- Friendly, Lemmih I

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Daniel Fischer
Am Samstag, 10. Dezember 2005 18:29 schrieb Branimir Maksimovic: From: Tomasz Zielonka [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: [EMAIL PROTECTED], haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo Date:

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Bulat Ziganshin
Hello Christophe, Saturday, December 10, 2005, 7:03:57 PM, you wrote: CP - ada; CP - erlang; CP - clisp or scheme; CP and of course CP - haskell. CP Haskell seems very interesting indeed (monadic, STM, a good library). CP Maybe some of you know some or all of these languages and can explain CP

[Haskell-cafe] GHCi and threads, was Connecting to a running process (REPL)

2005-12-10 Thread Rohan Drape
On Tue Dec 6 15:01:45 EST 2005 Tomasz Zielonka wrote: Unfortunately it seems that forkIO'ed threads are freezed when GHCi is waiting for command-line input. I bet it would be possible to let the threads work in the background. I think the current behaviour is caused by using readline, which

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Marc A. Ziegert
hi Christophe. In terms of speed, is haskell good enough ? in some cases, optimized haskell may even be faster than C. (that depends on your C-programming skills. i.e. function-inlining will speed C up, too.) how possible? look at the mangler:

RE: Re[2]: [Haskell-cafe] Differences in optimisiation with interactive and comp

2005-12-10 Thread Branimir Maksimovic
From: Bulat Ziganshin [EMAIL PROTECTED] Reply-To: Bulat Ziganshin [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: [EMAIL PROTECTED], [EMAIL PROTECTED],haskell-cafe@haskell.org Subject: Re[2]: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo Date:

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-10 Thread Branimir Maksimovic
From: Daniel Fischer [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: Haskell-Cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo Date: Sat, 10 Dec 2005 23:56:28 +0100 Am Samstag, 10. Dezember 2005 18:29 schrieb Branimir

[Haskell-cafe] RE: Substring replacements (was: Differences in optimisiation ...)

2005-12-10 Thread Branimir Maksimovic
From: Daniel Fischer [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: Haskell-Cafe@haskell.org Subject: Substring replacements (was: Differences in optimisiation ...) Date: Sat, 10 Dec 2005 22:56:10 +0100 and if you try it on main2 :: IO () main2 = let src = replicate 1000

[Haskell-cafe] RE: Substring replacements (was: Differences in optimisiation ...)

2005-12-10 Thread Branimir Maksimovic
After seeing your test, I've implemented full KMP algorithm, which is blazingly fast with your test. It is slower in mine test due excessive temporaries I guess, but perhaps you can help me to make it better as I'm just Haskell newbie. You can see that by my code :0) Especially I'm clumsy

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Joel Reymont
Erlang can be compiled to machine code with the built-in HiPE compiler. You just have to explicitly make use of this facility. On Dec 10, 2005, at 11:25 PM, Bulat Ziganshin wrote: what you mean saying network programming? Erlang has amazing distributed processing features with fault tolerance

RE: [Haskell-cafe] RE: Substring replacements (was: Differences inoptimisiation

2005-12-10 Thread Branimir Maksimovic
I've found one remaining bug, and this is corrected version. Now it is fastest with your test (still 0.25 seconds), but undoubtly slowest with mine:0) But I crafted this test to be really rigorous to mine implementation. Lot of replaces, repated patterns and so. In real world situtaion it will