Re: [Haskell-cafe] Question on leazy evaluation

2005-03-26 Thread Tomasz Zielonka
On Fri, Mar 25, 2005 at 03:13:48PM +0100, Pierre Barbier de Reuille wrote: For some reason, this function does not use leazy evaluation ! Do you mean lazy or sleazy? Sleazy evaluation - that would be interesting ;-) Best regards Tomasz ___

Re: [Haskell-cafe] Question on leazy evaluation

2005-03-25 Thread Pierre Barbier de Reuille
Still on the same subject, I solved one problem but don't really understand why it didn't work in the first place ! Although it seems to be a difference between newtype and data ! I have a newtype defined as : data Fct s a = Fct (s - [a]) and a function defined by : plus :: Fct a b - Fct a b -

Re: [Haskell-cafe] Question on leazy evaluation

2005-03-25 Thread Tomasz Zielonka
On Fri, Mar 25, 2005 at 03:13:48PM +0100, Pierre Barbier de Reuille wrote: plus :: Fct a b - Fct a b - Fct a b plus (Fct f1) (Fct f2) = Fct ( \ a - (f1 a) ++ (f2 a) ) For some reason, this function does not use leazy evaluation ! I can test it using : test_fct :: Fct Int Int test_fct =

[Haskell-cafe] Question on leazy evaluation

2005-03-24 Thread Pierre Barbier de Reuille
Hello, I'm very new to Haskell and I'm learning it in my spare time (ie. just for fun ;) ). I already had a quick look through tutorials, some articles, the Wiki, ... My question is: is there some (simple?) rule/criteria to ensure leazy evaluation will be efficient ? Typically, I process a

Re: [Haskell-cafe] Question on leazy evaluation

2005-03-24 Thread Henning Thielemann
On Thu, 24 Mar 2005, Pierre Barbier de Reuille wrote: My question is: is there some (simple?) rule/criteria to ensure leazy evaluation will be efficient ? One rule of thumb is: If your implementation works for infinite lists then it will also be quite efficient for finite lists. Do you mean

Re: [Haskell-cafe] Question on leazy evaluation

2005-03-24 Thread Pierre Barbier de Reuille
Henning Thielemann a écrit : On Thu, 24 Mar 2005, Pierre Barbier de Reuille wrote: My question is: is there some (simple?) rule/criteria to ensure leazy evaluation will be efficient ? One rule of thumb is: If your implementation works for infinite lists then it will also be quite efficient for