[Haskell-cafe] Foldr tutorial, Inspired by Getting a Fix from a Fold

Pixel pixel at mandriva.com
Mon Feb 12 04:30:30 EST 2007


Chris Moline <evilantleredthing at yahoo.ca> writes:

> dropWhile p = foldr (\x l' -> if p x then l' else x:l') []

invalid:  dropWhile (< 5) [1, 10, 1]  should return [10, 1]


More information about the Haskell-Cafe mailing list