我尝试了本指南中的代码:
(defn my-fn [ms]
(println "entered my-fn")
(Thread/sleep ms)
(println "leaving my-fn"))
(let [thread (Thread. #(my-fn 1))]
(.start thread)
(println "started thread")
(while (.isAlive thread)
(print ".")
(flush))
(println "thread stopped"))
Run Code Online (Sandbox Code Playgroud)
当我执行它时,部分输出显示在REPL中,而另一部分显示在控制台中(由于我通常将其隐藏起来因为我不使用它而弹出).
我想将所有输出发送到REPL窗口,我该如何实现?