Disclaimer: I'm learning clojure.
This is the simple example I'm trying to run:
(ns ClojureTest.core)
(let [input (read-line)]
;if user input = "x"
(if (= "x" input)
;stop accepting input
(println "Exit")
;else output the input and continue accepting input
(
(println input)
(recur)
)
)
)
Now I'm getting this error, which I guess makes sense, because I'm unfamiliar with syntax:
Exception in thread "main" java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(ClojureTest/core.clj:8:7)
How do I fix this?
Side questions:
- When I click "run" in eclipse (as I would do with Java) I get not only the console opened but this "REPL" window. Why is it necessary and what does it do?
- When I click "run" it takes quite a few seconds to launch the app. Is there a way to make it faster?
- When I need to edit the code and relaunch the app I'm getting this message: "The selection cannot be launched, and there are no recent launches". What is that and why wouldn't it let me relaunch my code? If I wait a while I can launch it again.