simonmarhaskell:
> >I guess the problem with the splitWith thing is that it's a slippery
> >path that leads right up to full-on parsers.
>
> Exactly, and this is why we didn't reach a concensus last time.
>
> Would someone like to make a concrete proposal (with code!) for 2-3
> functions we could reasonably add to Data.List?
No parsers!
I vote for this, currently implemented in Data.ByteString:
-- | split on characters
split :: Char -> String -> [String]
-- | split on predicate *
splitBy :: (Char -> Bool) -> String -> [String]
and
-- | split on a string
tokens :: String -> String -> [String]
Question over whether it should be:
splitBy (=='a') "aabbaca" == ["","","bb","c",""]
or
splitBy (=='a') "aabbaca" == ["bb","c"]
I argue the second form is what people usually want.
-- Don
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe