Re: [Haskell-cafe] Pattern matching articles/explanations

2007-08-16 Thread Neil Mitchell
Hi > So what I noticed that "A Gentle Introduction to Haskell" mentioned > that wild-cards are useful in constructors. For example: > > head (x:_) = x > > So, does that offer any performance benefits over: > > head (x:xs) = x No. They are exactly the same. _ simply means "a new unique name". > O

[Haskell-cafe] Pattern matching articles/explanations

2007-08-16 Thread Ian Duncan
So what I noticed that "A Gentle Introduction to Haskell" mentioned that wild-cards are useful in constructors. For example: head (x:_) = x So, does that offer any performance benefits over: head (x:xs) = x Or is it primarily to indicate to the coder that xs is useless? I get the impressio

[Haskell-cafe] Pattern matching articles/explanations

2007-08-15 Thread Ian Duncan
Hello everyone, I've been working on improving my Haskell knowledge, and in doing so, I have read a little about as-patterns as well as some form of pattern that uses "~" that I don't really understand. I suspect there are even more lesser-known pattern matching expressions than just these,