type 'a list = Nil | Cons of 'a * 'a list
type nat = Zero | Succ of nat
let rec
['a] (length : 'a list -> nat) =
  ['a]
  fun (l : 'a list) ->
    match l[] with Nil['a] -> Zero[]| Cons['a](_, xs) -> Succ[] (length['a] xs[])
let
(n : nat) = length[int] (Cons[int] (1, Cons[int] (2, Cons[int] (3, Nil[int]))))
