
21 May
2012
21 May
'12
9:02 p.m.
AntC
So Ertugrul, as an experienced Haskeller which of these do you put in your code for a singleton list (whether appearing in a pattern or as an expression): [x] (x: [])
I tend to use bracket notation for fixed-length list patterns.
Or perhaps you mix them, depending on whether you want to be more suggestive of an empty list [] or an unknown-length list (x: xs)?
Yes. It's quite seldom that I use bracket notation, though. That's simply because it's seldom that I pattern-match against fixed-length lists. Greets, Ertugrul