Tutorial by Examples

Below is a non-tail-recursive function to compute the sum of a list of integers. let rec sum = function | [] -> 0 | h::t -> h + (sum t) The last operation the function performs is the addition. Thus, the function isn't tail-recursive. Below is a tail-recursive version of the same fu...

Page 1 of 1