So tail recursive means a recursive function that uses one recursive call in the body. Moreover it is outermost, meaning that the recursive call is not inside a statement but rather the recursion is done on the parameter of the recursive call. For example(Here I'm using OCaml),
recursive:
let rec fact n =
if n=0 then 1
else n* fact (n-1);;
Tail Recursive:
let fact n =
let rec helper (n,m)=
if n=0 then m
else helper(n-1,n*m)
in
helper(n,1);;
I don't see why would tail recursive be better than the other one?
Also some questions about OCamel: Do we have have to worry about indentations? Because it seem that we don't when i tried it in tryOCamel.
Also, Can we make a new tag for OCaml questions? Please help