3 ms·
This is a great solution. For fun I had a go at golfing it a bit: (-> "https://gist.githubusercontent.com/jorin-vogel/7f19ce95a9a842956358/raw/e319340c2f669
by lgas 12y ago
This is a great solution. For fun I had a go at golfing it a bit:
(-> "https://gist.githubusercontent.com/jorin-vogel/7f19ce95a9a842956358/raw/e319340c2f6691f9cc8d8cc57ed532b5093e3619/data.json"
client/get :body
(json/parse-string true)
(->> (remove (comp nil? :creditcard))
(map (comp (partial join ",") (juxt :name :creditcard)))
(join "\n")
(apply str "Name,Credit Card\n")
(spit (-> (java.text.SimpleDateFormat. "YYYYMMDD")
(.format (java.util.Date.))
(str ".csv")))))
edit: Shorter, requires `(require '[clojure.string :refer [join]])`