
20 Jul
2007
20 Jul
'07
2:10 p.m.
2007/7/19, Jason Dagit
I prefer,
allEqual [] = True allEqual xs = foldl1 (==) xs
But, unfortunately, it's not a one liner like yours (unless you allow allEqual [] = undefined).
Oh and silly me, that only works for [Bool].
My natural instinct is, allEqual [] = True allEqual (x:xs) = all (== x) xs with the same caveat about allEqual [] as in your case. - Benja