
4.7.2 Adding more definitions Let us now add another definition to our function, so that it will give 2 on every even number :
Check now :
We see that nothing changed  it does not work (It is interesting that the result is correct in version 6). The reason can be seen by looking at function definitions:
By the way, the question mark in this context means the Information command, and returns the information contained in the global rule base on a given symbol (section 2.2.2). We see that the reason for the above behavior is that Mathematica was able to figure out that the pattern f[x_Integer?EvenQ] is more specific than the pattern f[x_], but unable to figure out that it is also more specific than f[x_Integer] (this refers to versions prior to 6.0. In 6.0, the patternmatcher does figure out the latter fact as well). The simplest thing one can do is to redefine the function, by placing definitions in a different order:
Check now :

