[Haskell-cafe] wordsBy in the base libraries?

Maxime Henrion mux at FreeBSD.org
Mon Oct 22 05:26:41 EDT 2007


This got a bit mangled, here's the fixed version:

> > wordsBy :: (a -> Bool) -> [a] -> [[a]]
> > wordsBy p s = case dropWhile p s of
> >   []      -> []
> >   s':rest -> (s':w) : wordsBy p s''
> >     where (w, s'') = break p rest


More information about the Haskell-Cafe mailing list