Skip to content

Instantly share code, notes, and snippets.

@chomado
Created February 24, 2014 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chomado/9189807 to your computer and use it in GitHub Desktop.
Save chomado/9189807 to your computer and use it in GitHub Desktop.
(* 目的: init から始めてlstの要素を右から順にfを施し込む *)
(* fold_right: ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b *)
let rec fold_right f lst init = match lst with
[] -> init
| first :: rest -> f first (fold_right f rest init)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment