Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-02-01 Thread David House
On 31/01/07, David House [EMAIL PROTECTED] wrote: dw :: (a - Bool) - [a] - [a] dw p = reverse . fst . foldl comb ([],False) where comb (xs,done) x | done = (x:xs, True) | p x = (xs, False) | otherwise = (x:xs, True) I forgot to

Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-02-01 Thread Spencer Janssen
Yet another higher order solution: dropWhile' p0 xs = foldr f (const []) xs $ p0 where f y ys p | p y = ys p | otherwise = y : ys (const False) Spencer Janssen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-02-01 Thread Bernie Pope
David House wrote: It was a great article though, seeing fix's definition in terms of foldr was one of those mind-bending moments which makes learning Haskell what it is. It's nice to see so many new solutions posted in the cafe. The great thing about Haskell is that it keeps on giving :)

[Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-01-31 Thread Wouter Swierstra
Dear all, I pleased to announce that the latest issue of The Monad.Reader is now available: http://www.haskell.org/haskellwiki/The_Monad.Reader Issue 6 consists of the following three articles: * Bernie Pope - Getting a Fix from the Right Fold * Dan Piponi - Adventures in Classical-Land

Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-01-31 Thread Pixel
Wouter Swierstra [EMAIL PROTECTED] writes: * Bernie Pope - Getting a Fix from the Right Fold i ended up with this one: dwBool predicate l = (foldr combine (\_ - []) l) True where combine e fl beg = if beg predicate e then fl True

Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-01-31 Thread David House
On 31/01/07, Pixel [EMAIL PROTECTED] wrote: i ended up with this one: dwBool predicate l = (foldr combine (\_ - []) l) True where combine e fl beg = if beg predicate e then fl True else e : fl False Mine was: dw :: (a - Bool) - [a]

Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-01-31 Thread Matthew Brecknell
dw :: (a - Bool) - [a] - [a] dw p = reverse . fst . foldl comb ([],False) where comb (xs,done) x | done = (x:xs, True) | p x = (xs, False) | otherwise = (x:xs, True) Which is the simplest working algorithm I could come up with;