Somewhat analogous to pattern matching, and also similar to if .. then .. else,
constructs (which we saw examples of earlier) are guards in function definitions. A
guard is simply a condition that might obtain, and a definition of a function that pertains
in that case. Anything that could be stated with pattern matching can also be rephrased
into a guard, but guards allow additional tests to be used as well. Whichever guard
matches first (in the order listed) becomes the definition of the function for the
particular application (other guards might match also, but they are not used for a call if
listed later).
In terms of efficiency, pattern matching is usually best, when possible. It is often
possible to combine guards with pattern matching, as in the isSublist example.