## Instructions

**Objective**

Write the solutions for the given questions of pattern matching and higher order functions in OCAML.

## Requirements and Specifications

Pattern Match

Exhaustively match all patterns of the following expressions using only the match keyword.

Y
should match until there are only base types (int, float, bool, string).

A wildca (_) should be used to match the right-hand side of the cons (_::_) pattern.

Below are three examples that attempt to illustrate what satisfies our requirements.

WRONG EXAMPLE 1.1:

e: (int * bool) list

match e with

| [] -> …

| a :: _ -> …

Wrong, because a is a tuple which is not a base type so it must be matched further.

CORRECT EXAMPLE 1.2:

e: (int * bool) list

match e with

| [] -> …

| (a, b) :: _ -> …

Correct, because a and b in the pattern (a, b) are of type int and bool respectively.

**Solution**