[A little more about when to use wild cards. Bryan O'Sullivan **20070919210222] { hunk ./en/ch04-fp.xml 795 + + What are those wild cards doing there? + + If you're new to functional programming, the reasons for + matching patterns in certain ways won't always be obvious. + For example, in the definition of myMap + above, the first equation binds the function we're mapping + to the variable f, but the second uses + wild cards for both parameters. What's going on? + + We use a wild card in place of f to + indicate that we aren't calling the function + f on the right hand side of the equation. + What about the list parameter? The list type has two + constructors. We've already matched on the non-empty + constructor in the first equation that defines + myMap. By elimination, the constructor + in the second equation is thus necessarily the empty list + constructor, so there's no point in doing a pattern match to + see what its value really is. + + }