
4 Jun
2008
4 Jun
'08
12:28 a.m.
On Tue, Jun 3, 2008 at 6:48 PM, Ronald Guida
filter (\x -> case x of A -> True; otherwise -> False) sampleTypes ==> [A]
filter (\x -> case x of B _ -> True; otherwise -> False) sampleTypes ==> [B 5]
There's a neat little mini-trick for these types of pattern matches: filter (\x -> case x of B {} -> True; otherwise -> False) sampleTypes Does the same thing, but works no matter how many arguments the constructor B takes. Luke