1. A function is defined to take arguments of a particular type, form or value. When applying the function to its actual arguments it is necessary to match the type, form or value of the actual arguments against the formal arguments in some definition. For example, the function
length  = 0 length (x:xs) = 1 + length xs
length l = case l of  -> 0 x:xs -> 1 : length xs
Pattern matching is usually performed in textual order though there are languages which match more specific patterns before less specific ones.