Fork me on GitHub
agata_anastazja (she/her)20:01:32

Edit: solved 😄 Hello, I have a question around repl set up in intellij with the cursive plugin. I used the lein new app app_name command, and can run the app from my terminal. I haven’t changed anything at all in the scaffolded app. When I try to run the repl, I get Error: Could not find or load main class clojure.main Caused by: java.lang.ClassNotFoundException: clojure.main and all the function names are highlighted as not resolved. Any idea what might be causing that?

R.A. Porter20:01:56

Probably best asked in the #cursive channel.

💜 3

Do you have clojure in project.clj :dependencies? Ie.: [org.clojure/clojure "1.10.1"]

agata_anastazja (she/her)20:01:07

long answer - here is my project.clj

(defproject comparer "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.1"]]
  :main ^:skip-aot comparer.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all
                       :jvm-opts [""]}})


What I always do when creating a new leiningen project is create it at the command line like you did, and then in IntelliJ, select File -> New -> Project From Existing Sources. That registers the project as a Leiningen project and loads all the dependencies, etc. If you didn’t do that, that might be why it’s giving you problems.

parrot 3
agata_anastazja (she/her)20:01:37

actually, just looking at the file tab, there was an option to add it as leiningen project, and that did the trick!


for the future, you can right click on project.clj or deps.edn files and import it


if I want to do web developement in clojure as soon as i finished the brave book, can I then better make a leiningen or a clojure-clj project ?


I personally just use clj and shadow-cljs. But getting familiar with leinigen is beneficial. Also for web dev have a look at: And consider reading:


clj; back or front -end, or both?


Here's a small (server-side) web app that uses the Clojure CLI and deps.edn: -- I would suggest making sure you understand how this works and that you can modify and enhance it yourself before trying to work with Luminus (or the Web Development book). Luminus is a lot of moving parts and uses a lot of different libraries. It's a huge step up from what you're currently working with in Brave&True.

👍 3

My ideea was to start very small. A app with 3 routes and some json parsing and hiccup


and no problem to start this app very small. As I look at it Luminus seems to be overkill for this app

Scott Meyers22:01:41

When I evaluate a line referencing a function, after changes were made to that function, those changes aren't being reflected when evaluating the line. Evaluating that function and then evaluating the line referencing it shows the changes. Why is that?


can you be a bit more specific what "changes were made to that function" means?

Scott Meyers22:01:32

Yeah, so say I have a function that adds 2 to a provided number, then I realize it should be adding 3. I'll change that number to 3 inside of the function, evaluate a line referencing that function, and it'll still add 2.

Scott Meyers22:01:44

But if I evaluate the function and then evaluate the reference, that change will be reflected.


right. you need to reevaluate the function


until you reevaluate it with 3, the function exists but with the value of 2.

Scott Meyers22:01:15

Cool, thank you! Just taking some getting used to on my part.


If it helps: Clojure is always compiled, even in the REPL, and compilation happens as you evaluate each top-level form. It's a good practice to get into to instinctively "eval top-level block" after every change you make to any function.


Funnily enough, I just gave a talk to the London Clojurians about this very topic... recording to be available soon!

Scott Meyers23:01:53

Awesome, that does help! I'll keep an eye out for the recording.