Skip to content

Instantly share code, notes, and snippets.

@jennifersmith
Created October 8, 2012 20:47
Show Gist options
  • Save jennifersmith/3854870 to your computer and use it in GitHub Desktop.
Save jennifersmith/3854870 to your computer and use it in GitHub Desktop.
(defn which-am-i [unranked-value]
(let [all-the-things
(map #(vector (first %1) (distance-between (second %1) unranked-value)) all-the-averages)
top-two (take 2 (sort-by second all-the-things))
difference-between-top-two (Math/abs (apply - (map second top-two)))
very-close (< difference-between-top-two 50)
best-one (if
very-close
(ffirst (shuffle top-two))
(ffirst (first top-two)))]
[best-one all-the-things best-one]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment