Learn Clojure, a functional Lisp on the JVM: printing, immutable values, decisions, loop/recur, functions, vectors and maps, ending with a small receipt program.
8 lessons, 16 exercises. Runs Clojure 1.12.
Not started
Hello, output
Print text with println, print and printf, write comments, and learn how Clojure reads and runs your code.
Values and names
Name values with def and let, meet Clojure's basic types, and see why values never change.
Reading input and arithmetic
Read lines from standard input, turn text into numbers, and calculate with Clojure's prefix arithmetic.
Making decisions
Choose between values with if, when, cond and case, using comparisons, and/or/not and Clojure's idea of truthiness.
Loops and recursion
Repeat work with doseq and dotimes for side effects, and with loop/recur when you need to compute a result or stop early.
Functions
Define functions with defn, give them parameters and results, write quick anonymous functions, and keep names local.
Vectors and maps
Hold many values in vectors and maps, transform them with map, filter and reduce, and count things with frequencies.
Strings and a small project
Slice, split, join and format strings with clojure.string, then combine everything so far into a receipt printer.
Your progress is saved in this browser. Sign in to keep it on every device.