I have this Clojure code that starts and executes a function.
(import [java.lang Thread])
(defn with-new-thread [f]
(.start (Thread. f)))
(with-new-thread (fn [] (print "hi")))
However, when I run it in emacs in slime-repl mode (executed with cider-jack-in
, there is nothing printed out, but nil returned.
With lein real
, I got the expected output.
user=> (import [java.lang Thread])
java.lang.Thread
user=> (defn with-new-thread [f] (.start (Thread. f)))
#'user/with-new-thread
user=> (with-new-thread (fn [] (print "hello\n")))
hello
nil
What might be wrong?