Hacker News new | ask | show | jobs
by Naomarik 2496 days ago
You don't actually need to know anything about Java to be productive in Clojure. At least that was my own experience.
1 comments

I've been told that before and respect your experience even if it is very different than mine.

Let's talk about writing code in Python. You write a script and either run it through your IDE or via the command line via Python pythonscript.py. With D, I write some code and feed it through the compiler like dmd scriptname.d.

With Clojure in addition to all the cruft I have to learn (Emacs, leinegen...etc), I still have to know something of Java. One of the big selling points is integration. If I know zero Java, how am I supposed to make use of the various classes? Even if I largely stick to just Clojure, how does one interpret the Java stack traces? What is the best method for running via the JVM? How do I performance tune the JVM? How do I use GUI frameworks that are largely all OO Java?

You can run Clojure without Leiningen and you definitely do not need to learn emacs. I use vim, but Cursive (IntelliJ plugin) is IMHO the most beginner friendly option available (other good options include Nightlight, Atom with clojure olugin, VS Code with plugin). You can run Clojure without learning Leiningen with many of these too.
How does one not use leiningen? Do you just substitute lein for the other build tool provided by cognitect? All the tutorials I've seen have you jack-in to a lein REPL. I guess I could just use the jar file from the download directly as my REPL? I wish more tutorials started that way so I could learn without all the tools that I don't need at this point.

Thanks for helping point this out. Cursive has a trial license and is pretty cheap, but it is still annoying to get a license to something you might not need in my organization if others aren't already using it (probably easier to get visual studio for over $1k than $100 cursive license). VS Code asked me for the leiningen REPL path and I just gave up at that point for the night. I wish the Clojure download zip came with a very simple IDE like Dr. Racket or the GroovyConsole with line wrap, parenthesis matching/highlighting and a pane for the file and REPL and some pre- loaded tutorials. I would have no excuses.

If don't like or do not want InteliJ with Cursive or vanilla Emacs or VSCode, you can still use Vim, Eclipse, Atom, Spacemacs. The days when Clojure could be used only in Emacs are long gone.
Here are instructions for running clojure directly: JVM, Clojure.jar and nothing else:

https://clojure.org/guides/getting_started#_other_ways_to_ru...

You can also use boot, or if you’re using clojurescript, there are other non-leiningen options too. But really, leiningen is easy — you only need to know where in the project file to put dependencies (if you’ve ever used any other build tool, you can do this) and then run `lein repl` or `lein run` or `lein test` and to package a jar: `lein uberjar`. You don’t need to know anything else to get started.

Cursive is free for non-commercial use. If you just want a simple editor to get started, check out Nightcode or Nightlight.

https://sekao.net/nightcode/

https://sekao.net/nightlight/