Clojure for non Clojure programmers - Chapter 1, Syntax

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

4 Likes

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.

Teodor

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.

2 Likes

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.