Creating the future of Clojure without launching it

I have a basic Clojure script containing:

(def test (future (loop [] (println "Running") (recur)))) 

However, if I execute the file with:

 java -cp clojure-1.3.0.jar clojure.main test.clj 

Then the screen fills with "Launch". How can I change it so that the future starts when I want?

Note. I understand that this will work forever, this is just an example of my problem.

+4
source share
1 answer

A future that does not start right away is just a function with no arguments.

So:

 (defn test [] (println "Running") (recur)) 

... Further...

 (future (test)) 
+10
source

Source: https://habr.com/ru/post/1386667/


All Articles