beginners

Marcin Borkowski 2025-12-15T05:01:56.191689Z

hello all Got some beginner questions I really want to learn Clojure I don't need it for anything now, but I like the idea of a Lisp and learning a modern Lisp seems a fun and useful thing to do I'm a JavaScript programmer (but more back-end with Node.js than front-end) and fairly proficient in Emacs Lisp, too but I struggle with tooling I started with "Clojure for the brave and true", but didn't like it too much (though not sure why) then I read "Getting Clojure", which was nice, but a bit too theoretical for me now I'm reading "Living Clojure" and it seems the best of the three, with lots of exercise I slowly make my way through but I have some troubles... 1. Some chapters use very outdated libraries. 2. And I still do not understand tooling-related stuff very well. For example, I'm now on the "Clojure katas" part, where there is an exercise (writing a small program doing one, usually simple, thing), and a test. I cloned the https://github.com/gigasquid/wonderland-clojure-katas.git repo, went to the directory with the first exercise, typed lein test and saw this: Couldn't find project.clj, which is needed for test I used ChatGPT for help, and came up with this instead: clojure -X:test, which worked but only half-well since (after some frustration and another session with an LLM) I found out that I need to do rm -r .cpcache after I change some code and want to run the tests again this seems weird – I think that running unit tests should not involve manually deleting any cache so I'm pretty sure I'm doing something wrong but I'm a bit lost so, my first question: how am I supposed to learn tooling – things like lein etc. Also, to practice, I'd like to start with writing some CLI tools (and from what I've heard, https://babashka.org/ is the way to go), and some web apps (which make creating simple UIs, well, simple) So, my second question: how do I start with web apps and Clojure? Preferably using CLojureScript on the front-end to get the "full experience"? Is there any book I could buy to start with that? Preferably not outdated like "Living Clojure" (which I find well-written and with great exercises, but some chapters of which are next to useless because they discuss very old, unsupported stuff)?

Marcin Borkowski 2026-01-03T08:28:04.528989Z

And if not this, I have some other ideas, but one main question is this: what if I want my Clojure program to have some reasonable UI? I assume that for CLI, babashka is the way to go, but what are my options if I want to have some TUI or GUI? ClojureScript with HTML seems an obvious choice, what are others?

p-himik 2026-01-03T11:15:24.592809Z

Check out #clojure-gamedev, someone there is working on an open source 2D game, IIRC. For both GUI and TUI there are libraries. And you can always use any Java library via interop if anything is missing. Clojure is a general-purpose language, you can do anything in it. :) Of course, some things would be a worse fit than others, but such a gap can always be narrowed.

daveliepmann 2025-12-15T07:14:08.149989Z

Why did you run lein test? The https://github.com/gigasquid/wonderland-clojure-katas?tab=readme-ov-file#how-to-do-the-katas say to run the tests with clj -X:test. If the readme were blank, the way to tell to use the https://clojure.org/guides/deps_and_cli for reference is that you can see a deps.edn file, which is what is uses instead of leiningen.

Marcin Borkowski 2026-01-03T07:35:00.031919Z

Thanks to all of you! I've read some guides, that really helped. I understand a bit more now and I'm even more eager to try and start some side project using Clojure. Is a simple 2D game a good fit? I know next to nothing about gamedev – I did my share of simple games and similar things in C64 Basic back in the day, then QBasic and Turbo Pascal (with ASCII art, mostly). I have one game, finished in maybe 20% in one of the simple JS engines, but doing it again in Clojure might be great – my son would get the game he begs me to code, I would gain some Clojure experience. WDYT?

Marcin Borkowski 2025-12-15T08:09:46.979429Z

The repo was referenced in the book, which told me to clone it, go into any directory and run lein test. Only after looking at tne readme I found about about clj -X:test, which didn't work, either – but suggested clojure -X:test.

👍 1
Marcin Borkowski 2025-12-15T08:12:24.511299Z

(In fact, Git history tells me that the README also said to use lein test and was changed 4 years ago; the book is obviously older than that.)

p-himik 2025-12-15T09:41:14.853039Z

When you want to learn how to do something and prefer to rely on books, it's best to use the same versions that the books are using. So if a book requires a 4-year-old version of a library, you should use that 4-year-old version and not the most recent one. When you want to learn a particular tool or a library, it's best to rely on the documentation of that tool or library. But, of course, it also must be compatible with the version that you want to use.

Marcin Borkowski 2025-12-15T10:09:38.417779Z

that is all obvious, in theory. But: – I'm afraid there's no easy way to install Clojure (and various libraries) as it existed 4 or 8 years ago (and no point I guess) – documentation is often very scarce – at least in theory, a book is laid out differently than docs, facilitating learning over reference (for example, a good textbook has exercises, unlike even very good documentation) Anyway, after reading 3 books on Clojure, I think I should be able to learn from docs. Still, docstrings for some functions are incomprehensible for me. But I'm open to suggestions where to start to learn tooling (since I think I know enough about the language, at least for now)?

Marcin Borkowski 2025-12-15T10:10:58.040299Z

For example, why couldn't I say lein test? And why the readme suggested clj -X:test when it doesn't work? And what is the difference between clj and clojure?

Marcin Borkowski 2025-12-15T10:11:09.543639Z

Is all that documented somewhere so that I can understand that?

p-himik 2025-12-15T10:22:40.294299Z

– I'm afraid there's no easy way to install Clojure (and various libraries) as it existed 4 or 8 years ago (and no point I guess)You don't "install Clojure". You install some dependency management tool that gets the right version of Clojure for you. The book relies on Leiningen, so just install Leiningen - that's the only explicit installation that you'll need, at least when it comes to Clojure and regular Clojure/Java libraries. > – documentation is often very scarce Not for Leiningen or Clojure CLI (aka tools.deps). As for some specific libraries that might lack documentation - it happens sometimes, I just read the source code. In fact, I often read it before any docs or instead of them because it's the only source of truth. :) > – at least in theory, a book is laid out differently than docs, facilitating learning over reference (for example, a good textbook has exercises, unlike even very good documentation) "In theory" is a very appropriate caveat. Apart from that, there's also the issue of becoming out of date, as you've observed. Also, when it comes to a particular tool or a library, usually the amount of stuff one needs to learn is relatively small - no way to fill a whole book. Take clojure.string for instance - it's just a collection of obvious functions, all with docstring - what would even go into a book about clojure.string? > docstrings for some functions are incomprehensible for me. I'd solve that on a case-by-case basis. If you stumble upon something like that, just come here and ask away. :) > why couldn't I say lein test? Because the project doesn't use project.clj anymore, and lein cannot work without it at a project level. > why the readme suggested clj -X:test when it doesn't work? It does work, I just tested it. Most likely, it didn't work on your end because of the lein shenanigans. Or maybe something else. .cpcache should indeed never be an issue because files there are disregarded if their modification timestamp is earlier than the modification timestamp of the corresponding .clj files. But maybe something was somehow wrong with the timestamps. Or maybe you somehow changed the JDK version during the process, maybe implicitly. So e.g. suppose you run lein test, it does something weird without project.clj and somehow selects the latest JDK it can find. Then you run clj -X:test, it selects an older JDK because maybe it was specified explicitly somewhere. The files in .cpcache all have the right timestamps, but the bytecode version is newer than the older JDK supports. It's probably not what actually happened - I'm just inventing a story for demonstration purposes. You never said what the actual errors were so I can't do any better here. > what is the difference between clj and clojure? Just run cat $(which clj) to check. ;) > Is all that documented somewhere so that I can understand that? The first question - yes, Lein docs state somewhere that project.clj is needed. The second question - no, because it's abnormal behavior. The third question - yes: https://clojure.org/reference/clojure_cli#usage

Marcin Borkowski 2025-12-15T10:28:43.370629Z

thanks for a detailed answer will analyze after work

hrtmt brng 2025-12-15T10:43:02.873409Z

When I started 3 years ago I did not have any of these problems. I downloaded the lein script, did lein new app and could start to code. Starting web development is harder. There seem to be so many ways, and nobody tells you which is the right way. Especially when you want to develop a full stack web app (backend and frontend in the same project) I have the impression, that you really have to learn the build machinery. What I observed is that for Clojure the documentation really matters. In other languages the documentation is much about how tools and things technically fit together. If you have a good feeling of programming you normally skip such a documentation. You just naively try things out. But in Clojure the documentation is about how things semantically fit together. I was not used to take documentation so serious, before starting with Clojure. Instead of playing and trying things out you read the documentation. I personally had a good experience with https://figwheel.org/tutorial.html .

p-himik 2025-12-15T10:52:54.248319Z

> I have the impression, that you really have to learn the build machinery. Please, please do. I think everyone who makes anything more than a hello world app should do it. Not every single in and out of course, let alone the impl of such tools. But just the general capabilities and applicability, plus some ecosystem around it. So many issues stem from wanting a single button/flag/command named "Solve All My Problems". Like that create-react-app crap that they don't even recommend anymore - very easy to get started (a whopping ~10% easier on a second project than it would be if you were to specify things yourself), but pretty much impossible to do anything flexible with it. Not sure how many projects I've seen where the longest active issue was titled "Get rid of create-react-app" with weekly discussions on "how to do X when create-react-app doesn't allow you doing X". > If you have a good feeling of programming you normally skip such a documentation If you want to do something trivial, sure. And while you're staying within a set of very similar tools. If you were to switch from npm to pip you would not be able to just wing it. Both have install, but that's about it. Or from cmake to npm. Or from mvn to something else.

Marcin Borkowski 2025-12-15T10:54:38.143909Z

ok, I seem to agree with this (I also never liked create-react-app, I prefer to have at least a general understanding what is going on in my project). So, where do I start?

2025-12-15T13:16:24.830589Z

Re the clj vs clojure confusion, I've seen a problem with this before. I think there's a deb package or something for clojure that is a different thing from the official CLI tools. You might be using that. Follow the instructions on the Clojure website for installing the CLI and you should have access to both the clj and clojure commands (clj wraps clojure for an improved repl experience at the command line)

Bailey Kocin 2025-12-15T14:27:28.679349Z

I personally think the Clojure guide https://clojure.org/guides/getting_started is great way to get started and then the reference for more specific things https://clojure.org/reference/reader are a really good way to get started. It might help clear your confusion on some of the tooling as well and how Clojure is actually installed/used.

seancorfield 2025-12-15T14:29:42.776109Z

I'd also recommend reading https://clojure-doc.org/articles/tutorials/getting_started/ as it gives some background on the whole lein vs clj / clojure thing, and then walks you through the basics of each tool.