[Haskell-cafe] wordsBy in the base libraries?

Yitzchak Gale gale at sefer.org
Mon Oct 22 07:22:33 EDT 2007

Neil Mitchell wrote:
> ...Also remember that
> p may be arbitrarily expensive, while a test for an empty list is
> cheap. In the particular case of words, p (i.e. isSpace) is very
> expensive...
> A reasonable level of optimisation for this function would be that the
> predicate is invoked at most once on each character. Since its easy to
> do, it would be a shame not to. The other things are all "small",
> compared to the predicate whose cost is unknown.

Yes, that makes sense. That is the main issue.

Though here it's not much harder to optimize away the
extra empty list tests, also.


More information about the Haskell-Cafe mailing list