考虑以下MWE:
(ns toto.core
(:gen-class))
(defn write-something [i]
(spit (str "out-" (str i) ".txt") "Hi there!"))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(dorun (pmap write-something (range 16))))
-main
从REPL中,它按预期工作:它创建文件并返回。然而,如果我创建一个uberjar并运行
java -jar <toto.whatever-standalone.jar>
它将创建文件,但无法退出程序。我怀疑这是懒惰的问题,但不明白为什么
dorun
不像我期望的那样工作。