Suppose I have this function, in pseudo-code, that reverse a list:
def function reverse( list ) :
if ( empty(list) )
return empty_list;
else
return append(
reverse( list(2, lenght) ,
list(1)));
This code is not tail-recursive;
how can i make it tail-recursive?
See: Tail Call
For F#
For reversing a string