
1 Feb
2007
1 Feb
'07
3:27 a.m.
On 31/01/07, David House
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, dmhouse@gmail.com