Reputation: 875
(ns secretary.core)
(defn -main
[& args]
(println args "Hello, World!"))
(1 2 3) Hello, World!
But I want it keep in REPL. Not exit.
Upvotes: 0
Views: 193
Reputation: 29958
Try this:
(ns demo.core )
(defn -main
[& args]
(println "Got:" args ))
with the above code:
> lein repl
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Compiling 2 source files to /home/alan/expr/demo/target/default/class-files
nREPL server started on port 46184 on host 127.0.0.1 - nrepl://127.0.0.1:46184
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.1
Java HotSpot(TM) 64-Bit Server VM 13+33
demo.core=> (ns demo.core)
nil
demo.core=> (-main 1 2 3)
Got: (1 2 3)
demo.core=> (+ 3 4)
7
demo.core=>
So, you start the REPL first, then call a function (even -main
). You are still in the REPL when finished.
P.S. Although, my personal favorite, is to use the lein test-refresh plugin and write your experiments in unit-test style using your favorite editor.
Upvotes: 2