Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2016/functional-programming-design-and-analysis-of-algorithms-resit/4/b/solution

Use
type Point = (Double,Double)
type Polygon = [Point]
A valid polygon is a finite list of at least three vertices in boundary order, with the final vertex connected back to the first. The first vertex is not repeated at the end. A simple polygon also has no intersecting nonadjacent edges. Numerical routines below use finite coordinates; NaN and infinite coordinates are outside this representation's intended domain.

New to topics? Read the docs here!