
11 Jul
2006
11 Jul
'06
6:59 a.m.
John Meacham schrieb:
just a note: I find splitBy a much nicer routine to provide.
I would support this, if it helped to find a consensus. It's more difficult to decide if empty lists as elements of the result list (at the beginning, at the end or in the middle) should be returned. I would say yes, because removing is quite easy afterwards. The problem typically occurs with a final newline, that may produce an empty last line (that again may be closed by a further final newline by mistake) Christian
splitBy :: (a -> Bool) -- ^ whether element is a seperator -> [a] -- ^ list to split -> [[a]]
P.S. inspecting more than one element looks like an over-generalization to me and should be left to parsers or regexp libs.