[Haskell-cafe] Span function

2010-06-07 Thread R J
Can someone provide a hand calculation of: span ( 0) [-1, -2, -3, 0, 1, 2, -3, -4, -5]? I know the result is ([-1, -2, -3], [0, 1, 2, -3, -4, -5]), but the recursion flummoxes me. Here's the Prelude definition: mySpan :: (a - Bool) - [a] - ([a], [a])mySpan _ []

Re: [Haskell-cafe] Span function

2010-06-07 Thread wren ng thornton
R J wrote: Can someone provide a hand calculation of: span ( 0) [-1, -2, -3, 0, 1, 2, -3, -4, -5]? I know the result is ([-1, -2, -3], [0, 1, 2, -3, -4, -5]), but the recursion flummoxes me. Here's the Prelude definition: First, let's simplify the definition. span _ [] = ([],