# Questions on F#'s loop and cont [closed]

The following tail-recursion example is taken verbatim from Chris Smith's Programming F# 3.0. If this is not the appropriate forum for this post, I will gladly move the post to the appropriate place. I did not post this in SO, because I do not have a problem to solve.

let printListRev list =
let rec printListRevTR list cont =
match list with
// For an empy list, execute the continuation
| [] -> cont()
// For other lists, add printing the current
// node as part of the continuation.
| hd :: tl ->
printListRevTR tl (fun () -> printf "%d " hd
cont())

printListRevTR list (fun () -> printfn "Done!");;

1. What exactly is cont() continuing. I believe I understand the concept that cont() is encapsulating the remaining work to be done, but I am still a little confused about what is going on.
2. This SO post contains use of the keyword loop in @Juliet 's answer. I am confused as to why loop is used in that answer and not used in the example above.

## closed as off-topic by Martin R, JanDotNet, Der Kommissar, alecxe, 200_successJun 27 '17 at 20:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

• Unfortunately there isn't a place for this type of question on SE - one of the restrictions on questions here is that they "are not asking for an explanation of someone else's code." I do hope you find the information you want, and as a hint loop and cont are not keywords, but are variable/method names. Tail-call recursion is a hard concept to understand, especially if you're new to F#. – Der Kommissar Jun 27 '17 at 20:05
• Welcome to CodeReview. Unfortunately, questions about someone else's code are off-topic. I would post that question on SQ - even if you have no problem. – JanDotNet Jun 27 '17 at 20:05

cont is continuing the computation process.
The printListRevTR function, in the process of execution, builds up a "chain" of cont functions. The very first (or last, depending on how you count) such function is the one that prints "Done!". After that, each next cont prints the current number and then calls the previous cont.
As printListRevTR goes through the list, it builds up a chain of conts, by creating each next function that calls the previous one. This chain could be visualized like this:
As for loop - that's not a keyword, just a name that Juliet has chosen for her function.