let sum xs = let rec sum' acc = function | [] -> acc | x :: xs -> sum' (acc + x) xs sum' 0 xs