Using guard clauses and pattern matching in function definitions