- Write a function that takes a pair and returns a list of its elements. For instance, given (7, 8) it returns [7; 8]
- Write a function that takes two pairs and finds their
lexicographic minimum: if the first components are different then the
pair with the smaller one is smaller; if the first components are the
same, the second components determine the minimum.

Test your function on pairs of ints and pairs of strings. Does it work on pairs of a string and an integer? On a pair of integers and a pair of floats? - Write a function that finds a minimum in a list of integers.
- Write a recursive function
`append`

that takes two lists and appends the second one at the end of the first one. - Using the color type defined here,
write two functions:
`greener`

which takes two colors and returns the one whose greener component is larger, and`average`

which takes two colors and returns a new color whose components are the averages of the respective components of the two colors. - Using the type
`list`

given here, define a function that takes an element and a list and returns true if the element appears in the list and false otherwise. Note that when a function takes two arguments, but you want to do pattern-matching on one, you can use "match ... with" syntax. Here is the beginning of definition of the function:

Finish the definition of the function. Make sure to test your function on lists of different types.`let rec find l x = match l with Empty -> ...`

This is an example from CSci 4651 course.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.