Skip to content

Instantly share code, notes, and snippets.

@cmcbride
Created May 5, 2011 15:00
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 cmcbride/957200 to your computer and use it in GitHub Desktop.
Save cmcbride/957200 to your computer and use it in GitHub Desktop.
(* find min/max of an array, type generic *)
let minmax a =
let start = a.(0), a.(0) in
let mm t e = (min (fst t) e , max (snd t) e ) in
Array.fold_left mm start a
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment