Antony Courtney <[EMAIL PROTECTED]> writes:
> I often need to format a list of strings using some character as a
> *seperator* rather than a terminator for the items. Is there some
> simple combinator or idiom from the Prelude or standard libraries that
> could be used for this purpose?
List.intersperse :: a -> [a] -> [a]
> -- Example: format a list of strings, using a comma as a seperator:
> mkSepStr :: [String] -> String
> mkSepStr xs = foldrs (\x s -> x ++ ", " ++ s) "" xs
mkSepStr :: [String] -> String
mkSepStr = concat . intersperse ", "
Regards,
Malcolm
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe