F Sharp Programming/Solutions/Lists

Pair and Unpair
Write two functions with the following definitions:

The  function should convert a list into a list of pairs as follows:

The  function should convert a list of pairs back into a traditional list as follows:

Solution
Using fsi:

Expand a List
Write a function with the following type definition:

The  function should expand a list as follows:

Solution
This function can be written easily with or without tail recursion. Here are both functions in fsi:

Greatest common divisor on lists
can be implemented like this using Euler's algorithm: can be implemented like this:

Basic Mergesort
can be implemented like this:

can be implemented like this:

can be implemented like this: