I have the following code:
(do
(prn "sleeping for 60 seconds")
(Thread/sleep 6000)
(prn "kicking off calendar downloads @ " (new java.util.Date))
(let [links (map #(clojure.string/split % #",") (clojure.string/split (clojure.string/replace (slurp "calendars.csv") #"\r" "") #"\n"))]
(map download links))
I noticed let
evaluation must be last or else it does not get evaluated. This is confusing to me. Nonetheless when I implement this in a loop, let
is never evaluated since I think recur ends up being inferred.
(while
(do
(prn "sleeping for 60 seconds")
(Thread/sleep 60000)
(prn "kicking off calendar downloads @ " (new java.util.Date))
(let [links (map #(clojure.string/split % #",") (clojure.string/split (clojure.string/replace (slurp "calendars.csv") #"\r" "") #"\n"))]
(map download links))
))
I'd prefer for sleep
to be at the end of this do
section as well, but that is moot really.
How can I get let
to evaluate? Does it have to do with my use of map
? What am I misinterpreting here?
Download is a function:
(defn download [[calname ics]]
(prn "attempting cal download: " calname)
(try (spit (str dest calname ".csv") (slurp ics))
(catch Exception e (str "caught exception: " (.getMessage e)))))