我有以下代码:
(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))
我注意到let
评估必须是最后一个,否则它不会被评估。这让我很困惑。尽管如此,当我在循环中实现它时,let
从未评估过,因为我认为 recur 最终会被推断出来。
(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))
))
我也希望sleep
在本节的末尾do
,但这真的没有实际意义。
我怎样才能let
评估?它与我的使用有关map
吗?我在这里误解了什么?
下载是一个功能:
(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)))))