this repo has no description

use a map and get instead of filter for csv lookups

+6 -6
+6 -6
weather/weather.bb
··· 39 39 ([] (read-csv-to-maps (get-geonames-data-path))) 40 40 ([fname] 41 41 (let [csv-data (-> fname slurp (csv/read-csv :separator \tab))] 42 - (map #(zipmap [:postal_code :place_name :state_code :latitude :longitude] 43 - (->> (get-all % [1 2 4 9 10]) (map second))) csv-data)))) 42 + (->> csv-data 43 + (map #(zipmap [:postal_code :place_name :state_code :latitude :longitude] 44 + (->> (get-all % [1 2 4 9 10]) (map second)))) 45 + (map #(->> % ((juxt :postal_code identity)) (apply hash-map))) 46 + (into {}))))) 44 47 45 - (defn geocode [zipcode] 46 - (first (filter 47 - (fn [{zc :postal_code}] (= zc zipcode)) 48 - (read-csv-to-maps)))) 48 + (defn geocode [zipcode] (-> (read-csv-to-maps) (get zipcode))) 49 49 50 50 (defn check-rc [] 51 51 (let [path (str (fs/home) "/.weatherrc")]