
14 Mar
2010
14 Mar
'10
11:18 a.m.
Brent Yorgey wrote:
I would argue that it's good practice simply to never call head at all. I stopped a while ago, and I haven't missed it. =)
Daniel Fischer wrote:
I would argue that in snub = map head . group . sort and the like, calling head is perfectly cromulent. But apart from that, I don't remember using head in the last years.
Ah, true, I guess that's the one place I've used head as well. =)
snub = concatMap (take 1) . group . sort Perhaps a tiny bit slower if it doesn't get optimized. But I consider using head a premature optimization. listToMaybe is another helpful tool for getting rid of head. Enjoy, Yitz