# Clojure Loops

While working on a practice problem today, I realized I have to loop over a set of things. Acutally, to get super specific I wanted to use two loops, one nested in the other to do some comparisons between elements in the set.

I don’t understand using a loop over a function call though.

I also didn’t get a ton of time to play with the problem, but I hope to work on it some more tomorrow night. Aside from the actual solution of the practice problem, the main distraction I had today was figuring out how to make loops in Clojure work.

I think it looks like this:

(loop [some-var-name initial-val]
(if some-break-cond
(doThing)
(recur modified-some-var-name)))


To my understanding, recur just “calls” the loop again, as if it were some anonymous function. Modifying the thing in the square brackets differentiates the current iteration from the previous one.

So this is where I am in my Clojure journey. I’m excited for the “ah-ha!” moment to occur tomorrow!

Thanks for reading this post! Comments, questions, and feedback are always welcome.