Since state doesn't change here you could just substitute what the function does with its recursion. Imagine you have a two letter word a
:
(reverse a) ; =>
(word (last a) (reverse (bl a))) ; ==>
(word (last a) (word (last (bl a)) (reverse (bl (bl a))))) ; ==>
(word (last a) (word (last (bl a)) (bl (bl a)))) ; ==>
(word (last a) (word (last (bl a)) '()))
The last (bl (bl a))
is the only thing done by the last iteration and it's '()
.
The rest is done as the continuation of the previous calls.
EDIT
To clarify.. Imagine a is "ab"
(reverse "ab") ; turns into
(word (last "ab") (reverse (bl "ab"))) ; tuns into
(word "b" (reverse (bl "ab"))) ; turns into
(word "b" (reverse "a"))) ; turns into
(word "b" (word (last "a") (reverse (bl "a"))))) ; turns into
(word "b" (word "a" (reverse ""))))
Now look at that last one.. When (reverse "")
returns "" it's the result used in the previous form call, in the word
form, so you'll get (word "a" "") ==> "a"
, then that will be returned to the first call that does (word "b" "a")
. These are continuations.