type LinkedList<'T> =
Cons of 'T * LinkedList<'T>
| Nil
let rec map f = function
Cons (head, tail) -> Cons (f head, map tail)
| Nil -> Nil
let start = Cons (1, Cons (2, Cons (3, Nil)))
let end = map (~-) start
printf "%A\n%A" start end
dHlwZSBMaW5rZWRMaXN0PCdUPiA9CiAgQ29ucyBvZiAnVCAqIExpbmtlZExpc3Q8J1Q+CnwgTmlsCgpsZXQgcmVjIG1hcCBmID0gZnVuY3Rpb24KICBDb25zIChoZWFkLCB0YWlsKSAtPiBDb25zIChmIGhlYWQsIG1hcCB0YWlsKQp8IE5pbCAgICAgICAgICAgICAgIC0+IE5pbAoKbGV0IHN0YXJ0ID0gQ29ucyAoMSwgQ29ucyAoMiwgQ29ucyAoMywgTmlsKSkpCmxldCBlbmQgICA9IG1hcCAofi0pIHN0YXJ0CgpwcmludGYgIiVBXG4lQSIgc3RhcnQgZW5k