hy/eg/sunlight/party-count.hy
Julien Danjou 27e74d43b1 Re-indent Hy code using hy-mode
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 16:31:31 +02:00

25 lines
572 B
Hy
Executable File

#!/usr/bin/env hy
;; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2013 under the terms
;; of the Expat license, a copy of which you have should have recieved with
;; the source.
(import sys)
(import [sunlight [openstates]]
[collections [Counter]])
(def *state* (get sys.argv 1))
(defn get-legislators [state]
(kwapply (.legislators openstates) {"state" state}))
(defn get-party-breakdown [state]
(Counter (map
(lambda [x] (get x "party"))
(get-legislators state))))
(print *state* "-" (get-party-breakdown *state*))