Names for small functions: just say no... Re: Data.List.join

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Nov 9 12:27:39 EST 2006


Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> wrote:

> Then there's the specific question of whether intercalate is
> actually a better abstraction than intersperse.
> "concat . intersperse" is hardly difficult to read,

I have found over the years, that pretty-much every time I write
"intersperse" in a program, I get a type error.  It almost always turns
out that I really wanted "concat . intersperse", and so I write that
instead.

So perhaps this just demonstrates that I have the wrong idea about what
intersperse is supposed to do.  But the very fact that I keep making the
same mistake suggests that there is indeed a natural and intuitive
function hiding there, and I keep reaching for it, but with the wrong
name.

Regards,
    Malcolm


More information about the Libraries mailing list