by mkeoliya · 4y ago · 0 comments
The other way works too: fold right can be implemented in terms of fold left. Here's an approach using continuations in OCaml:
let fold_right f z xs = (List.fold_left (fun kont x -> (fun y -> kont (f x y))) Fun.id xs) z;;No comments yet.