开发者

where is the join function?

I need the join function to add separators between the members of a list. I found this function in Data.List.Utils and Data.String.Utils. Unfortunately, those modules doesn't seem to be part of the standard platform.

As it's a quite standard function, I'm pretty sure it should be somewhere in the standard platform , maybe with an other name.

Any idea ?

Update

开发者_运维知识库I have found the solution (but can't accept my answer, I have to wait for 2 days ???)


I found it (thanks Hoogle), it's called intercalate.


Data.List defines intersperse which has type a -> [a] -> [a] and intercalate which has type [a] -> [[a]] -> [a]

For example:
intersperse '_' "foo" will give "f_o_o"
intercalate "baa" ["f", "o", "o"] will give "fbaaobaaobaa"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜