
12 Feb
2007
12 Feb
'07
9:38 a.m.
pixel:
Chris Moline
writes: dropWhile p = foldr (\x l' -> if p x then l' else x:l') []
invalid: dropWhile (< 5) [1, 10, 1] should return [10, 1]
Prelude Test.QuickCheck Text.Show.Functions> quickCheck $ \p xs -> dropWhile p xs == foldr (\x l' -> if p x then l' else x:l') [] (xs :: [Int]) Falsifiable, after 4 tests: <function> [-1,-3,1] If in doubt, do a quick check! -- Don