Skip to content

Instantly share code, notes, and snippets.

@eigenhombre
Created October 1, 2020 16:51
Show Gist options
  • Save eigenhombre/e5670bc87fc4f1a62a48b670c880deae to your computer and use it in GitHub Desktop.
Save eigenhombre/e5670bc87fc4f1a62a48b670c880deae to your computer and use it in GitHub Desktop.
#!/usr/bin/env bb
(require '[babashka.curl :as curl])
(let [{:keys [body status]}
(curl/get "https://projects.fivethirtyeight.com/2020-election-forecast/us_simulations.json")
winner-map
(->> true
(json/parse-string body)
first
:simulations
(map :winner)
frequencies)]
(doseq [[k v] winner-map]
(printf "%12s %3d\n" k v)))
@eigenhombre
Copy link
Author

Thanks! Babashka is so cool for this kind of use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment