I am trying to write two separate tail recursive functions that compute the length of a list and I am given these limitations:
write a version,
lengtht
that is tail recursive and uses external (non-nested) auxiliary functions as neededwrite a second version,
lengtht2
that uses no additional top-level functions. The function should still be tail-recursive, and can use any local bindings that you want
I am new to racket and this is what I understand the general form of tail recursion is:
(define (func x)
(cond (end-test-1 end-value-1)
(end-test-2 end-value-2)
(else (func reduced-x))))
I am just a little confused about how to do this