>>> splitWhen (<0) [1,3,-4,5,7,-9,0,2] [[1,3],[5,7],[0,2]]
>>> splitWhen (<0) [1,-2,3,4,-5,-6,7,8,-9] [[1],[3,4],[],[7,8],[]]
>>> wordsBy (`elem` ",;.?! ") "Hello there, world! How?" ["Hello","there","world","How"]
>>> wordsBy (=='x') "dogxxxcatxbirdxx" ["dog","cat","bird"]
>>> linesBy (==';') "foo;bar;;baz;" ["foo","bar","","baz"]
>>> linesBy (=='x') "dogxxxcatxbirdxx" ["dog","","","cat","bird",""]
wordsBy (== ':') "::xyz:abc::123::" == ["xyz","abc","123"] \s -> wordsBy isSpace s == words s
linesBy (== ':') "::xyz:abc::123::" == ["","","xyz","abc","","123",""] \s -> linesBy (== '\n') s == lines s linesBy (== ';') "my;list;here;" == ["my","list","here"]
split (== 'a') "aabbaca" == ["","","bb","c",""] split (== 'a') "" == [""] split (== ':') "::xyz:abc::123::" == ["","","xyz","abc","","123","",""] split (== ',') "my,list,here" == ["my","list","here"]
intercalate [x] (chopWhen (== x) xs) == xs
>>> wordsBy (== ':') "bd:3" ["bd", "3"]
groupOn abs [1,-1,2] == [[1,-1], [2]]
> classifyOn head ["sheep", "chip", "ship", "cheap"] [["sheep","ship"],["chip","cheap"]]
> classifyOn odd [1,2,3,4,5,6] [[1,3,5],[2,4,6]](cf. classify, classifyBy)
>>> splitWhen (<0) (BV.fromList [1,3,-4,5,7,-9,0,2]) [[1,3],[5,7],[0,2]]
>>> wordsBy (=='x') (BV.fromList "dogxxxcatxbirdxx") ["dog","cat","bird"]
>>> linesBy (=='x') (BV.fromList "dogxxxcatxbirdxx") ["dog","","","cat","bird",""]