r/Clojure • u/sharificles • Oct 17 '26
Is it supposed to be this hard?
I'm learning clojure for the first time, I don't have very much experience with lisp-like languages. I worked through the tutorials on clojure's official site and now I'm currently on clojure for the brave and true chapter 3, everything was going 'fine' until I hit the section on matching parts and "symmetrize-body-parts" which took me a whole two DAYS to understand on its own. It's only now that I can kind of code those functions without looking at it.
At this pace I'm never going to finish the book, is it supposed to take this long just to understand what one function is doing?
Edit: thank you for the positive messages everyone, seems like it's not just me. Currently on chapter 4 now!
20
u/CoBPEZ Oct 17 '26
I think there are some passages that will be hard, as things need to click, old assumptions need to fade away/get corrected. It will get interleaved with passages where you zoom through things. Hang in there!
You could also vary your source of training material. To me Advent of Code helped a lot.
16
u/p-himik Oct 17 '26 edited Oct 19 '26
Everything novel enough for a particular person has a very high chance to be like that.
I remember feeling that exact way when I had to read our tax laws for sole proprietorships. My head was physically hurting. :D It went away after a few days and I was able to breeze through all that legalese nonsense.
It'll be fine soon enough, if you stick to it, take enough breaks, talk to other people. I definitely suggest joining us on the Clojurians Slack, especially the
#beginnerschannel. Or any other online Clojure community - everywhere is friendly to beginners.Don't sit stuck on something for hours, let alone days. If you cannot grok something yourself under half an hour - just ask. It's much more efficient that way, and much less frustrating. You'd also be likely to learn much more, because topics rarely travel in isolation.
11
u/huahaiy Oct 18 '26
It is. It took me a solid half an year to feel comfortable. I had 20 years of programming experience.
5
u/Hostilian Oct 17 '26
When I learned it I had real actual stress dreams about S-expressions that wouldn’t balance their parenthesis.
It’s not an easy language and it’ll change your brain when you’re done, in good ways.
5
u/daveliepmann Oct 18 '26
Two days is a good and proper amount of time to be stuck on a problem in a new domain or language.
4
u/argvniyx Oct 17 '26
Your mileage may vary, but something that has helped me tackle books before is reading them quickly, and only trying to solve their exercises and trying to grok them on a second pass.
My first shot at How to Design Programs, I kinda felt like you (re "At this pace I'm never going to finish the book"). I felt that breaking things down to two passes gave me a better overall picture, and somehow made me feel less pressure to get everything right the first time. As others have pointed out, novel things can take a bit to click, so be easy on yourself. Good luck!
3
u/gogo-bog Oct 17 '26
I’ve been a mostly Ruby dev for quite a few years before I picked clojure up and boy did my brain hurt for days! It takes time, take a little brake and come back to it later
3
u/sankyo Oct 17 '26
Back in the day I found this to be great for me. The problems are more bite sized. I was thinking imperatively and when I saw the solutions they were so concise, I was amazed https://4clojure.zenius.com Edit: actually add link
3
u/chamomile-crumbs Oct 18 '26
Clojure for the brave and true was like REALLY hard for me. Weirdly hard, compared to other programming books.
I ended up writing silly random babashka scripts and utils for a few months for going back to it. It was a v fun way to learn.
2
u/EZanotto Oct 21 '26
I first learned Clojure at the company where I used to work. I didn't find it so hard because I had many people in the company to help me. Now I realise that because I needed to ship code while I was learning, I kind of skipped some of the “theory” of how Clojure works. After I left the company, I decided to go deeper into the theory and learn from the books. It was much easier for me to understand the complex parts after I learned how to build a few things in Clojure. My suggestion is: skip things that are hard for now, keep going, build things in the way that is easier for you until you get more comfortable writing Clojure in general, then go back to the hard things, and they may click instantly for you.
2
u/c_a_l_m Oct 17 '26
You're doing great! Lisp can be a lot all at once if you're new, and in particular clj's opinionated ways of dealing with data structures can be intimidating. Once you get it, though, you don't want to go back.
2
u/k1v1uq Oct 18 '26 edited Oct 20 '26
This is like a machine going through a list of items one by one with an empty basket at the beginning, and whenever it comes across an item, it applies a transformation to it, adds the result to the basket, and then moves on to the next element. Then it checks if the remaining list is empty, and if so, it knows that it's done and returns the basket. Like a debt collector.
Re:
Here in the pseudo code example
transform(item)produces thesetwith 2 items: the matching part and the original body-part. Wrapped in a set to deduplicate, then added into the basket withinto.Since
defn matching-partwill return a mouth-part as the same mouth-part, like any body part that isn't matched by the regexp, it would appear twice in the result aspartandmatching-part. If the body part doesn't fall under a left-right category, they usesetto automatically duplicate the result.2
u/rymdresarn Oct 20 '26
New ideas sometimes take a lot of time to click even if you're very experienced. It's normal. I had a similar "brain kerfuffle" while picking up the Prolog & Erlang ways of seeing things coming from an OOP (C++/Java) and C approach. Certain "simple things" didn't click until a few days later, when I was doing something completely offline.
1
u/ffrkAnonymous Oct 23 '26
I started peg-thing like two years ago but got distracted and never finished. So my clojure is quite poor. But I'm comfortable in Emacs thanks to the book.
1
u/WraithGlade 22d ago
I've not worked through that specific book, but I will share a few thoughts anyway just in case it helps:
The syntax sometimes lacking signposts that clearly delineate different parts of a form can make expressions look more confusing than they actually are sometimes.
As such, it can be helpful to use a "rainbow highlighter" for matching parentheses at a glance more easily and/or rearranging the pairs differently than is the standard, in a more C-like way so that the structure is easier to see.
Basically, anything you can do to reduce mental load may help you think more clearly about the problem more easily.
A good night's sleep and patience is also sometimes all that's really needed when facing challenging problems.
Good luck! 🍀🙂