As a scheme-newbie I'm trying to solve some basic problems.
One of them are continued fractions, which I like to realize both ways, recursively and via tailrecursion.
My recursive soloution (d and n are functions and k is the recursion-depth):
(define (c-fraction d n k)
(if (= k 0) 1
(/ (n k) (+ (d k) (c-fraction d n (- k 1))))))
is working like I want to, but I've no idea, how to makte this tail-recursively.
I do not to recognize, which expression I have to to accumulate in which way.
The rest is much more easier as I thought, my thinking was to complicated. It is very instructive to recognize, that there is no need to reverse the coefficients when using the tailrcursion. Thank you verry much,
Peer – Peer Jan 20 '21 at 18:35