314 documented stdlib functions across sequences, predicates, math, maps, strings, and more.
(not value)
Returns false for truthy values and true for falsy values.
Arity: 1 · Return: false for truthy values and true for falsy values ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
(not false)
;=> true
(assert condition ...message)
Throws when condition is falsy. Returns nil when the assertion passes.
Arity: 1+ · Return: Throws when condition is falsy · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: may throw
No verified inline example: the interesting failure path is an intentional thrown error.
(str ...args)
Concatenates the string representation of all arguments. nil renders as an
empty string.
Arity: 0+ · Return: Concatenates the string representation of all arguments · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: not, assert, contains?, xor
(str "a" 1 nil "b")
;=> "a1b"
(contains? coll key)
Returns true when coll contains key: Set/Map membership, array/string index,
or object own key.
Arity: 2 · Return: true when coll contains key: Set/Map membership,
array/string index, or object own key · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: assert, str, xor, print
(contains? [10 20 30] 1)
;=> true
(xor a b)
Returns b when a is falsy, otherwise the logical negation of b.
Arity: 2 · Return: b when a is falsy, otherwise the logical negation of b
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: str, contains?, print, add-tap
(xor true false)
;=> true
(print ...args)
Prints arguments WITHOUT a trailing newline where the host has a raw sink (hql_print_writer or Deno stdout); browser hosts fall back to console.log. Typed print options delegate to a host formatter.
Arity: 0+ · Return: Prints arguments WITHOUT a trailing newline where the host has a raw sink (hql_print_writer or Deno stdout); browser hosts fall back to console.log · Evaluation: eager · Effects: output side effect · Host: portable stdlib · Throws: not documented as throwing
Related: contains?, xor, add-tap, remove-tap
No verified inline example: writes to stdout and would pollute the example verifier output.
(add-tap f)
Adds f to the tap> notification set and returns nil.
Arity: 1 · Return: Adds f to the tap> notification set and returns nil ·
Evaluation: eager · Effects: output side effect · Host: portable stdlib ·
Throws: not documented as throwing
Related: xor, print, remove-tap, tap>
No verified inline example: mutates process-local tap subscribers.
(remove-tap f)
Removes f from the tap> notification set and returns nil.
Arity: 1 · Return: Removes f from the tap> notification set and returns nil ·
Evaluation: eager · Effects: output side effect · Host: portable stdlib ·
Throws: not documented as throwing
Related: print, add-tap, tap>, println
No verified inline example: mutates process-local tap subscribers.
(tap> x)
Sends x to every registered tap function and returns true.
Arity: 1 · Return: Sends x to every registered tap function and returns true
· Evaluation: eager · Effects: output side effect · Host: portable stdlib ·
Throws: not documented as throwing
Related: add-tap, remove-tap, println
No verified inline example: depends on process-local tap subscribers.
(println ...args)
Prints arguments followed by a newline.
Arity: 0+ · Return: Prints arguments followed by a newline · Evaluation: eager · Effects: output side effect · Host: portable stdlib · Throws: not documented as throwing
Related: remove-tap, tap>
No verified inline example: writes to stdout and would pollute the example verifier output.
(take n ...args)
Returns a lazy sequence of the first n items from coll. With only n,
returns the take transducer.
Arity: 1+ · Return: a lazy sequence of the first n items from coll ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
(take 2 [1 2 3 4])
;=> (1 2)
(drop n ...args)
Returns a lazy sequence of all but the first n items from coll. With only
n, returns the drop transducer.
Arity: 1+ · Return: a lazy sequence of all but the first n items from coll
· Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
(drop 2 [1 2 3 4])
;=> (3 4)
(map f ...colls)
Returns a lazy sequence consisting of (f x) for each x in coll. With only
f, returns the map transducer.
Arity: 1+ · Return: a lazy sequence consisting of (f x) for each x in
coll · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: take, drop, filter, reduce
(map (fn [x] (* x x)) [1 2 3])
;=> (1 4 9)
(filter pred ...args)
Returns a lazy sequence of items from coll for which (pred item) is truthy.
With only pred, returns the filter transducer.
Arity: 1+ · Return: a lazy sequence of items from coll for which
(pred item) is truthy · Evaluation: lazy · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: drop, map, reduce, reduce-kv
(filter odd? [1 2 3 4 5])
;=> (1 3 5)
(reduce f ...args)
Reduces coll with f, optionally starting from init. Honors (reduced x)
for early termination.
Arity: 1+ · Return: Reduces coll with f, optionally starting from init ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: map, filter, reduce-kv, concat
(reduce + [1 2 3 4])
;=> 10
(reduce-kv f init coll ...extra)
Reduces a map-like collection as (f acc key value) or a vector as
(f acc index value). Honors (reduced x).
Arity: 3+ · Return: Reduces a map-like collection as (f acc key value) or a
vector as (f acc index value) · Evaluation: eager · Effects: pure/derived
value · Host: portable stdlib · Throws: not documented as throwing
Related: filter, reduce, concat, list*
(reduce-kv (fn [acc k v] (+ acc v)) 0 {:a 1 :b 2})
;=> 3
(concat ...colls)
Returns a lazy sequence concatenating the items of all collections.
Arity: 0+ · Return: a lazy sequence concatenating the items of all collections · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: reduce, reduce-kv, list*, flatten
(concat [1 2] [3 4])
;=> (1 2 3 4)
(list* x ...more)
Returns a seq made by consing leading args onto the final seqable arg.
Arity: 1+ · Return: a seq made by consing leading args onto the final seqable arg · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: reduce-kv, concat, flatten, tree-seq
(list* 1 2 [3 4])
;=> (1 2 3 4)
(flatten coll)
Recursively flattens nested iterables into a single lazy sequence. Strings are treated as scalars.
Arity: 1 · Return: Recursively flattens nested iterables into a single lazy sequence · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: concat, list*, tree-seq, distinct
(flatten [1 [2 [3 4]]])
;=> (1 2 3 4)
(tree-seq branch? children root ...extra)
Returns a lazy preorder traversal of root, descending through
(children node) when (branch? node) is truthy.
Arity: 3+ · Return: a lazy preorder traversal of root, descending through
(children node) when (branch? node) is truthy · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: list*, flatten, distinct, next
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(distinct ...args)
Returns a lazy sequence of unique items from coll, preserving order. With no
args, returns the distinct transducer.
Arity: 0+ · Return: a lazy sequence of unique items from coll, preserving
order · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: flatten, tree-seq, next, nth
(distinct [1 1 2 3 3])
;=> (1 2 3)
(next coll)
Returns a seq of the items after the first, or nil when there are none.
Arity: 1 · Return: a seq of the items after the first, or nil when there are
none · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: tree-seq, distinct, nth, second
(next [1 2 3])
;=> (2 3)
(nth coll index ...args)
Returns the item at index i. Throws on out-of-bounds unless not-found is
provided.
Arity: 2+ · Return: the item at index i · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: may throw
Related: distinct, next, second, count
(nth [10 20 30] 1)
;=> 20
(second coll)
Returns the second item of coll, or nil.
Arity: 1 · Return: the second item of coll, or nil · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: next, nth, count, last
(second [1 2 3])
;=> 2
(count coll)
Returns the number of items in coll. O(1) for arrays, strings, Set/Map, plain
objects, and counted seqs; O(n) otherwise.
Arity: 1 · Return: the number of items in coll · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: nth, second, last, first
(count [1 2 3])
;=> 3
(last coll)
Returns the last item of coll, or nil for empty colls.
Arity: 1 · Return: the last item of coll, or nil for empty colls ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: second, count, first, rest
(last [1 2 3])
;=> 3
(first coll)
Returns the first item of coll, or nil for an empty/nil collection.
Arity: 1 · Return: the first item of coll, or nil for an empty/nil collection
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: count, last, rest, cons
(first [1 2 3])
;=> 1
(rest coll)
Returns a sequence of all items after the first. Empty/nil collections return an empty sequence.
Arity: 1 · Return: a sequence of all items after the first · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: last, first, cons, seq
(rest [1 2 3])
;=> (2 3)
(cons x coll)
Returns a sequence with x prepended to coll.
Arity: 2 · Return: a sequence with x prepended to coll · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: first, rest, seq, range
(cons 0 [1 2])
;=> (0 1 2)
(seq coll)
Returns a sequence over coll, or nil when coll is nil or empty.
Arity: 1 · Return: a sequence over coll, or nil when coll is nil or empty ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
(seq [1 2 3])
;=> (1 2 3)
(range start end step)
Returns a lazy numeric range. With no args, starts at 0; with one arg, returns 0 through end-1; with start/end/step, returns that stepped range.
Arity: 3 · Return: a lazy numeric range · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(range 5)
;=> (0 1 2 3 4)
(map-indexed f coll)
Returns a lazy sequence of (f index item) over coll.
Arity: 2 · Return: a lazy sequence of (f index item) over coll ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: keep-indexed, mapcat
(map-indexed (fn [i x] [i x]) ["a" "b"])
;=> ([0 "a"] [1 "b"])
(keep-indexed f coll)
Like map-indexed but drops nil results. Returns a lazy sequence.
Arity: 2 · Return: Like map-indexed but drops nil results · Evaluation: lazy
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: map-indexed, mapcat, keep
(keep-indexed (fn [i x] (if (odd? i) x nil)) [10 20 30 40])
;=> (20 40)
(mapcat f ...colls)
Returns a lazy concatenation of mapped collections. With only f, returns the
mapcat transducer.
Arity: 1+ · Return: a lazy concatenation of mapped collections · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: map-indexed, keep-indexed, keep, take-while
(mapcat (fn [x] [x x]) [1 2])
;=> (1 1 2 2)
(keep f ...args)
Returns non-nil results of (f item) over coll. With only f, returns the
keep transducer.
Arity: 1+ · Return: non-nil results of (f item) over coll · Evaluation:
lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: keep-indexed, mapcat, take-while, drop-while
(keep (fn [x] (if (odd? x) x nil)) [1 2 3 4])
;=> (1 3)
(take-while pred ...args)
Returns a lazy sequence of items from coll while (pred item) is truthy. With
only pred, returns the take-while transducer.
Arity: 1+ · Return: a lazy sequence of items from coll while (pred item) is
truthy · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: mapcat, keep, drop-while, split-with
(take-while (fn [x] (< x 3)) [1 2 3 4 1])
;=> (1 2)
(drop-while pred ...args)
Returns a lazy sequence of items from coll starting at the first one where
(pred item) is falsy. With only pred, returns the drop-while transducer.
Arity: 1+ · Return: a lazy sequence of items from coll starting at the first
one where (pred item) is falsy · Evaluation: lazy · Effects: pure/derived
value · Host: portable stdlib · Throws: not documented as throwing
Related: keep, take-while, split-with, split-at
(drop-while (fn [x] (< x 3)) [1 2 3 4 1])
;=> (3 4 1)
(split-with pred coll)
Returns [(take-while pred coll), (drop-while pred coll)] as a tuple of two
realized arrays.
Arity: 2 · Return: [(take-while pred coll), (drop-while pred coll)] as a
tuple of two realized arrays · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
Related: take-while, drop-while, split-at, nthrest
(split-with (fn [x] (< x 3)) [1 2 3 4])
;=> [[1, 2], [3, 4]]
(split-at n coll)
Returns [(take n coll), (drop n coll)] as a tuple of two realized arrays.
Arity: 2 · Return: [(take n coll), (drop n coll)] as a tuple of two realized
arrays · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: drop-while, split-with, nthrest, nthnext
(split-at 2 [1 2 3 4])
;=> [[1, 2], [3, 4]]
(nthrest coll n)
Returns the seq after dropping n items from coll; returns nil for nil input.
Arity: 2 · Return: the seq after dropping n items from coll; returns nil
for nil input · Evaluation: lazy · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: split-with, split-at, nthnext, splitv-at
(nthrest [1 2 3 4 5] 2)
;=> (3 4 5)
(nthnext coll n)
Returns (seq (nthrest coll n)), or nil when no items remain.
Arity: 2 · Return: (seq (nthrest coll n)), or nil when no items remain ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: split-at, nthrest, splitv-at, take-nth
(nthnext [1 2 3 4 5] 2)
;=> (3 4 5)
(splitv-at n coll)
Returns a persistent vector of two persistent vectors: (take n coll) and
(drop n coll).
Arity: 2 · Return: a persistent vector of two persistent vectors:
(take n coll) and (drop n coll) · Evaluation: eager · Effects: pure/derived
value · Host: portable stdlib · Throws: not documented as throwing
Related: nthrest, nthnext, take-nth, reductions
(splitv-at 2 [1 2 3 4])
;=> [[1 2] [3 4]]
(take-nth n coll)
Returns a lazy sequence of every nth item from coll.
Arity: 2 · Return: a lazy sequence of every nth item from coll · Evaluation:
lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: nthnext, splitv-at, reductions, interpose
(take-nth 2 [1 2 3 4 5 6])
;=> (1 3 5)
(reductions f ...args)
Returns a lazy sequence of intermediate values from a reduce over coll. With
an init: (reductions f init coll); without: uses the first element.
(reductions + [1, 2, 3, 4]) ⇒ (1 3 6 10).
Arity: 1+ · Return: a lazy sequence of intermediate values from a reduce over
coll · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: splitv-at, take-nth, interpose, interleave
(reductions + [1 2 3 4])
;=> (1 3 6 10)
(interpose sep coll)
Returns a lazy sequence of coll with sep placed between each pair of
elements. (interpose "x" [1, 2, 3]) ⇒ (1 "x" 2 "x" 3).
Arity: 2 · Return: a lazy sequence of coll with sep placed between each
pair of elements · Evaluation: lazy · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: take-nth, reductions, interleave, partition
(interpose "x" [1 2 3])
;=> (1 "x" 2 "x" 3)
(interleave ...colls)
Returns a lazy sequence of the first item in each coll, then the second, etc.
(interleave [1, 2, 3] ["a", "b", "c"]) ⇒ (1 "a" 2 "b" 3 "c").
Arity: 0+ · Return: a lazy sequence of the first item in each coll, then the second, etc · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: reductions, interpose, partition, partition-all
(interleave [1 2 3] ["a" "b" "c"])
;=> (1 "a" 2 "b" 3 "c")
(partition n ...args)
Returns lazy chunks of n items from coll. Supports (partition n coll),
(partition n step coll), and (partition n step pad coll).
Arity: 1+ · Return: lazy chunks of n items from coll · Evaluation: lazy ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: interpose, interleave, partition-all, partitionv
(partition 2 [1 2 3 4 5])
;=> ([1, 2] [3, 4])
(partition-all n ...args)
Like partition but keeps the trailing incomplete group. With only n, returns
the partition-all transducer.
Arity: 1+ · Return: Like partition but keeps the trailing incomplete group ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: interleave, partition, partitionv, partitionv-all
(partition-all 2 [1 2 3 4 5])
;=> ([1, 2] [3, 4] [5])
(partitionv n ...args)
Like partition, but each emitted group is a persistent vector.
Arity: 1+ · Return: Like partition, but each emitted group is a persistent
vector · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: partition, partition-all, partitionv-all, partition-by
(partitionv 2 [1 2 3 4])
;=> ([1 2] [3 4])
(partitionv-all n ...args)
Like partition-all, but each emitted group is a persistent vector.
Arity: 1+ · Return: Like partition-all, but each emitted group is a
persistent vector · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: partition-all, partitionv, partition-by, drop-last
(partitionv-all 2 [1 2 3 4 5])
;=> ([1 2] [3 4] [5])
(partition-by f coll)
Returns a lazy sequence of runs from coll, splitting whenever (f item)
changes.
Arity: 2 · Return: a lazy sequence of runs from coll, splitting whenever
(f item) changes · Evaluation: lazy · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: partitionv, partitionv-all, drop-last, take-last
(partition-by odd? [1 1 2 2 3])
;=> ([1, 1] [2, 2] [3])
(drop-last ...args)
Returns a seq of all but the last n items of coll; n defaults to 1.
Arity: 0+ · Return: a seq of all but the last n items of coll; n defaults
to 1 · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: partitionv-all, partition-by, take-last, butlast
(drop-last [1 2 3])
;=> (1 2)
(take-last n coll)
Returns a seq of the last n items of coll.
Arity: 2 · Return: a seq of the last n items of coll · Evaluation: lazy ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: partition-by, drop-last, butlast, ffirst
(take-last 2 [1 2 3 4])
;=> (3 4)
(butlast coll)
Returns a seq of all but the last item of coll, or nil when there are fewer
than two items.
Arity: 1 · Return: a seq of all but the last item of coll, or nil when
there are fewer than two items · Evaluation: lazy · Effects: pure/derived value
· Host: portable stdlib · Throws: not documented as throwing
Related: drop-last, take-last, ffirst, fnext
(butlast [1 2 3])
;=> (1 2)
(ffirst coll)
Equivalent to (first (first coll)).
Arity: 1 · Return: Equivalent to (first (first coll)) · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: take-last, butlast, fnext, nfirst
(ffirst [[1 2] [3 4]])
;=> 1
(fnext coll)
Equivalent to (first (next coll)).
Arity: 1 · Return: Equivalent to (first (next coll)) · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: butlast, ffirst, nfirst, nnext
(fnext [1 2 3])
;=> 2
(nfirst coll)
Equivalent to (next (first coll)).
Arity: 1 · Return: Equivalent to (next (first coll)) · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
(nfirst [[1 2 3] [4]])
;=> (2 3)
(nnext coll)
Equivalent to (next (next coll)).
Arity: 1 · Return: Equivalent to (next (next coll)) · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
(nnext [1 2 3 4])
;=> (3 4)
(empty? coll)
Returns true when coll has no items.
Arity: 1 · Return: true when coll has no items · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
(empty? [])
;=> true
(some pred coll)
Returns the first truthy (pred item) result from coll, or nil if none.
Short-circuits.
Arity: 2 · Return: the first truthy (pred item) result from coll, or nil
if none · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: empty?, every?, not-any?
(some odd? [2 4 5])
;=> true
(every? pred coll)
Returns true when (pred item) is truthy for every item in coll. Empty
collection returns true (vacuous). Short-circuits on first falsy.
Arity: 2 · Return: true when (pred item) is truthy for every item in coll
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: empty?, some, not-any?, not-every?
(every? odd? [1 3 5])
;=> true
(not-any? pred coll)
Returns true when (pred item) is falsy for every item in coll. The
complement of some.
Arity: 2 · Return: true when (pred item) is falsy for every item in coll
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: some, every?, not-every?, some?
(not-any? odd? [2 4 6])
;=> true
(not-every? pred coll)
Returns true when at least one item in coll makes (pred item) falsy. The
complement of every.
Arity: 2 · Return: true when at least one item in coll makes (pred item)
falsy · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: every?, not-any?, some?, any?
(not-every? odd? [1 2 3])
;=> true
(some? x)
Returns true when x is neither null nor undefined (0, false, "" all
qualify as some).
Arity: 1 · Return: true when x is neither null nor undefined (0, false,
"" all qualify as some) · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
Related: not-any?, not-every?, any?, boolean
(some? nil)
;=> false
(any? x)
Returns true for any value, including nil.
Arity: 1 · Return: true for any value, including nil · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: not-every?, some?, boolean, associative?
(any? nil)
;=> true
(boolean x)
Returns false only for nil and false; true for every other value.
Arity: 1 · Return: false only for nil and false; true for every other value · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: some?, any?, associative?, coll?
(boolean 0)
;=> true
(associative? x)
Returns true for map-like and vector-like collections.
Arity: 1 · Return: true for map-like and vector-like collections · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: any?, boolean, coll?, counted?
(associative? {:a 1})
;=> true
(coll? x)
Returns true for HQL and JS collection values, excluding nil and strings.
Arity: 1 · Return: true for HQL and JS collection values, excluding nil and strings · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: boolean, associative?, counted?, seq?
(coll? [1 2])
;=> true
(counted? x)
Returns true when count can be answered without walking a seq.
Arity: 1 · Return: true when count can be answered without walking a seq ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: associative?, coll?, seq?, seqable?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(seq? x)
Returns true when x is an HQL seq value.
Arity: 1 · Return: true when x is an HQL seq value · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: coll?, counted?, seqable?, sequential?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(seqable? x)
Returns true when x can be passed to seq.
Arity: 1 · Return: true when x can be passed to seq · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: counted?, seq?, sequential?, nil?
(seqable? "ab")
;=> true
(sequential? x)
Returns true for list/vector/seq-like collections.
Arity: 1 · Return: true for list/vector/seq-like collections · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: seq?, seqable?, nil?, null?
(sequential? [1 2])
;=> true
(nil? x)
Returns true when x is null or undefined.
Arity: 1 · Return: true when x is null or undefined · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: seqable?, sequential?, null?, undefined?
(nil? nil)
;=> true
(null? x)
Returns true when x is exactly null.
Arity: 1 · Return: true when x is exactly null · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: sequential?, nil?, undefined?, defined?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(undefined? x)
Returns true when x is exactly undefined.
Arity: 1 · Return: true when x is exactly undefined · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: nil?, null?, defined?, even?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(defined? x)
Returns true when x is not undefined.
Arity: 1 · Return: true when x is not undefined · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: null?, undefined?, even?, odd?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(even? n)
Returns true when n is an even integer.
Arity: 1 · Return: true when n is an even integer · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: undefined?, defined?, odd?, zero?
(even? 4)
;=> true
(odd? n)
Returns true when n is an odd integer.
Arity: 1 · Return: true when n is an odd integer · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: defined?, even?, zero?, pos?
(odd? 3)
;=> true
(zero? n)
Returns true when n equals 0.
Arity: 1 · Return: true when n equals 0 · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: even?, odd?, pos?, neg?
(zero? 0)
;=> true
(pos? n)
Returns true when n > 0.
Arity: 1 · Return: true when n > 0 · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: odd?, zero?, neg?, NaN?
(pos? 3)
;=> true
(neg? n)
Returns true when n < 0.
Arity: 1 · Return: true when n < 0 · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: zero?, pos?, NaN?, infinite?
(neg? -2)
;=> true
(NaN? x)
Returns true when x is the JavaScript NaN value.
Arity: 1 · Return: true when x is the JavaScript NaN value · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: pos?, neg?, infinite?, inst?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(infinite? x)
Returns true when x is positive or negative infinity.
Arity: 1 · Return: true when x is positive or negative infinity · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: neg?, NaN?, inst?, inst-ms
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(inst? x)
Returns true when x is a JavaScript Date.
Arity: 1 · Return: true when x is a JavaScript Date · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: NaN?, infinite?, inst-ms, instance?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(inst-ms x)
Returns the epoch millisecond value of a Date.
Arity: 1 · Return: the epoch millisecond value of a Date · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: infinite?, inst?, instance?, uri?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(instance? cls x)
Returns true when x is an instance of constructor cls.
Arity: 2 · Return: true when x is an instance of constructor cls ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: inst?, inst-ms, uri?, number?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(uri? x)
Returns true when x is a JavaScript URL.
Arity: 1 · Return: true when x is a JavaScript URL · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: inst-ms, instance?, number?, string?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(number? x)
Returns true when x is a number.
Arity: 1 · Return: true when x is a number · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: instance?, uri?, string?, boolean?
(number? 42)
;=> true
(string? x)
Returns true when x is a string.
Arity: 1 · Return: true when x is a string · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: uri?, number?, boolean?, fn?
(string? "x")
;=> true
(boolean? x)
Returns true when x is a boolean.
Arity: 1 · Return: true when x is a boolean · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: number?, string?, fn?, ifn?
(boolean? true)
;=> true
(fn? x)
Returns true when x is a function.
Arity: 1 · Return: true when x is a function · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: string?, boolean?, ifn?, array?
(fn? inc)
;=> true
(ifn? x)
Returns true for values HQL can invoke directly as a function call.
Arity: 1 · Return: true for values HQL can invoke directly as a function call · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: boolean?, fn?, array?, indexed?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(array? x)
Returns true when x is a JavaScript array.
Arity: 1 · Return: true when x is a JavaScript array · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: fn?, ifn?, indexed?, object?
(array? [1, 2])
;=> true
(indexed? x)
Returns true for collections addressable by integer index in O(1).
Arity: 1 · Return: true for collections addressable by integer index in O(1) · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: ifn?, array?, object?, array
(indexed? [1 2 3])
;=> true
(object? x)
Returns true when x is a plain object (not nil, not an array).
Arity: 1 · Return: true when x is a plain object (not nil, not an array) ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: array?, indexed?, array, vector
(object? {a: 1})
;=> true
(array ...items)
Returns a fresh JavaScript array containing items.
Arity: 0+ · Return: a fresh JavaScript array containing items · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: indexed?, object?, vector, persistent-map
(array 1 2 3)
;=> [1, 2, 3]
(vector ...items)
Returns an immutable HQL persistent vector with structural updates.
Arity: 0+ · Return: an immutable HQL persistent vector with structural updates · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: object?, array, persistent-map, array-map
(vector 1 2 3)
;=> [1 2 3]
(persistent-map ...entries)
Returns an immutable persistent map. Keys compare by structural value, not JS object identity.
Arity: 0+ · Return: an immutable persistent map · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: array, vector, array-map, persistent-set
(persistent-map :a 1 :b 2)
;=> {:a 1 :b 2}
(array-map ...entries)
Returns a persistent map from alternating key/value arguments.
Arity: 0+ · Return: a persistent map from alternating key/value arguments · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: vector, persistent-map, persistent-set, persistent-vector?
(array-map :a 1 :b 2)
;=> {:a 1 :b 2}
(persistent-set ...items)
Returns an immutable persistent set. Values compare by structural value, not JS object identity.
Arity: 0+ · Return: an immutable persistent set · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: persistent-map, array-map, persistent-vector?, persistent-map?
(persistent-set 1 2 2 3)
;=> #[2 3 1]
(persistent-vector? x)
Returns true when x is an HQL persistent vector.
Arity: 1 · Return: true when x is an HQL persistent vector · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: array-map, persistent-set, persistent-map?, persistent-set?
(persistent-vector? [1 2 3])
;=> true
(persistent-map? x)
Returns true when x is an HQL persistent map.
Arity: 1 · Return: true when x is an HQL persistent map · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: persistent-set, persistent-vector?, persistent-set?, map-entry?
(persistent-map? {:a 1})
;=> true
(persistent-set? x)
Returns true when x is an HQL persistent set.
Arity: 1 · Return: true when x is an HQL persistent set · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: persistent-vector?, persistent-map?, map-entry?, to-js
(persistent-set? #[1 2])
;=> true
(map-entry? x)
Returns true for HQL map-entry shaped key/value pairs.
Arity: 1 · Return: true for HQL map-entry shaped key/value pairs · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: persistent-map?, persistent-set?, to-js, from-js
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(to-js x)
Recursively converts HQL persistent collections to plain JavaScript arrays, objects, Maps, and Sets.
Arity: 1 · Return: Recursively converts HQL persistent collections to plain JavaScript arrays, objects, Maps, and Sets · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: persistent-set?, map-entry?, from-js, delay?
(to-js [1 2 3])
;=> [1, 2, 3]
(from-js x)
Recursively converts JavaScript arrays and plain objects/Maps to HQL persistent collections.
Arity: 1 · Return: Recursively converts JavaScript arrays and plain objects/Maps to HQL persistent collections · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: map-entry?, to-js, delay?, force
(from-js [1, 2, 3])
;=> [1 2 3]
(delay? x)
Returns true when x is a Delay returned by the delay macro.
Arity: 1 · Return: true when x is a Delay returned by the delay macro ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: to-js, from-js, force, realized?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(force x)
Forces evaluation of a Delay x (memoized). Returns non-Delay values unchanged.
Arity: 1 · Return: Forces evaluation of a Delay x (memoized) · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: from-js, delay?, realized?, reduced?
(force 42)
;=> 42
(realized? coll)
Returns true when coll is nil, a forced Delay, or a realized LazySeq;
false otherwise.
Arity: 1 · Return: true when coll is nil, a forced Delay, or a realized
LazySeq; false otherwise · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
Related: delay?, force, reduced?, ensure-reduced
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(reduced? x)
Returns true when x is a reduced marker.
Arity: 1 · Return: true when x is a reduced marker · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: force, realized?, ensure-reduced, unreduced
(reduced? (reduced 5))
;=> true
(ensure-reduced x)
Returns x when it is already reduced, otherwise wraps it with reduced.
Arity: 1 · Return: x when it is already reduced, otherwise wraps it with
reduced · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: realized?, reduced?, unreduced
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(unreduced x)
Returns the value inside a reduced marker, or x unchanged when it is not
reduced.
Arity: 1 · Return: the value inside a reduced marker, or x unchanged when it
is not reduced · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: reduced?, ensure-reduced
(unreduced (reduced 5))
;=> 5
(inc x)
Returns x + 1.
Arity: 1 · Return: x + 1 · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
(inc 5)
;=> 6
(dec x)
Returns x - 1.
Arity: 1 · Return: x - 1 · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
(dec 5)
;=> 4
(abs x)
Returns the absolute value of x.
Arity: 1 · Return: the absolute value of x · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(abs -7)
;=> 7
(add ...nums)
Variadic addition. (add) ⇒ 0; (add x) ⇒ x; (add a b c ...) sums all args.
Arity: 0+ · Return: Variadic addition · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(add 1 2 3)
;=> 6
(sub ...nums)
Variadic subtraction. (sub) ⇒ 0; (sub x) ⇒ -x; (sub a b c ...) is
a - b - c - ....
Arity: 0+ · Return: Variadic subtraction · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(sub 10 3 2)
;=> 5
(mul ...nums)
Variadic multiplication. (mul) ⇒ 1; (mul x) ⇒ x; (mul a b c ...)
multiplies all.
Arity: 0+ · Return: Variadic multiplication · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(mul 2 3 4)
;=> 24
(div ...nums)
Variadic division. (div) ⇒ 1; (div x) ⇒ 1/x; (div a b c ...) is
a / b / c / ....
Arity: 0+ · Return: Variadic division · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(div 100 5 2)
;=> 10
(mod a b)
Returns a modulo b, floored so the result takes the sign of the divisor b
(mathematical modulo). (mod -7 3) ⇒ 2; (mod 7 -3) ⇒ -2. Use % for
truncated remainder.
Arity: 2 · Return: a modulo b, floored so the result takes the sign of the
divisor b (mathematical modulo) · Evaluation: eager · Effects: pure/derived
value · Host: portable stdlib · Throws: not documented as throwing
(mod -7 3)
;=> 2
(quot a b)
Returns the integer quotient of a / b, truncated toward zero.
Arity: 2 · Return: the integer quotient of a / b, truncated toward zero ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: div, mod, rem, bit-and
(quot 7 2)
;=> 3
(rem a b)
Returns the remainder of a / b with the sign of a.
Arity: 2 · Return: the remainder of a / b with the sign of a · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: mod, quot, bit-and, bit-or
(rem -7 3)
;=> -1
(bit-and x y ...more)
Returns the bitwise AND of two or more numbers using HQL's JavaScript integer bit semantics.
Arity: 2+ · Return: the bitwise AND of two or more numbers using HQL's JavaScript integer bit semantics · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: quot, rem, bit-or, bit-xor
(bit-and 6 3)
;=> 2
(bit-or x y ...more)
Returns the bitwise OR of two or more numbers using HQL's JavaScript integer bit semantics.
Arity: 2+ · Return: the bitwise OR of two or more numbers using HQL's JavaScript integer bit semantics · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: rem, bit-and, bit-xor, bit-not
(bit-or 6 3)
;=> 7
(bit-xor x y ...more)
Returns the bitwise XOR of two or more numbers using HQL's JavaScript integer bit semantics.
Arity: 2+ · Return: the bitwise XOR of two or more numbers using HQL's JavaScript integer bit semantics · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bit-and, bit-or, bit-not, bit-and-not
(bit-xor 6 3)
;=> 5
(bit-not x)
Returns the bitwise complement of x.
Arity: 1 · Return: the bitwise complement of x · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bit-or, bit-xor, bit-and-not, bit-clear
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(bit-and-not x y ...more)
Clears all bits from x that are set in the remaining arguments.
Arity: 2+ · Return: Clears all bits from x that are set in the remaining
arguments · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: bit-xor, bit-not, bit-clear, bit-flip
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(bit-clear x n)
Returns x with bit n cleared.
Arity: 2 · Return: x with bit n cleared · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bit-not, bit-and-not, bit-flip, bit-set
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(bit-flip x n)
Returns x with bit n flipped.
Arity: 2 · Return: x with bit n flipped · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bit-and-not, bit-clear, bit-set, bit-test
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(bit-set x n)
Returns x with bit n set.
Arity: 2 · Return: x with bit n set · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bit-clear, bit-flip, bit-test, bit-shift-left
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(bit-test x n)
Returns true when bit n is set in x.
Arity: 2 · Return: true when bit n is set in x · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: bit-flip, bit-set, bit-shift-left, bit-shift-right
(bit-test 5 0)
;=> true
(bit-shift-left x n)
Returns x shifted left by n bits.
Arity: 2 · Return: x shifted left by n bits · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bit-set, bit-test, bit-shift-right, unsigned-bit-shift-right
(bit-shift-left 1 4)
;=> 16
(bit-shift-right x n)
Returns x shifted right by n bits, preserving sign.
Arity: 2 · Return: x shifted right by n bits, preserving sign · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: bit-test, bit-shift-left, unsigned-bit-shift-right, rand
(bit-shift-right 16 2)
;=> 4
(unsigned-bit-shift-right x n)
Returns x shifted right by n bits, zero-filling from the left.
Arity: 2 · Return: x shifted right by n bits, zero-filling from the left ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: bit-shift-left, bit-shift-right, rand, rand-int
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(rand ...args)
Returns a random floating-point number between 0 and 1, or between 0 and n.
Arity: 0+ · Return: a random floating-point number between 0 and 1, or between 0 and n · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: bit-shift-right, unsigned-bit-shift-right, rand-int, rand-nth
No verified inline example: returns nondeterministic output.
(rand-int n)
Returns a random integer between 0 inclusive and n exclusive, truncated toward zero.
Arity: 1 · Return: a random integer between 0 inclusive and n exclusive, truncated toward zero · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: unsigned-bit-shift-right, rand, rand-nth, random-sample
No verified inline example: returns nondeterministic output.
(rand-nth coll)
Returns a random item from coll, or nil for nil.
Arity: 1 · Return: a random item from coll, or nil for nil · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: rand, rand-int, random-sample, parse-boolean
No verified inline example: returns nondeterministic output.
(random-sample prob coll)
Returns a lazy seq of items from coll selected with probability prob.
Arity: 2 · Return: a lazy seq of items from coll selected with probability prob · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: rand-int, rand-nth, parse-boolean, parse-long
No verified inline example: returns nondeterministic output.
(parse-boolean s)
Parses "true" to true, "false" to false, and returns nil otherwise.
Arity: 1 · Return: Parses "true" to true, "false" to false, and returns nil
otherwise · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: may throw
Related: rand-nth, random-sample, parse-long, parse-double
(parse-boolean "true")
;=> true
(parse-long s)
Parses a base-10 integer string, returning nil when the whole string is not an integer.
Arity: 1 · Return: Parses a base-10 integer string, returning nil when the whole string is not an integer · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: random-sample, parse-boolean, parse-double, not=
(parse-long "42")
;=> 42
(parse-double s)
Parses a floating-point string, returning nil when the whole string is not a number.
Arity: 1 · Return: Parses a floating-point string, returning nil when the whole string is not a number · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: parse-boolean, parse-long, not=, compare
(parse-double "3.14")
;=> 3.14
(not= x ...more)
Returns true when not all arguments are structurally equal.
Arity: 1+ · Return: true when not all arguments are structurally equal · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: parse-long, parse-double, compare, comparator
(not= 1 2)
;=> true
(compare a b)
Returns -1, 0, or 1 using Clojure-style ordering for nil, comparable scalar values, keywords, symbols, UUIDs, and vectors.
Arity: 2 · Return: -1, 0, or 1 using Clojure-style ordering for nil, comparable scalar values, keywords, symbols, UUIDs, and vectors · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: parse-double, not=, comparator, sorted?
(compare 1 2)
;=> -1
(comparator pred)
Returns a comparator from a binary predicate.
Arity: 1 · Return: a comparator from a binary predicate · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: not=, compare, sorted?, sorted-map-by
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(sorted? coll)
Returns true when coll is an HQL sorted map or sorted set.
Arity: 1 · Return: true when coll is an HQL sorted map or sorted set ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: compare, comparator, sorted-map-by, sorted-map
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(sorted-map-by cmp ...kvs)
Returns an HQL sorted map ordered by comparator cmp.
Arity: 1+ · Return: an HQL sorted map ordered by comparator cmp · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: comparator, sorted?, sorted-map, sorted-set-by
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(sorted-map ...kvs)
Returns an HQL sorted map ordered by compare.
Arity: 0+ · Return: an HQL sorted map ordered by compare · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: sorted?, sorted-map-by, sorted-set-by, sorted-set
(sorted-map :b 2 :a 1)
;=> {:a 1 :b 2}
(sorted-set-by cmp ...items)
Returns an HQL sorted set ordered by comparator cmp.
Arity: 1+ · Return: an HQL sorted set ordered by comparator cmp · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: sorted-map-by, sorted-map, sorted-set, subseq
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(sorted-set ...items)
Returns an HQL sorted set ordered by compare.
Arity: 0+ · Return: an HQL sorted set ordered by compare · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: sorted-map, sorted-set-by, subseq, rsubseq
(sorted-set 3 1 2)
;=> #[1 2 3]
(subseq coll test key ...args)
Returns a seq of sorted collection items satisfying the supplied bound(s).
Arity: 3+ · Return: a seq of sorted collection items satisfying the supplied bound(s) · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: sorted-set-by, sorted-set, rsubseq, lt
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(rsubseq coll test key ...args)
Returns a reverse seq of sorted collection items satisfying the supplied bound(s).
Arity: 3+ · Return: a reverse seq of sorted collection items satisfying the supplied bound(s) · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: sorted-set, subseq, lt, gt
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(lt ...nums)
Variadic less-than. (lt a b c) means a < b < c.
Arity: 0+ · Return: Variadic less-than · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: subseq, rsubseq, gt, lte
(lt 1 2 3)
;=> true
(gt ...nums)
Variadic greater-than. (gt a b c) means a > b > c.
Arity: 0+ · Return: Variadic greater-than · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: rsubseq, lt, lte, gte
(gt 3 2 1)
;=> true
(lte ...nums)
Variadic less-than-or-equal. (lte a b c) means a <= b <= c.
Arity: 0+ · Return: Variadic less-than-or-equal · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(lte 1 1 2)
;=> true
(gte ...nums)
Variadic greater-than-or-equal. (gte a b c) means a >= b >= c.
Arity: 0+ · Return: Variadic greater-than-or-equal · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(gte 3 3 1)
;=> true
(symbol n ...args)
Constructs an HQL symbol object from name, or from namespace and name.
Arity: 1+ · Return: Constructs an HQL symbol object from name, or from
namespace and name · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
(symbol "foo")
;=> foo
(gensym ...args)
Returns a fresh HQL symbol. (gensym) uses the G__ prefix; (gensym prefix)
stringifies prefix.
Arity: 0+ · Return: a fresh HQL symbol · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: symbol, keyword, find-keyword
No verified inline example: returns a fresh generated symbol.
(keyword n ...args)
Constructs an interned HQL keyword value from name, or from namespace and
name.
Arity: 1+ · Return: Constructs an interned HQL keyword value from name, or
from namespace and name · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
Related: symbol, gensym, find-keyword, parse-uuid
(keyword "foo")
;=> :foo
(find-keyword n ...args)
Returns an already-interned HQL keyword for name or namespace/name, or nil.
Arity: 1+ · Return: an already-interned HQL keyword for name or
namespace/name, or nil · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
Related: gensym, keyword, parse-uuid, random-uuid
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(parse-uuid s)
Parses a UUID string into an HQL UUID value, or nil when parsing fails.
Arity: 1 · Return: Parses a UUID string into an HQL UUID value, or nil when parsing fails · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: keyword, find-keyword, random-uuid, uuid?
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(random-uuid)
Returns a pseudo-random v4 HQL UUID value.
Arity: 0 · Return: a pseudo-random v4 HQL UUID value · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: find-keyword, parse-uuid, uuid?, name
No verified inline example: returns nondeterministic output.
(uuid? x)
Returns true when x is an HQL UUID value.
Arity: 1 · Return: true when x is an HQL UUID value · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: parse-uuid, random-uuid, name, pr-str
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(name x)
Returns the name part of a symbol or keyword; returns strings unchanged and
nil for nil.
Arity: 1 · Return: the name part of a symbol or keyword; returns strings
unchanged and nil for nil · Evaluation: eager · Effects: pure/derived value
· Host: portable stdlib · Throws: not documented as throwing
Related: random-uuid, uuid?, pr-str, hash
(name :foo)
;=> "foo"
(pr-str x)
Returns a readable HQL data string. Parenthesized code lists print space-separated; JS arrays/maps keep comma/colon syntax, persistent collections print HQL persistent syntax.
Arity: 1 · Return: a readable HQL data string · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: uuid?, name, hash, read-string
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(hash x)
Returns a deterministic structural hash code for HQL values.
Arity: 1 · Return: a deterministic structural hash code for HQL values · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: name, pr-str, read-string, print-str
No verified inline example: hash values are implementation details rather than tutorial output.
(read-string s)
Reads one canonical HQL data value from string s, producing the same
S-expression object shape as quote.
Arity: 1 · Return: Reads one canonical HQL data value from string s,
producing the same S-expression object shape as quote · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: pr-str, hash, print-str, println-str
(read-string "[1 2 3]")
;=> [1 2 3]
(print-str ...xs)
Returns the space-separated str rendering of xs.
Arity: 0+ · Return: the space-separated str rendering of xs · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: hash, read-string, println-str, prn-str
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(println-str ...xs)
Returns (print-str ...xs) followed by a newline.
Arity: 0+ · Return: (print-str ...xs) followed by a newline · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: read-string, print-str, prn-str, pr
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(prn-str ...xs)
Returns the space-separated pr-str rendering of xs followed by a newline.
Arity: 0+ · Return: the space-separated pr-str rendering of xs followed by
a newline · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: print-str, println-str, pr, prn
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(pr ...xs)
Prints the pr-str rendering of xs without a trailing newline and returns
nil.
Arity: 0+ · Return: Prints the pr-str rendering of xs without a trailing
newline and returns nil · Evaluation: eager · Effects: output side effect ·
Host: portable stdlib · Throws: not documented as throwing
Related: println-str, prn-str, prn, ex-info
No verified inline example: prints to stdout and returns nil.
(prn ...xs)
Prints the pr-str rendering of xs followed by a newline and returns nil.
Arity: 0+ · Return: Prints the pr-str rendering of xs followed by a newline
and returns nil · Evaluation: eager · Effects: output side effect · Host:
portable stdlib · Throws: not documented as throwing
Related: prn-str, pr, ex-info, ex-message
No verified inline example: prints to stdout and returns nil.
(ex-info message data ...args)
Returns an Error carrying message, data, and optional cause.
Arity: 2+ · Return: an Error carrying message, data, and optional cause ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: may throw
Related: pr, prn, ex-message, ex-data
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(ex-message err)
Returns the message from an exception value.
Arity: 1 · Return: the message from an exception value · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: prn, ex-info, ex-data, ex-cause
(ex-message (ex-info "boom" {:code 1}))
;=> "boom"
(ex-data err)
Returns data attached by ex-info, or nil when absent.
Arity: 1 · Return: data attached by ex-info, or nil when absent · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: ex-info, ex-message, ex-cause, repeat
(ex-data (ex-info "boom" {:code 1}))
;=> {:code 1}
(ex-cause err)
Returns the cause attached by ex-info, or nil when absent.
Arity: 1 · Return: the cause attached by ex-info, or nil when absent ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: ex-message, ex-data, repeat, replicate
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(repeat ...args)
Returns a lazy sequence of repeated values. (repeat x) is infinite — bound it
with take; (repeat n x) yields n copies of x.
Arity: 0+ · Return: a lazy sequence of repeated values · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: ex-data, ex-cause, replicate, repeatedly
(repeat 3 "x")
;=> ("x" "x" "x")
(replicate n x)
Returns a lazy sequence of n copies of x.
Arity: 2 · Return: a lazy sequence of n copies of x · Evaluation: lazy ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: ex-cause, repeat, repeatedly, cycle
(replicate 3 "x")
;=> ("x" "x" "x")
(repeatedly ...args)
Returns a lazy sequence of (f) calls. (repeatedly f) is infinite;
(repeatedly n f) yields n calls.
Arity: 0+ · Return: a lazy sequence of (f) calls · Evaluation: lazy ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: repeat, replicate, cycle, iterate
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(cycle coll)
Returns a lazy infinite sequence that repeats coll over and over. Use
(take n (cycle coll)) to bound.
Arity: 1 · Return: a lazy infinite sequence that repeats coll over and over ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: replicate, repeatedly, iterate, iteration
(take 5 (cycle [1 2]))
;=> (1 2 1 2 1)
(iterate f x)
Returns the lazy infinite sequence x, (f x), (f (f x)), ....
Arity: 2 · Return: the lazy infinite sequence x, (f x), (f (f x)), ... ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: repeatedly, cycle, iteration
(take 4 (iterate (fn [x] (* x 2)) 1))
;=> (1 2 4 8)
(iteration step ...args)
Returns a lazy sequence by repeatedly calling step with a continuation key.
Options: :initk, :somef, :vf, :kf.
Arity: 1+ · Return: a lazy sequence by repeatedly calling step with a
continuation key · Evaluation: lazy · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(keys obj)
Returns a seq of the keys of map/object m.
Arity: 1 · Return: a seq of the keys of map/object m · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
(keys {:a 1 :b 2})
;=> [:a, :b]
(group-by f coll)
Returns a persistent map of (f item) -> vector of items.
Arity: 2 · Return: a persistent map of (f item) -> vector of items ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: keys, reverse, reversible?
(group-by odd? [1 2 3 4 5])
;=> {true [1 3 5] false [2 4]}
(reverse coll)
Returns a sequence of coll in reverse order.
Arity: 1 · Return: a sequence of coll in reverse order · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: keys, group-by, reversible?, rseq
(reverse [1 2 3])
;=> [3, 2, 1]
(reversible? x)
Returns true when x supports efficient reverse sequence access.
Arity: 1 · Return: true when x supports efficient reverse sequence access ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: group-by, reverse, rseq, identity
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(rseq coll)
Returns a reverse seq over a vector-like collection, or nil when it is empty.
Arity: 1 · Return: a reverse seq over a vector-like collection, or nil when it is empty · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: reverse, reversible?, identity, freeze
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(identity x)
Returns its argument unchanged. Useful as a default mapper or predicate.
Arity: 1 · Return: its argument unchanged · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: reversible?, rseq, freeze, constantly
(identity 42)
;=> 42
(freeze x)
Recursively freezes x in place (deep Object.freeze) and returns the same
reference; frozen collections reject mutation (throwing in strict mode). Lazy
sequences, generators, and typed-array views are returned unfrozen because
freezing would break their internal state. let already prevents rebinding a
name — reach for freeze when you also need the value itself to be immutable.
Arity: 1 · Return: Recursively freezes x in place (deep Object.freeze) and
returns the same reference; frozen collections reject mutation (throwing in
strict mode) · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: rseq, identity, constantly, vals
No verified inline example: the observable result is object identity and immutability, not a useful printed value.
(constantly x)
Returns a function that ignores its arguments and always returns x.
Arity: 1 · Return: a function that ignores its arguments and always returns x
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: identity, freeze, vals, key
((constantly 7) 1 2 3)
;=> 7
(vals m)
Returns a seq of the values of map/object m.
Arity: 1 · Return: a seq of the values of map/object m · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: freeze, constantly, key, val
(vals {:a 1 :b 2})
;=> [1, 2]
(key entry)
Returns the key from a map entry.
Arity: 1 · Return: the key from a map entry · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: constantly, vals, val, update-keys
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(val entry)
Returns the value from a map entry.
Arity: 1 · Return: the value from a map entry · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: vals, key, update-keys, update-vals
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(update-keys m f)
Returns a map with every key transformed by f.
Arity: 2 · Return: a map with every key transformed by f · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: key, val, update-vals, juxt
(update-keys {:a 1 :b 2} name)
;=> {"b" 2 "a" 1}
(update-vals m f)
Returns a map with every value transformed by f.
Arity: 2 · Return: a map with every value transformed by f · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: val, update-keys, juxt, zipmap
(update-vals {:a 1 :b 2} inc)
;=> {:a 2 :b 3}
(juxt ...fns)
Returns a function applying each fn in turn to its args. ((juxt f g h) x)
returns [(f x), (g x), (h x)].
Arity: 0+ · Return: a function applying each fn in turn to its args · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: update-keys, update-vals, zipmap, get
((juxt first last) [1 2 3])
;=> [1 3]
(zipmap ks vs)
Returns a persistent map zipping each key in ks with the value at the same
position in vs.
Arity: 2 · Return: a persistent map zipping each key in ks with the value at
the same position in vs · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
Related: update-vals, juxt, get, get-in
(zipmap [:a :b] [1 2])
;=> {:a 1 :b 2}
(get m key ...args)
Looks up key in m. Returns not-found (or nil) when absent.
Arity: 2+ · Return: Looks up key in m · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: juxt, zipmap, get-in, assoc
(get {:a 1} :a)
;=> 1
(get-in m path ...args)
Looks up a nested value by walking path (a vector of keys). Returns
not-found (or nil) when any step is missing.
Arity: 2+ · Return: Looks up a nested value by walking path (a vector of
keys) · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib
· Throws: not documented as throwing
Related: zipmap, get, assoc, assoc-in
(get-in {:a {:b 2}} [:a :b])
;=> 2
(assoc m key value ...kvs)
Returns a new map/vector with key(s) set to value(s).
Arity: 3+ · Return: a new map/vector with key(s) set to value(s) · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: get, get-in, assoc-in, dissoc
(assoc {:a 1} :b 2)
;=> {:a 1 :b 2}
(assoc-in m path value)
Returns a new map with the nested value at path set to value. Intermediate
maps are created as needed.
Arity: 3 · Return: a new map with the nested value at path set to value ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: get-in, assoc, dissoc, update
(assoc-in {:a {:b 1}} [:a :c] 9)
;=> {:a {:c 9 :b 1}}
(dissoc m ...ks)
Returns a new map with the given keys removed. Maps and plain objects only —
arrays are rejected: deleting an index would leave a silent hole (count
unchanged, undefined slot).
Arity: 1+ · Return: a new map with the given keys removed · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: assoc, assoc-in, update, update-in
(dissoc {:a 1 :b 2} :a)
;=> {:b 2}
(update m key f ...args)
Returns a new map with key set to (f (get m key) ...args).
Arity: 3+ · Return: a new map with key set to (f (get m key) ...args) ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: assoc-in, dissoc, update-in, find
(update {:n 1} :n inc)
;=> {:n 2}
(update-in m path f)
Returns a new map with the nested value at path set to (f (get-in m path)).
Arity: 3 · Return: a new map with the nested value at path set to
(f (get-in m path)) · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
(update-in {:a {:b 1}} [:a :b] inc)
;=> {:a {:b 2}}
(find m key)
Returns [key value] when key is present in m, otherwise nil.
Arity: 2 · Return: [key value] when key is present in m, otherwise nil ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
(find {:a 1} :a)
;=> [:a 1]
(atom initial)
Returns a synchronous mutable reference whose contained value is read with
deref and changed with reset! or swap!.
Arity: 1 · Return: a synchronous mutable reference whose contained value is
read with deref and changed with reset! or swap! · Evaluation: eager ·
Effects: stateful · Host: portable stdlib · Throws: not documented as throwing
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(atom? x)
Returns true when x is an HQL atom.
Arity: 1 · Return: true when x is an HQL atom · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: atom, volatile!, volatile?
(atom? (atom 1))
;=> true
(volatile! initial)
Returns a mutable volatile reference whose value is read with deref and
changed with vreset! or vswap!.
Arity: 1 · Return: a mutable volatile reference whose value is read with
deref and changed with vreset! or vswap! · Evaluation: eager · Effects:
stateful · Host: portable stdlib · Throws: not documented as throwing
Related: atom, atom?, volatile?, deref
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(volatile? x)
Returns true when x is a volatile reference.
Arity: 1 · Return: true when x is a volatile reference · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: atom?, volatile!, deref, vreset!
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(deref ref)
Returns the current value of an atom/volatile or the realized value of a delay/reduced marker.
Arity: 1 · Return: the current value of an atom/volatile or the realized value of a delay/reduced marker · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: volatile!, volatile?, vreset!, vswap!
(do (def slot (atom 7)) (deref slot))
;=> 7
(vreset! ref value)
Sets volatile ref to value and returns value.
Arity: 2 · Return: Sets volatile ref to value and returns value ·
Evaluation: eager · Effects: stateful · Host: portable stdlib · Throws: not
documented as throwing
Related: volatile?, deref, vswap!, reset!
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(vswap! ref f ...args)
Sets volatile ref to (f (deref ref) ...args) and returns the new value.
Arity: 2+ · Return: Sets volatile ref to (f (deref ref) ...args) and
returns the new value · Evaluation: eager · Effects: stateful · Host: portable
stdlib · Throws: not documented as throwing
Related: deref, vreset!, reset!, swap!
(do (def vol (volatile! 1)) (vswap! vol inc) (deref vol))
;=> 2
(reset! ref value)
Sets atom ref to value, notifies watches, and returns value.
Arity: 2 · Return: Sets atom ref to value, notifies watches, and returns
value · Evaluation: eager · Effects: stateful · Host: portable stdlib ·
Throws: not documented as throwing
Related: vreset!, vswap!, swap!, reset-vals!
(do (def cell (atom 1)) (reset! cell 9) (deref cell))
;=> 9
(swap! ref f ...args)
Sets atom ref to (f (deref ref) ...args) and returns the new value.
Arity: 2+ · Return: Sets atom ref to (f (deref ref) ...args) and returns
the new value · Evaluation: eager · Effects: stateful · Host: portable stdlib ·
Throws: not documented as throwing
Related: vswap!, reset!, reset-vals!, swap-vals!
(do (def box (atom 1)) (swap! box inc) (deref box))
;=> 2
(reset-vals! ref value)
Sets atom ref to value and returns [old-value new-value].
Arity: 2 · Return: Sets atom ref to value and returns
[old-value new-value] · Evaluation: eager · Effects: stateful · Host: portable
stdlib · Throws: not documented as throwing
Related: reset!, swap!, swap-vals!, compare-and-set!
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(swap-vals! ref f ...args)
Sets atom ref to (f (deref ref) ...args) and returns
[old-value new-value].
Arity: 2+ · Return: Sets atom ref to (f (deref ref) ...args) and returns
[old-value new-value] · Evaluation: eager · Effects: stateful · Host: portable
stdlib · Throws: not documented as throwing
Related: swap!, reset-vals!, compare-and-set!, add-watch
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(compare-and-set! ref old-value new-value)
If atom ref currently contains old-value by identity, sets it to new-value
and returns true; otherwise returns false.
Arity: 3 · Return: If atom ref currently contains old-value by identity,
sets it to new-value and returns true; otherwise returns false · Evaluation:
eager · Effects: stateful · Host: portable stdlib · Throws: not documented as
throwing
Related: reset-vals!, swap-vals!, add-watch, remove-watch
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(add-watch ref key f)
Registers watch function f under key. Watches receive
[key ref old-value new-value] after reset/swap.
Arity: 3 · Return: Registers watch function f under key · Evaluation: eager
· Effects: stateful · Host: portable stdlib · Throws: not documented as
throwing
Related: swap-vals!, compare-and-set!, remove-watch
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(remove-watch ref key)
Removes the watch registered under key and returns ref.
Arity: 2 · Return: Removes the watch registered under key and returns ref ·
Evaluation: eager · Effects: stateful · Host: portable stdlib · Throws: not
documented as throwing
Related: compare-and-set!, add-watch
No verified inline example: stateful cell/watch behavior needs multi-step mutation context and is covered by managed-state tests.
(dispatch-key key)
Normalizes open-dispatch keys. Keywords become their printed :name; other keys
stay unchanged.
Arity: 1 · Return: Normalizes open-dispatch keys · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: dispatch-type, multi
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(dispatch-type x)
Returns the default open-polymorphism dispatch key for x: :type/"type"
when present, then constructor, then JavaScript typeof.
Arity: 1 · Return: the default open-polymorphism dispatch key for x:
:type/"type" when present, then constructor, then JavaScript typeof ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: dispatch-key, multi, multi?
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(multi dispatch-fn)
Returns an open dispatcher function. Register handlers with method!; call it
directly or with call-method.
Arity: 1 · Return: an open dispatcher function · Evaluation: eager · Effects: stateful · Host: portable stdlib · Throws: not documented as throwing
Related: dispatch-key, dispatch-type, multi?, method!
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(multi? x)
Returns true when x is an HQL multi dispatcher.
Arity: 1 · Return: true when x is an HQL multi dispatcher · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: dispatch-type, multi, method!, call-method
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(method! m key f)
Registers f as the handler for dispatch key on multi dispatcher m and
returns m.
Arity: 3 · Return: Registers f as the handler for dispatch key on multi
dispatcher m and returns m · Evaluation: eager · Effects: stateful · Host:
portable stdlib · Throws: not documented as throwing
Related: multi, multi?, call-method, get-method
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(call-method m x ...args)
Calls the method registered for ((dispatch m) x), passing x and remaining
args to the handler.
Arity: 2+ · Return: Calls the method registered for ((dispatch m) x), passing
x and remaining args to the handler · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: multi?, method!, get-method, methods
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(get-method m key)
Returns the best method registered for dispatch key, or nil.
Arity: 2 · Return: the best method registered for dispatch key, or nil ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: method!, call-method, methods, remove-method
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(methods m)
Returns a persistent map of dispatch keys to methods.
Arity: 1 · Return: a persistent map of dispatch keys to methods · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: call-method, get-method, remove-method, remove-all-methods
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(remove-method m key)
Removes the method registered for dispatch key and returns the dispatcher.
Arity: 2 · Return: Removes the method registered for dispatch key and returns
the dispatcher · Evaluation: eager · Effects: stateful · Host: portable stdlib ·
Throws: not documented as throwing
Related: get-method, methods, remove-all-methods, prefer-method
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(remove-all-methods m)
Removes all methods from dispatcher m and returns it.
Arity: 1 · Return: Removes all methods from dispatcher m and returns it ·
Evaluation: eager · Effects: stateful · Host: portable stdlib · Throws: not
documented as throwing
Related: methods, remove-method, prefer-method, prefers
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(prefer-method m x y)
Records that dispatch x is preferred over y and returns the dispatcher.
Arity: 3 · Return: Records that dispatch x is preferred over y and returns
the dispatcher · Evaluation: eager · Effects: stateful · Host: portable stdlib ·
Throws: not documented as throwing
Related: remove-method, remove-all-methods, prefers, make-hierarchy
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(prefers m)
Returns a persistent map of dispatch preferences.
Arity: 1 · Return: a persistent map of dispatch preferences · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: remove-all-methods, prefer-method, make-hierarchy, derive
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(make-hierarchy)
Returns a fresh HQL hierarchy value.
Arity: 0 · Return: a fresh HQL hierarchy value · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: prefer-method, prefers, derive, underive
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(derive h-or-tag tag-or-parent ...args)
Adds a parent relation to a hierarchy. With two args, updates HQL's global hierarchy.
Arity: 2+ · Return: Adds a parent relation to a hierarchy · Evaluation: eager · Effects: stateful · Host: portable stdlib · Throws: not documented as throwing
Related: prefers, make-hierarchy, underive, parents
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(underive h-or-tag tag-or-parent ...args)
Removes a parent relation from a hierarchy. With two args, updates HQL's global hierarchy.
Arity: 2+ · Return: Removes a parent relation from a hierarchy · Evaluation: eager · Effects: stateful · Host: portable stdlib · Throws: not documented as throwing
Related: make-hierarchy, derive, parents, ancestors
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(parents h-or-tag ...args)
Returns the direct parents of a tag in a hierarchy.
Arity: 1+ · Return: the direct parents of a tag in a hierarchy · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: derive, underive, ancestors, descendants
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(ancestors h-or-tag ...args)
Returns all ancestors of a tag in a hierarchy.
Arity: 1+ · Return: all ancestors of a tag in a hierarchy · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: underive, parents, descendants, supers
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(descendants h-or-tag ...args)
Returns all descendants of a tag in a hierarchy.
Arity: 1+ · Return: all descendants of a tag in a hierarchy · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: parents, ancestors, supers, isa?
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(supers x)
Returns HQL hierarchy ancestors for x.
Arity: 1 · Return: HQL hierarchy ancestors for x · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: ancestors, descendants, isa?, merge
No verified inline example: open-polymorphism setup is multi-definition state and is covered in language examples/tests.
(isa? h-or-child child-or-parent ...args)
Returns true when child equals or derives from parent in a hierarchy.
Arity: 2+ · Return: true when child equals or derives from parent in a
hierarchy · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: descendants, supers, merge
(isa? 42 42)
;=> true
(merge ...maps)
Merges maps left-to-right. Later keys win.
Arity: 0+ · Return: Merges maps left-to-right · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(merge {:a 1} {:b 2})
;=> {:a 1 :b 2}
(empty coll)
Returns an empty collection of the same type as coll (array, set, map, string,
or object).
Arity: 1 · Return: an empty collection of the same type as coll (array, set,
map, string, or object) · Evaluation: eager · Effects: pure/derived value ·
Host: portable stdlib · Throws: not documented as throwing
(empty [1 2 3])
;=> []
(conj coll ...items)
Adds items to coll, returning a new collection of the same type.
Arity: 1+ · Return: Adds items to coll, returning a new collection of the
same type · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
(conj [1 2] 3)
;=> [1 2 3]
(disj s ...items)
Returns a set with items removed.
Arity: 1+ · Return: a set with items removed · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: empty, conj, into, vec
(disj #[1 2 3] 2)
;=> #[3 1]
(into ...args)
Pours items from from into to, returning the same type as to.
(into to xform from) applies a transducer.
Arity: 0+ · Return: Pours items from from into to, returning the same type
as to · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: conj, disj, vec, subvec
(into [1] [2 3])
;=> [1 2 3]
(vec coll)
Returns a persistent vector containing the items of coll.
Arity: 1 · Return: a persistent vector containing the items of coll ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: disj, into, subvec, set
(vec (range 3))
;=> [0 1 2]
(subvec v start ...args)
Returns a persistent vector slice of v from start inclusive to end
exclusive.
Arity: 2+ · Return: a persistent vector slice of v from start inclusive to
end exclusive · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: into, vec, set, doall
(subvec [1 2 3 4 5] 1 3)
;=> [2 3]
(set coll)
Returns a persistent set containing the unique items of coll.
Arity: 1 · Return: a persistent set containing the unique items of coll ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: vec, subvec, doall, dorun
(set [1 2 2 3])
;=> #[2 3 1]
(doall coll)
Forces realization of a lazy sequence into an array. Returns nil for nil.
Arity: 1 · Return: Forces realization of a lazy sequence into an array · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(doall (map inc [1 2 3]))
;=> [2, 3, 4]
(dorun ...args)
Forces realization for side effects and returns nil. (dorun n coll) realizes
at most n items.
Arity: 0+ · Return: Forces realization for side effects and returns nil · Evaluation: eager · Effects: output side effect · Host: portable stdlib · Throws: not documented as throwing
No verified inline example: runs a collection for side effects and intentionally returns nil.
(comp ...fns)
Returns the composition of the given functions. ((comp f g) x) ≡ (f (g x)).
Arity: 0+ · Return: the composition of the given functions · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
((comp inc inc) 5)
;=> 7
(partial f ...args)
Returns a function that calls f with args prepended to its own arguments.
Arity: 1+ · Return: a function that calls f with args prepended to its own
arguments · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
((partial + 10) 5)
;=> 15
(apply f ...args)
Calls f with trailing collection items appended to any leading arguments.
Arity: 1+ · Return: Calls f with trailing collection items appended to any
leading arguments · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: comp, partial, sort, sort-by
(apply + [1 2 3 4])
;=> 10
(sort ...args)
Returns coll sorted in ascending order. (sort cmp coll) uses a custom
comparator.
Arity: 0+ · Return: coll sorted in ascending order · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: partial, apply, sort-by, shuffle
(sort [3 1 2])
;=> [1, 2, 3]
(sort-by keyfn ...args)
Returns coll sorted by (keyfn item). (sort-by keyfn cmp coll) uses a
custom comparator on keys.
Arity: 1+ · Return: coll sorted by (keyfn item) · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: apply, sort, shuffle, mapv
(sort-by count ["aa" "b" "ccc"])
;=> ["b", "aa", "ccc"]
(shuffle coll)
Returns a random permutation of coll as a persistent vector.
Arity: 1 · Return: a random permutation of coll as a persistent vector · Evaluation: eager · Effects: nondeterministic · Host: portable stdlib · Throws: not documented as throwing
Related: sort, sort-by, mapv, filterv
No verified inline example: returns nondeterministic order.
(mapv f ...colls)
Returns a persistent vector of applying f over one or more collections.
Arity: 1+ · Return: a persistent vector of applying f over one or more
collections · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: sort-by, shuffle, filterv
(mapv inc [1 2 3])
;=> [2 3 4]
(filterv pred coll)
Returns a persistent vector of items for which pred is truthy.
Arity: 2 · Return: a persistent vector of items for which pred is truthy ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
(filterv odd? [1 2 3 4])
;=> [1 3]
(halt-when pred ...args)
Returns a transducer that stops when (pred input) is truthy. With retf, the
reduced value is (retf result input).
Arity: 1+ · Return: a transducer that stops when (pred input) is truthy ·
Evaluation: transducer · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: reduced
No verified inline example: transducer examples need reducing context; behavior is covered by transducer tests.
(reduced x)
Wraps x as a reduced value to signal early termination to reducing and
transducer contexts.
Arity: 1 · Return: Wraps x as a reduced value to signal early termination to
reducing and transducer contexts · Evaluation: eager · Effects: pure/derived
value · Host: portable stdlib · Throws: not documented as throwing
Related: halt-when
(reduce (fn [acc x] (if (> acc 5) (reduced acc) (+ acc x))) 0 [1 2 3 4 5])
;=> 6
(frequencies coll)
Returns a persistent map of element → occurrence count in coll.
Arity: 1 · Return: a persistent map of element → occurrence count in coll ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: select-keys, merge-with
(frequencies [1 1 2 3 3 3])
;=> {2 1 3 3 1 2}
(select-keys m ks)
Returns a new map containing only the entries of m whose keys are in ks.
Arity: 2 · Return: a new map containing only the entries of m whose keys are
in ks · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: frequencies, merge-with, replace
(select-keys {:a 1 :b 2 :c 3} [:a :c])
;=> {:c 3 :a 1}
(merge-with f ...maps)
Merges maps left-to-right. On key conflict, the value becomes
(f existing new).
Arity: 1+ · Return: Merges maps left-to-right · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: frequencies, select-keys, replace, remove
(merge-with + {:a 1} {:a 2 :b 3})
;=> {:a 3 :b 3}
(replace smap ...args)
Replaces items found as keys in smap. With one argument, returns a transducer;
with a vector, preserves vector shape.
Arity: 1+ · Return: Replaces items found as keys in smap · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: select-keys, merge-with, remove, complement
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(remove pred ...args)
Returns items from coll for which (pred item) is falsy. With only pred,
returns the remove transducer.
Arity: 1+ · Return: items from coll for which (pred item) is falsy ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: merge-with, replace, complement, distinct?
(remove odd? [1 2 3 4])
;=> (2 4)
(complement f)
Returns a function that calls f and negates the result.
Arity: 1 · Return: a function that calls f and negates the result ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: replace, remove, distinct?, memoize
((complement odd?) 4)
;=> true
(distinct? ...vals)
Returns true when no two arguments are structurally equal.
Arity: 0+ · Return: true when no two arguments are structurally equal · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: remove, complement, memoize, not-empty
(distinct? 1 2 3)
;=> true
(memoize f)
Returns a version of f that caches results keyed by its arguments.
Arity: 1 · Return: a version of f that caches results keyed by its arguments
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: complement, distinct?, not-empty, peek
No verified inline example: the observable behavior is cache reuse across calls, covered by runtime tests.
(not-empty coll)
Returns coll if it has at least one item, otherwise nil.
Arity: 1 · Return: coll if it has at least one item, otherwise nil ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: distinct?, memoize, peek, pop
(not-empty [])
;=> nil
(peek coll)
Returns the next item to be popped: the last item for vectors/arrays, first item otherwise.
Arity: 1 · Return: the next item to be popped: the last item for vectors/arrays, first item otherwise · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: memoize, not-empty, pop, bounded-count
(peek [1 2 3])
;=> 3
(pop coll)
Returns coll without the next item to be popped.
Arity: 1 · Return: coll without the next item to be popped · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: not-empty, peek, bounded-count, run!
(pop [1 2 3])
;=> [1 2]
(bounded-count n coll)
Returns min(n, (count coll)), but stops iterating after n elements so it's
safe on infinite sequences.
Arity: 2 · Return: min(n, (count coll)), but stops iterating after n
elements so it's safe on infinite sequences · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: peek, pop, run!, every-pred
(bounded-count 2 [1 2 3 4])
;=> 2
(run! f coll)
Calls (f item) for side effects on every item in coll. Returns nil.
Arity: 2 · Return: Calls (f item) for side effects on every item in coll ·
Evaluation: eager · Effects: output side effect · Host: portable stdlib ·
Throws: not documented as throwing
Related: pop, bounded-count, every-pred, some-fn
No verified inline example: runs a function for side effects on each item and intentionally returns nil.
(every-pred ...preds)
Returns a predicate that is true only when every supplied predicate is truthy
for every argument. Strict boolean; short-circuits on the first failure.
Arity: 0+ · Return: a predicate that is true only when every supplied
predicate is truthy for every argument · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: bounded-count, run!, some-fn, true?
((every-pred number? pos?) 5)
;=> true
(some-fn ...preds)
Returns a predicate that yields the first truthy (pred arg) result (scanning
predicates, then arguments), or nil when none match. Short-circuits.
Arity: 0+ · Return: a predicate that yields the first truthy (pred arg)
result (scanning predicates, then arguments), or nil when none match ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: run!, every-pred, true?, false?
((some-fn string? number?) "x")
;=> true
(true? x)
Returns true when x is exactly true.
Arity: 1 · Return: true when x is exactly true · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: every-pred, some-fn, false?, identical?
(true? true)
;=> true
(false? x)
Returns true when x is exactly false.
Arity: 1 · Return: true when x is exactly false · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: some-fn, true?, identical?, cat
(false? false)
;=> true
(identical? a b)
Returns true when a and b are the same JS value/reference.
Arity: 2 · Return: true when a and b are the same JS value/reference ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: true?, false?, cat, dedupe
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(cat rf)
One-level flattening transducer. Forwards each item of its inputs as separate items downstream.
Arity: 1 · Return: One-level flattening transducer · Evaluation: transducer · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: false?, identical?, dedupe, min
No verified inline example: transducer examples need reducing context; behavior is covered by transducer tests.
(dedupe ...args)
Drops consecutive duplicate values from coll. With no args, returns the dedupe
transducer.
Arity: 0+ · Return: Drops consecutive duplicate values from coll ·
Evaluation: transducer · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: identical?, cat, min, max
(dedupe [1 1 2 2 3 1])
;=> (1 2 3 1)
(min ...args)
Returns the smallest of the given numbers.
Arity: 0+ · Return: the smallest of the given numbers · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: cat, dedupe, max, min-key
(min 3 1 2)
;=> 1
(max ...args)
Returns the largest of the given numbers.
Arity: 0+ · Return: the largest of the given numbers · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: dedupe, min, min-key, max-key
(max 3 1 2)
;=> 3
(min-key k x ...more)
Returns the argument whose (k arg) value is smallest; keeps the later winner
on ties.
Arity: 2+ · Return: the argument whose (k arg) value is smallest; keeps the
later winner on ties · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: min, max, max-key, fnil
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(max-key k x ...more)
Returns the argument whose (k arg) value is largest; keeps the later winner on
ties.
Arity: 2+ · Return: the argument whose (k arg) value is largest; keeps the
later winner on ties · Evaluation: eager · Effects: pure/derived value · Host:
portable stdlib · Throws: not documented as throwing
Related: max, min-key, fnil, trampoline
(max-key count ["a" "ccc" "bb"])
;=> ["a" "ccc" "bb"]
(fnil f ...defaults)
Wraps f so nil arguments are replaced positionally by defaults.
((fnil + 0) nil) ⇒ 0.
Arity: 1+ · Return: Wraps f so nil arguments are replaced positionally by
defaults · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: min-key, max-key, trampoline
((fnil inc 0) nil)
;=> 1
(trampoline f ...args)
Iteratively invokes the returned thunk until a non-function appears. The idiom for mutual tail recursion without growing the stack.
Arity: 1+ · Return: Iteratively invokes the returned thunk until a non-function appears · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
No verified inline example: needs multi-step callable state; covered by control-flow tests.
(format fmt ...args)
Formats a string with common printf-style conversion specifiers.
Arity: 1+ · Return: Formats a string with common printf-style conversion specifiers · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
(format "%s=%d" "x" 5)
;=> "x=5"
(printf fmt ...args)
Prints (format fmt ...args) and returns nil.
Arity: 1+ · Return: Prints (format fmt ...args) and returns nil · Evaluation:
eager · Effects: output side effect · Host: portable stdlib · Throws: not
documented as throwing
Related: format, str-join, split
No verified inline example: writes formatted stdout and would pollute verifier output.
(str-join separator coll)
Joins items of coll into a single string using separator.
Arity: 2 · Return: Joins items of coll into a single string using separator
· Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: format, printf, split, str-replace
(str-join ", " [1 2 3])
;=> "1, 2, 3"
(split s separator)
Splits string s by separator, returning an array of strings.
Arity: 2 · Return: Splits string s by separator, returning an array of
strings · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: printf, str-join, str-replace, trim
(split "a,b,c" ",")
;=> ["a", "b", "c"]
(str-replace s match replacement)
Returns a string with every occurrence of match in s replaced by
replacement.
Arity: 3 · Return: a string with every occurrence of match in s replaced by
replacement · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: not documented as throwing
Related: str-join, split, trim, upper-case
(str-replace "hello" "l" "L")
;=> "heLLo"
(trim s)
Removes leading and trailing whitespace from s.
Arity: 1 · Return: Removes leading and trailing whitespace from s ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: split, str-replace, upper-case, lower-case
(trim " hi ")
;=> "hi"
(upper-case s)
Returns s converted to upper case.
Arity: 1 · Return: s converted to upper case · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: str-replace, trim, lower-case, starts-with?
(upper-case "hi")
;=> "HI"
(lower-case s)
Returns s converted to lower case.
Arity: 1 · Return: s converted to lower case · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: trim, upper-case, starts-with?, ends-with?
(lower-case "HI")
;=> "hi"
(starts-with? s prefix)
Returns true when string s starts with prefix.
Arity: 2 · Return: true when string s starts with prefix · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: upper-case, lower-case, ends-with?, includes?
(starts-with? "hello" "he")
;=> true
(ends-with? s suffix)
Returns true when string s ends with suffix.
Arity: 2 · Return: true when string s ends with suffix · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: lower-case, starts-with?, includes?, subs
(ends-with? "hello" "lo")
;=> true
(includes? s substr)
Returns true when string s contains substr.
Arity: 2 · Return: true when string s contains substr · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: starts-with?, ends-with?, subs, re-pattern
(includes? "hello" "ell")
;=> true
(subs s start ...args)
Returns a substring of s from start (inclusive). (subs s start end) slices
up to end (exclusive).
Arity: 2+ · Return: a substring of s from start (inclusive) · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: ends-with?, includes?, re-pattern, re-matcher
(subs "hello" 1 3)
;=> "el"
(re-pattern pattern)
Returns a RegExp from pattern, or pattern unchanged when already a RegExp.
Arity: 1 · Return: a RegExp from pattern, or pattern unchanged when already
a RegExp · Evaluation: eager · Effects: pure/derived value · Host: portable
stdlib · Throws: may throw
Related: includes?, subs, re-matcher, re-find
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(re-matcher pattern s)
Returns a stateful regex matcher for repeated re-find calls.
Arity: 2 · Return: a stateful regex matcher for repeated re-find calls ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: may throw
Related: subs, re-pattern, re-find, re-groups
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(re-find pattern-or-matcher ...args)
Returns the next regex match. With capture groups, returns a persistent vector of full match and groups.
Arity: 1+ · Return: the next regex match · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: re-pattern, re-matcher, re-groups, re-matches
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(re-groups matcher)
Returns the groups from the most recent successful matcher operation.
Arity: 1 · Return: the groups from the most recent successful matcher operation · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: re-matcher, re-find, re-matches, re-seq
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(re-matches pattern s)
Returns a full-string regex match, or nil when the whole string does not match.
Arity: 2 · Return: a full-string regex match, or nil when the whole string does not match · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: re-find, re-groups, re-seq
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(re-seq pattern s)
Returns a lazy sequence of successive regex matches.
Arity: 2 · Return: a lazy sequence of successive regex matches · Evaluation: eager · Effects: pure/derived value · Host: portable stdlib · Throws: may throw
Related: re-groups, re-matches
No verified inline example: low-level helper behavior is documented by signature/docstring and covered by focused stdlib tests.
(keyword? x)
Returns true when x is an HQL keyword value.
Arity: 1 · Return: true when x is an HQL keyword value · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
(keyword? :a)
;=> true
(symbol? x)
Returns true when x is an HQL symbol object.
Arity: 1 · Return: true when x is an HQL symbol object · Evaluation: eager
· Effects: pure/derived value · Host: portable stdlib · Throws: not documented
as throwing
Related: keyword?, list?, vector?
(symbol? (symbol "x"))
;=> true
(list? x)
Returns true when x is a quoted HQL list object.
Arity: 1 · Return: true when x is a quoted HQL list object · Evaluation:
eager · Effects: pure/derived value · Host: portable stdlib · Throws: not
documented as throwing
Related: keyword?, symbol?, vector?, map?
(list? '(1 2))
;=> true
(vector? x)
Returns true when x is a JS array or HQL persistent vector.
Arity: 1 · Return: true when x is a JS array or HQL persistent vector ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: symbol?, list?, map?, set?
(vector? [1 2])
;=> true
(map? x)
Returns true when x is a plain HQL map or HQL persistent map.
Arity: 1 · Return: true when x is a plain HQL map or HQL persistent map ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: list?, vector?, set?, integer-number?
(map? {:a 1})
;=> true
(set? x)
Returns true when x is a JS Set or HQL persistent set.
Arity: 1 · Return: true when x is a JS Set or HQL persistent set ·
Evaluation: eager · Effects: pure/derived value · Host: portable stdlib ·
Throws: not documented as throwing
Related: vector?, map?, integer-number?, fractional-number?
(set? #[1 2])
;=> true
(integer-number? x)
Returns true when x is an integer number.
Arity: 1 · Return: true when x is an integer number · Evaluation: eager ·
Effects: pure/derived value · Host: portable stdlib · Throws: not documented as
throwing
Related: map?, set?, fractional-number?, completing
(integer-number? 5)
;=> true
(fractional-number? x)
Returns true when x is a number with a fractional part (the complement of
integer-number? over numbers).
Arity: 1 · Return: true when x is a number with a fractional part (the
complement of integer-number? over numbers) · Evaluation: eager · Effects:
pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: set?, integer-number?, completing, transduce
(fractional-number? 5.5)
;=> true
(completing f ...args)
Wraps a reducing function/transformer with an optional completion function.
Arity: 1+ · Return: Wraps a reducing function/transformer with an optional completion function · Evaluation: transducer · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: integer-number?, fractional-number?, transduce, sequence
No verified inline example: transducer examples need reducing context; behavior is covered by transducer tests.
(transduce xform rf ...args)
Applies a transducer to a collection with a reducing function.
Arity: 2+ · Return: Applies a transducer to a collection with a reducing function · Evaluation: transducer · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
Related: fractional-number?, completing, sequence, eduction
No verified inline example: transducer examples need reducing context; behavior is covered by transducer tests.
(sequence xform-or-coll ...args)
Returns a seq over coll, or over coll transformed by xform.
Arity: 1+ · Return: a seq over coll, or over coll transformed by xform ·
Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws:
not documented as throwing
Related: completing, transduce, eduction
(sequence (map inc) [1 2 3])
;=> (2 3 4)
(eduction xform coll ...colls)
Returns a seqable transducer view over one or more collections.
Arity: 2+ · Return: a seqable transducer view over one or more collections · Evaluation: lazy · Effects: pure/derived value · Host: portable stdlib · Throws: not documented as throwing
No verified inline example: transducer examples need reducing context; behavior is covered by transducer tests.
Userland virtual packages importable as
(import [...] from "@hql/<name>").
5 documented · 5 exported · source →
(ask prompt ...args)
Sends prompt to the host AI and returns the response. Optional options may
include data/schema/model/system/temperature/signal.
Arity: 1+ · Return: Sends prompt to the host AI and returns the response ·
Evaluation: async · Effects: AI runtime · Host: HLVM AI runtime · Throws: not
documented as throwing
No verified inline example: requires HLVM AI runtime setup, so the generated reference keeps it documented without an inline runtime example.
(agent prompt ...args)
Runs an agentic invocation on the host AI with prompt. Optional options may
include data/model/tools/signal.
Arity: 1+ · Return: Runs an agentic invocation on the host AI with prompt ·
Evaluation: async · Effects: AI runtime · Host: HLVM AI runtime · Throws: not
documented as throwing
No verified inline example: requires HLVM AI runtime setup, so the generated reference keeps it documented without an inline runtime example.
(chat messages ...args)
Streams a chat response from the host AI for an array of messages. Returns an
AsyncIterable of strings.
Arity: 1+ · Return: Streams a chat response from the host AI for an array of
messages · Evaluation: eager · Effects: AI runtime · Host: HLVM AI runtime ·
Throws: not documented as throwing
No verified inline example: requires HLVM AI runtime setup, so the generated reference keeps it documented without an inline runtime example.
(models)
Returns the list of available models from the host AI adapter.
Arity: 0 · Return: the list of available models from the host AI adapter · Evaluation: async · Effects: AI runtime · Host: HLVM AI runtime · Throws: not documented as throwing
No verified inline example: requires HLVM AI runtime setup, so the generated reference keeps it documented without an inline runtime example.
(status)
Returns the current status object from the host AI adapter.
Arity: 0 · Return: the current status object from the host AI adapter · Evaluation: async · Effects: AI runtime · Host: HLVM AI runtime · Throws: not documented as throwing
No verified inline example: requires HLVM AI runtime setup, so the generated reference keeps it documented without an inline runtime example.
2 documented · 2 exported · source →
(assert condition message)
Throws Error(message) when condition is falsy. Returns true otherwise.
Arity: 2 · Return: Throws Error(message) when condition is falsy ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: may
throw
No verified inline example: the interesting failure path is an intentional thrown error.
(assert-equal actual expected message)
Throws when actual is not deep-equal to expected.
Arity: 3 · Return: Throws when actual is not deep-equal to expected ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
17 documented · 17 exported · source →
(now)
Returns the current Unix timestamp in milliseconds.
Arity: 0 · Return: the current Unix timestamp in milliseconds · Evaluation: eager · Effects: pure/derived value · Host: host clock/timezone · Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(parse s)
Parses an ISO-8601 (or other Date-compatible) string and returns ms-since-epoch.
Arity: 1 · Return: Parses an ISO-8601 (or other Date-compatible) string and returns ms-since-epoch · Evaluation: eager · Effects: pure/derived value · Host: host clock/timezone · Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(format ts)
Returns the ISO 8601 string representation of timestamp ts.
Arity: 1 · Return: the ISO 8601 string representation of timestamp ts ·
Evaluation: eager · Effects: pure/derived value · Host: host clock/timezone ·
Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(add ts ms)
Returns ts + ms. Generic millisecond addition.
Arity: 2 · Return: ts + ms · Evaluation: eager · Effects: pure/derived value
· Host: host clock/timezone · Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(diff a b)
Returns a - b in milliseconds. Negative when a is before b.
Arity: 2 · Return: a - b in milliseconds · Evaluation: eager · Effects:
pure/derived value · Host: host clock/timezone · Throws: not documented as
throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(add-seconds ts n)
Adds n seconds to timestamp ts. n may be negative.
Arity: 2 · Return: Adds n seconds to timestamp ts · Evaluation: eager ·
Effects: pure/derived value · Host: host clock/timezone · Throws: not documented
as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(add-minutes ts n)
Adds n minutes to timestamp ts. n may be negative.
Arity: 2 · Return: Adds n minutes to timestamp ts · Evaluation: eager ·
Effects: pure/derived value · Host: host clock/timezone · Throws: not documented
as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(add-hours ts n)
Adds n hours to timestamp ts. n may be negative.
Arity: 2 · Return: Adds n hours to timestamp ts · Evaluation: eager ·
Effects: pure/derived value · Host: host clock/timezone · Throws: not documented
as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(add-days ts n)
Adds n days to timestamp ts. Drifts by up to 1 hour across DST.
Arity: 2 · Return: Adds n days to timestamp ts · Evaluation: eager ·
Effects: pure/derived value · Host: host clock/timezone · Throws: not documented
as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(diff-seconds a b)
Returns a - b in whole seconds (truncated toward zero).
Arity: 2 · Return: a - b in whole seconds (truncated toward zero) ·
Evaluation: eager · Effects: pure/derived value · Host: host clock/timezone ·
Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(diff-minutes a b)
Returns a - b in whole minutes (truncated toward zero).
Arity: 2 · Return: a - b in whole minutes (truncated toward zero) ·
Evaluation: eager · Effects: pure/derived value · Host: host clock/timezone ·
Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(diff-hours a b)
Returns a - b in whole hours (truncated toward zero).
Arity: 2 · Return: a - b in whole hours (truncated toward zero) · Evaluation:
eager · Effects: pure/derived value · Host: host clock/timezone · Throws: not
documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(diff-days a b)
Returns a - b in whole days (truncated toward zero).
Arity: 2 · Return: a - b in whole days (truncated toward zero) · Evaluation:
eager · Effects: pure/derived value · Host: host clock/timezone · Throws: not
documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(before? a b)
Returns true when timestamp a is strictly before b.
Arity: 2 · Return: true when timestamp a is strictly before b · Evaluation:
eager · Effects: pure/derived value · Host: host clock/timezone · Throws: not
documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(after? a b)
Returns true when timestamp a is strictly after b.
Arity: 2 · Return: true when timestamp a is strictly after b · Evaluation:
eager · Effects: pure/derived value · Host: host clock/timezone · Throws: not
documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(start-of-day ts)
Returns the timestamp at the start of ts's local calendar day (00:00:00.000).
Arity: 1 · Return: the timestamp at the start of ts's local calendar day
(00:00:00.000) · Evaluation: eager · Effects: pure/derived value · Host: host
clock/timezone · Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
(end-of-day ts)
Returns the timestamp at the end of ts's local calendar day (23:59:59.999).
Arity: 1 · Return: the timestamp at the end of ts's local calendar day
(23:59:59.999) · Evaluation: eager · Effects: pure/derived value · Host: host
clock/timezone · Throws: not documented as throwing
No verified inline example: requires host clock/timezone setup, so the generated reference keeps it documented without an inline runtime example.
7 documented · 7 exported · source →
(base64-encode s)
Encodes ASCII string s to base64. Throws on non-ASCII; use a Uint8Array path
for binary.
Arity: 1 · Return: Encodes ASCII string s to base64 · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(base64-decode s)
Decodes base64 string s to its original string. Throws on malformed input.
Arity: 1 · Return: Decodes base64 string s to its original string ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(hex-encode bytes)
Encodes a Uint8Array or byte array bytes to a lowercase hex string.
Arity: 1 · Return: Encodes a Uint8Array or byte array bytes to a lowercase
hex string · Evaluation: eager · Effects: pure/derived value · Host: portable ·
Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(hex-decode hex)
Decodes a hex string hex to a Uint8Array. Throws on odd length or non-hex
chars.
Arity: 1 · Return: Decodes a hex string hex to a Uint8Array · Evaluation:
eager · Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(uri-encode s)
URI-encodes s (every byte except RFC3986 unreserved chars becomes %XX).
Arity: 1 · Return: URI-encodes s (every byte except RFC3986 unreserved chars
becomes %XX) · Evaluation: eager · Effects: pure/derived value · Host: portable
· Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(uri-decode s)
Decodes a URI-encoded string s. Throws on malformed % sequences.
Arity: 1 · Return: Decodes a URI-encoded string s · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(uuid)
Returns a random v4 UUID string. Requires a host with crypto.randomUUID.
Arity: 0 · Return: a random v4 UUID string · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
5 documented · 5 exported · source →
(getenv name)
Returns the value of the environment variable name, or nil if unset.
Arity: 1 · Return: the value of the environment variable name, or nil if
unset · Evaluation: eager · Effects: environment · Host: process environment ·
Throws: not documented as throwing
No verified inline example: requires process environment setup, so the generated reference keeps it documented without an inline runtime example.
(has? name)
Returns true when the environment variable name is set (not undefined).
Arity: 1 · Return: true when the environment variable name is set (not
undefined) · Evaluation: eager · Effects: environment · Host: process
environment · Throws: not documented as throwing
No verified inline example: requires process environment setup, so the generated reference keeps it documented without an inline runtime example.
(setenv name value)
Sets the environment variable name to value in the current process.
Arity: 2 · Return: Sets the environment variable name to value in the
current process · Evaluation: eager · Effects: environment · Host: process
environment · Throws: not documented as throwing
No verified inline example: requires process environment setup, so the generated reference keeps it documented without an inline runtime example.
(cwd)
Returns the current working directory.
Arity: 0 · Return: the current working directory · Evaluation: eager · Effects: environment · Host: process environment · Throws: not documented as throwing
No verified inline example: requires process environment setup, so the generated reference keeps it documented without an inline runtime example.
(home-dir)
Returns the user's home directory (HOME on Unix, USERPROFILE on Windows), or nil.
Arity: 0 · Return: the user's home directory (HOME on Unix, USERPROFILE on Windows), or nil · Evaluation: eager · Effects: environment · Host: process environment · Throws: not documented as throwing
No verified inline example: requires process environment setup, so the generated reference keeps it documented without an inline runtime example.
15 documented · 15 exported · source →
(read path)
Reads the contents of path as a UTF-8 string. Returns a Promise.
Arity: 1 · Return: Reads the contents of path as a UTF-8 string · Evaluation:
eager · Effects: filesystem · Host: filesystem · Throws: not documented as
throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(write path content)
Writes content (a string) to path, overwriting any existing file. Returns a
Promise.
Arity: 2 · Return: Writes content (a string) to path, overwriting any
existing file · Evaluation: eager · Effects: filesystem · Host: filesystem ·
Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(remove path)
Removes the file at path. Returns a Promise.
Arity: 1 · Return: Removes the file at path · Evaluation: lazy · Effects:
filesystem · Host: filesystem · Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(exists? path)
Returns true when a file or directory exists at path (synchronous).
Arity: 1 · Return: true when a file or directory exists at path (synchronous)
· Evaluation: eager · Effects: filesystem · Host: filesystem · Throws: not
documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(read-bytes path)
Reads the contents of path as a Uint8Array. Returns a Promise.
Arity: 1 · Return: Reads the contents of path as a Uint8Array · Evaluation:
eager · Effects: filesystem · Host: filesystem · Throws: not documented as
throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(stat path)
Returns {isFile, isDirectory, size} for the file at path, or nil if missing.
Uses statSync — synchronous and nil-safe (no exception on missing path).
Arity: 1 · Return: {isFile, isDirectory, size} for the file at path, or nil
if missing · Evaluation: eager · Effects: filesystem · Host: filesystem ·
Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(read-json path)
Reads path as UTF-8 and JSON-parses the contents. Rejects on malformed JSON.
Arity: 1 · Return: Reads path as UTF-8 and JSON-parses the contents ·
Evaluation: async · Effects: filesystem · Host: filesystem · Throws: not
documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(write-json path obj)
JSON-stringifies obj and writes it to path. Returns a Promise.
Arity: 2 · Return: JSON-stringifies obj and writes it to path · Evaluation:
async · Effects: filesystem · Host: filesystem · Throws: not documented as
throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(read-lines path)
Reads path as UTF-8 text and splits into lines on \r\n, \n, or \r.
Arity: 1 · Return: Reads path as UTF-8 text and splits into lines on \r\n,
\n, or \r · Evaluation: async · Effects: filesystem · Host: filesystem · Throws:
not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(list-dir path)
Returns a Promise of an array of {name, isFile, isDirectory} entries for
path.
Arity: 1 · Return: a Promise of an array of {name, isFile, isDirectory}
entries for path · Evaluation: eager · Effects: filesystem · Host: filesystem
· Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(mkdir path)
Creates the directory at path. Throws when the parent does not exist; use
mkdir-recursive to create intermediate directories.
Arity: 1 · Return: creates the directory at path · Evaluation: eager ·
Effects: filesystem · Host: filesystem · Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(mkdir-recursive path)
Creates path and any missing intermediate directories.
Arity: 1 · Return: creates path and any missing intermediate directories ·
Evaluation: eager · Effects: filesystem · Host: filesystem · Throws: not
documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(copy src dst)
Copies the file at src to dst. Overwrites dst if it exists.
Arity: 2 · Return: Copies the file at src to dst · Evaluation: eager ·
Effects: filesystem · Host: filesystem · Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(move src dst)
Moves/renames the file at src to dst.
Arity: 2 · Return: Moves/renames the file at src to dst · Evaluation: eager
· Effects: filesystem · Host: filesystem · Throws: not documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
(remove-recursive path)
Removes path and (if it is a directory) all its contents.
Arity: 1 · Return: Removes path and (if it is a directory) all its contents ·
Evaluation: eager · Effects: filesystem · Host: filesystem · Throws: not
documented as throwing
No verified inline example: requires filesystem setup, so the generated reference keeps it documented without an inline runtime example.
7 documented · 7 exported · source →
(request url options)
Performs an HTTP request to url with optional options (method, headers,
body). Returns a Promise<Response>.
Arity: 2 · Return: Performs an HTTP request to url with optional options
(method, headers, body) · Evaluation: eager · Effects: network · Host: network ·
Throws: not documented as throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
(get url)
Performs a GET request against url and returns a Promise<Response>.
Arity: 1 · Return: Performs a GET request against url and returns a
Promise<Response> · Evaluation: eager · Effects: network · Host: network ·
Throws: not documented as throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
(post url body)
Performs a POST request to url with the given body. Returns a
Promise<Response>.
Arity: 2 · Return: Performs a POST request to url with the given body ·
Evaluation: eager · Effects: network · Host: network · Throws: not documented as
throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
(get-json url)
Performs a GET request and parses the response body as JSON.
Arity: 1 · Return: Performs a GET request and parses the response body as JSON · Evaluation: async · Effects: network · Host: network · Throws: not documented as throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
(post-json url body)
Performs a POST with a JSON-encoded body and parses the response as JSON. Sets
Content-Type: application/json automatically.
Arity: 2 · Return: Performs a POST with a JSON-encoded body and parses the
response as JSON · Evaluation: async · Effects: network · Host: network ·
Throws: not documented as throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
(status-ok? res)
Returns true when the response status is in the 2xx range.
Arity: 1 · Return: true when the response status is in the 2xx range · Evaluation: eager · Effects: network · Host: network · Throws: not documented as throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
(status-code res)
Returns the numeric status code of the response.
Arity: 1 · Return: the numeric status code of the response · Evaluation: eager · Effects: network · Host: network · Throws: not documented as throwing
No verified inline example: requires network setup, so the generated reference keeps it documented without an inline runtime example.
4 documented · 4 exported · source →
(parse s)
Parses a JSON string into an HQL value. Throws SyntaxError on malformed input.
Arity: 1 · Return: Parses a JSON string into an HQL value · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(stringify obj)
Serializes an HQL value to a JSON string.
Arity: 1 · Return: Serializes an HQL value to a JSON string · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(parse-safe s default)
Parses a JSON string; returns default if s is invalid JSON.
Arity: 2 · Return: Parses a JSON string; returns default if s is invalid
JSON · Evaluation: eager · Effects: pure/derived value · Host: portable ·
Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pretty-stringify obj indent)
Serializes with indent spaces of indentation (pass 2 for the common case).
Arity: 2 · Return: Serializes with indent spaces of indentation (pass 2 for
the common case) · Evaluation: eager · Effects: pure/derived value · Host:
portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
26 documented · 26 exported · source →
(sqrt x)
Returns the square root of x. Negative input returns NaN.
Arity: 1 · Return: the square root of x · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pow base exp)
Returns base raised to the power exp.
Arity: 2 · Return: base raised to the power exp · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(log x)
Natural logarithm (base e) of x. Negative input returns NaN.
Arity: 1 · Return: Natural logarithm (base e) of x · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(log2 x)
Logarithm base 2 of x.
Arity: 1 · Return: Logarithm base 2 of x · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(log10 x)
Logarithm base 10 of x.
Arity: 1 · Return: Logarithm base 10 of x · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(exp x)
Returns e^x.
Arity: 1 · Return: e^x · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(sin x)
Sine of x in radians.
Arity: 1 · Return: Sine of x in radians · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(cos x)
Cosine of x in radians.
Arity: 1 · Return: Cosine of x in radians · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(tan x)
Tangent of x in radians.
Arity: 1 · Return: Tangent of x in radians · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(asin x)
Arcsine of x in radians.
Arity: 1 · Return: Arcsine of x in radians · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(acos x)
Arccosine of x in radians.
Arity: 1 · Return: Arccosine of x in radians · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(atan x)
Arctangent of x in radians.
Arity: 1 · Return: Arctangent of x in radians · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(atan2 y x)
Arctangent of y/x in radians, handling all quadrants.
Arity: 2 · Return: Arctangent of y/x in radians, handling all quadrants · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(floor x)
Largest integer ≤ x.
Arity: 1 · Return: Largest integer ≤ x · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(ceil x)
Smallest integer ≥ x.
Arity: 1 · Return: Smallest integer ≥ x · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(round x)
x rounded to nearest integer.
Arity: 1 · Return: x rounded to nearest integer · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(truncate x)
x with the fractional part removed (toward zero).
Arity: 1 · Return: x with the fractional part removed (toward zero) ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(random)
Returns a pseudo-random number in [0, 1).
Arity: 0 · Return: a pseudo-random number in [0, 1) · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(random-int min max)
Returns a pseudo-random integer in [min, max) (max exclusive).
Arity: 2 · Return: a pseudo-random integer in [min, max) (max exclusive) · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(parse-int s)
Parses s as a base-10 integer. Returns NaN on failure.
Arity: 1 · Return: Parses s as a base-10 integer · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(parse-float s)
Parses s as a float. Returns NaN on failure.
Arity: 1 · Return: Parses s as a float · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(nan? x)
Returns true when x is NaN.
Arity: 1 · Return: true when x is NaN · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(infinity? x)
Returns true when x is +Infinity or -Infinity.
Arity: 1 · Return: true when x is +Infinity or -Infinity · Evaluation: eager
· Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(finite? x)
Returns true when x is a finite number (not NaN, not Infinity).
Arity: 1 · Return: true when x is a finite number (not NaN, not Infinity) ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pi)
Constant binding pi exported by this module.
Arity: 0 · Return: Constant binding pi exported by this module · Evaluation:
eager · Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(e)
Constant binding e exported by this module.
Arity: 0 · Return: Constant binding e exported by this module · Evaluation:
eager · Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
7 documented · 7 exported · source →
(media-type)
Constant binding media-type exported by this module.
Arity: 0 · Return: Constant binding media-type exported by this module ·
Evaluation: eager · Effects: media host · Host: filesystem/network media host ·
Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
(create-media type mime-type base64-data source)
Constructs a Media object with type, mimeType, base64 data, and optional
source path/URL.
Arity: 4 · Return: Constructs a Media object with type, mimeType, base64
data, and optional source path/URL · Evaluation: eager · Effects: media host
· Host: filesystem/network media host · Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
(media? value)
Returns true when value is a Media object (tagged with hql_media).
Arity: 1 · Return: true when value is a Media object (tagged with
hql_media) · Evaluation: eager · Effects: media host · Host:
filesystem/network media host · Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
(read-image path)
Read an image file and return a Media object for vision models
Arity: 1 · Return: Read an image file and return a Media object for vision models · Evaluation: async · Effects: media host · Host: filesystem/network media host · Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
(read-media path)
Read any media file and return a Media object
Arity: 1 · Return: Read any media file and return a Media object · Evaluation: async · Effects: media host · Host: filesystem/network media host · Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
(media-from-base64 mime-type base64-data)
Create a Media object from raw base64 data
Arity: 2 · Return: creates a Media object from raw base64 data · Evaluation: eager · Effects: media host · Host: filesystem/network media host · Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
(read-media-url url)
Fetch media from a URL and return a Media object
Arity: 1 · Return: Fetch media from a URL and return a Media object · Evaluation: async · Effects: media host · Host: filesystem/network media host · Throws: not documented as throwing
No verified inline example: requires filesystem/network media host setup, so the generated reference keeps it documented without an inline runtime example.
8 documented · 8 exported · source →
(sep)
Constant binding sep exported by this module.
Arity: 0 · Return: Constant binding sep exported by this module · Evaluation:
eager · Effects: pure/derived value · Host: portable path rules · Throws: not
documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(join ...parts)
Joins path segments with /, collapsing duplicate separators.
Arity: 0+ · Return: Joins path segments with /, collapsing duplicate
separators · Evaluation: eager · Effects: pure/derived value · Host: portable
path rules · Throws: not documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(basename path)
Returns the last segment of path (file name with extension).
Arity: 1 · Return: the last segment of path (file name with extension) ·
Evaluation: eager · Effects: pure/derived value · Host: portable path rules ·
Throws: not documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(dirname path)
Returns everything before the last / of path, or "." if none.
Arity: 1 · Return: everything before the last / of path, or "." if none ·
Evaluation: eager · Effects: pure/derived value · Host: portable path rules ·
Throws: not documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(extname path)
Returns the file extension including the leading dot (e.g. ".txt"), or "".
Arity: 1 · Return: the file extension including the leading dot (e.g · Evaluation: eager · Effects: pure/derived value · Host: portable path rules · Throws: not documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(absolute? path)
Returns true when path starts with /.
Arity: 1 · Return: true when path starts with / · Evaluation: eager ·
Effects: pure/derived value · Host: portable path rules · Throws: not documented
as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(normalize path)
Collapses ./ segments and resolves ../ segments where possible.
Arity: 1 · Return: Collapses ./ segments and resolves ../ segments where
possible · Evaluation: eager · Effects: pure/derived value · Host: portable path
rules · Throws: not documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
(relative from to)
Returns the relative path from from to to, both normalized.
Arity: 2 · Return: the relative path from from to to, both normalized ·
Evaluation: eager · Effects: pure/derived value · Host: portable path rules ·
Throws: not documented as throwing
No verified inline example: requires portable path rules setup, so the generated reference keeps it documented without an inline runtime example.
3 documented · 3 exported · source →
(pp-str obj indent)
Returns a pretty-printed string of obj. Defaults to 2-space indentation; pass
nil for compact.
Arity: 2 · Return: a pretty-printed string of obj · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pp obj indent)
Prints (pp-str obj indent) followed by a newline. Returns nil.
Arity: 2 · Return: Prints (pp-str obj indent) followed by a newline ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pretty? obj max-width)
Returns true when no line in (pp-str obj 2) exceeds max-width characters.
Arity: 2 · Return: true when no line in (pp-str obj 2) exceeds max-width
characters · Evaluation: eager · Effects: pure/derived value · Host: portable ·
Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
8 documented · 8 exported · source →
(pattern src flags)
Compiles a regex from src with optional flags (e.g. "gi"). Pass nil for no
flags.
Arity: 2 · Return: Compiles a regex from src with optional flags (e.g ·
Evaluation: eager · Effects: pure/derived value · Host: portable RegExp ·
Throws: not documented as throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(find s re)
Returns the first match of re in s, or nil if none.
Arity: 2 · Return: the first match of re in s, or nil if none · Evaluation:
eager · Effects: pure/derived value · Host: portable RegExp · Throws: not
documented as throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(find-all s re)
Returns an array of all matched strings. re must have the 'g' flag.
Arity: 2 · Return: an array of all matched strings · Evaluation: eager · Effects: pure/derived value · Host: portable RegExp · Throws: not documented as throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(match? s re)
Returns true when s matches re anywhere.
Arity: 2 · Return: true when s matches re anywhere · Evaluation: eager ·
Effects: pure/derived value · Host: portable RegExp · Throws: not documented as
throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(replace s re replacement)
Replaces the first match of re in s with replacement.
Arity: 3 · Return: Replaces the first match of re in s with replacement ·
Evaluation: eager · Effects: pure/derived value · Host: portable RegExp ·
Throws: not documented as throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(replace-all s re replacement)
Replaces every match of re in s with replacement. re must have the 'g'
flag.
Arity: 3 · Return: Replaces every match of re in s with replacement ·
Evaluation: eager · Effects: pure/derived value · Host: portable RegExp ·
Throws: not documented as throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(split s re)
Splits s at every match of re.
Arity: 2 · Return: Splits s at every match of re · Evaluation: eager ·
Effects: pure/derived value · Host: portable RegExp · Throws: not documented as
throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
(escape s)
Escapes s so it can be embedded literally inside a pattern.
Arity: 1 · Return: Escapes s so it can be embedded literally inside a pattern
· Evaluation: eager · Effects: pure/derived value · Host: portable RegExp ·
Throws: not documented as throwing
No verified inline example: requires portable RegExp setup, so the generated reference keeps it documented without an inline runtime example.
8 documented · 8 exported · source →
(to-array s)
Returns the elements of s as a JS array (order: insertion order).
Arity: 1 · Return: the elements of s as a JS array (order: insertion order) ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(union ...sets)
Returns a new Set containing every element from all input sets.
Arity: 0+ · Return: a new Set containing every element from all input sets · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(intersection ...sets)
Returns a new Set containing only elements present in every input set.
Arity: 0+ · Return: a new Set containing only elements present in every input set · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(difference ...sets)
Returns a new Set containing elements in the first set but not in any of the others.
Arity: 0+ · Return: a new Set containing elements in the first set but not in any of the others · Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(subset? sub larger)
Returns true when every element of sub is in larger.
Arity: 2 · Return: true when every element of sub is in larger ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(superset? larger sub)
Returns true when larger contains every element of sub.
Arity: 2 · Return: true when larger contains every element of sub ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(disjoint? a b)
Returns true when a and b share no elements.
Arity: 2 · Return: true when a and b share no elements · Evaluation: eager
· Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(select pred s)
Returns a new Set of s elements for which pred returns truthy.
Arity: 2 · Return: a new Set of s elements for which pred returns truthy ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
23 documented · 23 exported · source →
(split s sep)
Splits string s at every occurrence of sep. Returns an array of substrings.
Arity: 2 · Return: Splits string s at every occurrence of sep · Evaluation:
eager · Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(join arr sep)
Joins array arr of strings into one string with sep between elements.
Arity: 2 · Return: Joins array arr of strings into one string with sep
between elements · Evaluation: eager · Effects: pure/derived value · Host:
portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(trim s)
Returns s with leading and trailing whitespace removed.
Arity: 1 · Return: s with leading and trailing whitespace removed ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(upper-case s)
Returns s with all characters upper-cased.
Arity: 1 · Return: s with all characters upper-cased · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(lower-case s)
Returns s with all characters lower-cased.
Arity: 1 · Return: s with all characters lower-cased · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(starts-with? s search)
Returns true when s begins with search.
Arity: 2 · Return: true when s begins with search · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(ends-with? s search)
Returns true when s ends with search.
Arity: 2 · Return: true when s ends with search · Evaluation: eager ·
Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(replace s search replacement)
Replaces the first occurrence of search in s with replacement.
Arity: 3 · Return: Replaces the first occurrence of search in s with
replacement · Evaluation: eager · Effects: pure/derived value · Host: portable
· Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(blank? s)
Returns true when s is nil, empty, or contains only whitespace.
Arity: 1 · Return: true when s is nil, empty, or contains only whitespace ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(not-blank? s)
Opposite of blank? — returns true when s has at least one non-whitespace
character.
Arity: 1 · Return: Opposite of blank? — returns true when s has at least
one non-whitespace character · Evaluation: eager · Effects: pure/derived value ·
Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(capitalize s)
Returns s with the first character upper-cased and the rest lower-cased.
Arity: 1 · Return: s with the first character upper-cased and the rest
lower-cased · Evaluation: eager · Effects: pure/derived value · Host: portable ·
Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pad-left s width pad)
Pads s on the left with pad (default " ") until it reaches width.
Arity: 3 · Return: Pads s on the left with pad (default " ") until it
reaches width · Evaluation: eager · Effects: pure/derived value · Host:
portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(pad-right s width pad)
Pads s on the right with pad (default " ") until it reaches width.
Arity: 3 · Return: Pads s on the right with pad (default " ") until it
reaches width · Evaluation: eager · Effects: pure/derived value · Host:
portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(repeat-str s n)
Returns s concatenated n times. Throws if n is negative.
Arity: 2 · Return: s concatenated n times · Evaluation: eager · Effects:
pure/derived value · Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(reverse-str s)
Returns s with character order reversed (ASCII; combining marks may render
oddly).
Arity: 1 · Return: s with character order reversed (ASCII; combining marks
may render oddly) · Evaluation: eager · Effects: pure/derived value · Host:
portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(index-of s search)
Returns the first index of search in s, or -1 if not found.
Arity: 2 · Return: the first index of search in s, or -1 if not found ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(last-index-of s search)
Returns the last index of search in s, or -1 if not found.
Arity: 2 · Return: the last index of search in s, or -1 if not found ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(replace-first s search replacement)
Replaces only the first match of search (string or RegExp) in s with
replacement.
Arity: 3 · Return: Replaces only the first match of search (string or RegExp)
in s with replacement · Evaluation: eager · Effects: pure/derived value ·
Host: portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(split-lines s)
Splits s into lines on \r\n, \r, or \n.
Arity: 1 · Return: Splits s into lines on \r\n, \r, or \n · Evaluation: eager
· Effects: pure/derived value · Host: portable · Throws: not documented as
throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(camel-case s)
Converts s (space-, dash-, or underscore-separated) to camelCase.
Arity: 1 · Return: Converts s (space-, dash-, or underscore-separated) to
camelCase · Evaluation: eager · Effects: pure/derived value · Host: portable ·
Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(kebab-case s)
Converts s to kebab-case (lowercased, dash-separated).
Arity: 1 · Return: Converts s to kebab-case (lowercased, dash-separated) ·
Evaluation: eager · Effects: pure/derived value · Host: portable · Throws: not
documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(snake-case s)
Converts s to snake_case (lowercased, underscore-separated).
Arity: 1 · Return: Converts s to snake_case (lowercased,
underscore-separated) · Evaluation: eager · Effects: pure/derived value · Host:
portable · Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.
(title-case s)
Converts s to Title Case (each word capitalized, spaces preserved).
Arity: 1 · Return: Converts s to Title Case (each word capitalized, spaces
preserved) · Evaluation: eager · Effects: pure/derived value · Host: portable ·
Throws: not documented as throwing
No verified inline example: package examples require scoped import fixtures; package behavior is covered by package and compiler tests.