preludes / kernel.lisp
kernel
Kernel macros. The control-flow and threading sugar every program uses, written as ordinary Forma macros.
kernel.forma is the same library as an exported file module, regenerated from kernel.lisp.
From the source
Purpose: Core control-flow and threading macros, expanded before checking and evaluation. Requires: Core reader and macro evaluator; no descriptor preludes. Used by: Descriptor bootstrap and, via generated kernel.forma, explicit file-module imports.
Macros 8
Syntax rewrites expanded before evaluation and type checking.
(not x)kernel.lisp:8
logical negation
(when test body ...)kernel.lisp:11
conditional with implicit do
(unless test body ...)kernel.lisp:14
inverse conditional with implicit do
(cond clauses ...)kernel.lisp:23
multi-branch conditional (cond (> x 0) "positive" (< x 0) "negative" :else "zero")
(and args ...)kernel.lisp:39
short-circuit logical AND (and x y z) expands to nested let/if that stops on first falsy value
(or args ...)kernel.lisp:51
short-circuit logical OR (or x y z) expands to nested let/if that stops on first truthy value
(-> x forms ...)kernel.lisp:63
thread-first (-> x (f a) (g b)) expands to (g (f x a) b)
(->> x forms ...)kernel.lisp:81
thread-last (->> x (f a) (g b)) expands to (g b (f a x))