Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created January 11, 2013 14:26
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 adilakhter/4511020 to your computer and use it in GitHub Desktop.
Save adilakhter/4511020 to your computer and use it in GitHub Desktop.
bound
let rec bound (lst:int list) : (int*int) option =
match lst with
| [] -> None // Empty List
| xhd::xtl ->
match bound xtl with
| None -> Some (xhd,xhd) // List with only 1 element
| Some (x,y) ->
Some ((if x>xhd then xhd else x), (if y<xhd then xhd else y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment