[Haskell-beginners] Pattern Matching
el.zingo at gmail.com
Sat Aug 2 22:09:24 EDT 2008
The best way I can explain what I'd like to do is show an example, so here
same :: a -> a -> Bool
same x x = True
same _ _ = False
Is there any way to do this in Haskell? The actual reason I'd like to do
this is something slightly more complicated. I want to match against a list
of elements, like so:
foo [x,x,x] = ...
Thanks for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners