Questions on F#'s loop and cont 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
        | [] -&gt; cont()
        // For other lists, add printing the current
        // node as part of the continuation.
        | hd :: tl -&gt;
            printListRevTR tl (fun () -&gt; printf "%d " hd
                                         cont())

    printListRevTR list (fun () -&gt; printfn "Done!");;



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.
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.
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:



After the list has been exhausted, the very last iteration calls the very last (or first, depending on how you count) function in that chain, which calls the next one, which calls the next one, and so on, until the final "Done!" function is called.

As for loop - that's not a keyword, just a name that Juliet has chosen for her function.