Syntax, Forms and Evaluation

def, if, do, let*, quote, var, fn*, loop*, recur, throw, try, monitor-enter/monitor-exit, new, .

3.1 Prefix Notation and Forms

(+ 1 2 3)                 ; 6: (function arg1 arg2 ...)
(* 2 (+ 3 4))             ; 14
(str "a" "b" 1)           ; "ab1"
(max 3 9 2)               ; 9
(< 1 2 3)                 ; true (chained)
(= 1 1.0)                 ; false (different numeric categories)
(== 1 1.0)                ; true (numeric equality)

3.2 Evaluation Rules

Literals (numbers, strings, keywords, booleans, nil) evaluate to themselves.

Symbols resolve to vars, locals, or Java classes.

Lists are calls: the first element is a function, macro, or special form.

Vectors, maps, and sets evaluate their elements.

'(1 2 3)                  ; quote: the list itself, unevaluated
(quote (+ 1 2))           ; (+ 1 2)
(eval '(+ 1 2))           ; 3
`(a b ~(+ 1 2))           ; syntax-quote: (user/a user/b 3)

3.3 Special Forms

def, if, do, let*, quote, var, fn*, loop*, recur, throw, try, monitor-enter/monitor-exit, new, . (dot), set!, letfn*, case*, import*, reify*, deftype*. Almost everything else (defn, when, cond, let, ->) is a macro built on these.

3.4 Reader Syntax

Ignore the next form (discard) (comment...) Rich comment block (returns nil; used for REPL experiments)

` x `, ~x, ~@x | Syntax quote, unquote, unquote-splicing ^{:doc "..."}, ^String` Metadata, type hints

Anonymous function literal (%, %1, %2, %&) #inst "2025-10-24", #uuid "..." #?(:clj...:cljs...) Reader conditionals (.cljc files) \a, \newline