Why is there no splitBy in the list module?
Christian Maeder
maeder at tzi.de
Wed Jul 12 10:11:52 EDT 2006
Donald Bruce Stewart schrieb:
> I'ved added some QuickChecks, and suggest changing splitWith to splitBy,
> following the other List functions with explicit predicates, sortBy,
> groupBy, minimumBy, ...
fine (if also splitWithPS is changed to splitByPS)
The other versions (not ignoring a final delimiter and deleting all
empty lists) are desirable, too. Are there any suggestions for canonical
names? The implementations could be hidden (and more efficient) then (by
avoiding to traverse a list twice).
How about this?
splitFields, splitWords, splitLines (= split ?)
splitFieldsBy, splitWordsBy, splitLinesBy (= splitBy ?)
splitFields 'a' "baaba" -> ["b", "", "b", ""]
splitLines 'a' "baaba" -> ["b", "", "b"]
splitWords 'a' "baaba" -> ["b", "b"]
Cheers Christian
More information about the Libraries
mailing list