
21 Oct
2006
21 Oct
'06
1:31 p.m.
josef.svenningsson:
Hi,
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: http://www.google.com/codesearch?q=file%3A%5C.hs+intersperse&btnG=Search+Code 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.
Oh, that's a nice trick for working out apis. Good idea!
The name 'join' was taken from Data.ByteString, where a similar function exists.
Seems reasonable. Want to submit a darcs patch, and maybe a quickcheck property or two? -- Don