Skip to content

Instantly share code, notes, and snippets.

@Wilfred

Wilfred/foo.ml Secret

Created January 16, 2019 11:19
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 Wilfred/b4456bab5fb4ba8d90a08b50949ab4b5 to your computer and use it in GitHub Desktop.
Save Wilfred/b4456bab5fb4ba8d90a08b50949ab4b5 to your computer and use it in GitHub Desktop.
partial application in ocaml
(* Using Jane Street Core. *)
let iteri_every (items : 'a list) (funcs : (int -> 'a -> unit) list): unit =
List.iter funcs ~f:(fun f -> List.iteri items f)
(* Doesn't type check! *)
let iteri_every2 (items : 'a list) (funcs : (int -> 'a -> unit) list): unit =
List.iter funcs ~f:(List.iteri items)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment