
On 18/07/07, J. Garrett Morris
You're partway there - concatMap is flip (>>=), so you have the xs >>= (\x -> <stuff>) part.
Ah, yes! I read about this equivalence in one of the other threads today but it didn't make any connection. Doh! I think I will have to, sooner or later, become more versed in the subtle ways of non-IO monads. They seem to be capable of some seriously tricksy shenanigans. In other news, I worked out a few minutes ago while walking home that the whole keepOneDiff function (used in my program above) is incredibly convoluted, to the point of Heath Robinson contortions. To be clear, I had:
keepOneDiff = map snd . filter (\x -> (fst x) < 2) . map (difference &&& id)
Where I could have just done this...
keepOneDiff = filter ((< 2) . difference)
Sometimes I am astounded at my own lack of vision. :-O Clearly, today has not been a good day. Cheers for all your help folks, Dougal.