
On 31/01/07, Pixel
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] -> [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; sadly it breaks the lazinesss constraint. 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. -- -David House, dmhouse@gmail.com