Subject: Re: Why is there no splitBy in the list module?
Date: Wednesday 12th July 2006 14:11:52 UTC (over 12 years ago)
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