Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-23 Thread Bas van Dijk
On 8/20/07, Stefan O'Rear [EMAIL PROTECTED] wrote: ... (I need to find some way to automate making these trails :) ) ... I think you can come a long way with the debugger in GHC HEAD. It provides a :trace command that, when applied to an expression with some breakpoint in it, remembers the

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-21 Thread Andrew Coppin
Stefan O'Rear wrote: sum = sum' 0 sum' k [] = k sum' k (x:xs) = (sum' $! (k+x)) xs enum x y | x = y= 0 | otherwise = x : enum (x+1) y sum (enum 1 10) = sum' 0 (enum 1 10) = sum' 0 (1 : enum (1+1) 10) = (sum' $! (0+1)) (enum (1+1) 10) = sum' 1

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Lanny Ripple
Not really more efficient but plays to the language implementation's strengths. Imagine take 10 $ foo (10^9) and take 10 $ bar (10^9) bar wouldn't evaluate until the 10^9 was done. (And I just ground my laptop to a halt checking that. :) foo on the other hand would run out to 10^6

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Lanny Ripple
Lanny Ripple wrote: Not really more efficient but plays to the language implementation's strengths. Imagine take 10 $ foo (10^9) and take 10 $ bar (10^9) bar wouldn't evaluate until the 10^9 was done. (And I just ground my laptop to a halt checking that. :) foo on the other hand

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Stefan O'Rear
On Mon, Aug 20, 2007 at 11:21:01AM -0500, Lanny Ripple wrote: Not really more efficient but plays to the language implementation's strengths. Imagine take 10 $ foo (10^9) and take 10 $ bar (10^9) bar wouldn't evaluate until the 10^9 was done. (And I just ground my laptop to a

RE: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-19 Thread Peter Verswyvelen
: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki? On Sat, 2007-08-18 at 20:35 +0200, Peter Verswyvelen wrote: When reading an article about tail recursion (http://themechanicalbride.blogspot.com/2007/04/haskell-for-c-3-programmers. html) I came across the follow statements

[Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-18 Thread Peter Verswyvelen
When reading an article about tail recursion (http://themechanicalbride.blogspot.com/2007/04/haskell-for-c-3-programmers. html) I came across the follow statements: If you can write a non-recursive function that uses the colon syntax it is probably better than a tail recursive one that doesn't.

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-18 Thread Derek Elkins
On Sat, 2007-08-18 at 20:35 +0200, Peter Verswyvelen wrote: When reading an article about tail recursion (http://themechanicalbride.blogspot.com/2007/04/haskell-for-c-3-programmers. html) I came across the follow statements: If you can write a non-recursive function that uses the colon

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-18 Thread Chaddaï Fouché
foo n = if n0 then [] else n : foo (n-1) bar n = aux 0 [] where aux i xs = if in then xs else aux (i+1) (i:xs) that foo is more efficient than bar because lazy evaluation of foo just puts the delayed computation in the cdr of the list, while lazy evaluation of bar has to keep track of