Back to Blog

Clojure for Beginners: S-Expressions & Syntax

Celest KimCelest Kim

Video: Clojure S-Expressions & Syntax — The One Rule You Need | Ep 2 by CelesteAI

Watch full page →

S-Expressions & Syntax — The One Rule You Need

The parentheses scared you off Lisp once. In this episode we master Clojure's syntax in five minutes flat. Clojure has exactly one rule — prefix notation — and once you see it, you can read any Clojure code.

Code

;; Episode 2: S-Expressions and Syntax
;; Clojure for Beginners in Neovim

;; Prefix notation — function first, arguments after
(println (+ 1 2 3))

;; Variable arity — as many args as you want
(println (* 2 3 4 5))

;; Nested expressions evaluate inside-out
(println (+ 10 (* 2 3)))

;; Code is data — a quoted list is a list
(println '(+ 1 2 3))
(println (first '(+ 1 2 3)))

Key Points

  • Prefix notation: function first, arguments after. Every time.
  • Variable arity: core operators take any number of arguments.
  • Nesting: inner expressions evaluate inside-out.
  • Code is data: a quoted list has the same shape as code.

Watch the video above for a full walkthrough — every keystroke is shown so you can code along.

Student code: GitHub