Conditional analysis for if, if-not, when, when-not, if-let,
when-let, if-some, when-some, when-first, cond, case, and condp forms.
Transforms conditional expressions into CoreAST {:if, ...} nodes,
using callback functions for analyzing sub-expressions and wrapping bodies.
Summary
Functions
Analyzes a case form. Desugars to a let binding + nested if with equality checks.
Analyzes a cond form. Desugars to nested if expressions.
Analyzes a condp form. Desugars to let bindings + nested if with predicate calls.
Analyzes an if form.
Analyzes an if-let form. Desugars to (let [x cond] (if x then else)).
Analyzes an if-not form. Desugars by swapping then/else branches.
Analyzes an if-some form. Desugars to (let [x expr] (if (nil? x) else then)).
Analyzes a when form. Desugars to (if cond (do body...) nil).
Analyzes a when-first form.
Analyzes a when-let form. Desugars to (let [x cond] (if x body nil)).
Analyzes a when-not form. Desugars to (if cond nil (do body...)).
Analyzes a when-some form. Desugars to (let [x expr] (if (nil? x) nil (do body...))).
Functions
Analyzes a case form. Desugars to a let binding + nested if with equality checks.
Test values must be compile-time constants (keywords, strings, numbers, booleans, nil).
Grouped values (:a :b) match any value in the group.
Returns nil if no match and no default.
Analyzes a cond form. Desugars to nested if expressions.
Analyzes a condp form. Desugars to let bindings + nested if with predicate calls.
Calls (pred test-val expr) for each clause. Both pred and expr are evaluated exactly once.
Returns nil if no match and no default.
The :>> form is not supported.
Analyzes an if form.
Analyzes an if-let form. Desugars to (let [x cond] (if x then else)).
Analyzes an if-not form. Desugars by swapping then/else branches.
Analyzes an if-some form. Desugars to (let [x expr] (if (nil? x) else then)).
Unlike if-let, if-some only tests for nil — false binds successfully.
Analyzes a when form. Desugars to (if cond (do body...) nil).
Analyzes a when-first form.
Desugars to:
(let [__wf (seq coll)]
(if (nil? __wf)
nil
(let [x (first __wf)]
(do body...))))Binds coll once via seq to avoid double evaluation, then binds the
first element if the sequence is non-empty.
Analyzes a when-let form. Desugars to (let [x cond] (if x body nil)).
Analyzes a when-not form. Desugars to (if cond nil (do body...)).
Analyzes a when-some form. Desugars to (let [x expr] (if (nil? x) nil (do body...))).
Unlike when-let, when-some only tests for nil — false binds successfully.