bind
Immutable binding → const
(bind name "Flavoparmelia caperata")
Reference
Every kernel and surface form, organized by category. Click any form for its full documentation in the book.
bindImmutable binding → const
(bind name "Flavoparmelia caperata")
bind with typeTyped binding with runtime check
(bind :number x (parse input))
cellMutable container → { value: x }
(bind count (cell 0))
swap! · reset! · expressCell operations
(swap! count (fn (:number n) (+ n 1)))
(reset! count 0)
(express count) ;; → current value
funcNamed function → function
(func add
:args (:number a :number b)
:returns :number
:body (+ a b))
fn · lambdaAnonymous function → arrow / lambda
(fn (:number x) (* x 2))
func multi-clauseDispatch by type
(func describe
(:args (:string x) :body ...)
(:args (:number x) :body ...))
:pre · :postDesign by contract
(func withdraw
:args (:number amount)
:pre (> amount 0)
:body ...)
typeAlgebraic data type
(type Option
(Some :any value)
None)
matchExhaustive pattern matching
(match opt
((Some v) (use v))
(None (fallback)))
match structuralPattern match on plain objects
(match response
((obj :ok true :data d) d)
(_ (handle-error)))
objObject literal with keywords
(obj :name "Flavoparmelia caperata"
:age 42)
ifConditional
(if (> x 0) "positive" "non-positive")
if-let · when-letConditional binding
(if-let (result (find-user id))
(render result)
(show-404))
for-of · for-in · forIteration
(for-of item items
(console:log item))
try · catch · finallyException handling
(try
(risky-op)
(catch e (handle e))
(finally (cleanup)))
-> · ->>Thread first / thread last
(-> x (f) (g) (h))
;; → (h (g (f x)))
some-> · some->>Nil-safe threading
(some-> user
(:address)
(:city)
(:to-upper-case))
assoc · dissoc · conjImmutable updates
(assoc user :name "New")
(dissoc user :temp)
(conj items new-item)
import · exportES Modules
(import "./lib.js" (add))
(export (bind x 42))
async · awaitAsync functions
(async (func fetch-data
:body
(bind res (await (fetch url)))
(await (res:json))))
js: namespaceEscape to raw JS operations
(js:typeof x)
(js:eq x null)
(js:eval "1 + 2")