Clojure for non Clojure programmers - Chapter 1, Syntax

Finally got started on my first learning Clojure series. Hope you like it!


I like how you handled syntax:

  1. There’s functions
  2. There’s nested functions
  3. And there’s macros and special forms which can be tought of as “special functions” for now.

Do you have a goal in mind for the series? Curious as to how the final outline will look like, if this is the first chapter.


I do have a rough outline right now, though it’s tentative, and I feel it might be too long. I didn’t want to commit to it, that’s why I didn’t publish it as well.

My goal is that if a junior to mid level programmer who doesn’t have experience with Clojure, but mostly with Java, Python, or C#, were to join my team, this tutorial series would help them ramp-up a lot more quickly. Either quicker, or like more properly, in that it directs them towards a good foundation very early.

Right now, my idea is to order things kind of in a mix of logical, and what is most important first so you can as quickly as possible understand and write programs in Clojure. So my next few chapters right now I’m thinking will be how to write a small program and use the clj command line tools and repl. Hoping to cover the basic functions and macros, and get people in a state they can already mess with Clojure (without an IDE quite yet), for small programs or CLIs. And once that’s done, I’ll cover the full REPL driven develeomemt and its setup. And then we’ll explore a more complicated program, and through that, I’ll dig in the more advanced features and especially how to design and organize Clojure code, like components and state. Anyways, that might change as I go, but that’s the idea right now.


Minor nitpick:

The first symbol after the open parenthesis is the function name you want to run

This is not true, because after open parenthesis it is valid to have another expression, which is also evaluated (this also isn’t mentioned):

((juxt remove filter) even? (range 10)) ;; ← valid syntax

Ya, there’s certain details I believe are worth simplifying and overlooking at first. I find that hard to explain without going into too big a tangent and having to explain first class functions.

Maybe I should remove “name” from the sentence though. If I just refer to it as function, its ambiguous enough but more accurate, so at first people would assume a named symbol, and eventually they’ll learn it’s actually a function object.

Also, I probably shouldn’t use the word symbol in that sentence, since I don’t totally mean a Clojure symbol, but more like the first glyph. I’m not sure I’ve explained forms yet at that point, maybe I should say first form though, I think that would still make sense, and again be more accurate.

Thanks, I’ll make those changes, I like that better.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.