Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ssrihari
Last active April 15, 2024 14:54
Show Gist options
  • Save ssrihari/0bf159afb781eef7cc552a1a0b17786f to your computer and use it in GitHub Desktop.
Save ssrihari/0bf159afb781eef7cc552a1a0b17786f to your computer and use it in GitHub Desktop.
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
  2. Exercises
  3. Sit back and understand the language
  4. Rationale
  5. Books or Courses
  6. Getting comfortable with the editor and REPL
  7. Application programming in Clojure
  8. Error handling
  9. Debugging
  10. Modeling, and Organising code
  11. Functional programming for people coming from OO
  12. Beyond the basics
  13. JVM
  14. Other such lists

Getting into the language

Use these to get a hang of the language in a quick manner. Deeper than a hello world, less deep than a book.

Exercises

  • 🔴 4clojure: This was a big part of how I learnt Clojure. Do all the elementary, easy, and medium ones. Do some hard ones too. Look at other people's solutions, and re-write your solutions. This is a drill in Clojure basics, and is very effective.
  • 🟩 Exercism
  • 🟩 Clojure Koans
  • 🟩 Mars Rover: This is a simple problem (not just plain math/data munging) that lets you explore some domain modelling, writing tests, etc.

Sit back and understand the language

A language influences the way you think. It can change your paradigm of thought, and you need to let it do that so that you can really understand it when you use it. These videos, especially the ones by Rich are powerful, and are a large part of the reason for Clojure's adoption today. Watch / read these (maybe one or two per day) on the side as you learn Clojure.

  • 🔴 Simple made easy: This talk transcends the language, and makes its way into changing how you think about.. thinking. Un-twine those ropes, separate those concerns, and decomplect your life.
  • 🟩 Simplicity Aint easy: A nice follow up to Rich's talk, with specific examples and how it applies to every day programming.
  • 🟨 Value of values: This will take a few re-watches to grok. Alternatively, watch this when you've got your feet wet with Clojure.
  • 🟨 Clojure's approach to identity and state: Rich hickey looking over his glasses, telling you you're doing it wrong.
  • 🔴 JoC chapter 1, 2: This is what my peers and I used when we initially learnt Clojure. It's what I would prescribe time and again if asked for one textbook to follow. At least read the first 2 chapters to understand the philosophy.. I somehow find other books lacking on that front.
  • 🔴 Solving problems the Clojure way: I've seen this talk repeatedly make people go "oh yeah, that makes sense, the puzzle sort of came together with this".
  • 🟩 Hammock Driven Development: Generally good advice on sleep, and using "thinking" as a tool.

Rationale

Why was the language designed this way? It helps to get into the maker's mind a little to make effective use of the language.

  • 🔴 Rationale page in guides: Start there, but mostly read all the guides. They're well done.
  • 🟨 Are we there yet?: Consider this a must-watch if you're coming from an object oriented programming background.
  • 🟨 Rich's A History of Clojure (2020): the whole story, and some fun comparisons with other language evolutions.
  • 🟨 Maybe Not (Nov 2018): On the choice of a dynamically typed language, with some Haskell bashing on the side.

Books or Courses

  • Joy of Clojure: What I normally suggest. It's a bit old school (imo), and what's considered a textbook at nilenso. It's a bit dry, but effective if you're up for a slightly steep learning curve.
  • Clojure programming: This is what the new kids on the block are reading, I hear good things about it. It's also writted by absolute rockstars.
  • Clojure by example: This was used in IN/Clojure workshops for 1 day introductory crash courses. Consider it strongly if you like learning by example.
  • Clojure for the brave and true: A fun book, and easy to follow along. Has a good section on macros.
  • The little schemer: Not Clojure, but an excellent read.
  • Eric Normand's Courses: They're paid, but I would recommend these if you're looking for full courses that'll get you upskilled in a relatively short time period.
  • Lambda Island's courses: Check out the episodes on React/Reagent, and Testing. They're free!

Getting comfortable with the editor and REPL

Application programming in Clojure

When you're serious about using Clojure for your job, you got to sharpen certain edges, and polish up. Here are some resources I usually point people to:

  • 🔴 Community style guide: Format your code right. Read this end-to-end once you've written some Clojure, and then come back to it as a reference when you're unsure.
  • 🔴 Linting: Set up clj kondo, it'll help you adhere to that style guide, and then teach you some Clojure guidelines along the way.
  • 🔴 Destructuring: I see a lot of newcomers missing out on good destructuring, and this is the article I usually point them to.
  • 🔴 Prismatic/Plumatic guides: Read all 3 of these. I keep linking people to them whenever they are grappling with datastructure decisions.
  • 🟩 Stuart sierra's dos and donts list: Read all of these. I keep referring people to the article on naming functions, read that one at least.
  • 🟩 Running with scissors: Another talk by Stu, reminding you to use the REPL.
  • 🟨 Data > Functions > Macros: I wish there were more material on this. It is a large influence on design in FP.

Error handling

The community doesn't have a canonical answer to this. And your approach would largely depend on whether you like exceptions or not. There are a lot of articles and discussions around this, but nothing that summarises it perhaps.

  • Might be worth going through some interesting discussions in clojureverse: 1, 2, 3
  • Want a monadic approach? Use Failjure. But also read the related blogs.
  • [WIP] Railway oriented programming
  • [WIP] Erlang style error tuple
  • [WIP] Exceptions, and how to use them effectively

Debugging

Modeling, and Organising code

  • 🟨 Clojureverse Discussion: This is a very detailed (and long) discussion, with a few different views. It'll be good to have these ideas in a condensed form somewhere.
  • 🟨 Functional Core Imperative shell: This is a predominant way of structuring code in functional lanugages, and Shantanu does a great job of eludicating the rationale and benefits here.
  • 🟨 How to name functions: This is a great article that I keep referring people to.
  • 🟨 Redundant map: One of the top suggestions in my refactoring sessions, usually.
  • 🟨 Elements of Clojure: This is a gold mine on naming things well.
  • 🟨 Namespace organisation: The fundamentals are solid in this article. I might use namespaces for large sections of code though.
  • 🟩 The sequences part of Programming Clojure: This is a lucid introduction to interface design used in clojure.core for sequences. However, it's broadly applicable for interface / protocol design in applications as well.

Functional programming for people coming from OO

Beyond the basics

These aren't essential to learning Clojure, but they open up your mind to certain surprising paradigms of thought. I haven't had the time to write about them yet.

JVM

TODO: Testing in Clojure

  • 🟨 TDD vs REPL DD
  • 🟨 Generative testing
  • 🟩 Sandy's video
  • 🟨 Lambda island, and Eric normand episodes

Other such lists

@ssrihari
Copy link
Author

ssrihari commented Dec 2, 2022

Thanks to:

@esuomi
Copy link

esuomi commented Dec 2, 2022

Hi, wonderful list! Here's a few more links/notes I'd add as well:

  • Book Clojure: The Essential Reference
  • Style Guide I think that instead of linking to the GitHub repository, you should link to https://guide.clojure.style/ :)
  • Documentation ClojureDocs is IMHO the most essential documentation for Clojure API documentation, as the community driven effort to add examples and various links to similar functions between each API function is especially useful for newbies and a bit more seasoned devs alike. In fact this is pretty much the first link I always share when someone's starting with Clojure, it's just so useful.

@wedesoft
Copy link

wedesoft commented Dec 2, 2022

I found Clojure in Action (2nd edition) to be a very thorough introduction to Clojure.

@port19x
Copy link

port19x commented Dec 3, 2022

Brave Clojure would be a good fit for "getting into the language".
It, reffering to mostly chapter 3, got me into the language in one day.

That was with one month of haskell experience solving problems on codewars , so no need to learn functional concepts.

codewars is a decent addition to "Exercises", tho the number of available clojure Kata isn't as high as I'd like it to be.

@niquola
Copy link

niquola commented Dec 3, 2022

Excellent demonstration of REPL-driven development - Parens of Dead!

@chase-lambert
Copy link

In the exercises section you link to the Mars Rover problem. For those wanting to read an opinionated approach to solving it using Clojure, check out this guide: https://www.evalapply.org/posts/clojure-mars-rover/index.html

@prabhanshuguptagit
Copy link

This is a nice short guide to setup clojure.test for the testing section https://www.testcookbook.com/book/clojure/unit-test-with-clojure.html

@alishamohanty
Copy link

I find this Clojure cheatsheet very helpful for destructuring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment