Skip to content

Instantly share code, notes, and snippets.

@sslotsky
Created January 7, 2019 17:33
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 sslotsky/c96a9cd91380a0dd8217a41d11377cf0 to your computer and use it in GitHub Desktop.
Save sslotsky/c96a9cd91380a0dd8217a41d11377cf0 to your computer and use it in GitHub Desktop.
let percentCovered = (x, y) => {
let (x, y) = (min(x, y), max(x, y));
let amountCovered = sites^ |> List.fold_left((sum, site) => {
sum +. (min(site.right, y) -. max(site.left, x))
}, 0.0);
100.0 *. amountCovered /. (y -. x);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment