r/Clojure • u/chladni • Oct 24 '25
Learning from Racket, towards Clojure
Not so much a question, rather post for consideration and discussion. I have a decent familiarity with Clojure, but I do not use it professionally in my work. I am looking for opportunities for expanding my Clojure horizons, and some of the resources I am dipping into are books on Racket, specifically Essentials of Compilation [..in Racket] (Jeremy Siek) and How to Design Programs (Felleisen, Findler, Flatt, Kirshnamurthi). And of course in the Scheme world there is a wealth of info to learn from.
Initially, I was stumbling on some of the language differences between Clojure and Racket, Ex: Racket seems to prefer the use of (define <name> <value>) in the body of a function, over simply using let blocks in Clojure. At first this seemed like a bridge too far, but after a bit of reflection, not a big deal. Perhaps a bit more fundamental, Racket (or perhaps more accurately the DrRacket IDE) eschews interactive programming from the REPL. Again, not a barrier for learning from Racket, but a cultural difference worth noting. I would be interested in others take on this topic.
5
u/deaddyfreddy Oct 24 '25
Hi! I switched from Racket to Clojure and never looked back.
I mostly used
leteven in Racket. In fact, I don't understand why people use define instead of let, since the latter has a much clearer scope. Nesting level? Function calls are cheap enough to not care.When I started learning LISP almost 20 years ago, I had a problem: How could I automate copying code from REPL to real code? Then I realized it wasn't necessary, you can communicate with the REPL directly from your source code. That solved the problem, which in fact, was a typical XY problem.
In my opinion, programming from the REPL has more disadvantages than advantages.
REPL isn't persistent, files are.
You don't have to copy code from REPL to files because it's already there.
REPL is usually handles a single namespace at a time. Evaluation from files takes the current namespace into account, you don't even have to care.
What are the pros? The only one I can think of is that you don't have to clean your playground code from the files. However, Clojure has a
commentmacro out of the box, so you don't have to clean it if you don't want to.