pattern matching excercises