john at repetae.net
Sat Oct 21 23:12:16 EDT 2006
On Sat, Oct 21, 2006 at 03:29:57PM +0200, Josef Svenningsson wrote:
> I'd like to propose to include the following function in Data.List:
> join :: [a] -> [[a]] -> [a]
> join x xs = concat (intersperse x xs)
> I find that every time I use intersperse I also concat the result. And
> it seems that I'm not alone:
> A clear majority of all the uses of intersperse also use concat on the
> result. I think it seems worthwhile to give a name to that idiom.
> The name 'join' was taken from Data.ByteString, where a similar function
> All the best,
I have that same function in my standard toolbox, but call it
a la concatMap.
though mconcatInter would probably be better, since then we can do it
for an arbitrary monoid.
John Meacham - ⑆repetae.net⑆john⑈
More information about the Libraries