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 mention: I used foldl because it was neater, but you can easily convert it to use foldr by reversing the list first and swapping the arguments to comb. -- -David House, [EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe