Continuation Passing Style in ocaml
问题 I am a bit confused on the concept. So I have the following function let rec sumlist lst = match lst with | [] -> 0 | (h::t) -> h + (sumlist t) With continuation, it can be written as let rec cont_sumlist lst c = match lst with | [] -> (c 0) | (h::t) -> cont_sumlist t (fun x -> c (h + x)) I am still confused on what the c means and what it does 回答1: A general answer is already given, but specifically, for cont_sumlist , in case of [] we "return" (i.e. feed) 0 into c that we're given ( 0 is