
17 Aug
2008
17 Aug
'08
5 a.m.
On Sun, Aug 17, 2008 at 9:43 AM, Barton C Massey
Maybe something like
intersperse _ [] = [] intersperse sep (x : xs) = x : concatMap ((sep :) . (: [])) xs
is clearer (maybe), but I doubt it's as efficient (although I haven't checked).
concatMap is a bit tricky when it comes to performance. I also think the low-level loop implementation that duncan showed is rather readable.
Thanks much for the corrections! (I hope it's OK to do this on-list.)
Of course. Nobody gets it right the first time. (Well, maybe Oleg. But then again we have some doubts whether he is from this planet or, if he is, perhaps from the future.)