I just started to learn Clojure in my free time and for fun. I installed Leiningen and I have the REPL working on the Windows command. But I wanted to use an IDE and downloaded Nightcode . But I am having problems with lack of Java experience and lack of documentation.
I tried to read Leiningen documentation but that did not make much sense either. I know I am not understanding the basics. When I click run on Nightcode I just get this result
Running...
Compiling my-project.core
Hello, World!
I know this is a very newbee question but can anyone direct me to the right place about how to enter some Clojure functions and run it and see the result in Nightcode? I was expecting to see something as easy as Python IDLE but this is very different.
Thanks.
Re Jared314's answer:
Now I have this code on the top window:
(ns newclojureproject.core
(:gen-class))
(+ 1 2 3)
I click Run with REPL
and I don't see the result for sum but this
my-first-project.clj=> Running...
Compiling my-first-project.clj
Running with REPL...
nREPL server started on port 51595 on host 127.0.0.1
REPL-y 0.2.1
Clojure 1.5.1
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
my-first-project.clj=> Running...
=== Finished ===
=== Finished ===
What am I doing wrong?
I'm the author of Nightcode so I may be able to help. The Run with REPL button is the equivalent of running "lein repl" on the command line. It should bring up a prompt where you can type in clojure commands within the context of your project. It appears that you may have clicked several buttons in rapid succession, so the prompt wasn't available.
Keep in mind that if you just want a simple REPL to try Clojure commands in, just use the one in the bottom left of the window. It's essentially the same thing, except it's always-on and doesn't have access to any project's namespace. I added it precisely for these situations where you just want a quick way to try a command out.
If you have other questions, feel free to ask here or on the Nightcode subreddit.
Try using Run with REPL
, and when you make modifications to the files, the Reload
button next to it. Create your project and add a new clj file in your src/my_project/ directory, add the ns
statement at the top of the file, and Run with REPL
.
As you add functions to the file, and save the file, click the Reload
button to make your changes available to the REPL. (Note: the Reload
button will only work when a file in the project has been changed and saved.) There are some limits to what kinds of changes you can reload, because of the limits of the underlying JVM. When you change project dependencies, in the project.clj file, you may need to click Stop
and then Run with REPL
again.
I also found a strange issue with my Nightcode REPL where occasionally some statements, are not executed the first time. I worked around that issue by pressing enter, to get back to the prompt, and executing it a second time, with the up arrow and enter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With