I’ve tried to get started with Clojure several times, but I always ended up giving up. After more than 30 years of development in “non-Lisp” languages, it’s just too easy to fall back into old habits when things get hard: “OK, I’ll just fix this in Python this time.” If anyone else has the same problem, I’ve found something that works for me: fire up a REPL and use Clojure for small, everyday things. I used to do a lot of quick calculations in Python. Today, I try to use Clojure instead. Small problems, small steps. This works for me because I need to use what I learn in a practical way, otherwise it simply doesn’t stick. Has anyone else struggled with getting started? What are your tips for taking baby steps into this interesting world?
I’d recommend trying to finish a small project in Clojure. Something that’s useful to you but still as tiny as possible. Babashka scripts would be perfect for it.
E.g. I have an llm-summary script that I call with a YouTube URL. It then downloads the subtitles and makes a short bullet-point summary for me. There’s also a flag where it doesn’t need a URL and instead reads the clipboard and summarizes its contents.
If CLI is not your thing, a tiny browser game would also be great. E.g. a clone of 2048 written in Cherry, or something like that.
It took a lot of unlearning to really get into Clojure, but I was committed and accepted the fact that the first 6 months or so meant working at a reduced speed. Once you get “get” Clojure and its take on functional programming, it’s another story. Fogus’ book, The Joy of Clojure, really helped to sell the dream to me.
something I’ve found that helped me a lot is — you don’t always have to do functional programming, especially when you’re first learning it.
for example, if you want to add up the numbers in a list, it’s perfectly acceptable to do:
(let [x (atom 0)]
(doseq [elt inp-list]
(reset! x (+ x elt)))
@x)
to get something equivalent to:
x = 0
for elt in inp-list:
x = x + elt
return x
it can be hard to learn both a new syntax, and a new paradigm of development at the same time, and it’s perfectly ok to tackle one before learning the other
Small steps would be to set up a REPL connected editor (ncluding Clojure LSP for additiinal feedback). Tackle small challenges lije those on http://Exercism.io and 4EverClojure to become more familiar with the functions available in the core library. Identify a project you are willing and motivated to invest time in. Ideally fnd others who are eager to learn with you or mentor you in Clojure. https://practical.li/clojure/introduction/learning-clojure/
@anders.u.persson Another REPL technique is to attack more ambitious goals bottom-up. Functions compose well so you will be able to combine the small working parts without having begun with a daunting framework. (“Everything should be built top-down, except the first time.” -Alan Perlis https://www.cs.yale.edu/homes/perlis-alan/quotes.html)