Why is there no splitBy in the list module?
u.stenzel at web.de
Tue Jul 18 08:54:44 EDT 2006
Christian Maeder wrote:
> Malcolm Wallace schrieb:
> > I think the general objection to the "With" suffix is that it is
> > non-standard naming. All the Haskell'98 libraries use "By" for this
> > kind of meaning.
> Looking at Data.List there is not a single function with suffix "By"
> that takes a predicate argument (filter, dropWhile, etc.).
> All "...By" function (nubBy, ..., minimumBy) take binary comparison
Hmm... splitWhen ?
However, by analogy with 'break' and 'span' it should be just 'split',
and if you want to split on white space, you say so: 'split isSpace'.
I also think, this version of 'split' (or whatever you want to call it)
is all that's needed, because
*> lines == split (== '\n')
*> words == filter (not.null) . split isSpace
and anyone who needs more than that is better served with alex, some
sort of regexes or Manuel Chakravarty's lexer combinators.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/libraries/attachments/20060718/2157ba56/attachment.bin
More information about the Libraries