A Function Index

  • != — Is another name for comparisons/not=. It takes the same arguments and returns the same results and errors.

    (!= value more*) → boolean

  • * — Returns the product of its arguments.

    (*) → integer
    (* value) → value
    (* value other more*) → value

  • + — Returns the sum of its arguments.

    (+) → integer
    (+ value) → value
    (+ value other more*) → value

  • - — With one argument, returns its negation. With additional arguments, subtracts each from the running result in order. At least one argument is required. Numeric operands follow the arithmetic rules above; temporal operands use the combinations in the table. Integer overflow and non-finite floating-point results are errors, including when negating the minimum integer. Unary subtraction also negates durations; UTC timestamps cannot be negated.

    (- value more*) → value

  • / — Returns n divided by d and each additional divisor in more, or the reciprocal of n when called with one argument.

    (/ n) → float
    (/ value divisor more*) → value

  • < — Returns whether the arguments are strictly increasing.

    (< first second more*) → boolean

  • <= — Returns whether the arguments are nondecreasing.

    (<= first second more*) → boolean

  • = — Returns true if all supplied values are equal, otherwise false.

    (= x) → boolean
    (= x y) → boolean
    (= x y more*) → boolean

  • == — Is another name for the equality function. It takes the same arguments and returns the same results and errors.

    (== x) → boolean
    (== x y) → boolean
    (== x y more*) → boolean

  • > — Returns whether the arguments are strictly decreasing.

    (> first second more*) → boolean

  • >= — Returns whether the arguments are nonincreasing.

    (>= first second more*) → boolean

  • Secure random generators — Creates a generator backed by the operating system's secure entropy source. Use it with random/int, random/float, random/choose, random/shuffle and random/bytes, with the same bounds and validation as a seeded generator:

    (crypto/random) → generator

  • aabb? — Returns true for a #aabb value, an AABB, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (aabb? value) → boolean

  • and — Evaluates forms once each, from left to right, and returns the first falsey value without evaluating later forms; an #err value is falsey, so and returns it. If every form is truthy, returns the last value. With no forms, returns true.

    (and forms*) → value

  • apply — Calls a function value with the elements of a list as its arguments.

    (apply function arguments) → value

  • bitset? — Returns true for a Bitset, otherwise false.

    (bitset? value) → boolean

  • bitsets/add — Add one or more members. Adding a present member has no effect.

    (bitsets/add set member ... more) → bitset

  • bitsets/and — Intersect two or more sets.

    (bitsets/and a b ... more) → bitset

  • bitsets/and-count — Count the intersection without constructing a result set.

    (bitsets/and-count a b) → integer

  • bitsets/and-not — Remove every member of b and the later sets from a.

    (bitsets/and-not a b ... more) → bitset

  • bitsets/contains? — Test whether the set contains member.

    (bitsets/contains? set member) → boolean

  • bitsets/intersects? — Test whether a and b share any member.

    (bitsets/intersects? a b) → boolean

  • bitsets/max — Return the largest member, or null for an empty set.

    (bitsets/max set) → integer or null

  • bitsets/min — Return the smallest member, or null for an empty set.

    (bitsets/min set) → integer or null

  • bitsets/of — Build a set from a list of integer members. Duplicate members appear once.

    (bitsets/of values) → bitset

  • bitsets/or — Union two or more sets.

    (bitsets/or a b ... more) → bitset

  • bitsets/range — Build the half-open interval from start through end−1. Equal bounds make an empty set.

    (bitsets/range start end) → bitset

  • bitsets/rank — Count members less than or equal to member.

    (bitsets/rank set member) → integer

  • bitsets/remove — Remove one or more members. Removing an absent member has no effect.

    (bitsets/remove set member ... more) → bitset

  • bitsets/select — Return the member at a zero-based index, or null when the index is outside the set.

    (bitsets/select set index) → integer or null

  • bitsets/slice — Keep only members in the half-open interval [start, end).

    (bitsets/slice set start end) → bitset

  • bitsets/subset? — Test whether every member of a belongs to b.

    (bitsets/subset? a b) → boolean

  • bitsets/xor — Take the symmetric difference of two or more sets, from left to right.

    (bitsets/xor a b ... more) → bitset

  • blackholes/audit — Returns the audits in transaction order. options is a map with optional after (a transaction) and limit (a positive integer). Without limit, the list has every audit after after. Each audit is also the value of a stardust/blackhole fact that queries can read.

    (blackholes/audit options?) → list

  • blackholes/execute — Applies a previewed blackhole. approval is the preview's invocation map with digest, confirm, actor and reason added. digest is the preview's digest and confirm is its confirmation text. A commit after the preview gives an error with the conflict code. Execute is refused inside a mutation or a reactor.

    (blackholes/execute approval) → map

  • blackholes/preview — Plans a blackhole and changes nothing. invocation is the map {namespace name args}; args is optional. The result has digest, targets, matched, replacements, removals, confirm, affected and samples.

    (blackholes/preview invocation) → map

  • blackholes/status — Returns {enabled audits recovering backups}.

    (blackholes/status) → map

  • boolean — Returns false if value is null or false, otherwise true.

    (boolean value) → boolean

  • boolean? — Returns true if b is either true or false, otherwise false.

    (boolean? b) → boolean

  • bytes/and — Returns the bitwise AND of two or more Bytes values of equal length. Values of different lengths are an error.

    (bytes/and a b more*) → bytes

  • bytes/concat — Returns the bytes of every argument joined in order. Without arguments it returns #b64 "". A null argument adds no bytes.

    (bytes/concat buffers*) → bytes

  • bytes/index-of — Returns the index of the first occurrence of the Bytes needle in b at or after start, or null if there is none. start defaults to zero and is limited to the range from zero to the byte count, as in strings/index-of. An empty needle is found at the limited start.

    (bytes/index-of b needle) → integer
    null
    (bytes/index-of b needle start) → integer
    null

  • bytes/not — Returns b with every bit inverted.

    (bytes/not b) → bytes

  • bytes/of — Returns Bytes with one byte for each integer in the list values. null is an empty list. Each element must be an integer from 0 to 255; any other element is an error, and no value is truncated. An element is a byte value, not a number to store: (bytes/of [1.5]) is an error. The encoding library writes a number as its 8 bytes.

    (bytes/of values) → bytes

  • bytes/or — Returns the bitwise OR of two or more Bytes values of equal length. Values of different lengths are an error.

    (bytes/or a b more*) → bytes

  • bytes/shift-left — Returns b shifted left by n bits as one number, with the first byte most significant. The byte count stays the same. Bits shifted past the first byte are lost, and the vacated bits are zero. n must be a nonnegative integer. A shift of the bit length or more returns all zero bytes, and a shift of zero returns equal Bytes.

    (bytes/shift-left b n) → bytes

  • bytes/shift-right — Returns b shifted right by n bits as one number, with the first byte most significant. The shift is logical: the vacated bits are zero. The byte count stays the same, and bits shifted past the last byte are lost. n must be a nonnegative integer. A shift of the bit length or more returns all zero bytes.

    (bytes/shift-right b n) → bytes

  • bytes/slice — Returns the bytes from index start up to, but not including, index end. end defaults to the byte count. The bounds must be integers with 0 ≤ start ≤ end ≤ (count b). Any other bounds produce #err <bounds index>; a slice never returns fewer bytes than its bounds name.

    (bytes/slice b start) → bytes
    (bytes/slice b start end) → bytes

  • bytes/xor — Returns the bitwise exclusive OR of two or more Bytes values of equal length. Values of different lengths are an error.

    (bytes/xor a b more*) → bytes

  • bytes? — Returns true if value is a Bytes value, otherwise false.

    (bytes? value) → boolean

  • collections/copy — Returns a copy of value that changes to either leave the other unchanged. Copies every list and map reachable from value. A list or map reached more than once is copied once, so collections shared within value stay shared within the copy, and cycles stay cycles. With the mode shallow, copies only the top-level list or map; its members are shared. Other values do not change and are returned as they are.

    (collections/copy value) → value
    (collections/copy value shallow) → value

  • collections/update — Replaces the value at path in root with the result of calling f on that value and args, in place, and returns the same root collection. Stores the result as put does, including container creation and list growth. A missing entry supplies null to f.

    (collections/update root path f args*) → collection

  • compare — Returns -1, 0, or 1 when first sorts before, ties with, or sorts after second, using sort ordering.

    (compare first second) → integer

  • comparisons/identical? — Returns true if its operands refer to the same value, otherwise false. Errors raised at the same place with the same tags and message may be the same value.

    (comparisons/identical? a b) → boolean

  • comparisons/not= — Returns the negation of the corresponding equality call. This means that not all arguments are equal, rather than requiring every pair to differ. One argument returns false; no arguments is an error. Equality retains its matching-kind checks and stops comparing after the first unequal pair.

    (comparisons/not= value more*) → boolean

  • cond — Chooses among pairs of tests and result expressions.

    (cond test result ...)

  • const? — Returns true if v is a constant reference, such as the quoted form `:name, otherwise false. A local and a constant with the same name are not equal.

    (const? v) → boolean

  • contains? — Returns true if path selects a value in root, including null or false, otherwise false.

    (contains? root path) → boolean

  • count — Returns the number of list elements, pointer segments, map members, Unicode string code points, or bytes of a Bytes value. For null, returns zero.

    (count collection) → integer

  • db/reactors — (db/reactors) returns the saved reactors and their work since the database opened. Each entry has these members:

    (db/reactors) → map

  • def — Defines top-level locals: bindings that the later top-level forms of the same file, or of the same REPL session, read as their names.

    (def name value? ...) → local reference

  • defblackhole — Defines a blackhole in a saved namespace. The parameters are locals in the query and in the expressions. query is a query map without as-of: a saved query cannot select an earlier snapshot. A blackhole rewrites every earlier version of a selected field, also when its current value is retracted. A distinct query keeps its own tuples: the variables that the patch reads do not make more rows. patch maps query variables that bind entities to null, which erases every field of the entity, or to a map of fields. A field's null erases each version; an expression computes a replacement for each version. links {incoming remove} removes links to erased entities from other fields.

    (defblackhole name doc? [params*] {query patch links?}) → name

  • defcron — A scheduled reactor is a mutation that the database runs at UTC times. Save it in a namespace. When the root configuration has the tag <scheduled-reactors>, the database runs the mutation at each minute that its schedule selects. Each run is a separate write transaction.

    (defcron name doc? map) → name

  • defmacro — Defines a macro for the later forms of the file or session.

    (defmacro name doc-or-meta? [params*] body*) → name

  • defmutation — Define a mutation with defmutation and call it with an open database. The result contains tx and ids. These examples run in order against a separate new database.

    (defmutation name [params*] mutation-map) → name

  • defn — Defines a top-level function using the existing def and fn semantics. The name is a declaration. Documentation, metadata, parameter rules, contracts, multiple arities and variadic clauses follow fn. The result is the binding name, as with def. Nested defn forms are errors.

    (defn name doc-or-meta? [params*] body*) → name

  • defquery — Defines a named function that queries the database snapshot attached to its evaluation. A result contract may follow the parameter list. Calling the function returns a list of maps unless the query requests positional tuples.

    (defquery name [params*] query-map) → name

  • defreactor — A reactor is a mutation that the database runs. Save it in a namespace. Each later write that changes a field that the reactor reads or writes then runs the reactor before the write commits. The facts that the reactor writes commit in the same transaction as the facts that caused them, so a query at that transaction sees both.

    (defreactor name doc? options? mutation-map) → name

  • defresponder — Defines a responder in a saved namespace. A request call on a subject that pattern matches calls fn with {subject data}, and its value is the reply. A responder answers before any host worker. A save that defines a responder with the pattern of another saved responder, written the same, fails with #err <conflict name>, with a message such as "math/add already answered by app/math/add". Different patterns that match one subject make the call fail with #err <conflict>, which names both responders. name is also bound to fn.

    (defresponder name pattern fn) → name

  • defsubscription — Defines a subscription in a saved namespace. For each publication whose subject pattern matches, the database calls fn with {subject data} before the publish returns, in publication order. fn may write, publish and call; its writes run their own on handlers. A publication that the body makes runs its subscriptions after the current ones, so a chain runs in order without a limit on its length. A failed body never undoes the publication: the publish result lists it under failures. name is also bound to fn.

    (defsubscription name pattern fn) → name

  • distinct — Returns a fresh list retaining the first occurrence of each distinct typed value. Collections compare structurally, with map member order ignored. Kinds remain distinct: integer 1 and float 1.0 are separate values. Functions compare by identity. Positive and negative floating zero compare equal.

    (distinct list) → list

  • do — Evaluates the expr forms in order and returns the last result.

    (do expr*) → value

  • duration? — Returns true for a duration, otherwise false. It is the kind predicate that time/duration? also provides.

    (duration? value) → boolean

  • empty? — Returns whether count is zero. Lists, pointers, maps, strings, bytes, and null are accepted.

    (empty? collection) → boolean

  • encoding/decode — Reverses encoding/encode for codec. hex takes a string of hexadecimal digit pairs of either case and returns Bytes; an odd length or any other character is an error. utf8 takes Bytes and returns a string.

    (encoding/decode codec value) → value
    (encoding/decode codec value options) → value

  • encoding/encode — Encodes value with codec. hex takes Bytes and returns two lowercase hexadecimal digits for each byte. utf8 takes a string and returns its bytes. No codec defines an option for encoding.

    (encoding/encode codec value) → string
    bytes
    (encoding/encode codec value options) → string
    bytes

  • error? — Returns true if value is an error and false otherwise. error? receives an error argument; a call of most other functions returns it (see Evaluation).

    (error? value) → boolean

  • errors/data — Returns the error's payload. For a map payload, returns a new map with the same keys and member values. Nested values remain shared. Other payloads are returned unchanged.

    (errors/data error) → value

  • errors/message — Returns the error's message: the message member of its payload when that is text, the payload itself when the payload is text, and otherwise null. Use it to log an error, since str of an error is the error.

    (errors/message error) → string
    null

  • errors/tags — Returns the error's tags: the boolean members of its payload, as a tag group map such as <division integer zero>. If the payload is not a map, the result is {}. Compare the result with a tag group, or read one tag with get.

    (errors/tags error) → map

  • events/call — Sends data as a request on subject and returns the reply. A saved responder that matches answers at once. Otherwise a host worker (events/accept) must answer: the call waits, and the wait counts against the evaluation's CPU budget and ends when the evaluation is cancelled. While it waits, plugin requests run on the database's other workers, so a call that needs a host worker fails with #err <denied events> when the database has one worker. Without a worker, it fails with no_worker.

    (events/call subject data) → value

  • events/cancel — Ends the exchange behind handle; the other side reads cancel.

    (events/cancel handle) → map

  • events/finish — Ends this side's stream of the exchange behind handle.

    (events/finish handle) → map

  • events/publish — Publishes data on subject and returns {delivered dropped}: the subscriptions it reached, saved ones included, and those whose queue allocation failed. The saved subscriptions run before it returns; a failed body adds an entry {namespace name subject error} to failures.

    (events/publish subject data) → map

  • events/send — Sends data to the other side of the exchange behind handle, as the events/send request does.

    (events/send handle data) → map

  • events/status — Returns {subscriptions registrations rpcs queued runs failures}: the open subscriptions, workers and exchanges, the queued notices, and the saved handler runs and failures since the database opened.

    (events/status) → map

  • export — Names the top-level locals that a library file provides. When code imports the file, as (import {s "lib/shapes"}) does, each named local becomes the constant :s/name. Its value is the value of the local after the file runs. The other locals of the file stay private. The file's functions read them, not the locals of the code that calls them.

    (export name*) → list

  • false? — Returns true if value is the boolean false, otherwise false.

    (false? value) → boolean

  • first — Returns the first element or pointer segment, or null when empty.

    (first list) → value

  • float — Converts an integer to a float, returns a float unchanged, or parses a signed decimal string with an optional decimal point and exponent. Integer conversion can lose precision; for example, integer 9007199254740993 converts to 9007199254740992.0. Whitespace, hexadecimal notation, NaN, and infinity are rejected. Overflow is an error; underflow to zero is permitted. Booleans, null, and nominal types such as links are rejected.

    (float value) → float

  • float? — Returns true if n is a floating-point number, otherwise false.

    (float? n) → boolean

  • fn — Creates a function.

    (fn name? doc-or-meta? [params*] body*) → function
    (fn name? doc-or-meta? ([params*] body*)+) → function

  • fn? — Returns true if f is a function, otherwise false.

    (fn? f) → boolean

  • for — Evaluates a body for each combination of collection values and returns a list of the results.

    (for [name collection ...] body)

  • format — Returns a string by substituting args into the conversion specifications in template.

    (format template args*) → string

  • from-pairs — Returns a fresh map from [key value] pairs in list. Later duplicate keys win.

    (from-pairs list) → map

  • frustum? — Returns true for a #frustum value, a frustum, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (frustum? value) → boolean

  • fs/abs — Returns an absolute path, using the process working directory when path is relative. The target need not exist. Does not resolve symbolic links or normalize dot components.

    (fs/abs path) → string

  • fs/chmod — Sets the permission bits of path to the permission map and returns path. Follows symbolic links and does not apply the umask. Windows produces #err <fs unsupported>.

    (fs/chmod path permissions) → string

  • fs/copy — Copies the contents of source to the exact path destination and returns destination. Options are replace-existing, which defaults to false, and permissions. An existing destination produces #err <fs exists> unless replace-existing is true. With replacement, a destination symbolic link is followed to its target, as the write functions do. When source and destination are the same file, including through a hard or symbolic link, the copy produces #err <fs same-file> before it truncates anything. Does not recurse, copy metadata, or add a filename when destination is a directory.

    (fs/copy source destination) → string
    (fs/copy source destination opts) → string

  • fs/create-file — Exclusively creates an empty regular file and returns path. Any existing entry produces #err <fs exists>. The only option is permissions.

    (fs/create-file path) → string
    (fs/create-file path opts) → string

  • fs/create-temp — Exclusively creates an empty file with a unique name and returns its absolute path.

    (fs/create-temp) → string
    (fs/create-temp opts) → string

  • fs/dir? — Returns true if path resolves to a directory, following symbolic links.

    (fs/dir? path) → boolean

  • fs/exists? — Returns true if path resolves to an existing entry. Returns false if the target or a parent component is absent. Follows symbolic links, so a dangling link returns false.

    (fs/exists? path) → boolean

  • fs/ext — Returns the final filename extension without its dot, or null if there is none. Neither . nor .. has an extension. A trailing dot gives the empty string.

    (fs/ext path) → string or null

  • fs/file-name — Returns the final name component of path, or null for a root. Ignores trailing separators.

    (fs/file-name path) → string or null

  • fs/file? — Returns true if path resolves to a regular file, following symbolic links.

    (fs/file? path) → boolean

  • fs/join — Returns a path formed from the supplied parts. An absolute child replaces the path before it. Does not resolve symbolic links or collapse . and .. components.

    (fs/join part) → string
    (fs/join parent child more*) → string

  • fs/lstat — Returns the same metadata as fs/stat for the final entry at path, ignoring trailing separators and without following that entry's symbolic link.

    (fs/lstat path) → map

  • fs/mkdir — Creates one directory and returns path. The parent must exist. An existing entry produces #err <fs exists>.

    (fs/mkdir path) → string
    (fs/mkdir path opts) → string

  • fs/mkdir-all — Creates missing parent directories and the directory at path, and returns path. An existing directory is accepted, including through a symbolic link. A conflicting non-directory entry produces #err <fs not-directory>. permissions applies only to the directories that the call creates.

    (fs/mkdir-all path) → string
    (fs/mkdir-all path opts) → string

  • fs/mkdir-temp — Exclusively creates a directory with a unique name and returns its absolute path.

    (fs/mkdir-temp) → string
    (fs/mkdir-temp opts) → string

  • fs/normalize — Returns a lexically normalized path. Removes redundant separators and . components, and reduces .. components that have a preceding name. Keeps unresolved leading .. components in a relative path. Returns "." when a relative path reduces to the current directory. Does not resolve symbolic links.

    (fs/normalize path) → string

  • fs/parent — Returns the lexical parent of path, or null if there is none. Ignores trailing separators except those that form a root.

    (fs/parent path) → string or null

  • fs/read — Returns the entire file as Bytes. An empty file returns #b64 "". With {encoding <utf8>}, returns a string and rejects invalid UTF-8 with #err <invalid value>. Text reads retain line endings and a leading byte-order mark.

    (fs/read path) → Bytes
    (fs/read path opts) → Bytes or string

  • fs/read-dir — Returns a list of the immediate child paths of dir. Excludes the . and .. entries. An empty directory returns [].

    (fs/read-dir dir) → list

  • fs/readlink — Returns the target text stored in the symbolic link at path. Does not resolve the target or require it to exist. A missing entry or an entry that is not a symbolic link produces an error.

    (fs/readlink path) → string

  • fs/real-path — Returns an absolute path with all symbolic links resolved. The target must exist. A broken link produces #err <fs missing>, and a link cycle produces #err <fs loop>.

    (fs/real-path path) → string

  • fs/rel — Returns a lexical relative path from base to path. base defaults to the process working directory. Both inputs are made absolute against the same working directory and normalized. Returns "." when the normalized paths are equal. Paths under different host roots, such as two drives, produce #err <invalid value>. Does not resolve symbolic links or require the paths to exist.

    (fs/rel path) → string
    (fs/rel base path) → string

  • fs/remove — Deletes a file, symbolic link, or empty directory and returns null. A missing entry produces #err <fs missing>, and a nonempty directory produces #err <fs not-empty>.

    (fs/remove path) → null

  • fs/remove-all — Deletes a file, symbolic link, or directory tree and returns null. An absent path is accepted. Does not follow symbolic links or change permissions to force deletion. A host root, such as / or a drive root, produces #err <invalid value>, also when the path reaches it through a link, as link/. does for a link to /. A failure can leave part of the tree deleted.

    (fs/remove-all path) → null

  • fs/remove-if-exists — Deletes a file, symbolic link, or empty directory. Returns true if it deleted the entry, or false if the entry was absent. A nonempty directory or other failure produces an error.

    (fs/remove-if-exists path) → boolean

  • fs/stat — Returns metadata for the entry that path reaches, following symbolic links. A missing target or other failure produces an error.

    (fs/stat path) → map

  • fs/strip-ext — Returns path with its final filename extension and dot removed. Returns path unchanged when it has no extension.

    (fs/strip-ext path) → string

  • fs/symlink — Creates a symbolic link at link that contains target, and returns link. target need not exist. A relative target is resolved against the link's parent when the link is followed. An existing entry at link produces #err <fs exists>. On Windows, creating a symbolic link can require a privilege or developer mode; a refusal produces #err <fs denied>.

    (fs/symlink link target) → string

  • fs/symlink? — Returns true if the final entry is a symbolic link, including a dangling link. Ignores trailing separators and does not follow the final link.

    (fs/symlink? path) → boolean

  • fs/walk — Returns a depth-first list of root and its descendants. Each directory comes before its children. Includes symbolic links but never descends through one, including when the root has trailing separators. A file or symbolic-link root returns a one-element list. A missing root or a traversal failure produces an error. There are no visitor callbacks, glob patterns, or link-following option.

    (fs/walk root) → list

  • fs/with-temp-dir — Creates a temporary directory, calls f with its absolute path, and deletes the tree afterwards. Takes the same options as fs/mkdir-temp. It is an ordinary function, not a binding form.

    (fs/with-temp-dir f) → value
    (fs/with-temp-dir f opts) → value

  • fs/write — Writes content and returns path. A string is encoded as UTF-8; Bytes are written unchanged. Creates the file if absent and truncates an existing file unless append is true. Adds no newline or byte-order mark.

    (fs/write path content) → string
    (fs/write path content opts) → string

  • functions/comp — Returns a function composing its inputs right to left, passing all call arguments to the rightmost function and each result to the next. With no inputs, returns functions/identity. With one, returns f.

    (functions/comp) → function
    (functions/comp f) → function
    (functions/comp f g functions*) → function

  • functions/complement — Returns a function that calls f with its arguments and negates the result as a boolean.

    (functions/complement f) → function

  • functions/constantly — Returns a function that ignores its arguments and returns value.

    (functions/constantly value) → function

  • functions/fnull — Returns a function that calls f, replacing null in its first three argument positions with the supplied defaults x, y, and z. Preserves false and does not supply missing arguments.

    (functions/fnull f x) → function
    (functions/fnull f x y) → function
    (functions/fnull f x y z) → function

  • functions/identity — Returns value unchanged.

    (functions/identity value) → value

  • functions/juxt — Returns a function that applies f and functions to the same arguments and returns their results in order as a list.

    (functions/juxt f functions*) → function

  • functions/partial — Returns a function that calls f with args followed by its call-time arguments. With no fixed arguments, returns f.

    (functions/partial f args*) → function

  • gensym — Returns a new name that no source form contains.

    (gensym) → name
    (gensym prefix) → name

  • get — Returns the value selected by path in root, or default if an entry is missing. Without default, a missing entry returns null. A selected value of null or false is returned unchanged, not replaced by default. get does not modify root or copy the selected value. A map or list in callee position calls get with itself as root: see Calling a map or list. In a packed math value, an index selects a part and a string swizzles a vector: see Destructuring and lookup.

    (get root path) → value
    (get root path default) → value

  • hash? — Returns true for a #hash digest, otherwise false.

    (hash? value) → boolean

  • hashes/digest — Returns a #hash of value under algorithm, a name from this table:

    (hashes/digest algorithm value) → hash

  • if — Selects a branch according to the truthiness of a test.

    (if test then)
    (if test then else)

  • int — Returns an integer unchanged, truncates a float toward zero, or parses a signed decimal string exactly. String input accepts an optional ASCII sign followed by ASCII decimal digits, including leading zeros. Whitespace, decimal points, exponents, and hexadecimal notation are rejected. Values outside signed 64-bit range are errors. Booleans, null, and nominal types such as links are rejected.

    (int value) → integer

  • int? — Returns true if n is an integer, otherwise false. A link scalar is not an integer.

    (int? n) → boolean

  • invoke? — Returns true for an invocation form, such as `(f 1), otherwise false.

    (invoke? value) → boolean

  • jsonptr — Converts RFC 6901 text to a pointer. The empty string gives the root pointer; a nonempty string must start with / and contain only valid ~0 and ~1 escapes. Invalid text gives #err <invalid value>; a non-string gives #err <mismatch type>.

    (jsonptr text) → pointer

  • jsonptr? — Returns true for a pointer and false for other values. A pointer is not a list, even though the list functions accept it.

    (jsonptr? value) → boolean

  • keys — Returns the map's string keys in ascending Unicode order.

    (keys map) → list

  • let — Introduces local bindings and evaluates a body in their scope.

    (let [bindings*] exprs*)

  • link? — Returns true for a link, otherwise false.

    (link? value) → boolean

  • list? — Returns true if xs is a list, otherwise false.

    (list? xs) → boolean

  • lists/any? — Returns true at the first truthy predicate result without visiting later elements. Returns false for an empty list.

    (lists/any? predicate list) → boolean

  • lists/append — Appends values to list in place as individual elements and returns the same list. Values are stored without copying. With no additional values, leaves list unchanged. list must be a list, not null or a pointer.

    (lists/append list values*) → list

  • lists/concat — Returns a fresh list containing the elements of each input list, in order. With no inputs, returns an empty list.

    (lists/concat lists*) → list

  • lists/drop — Returns a fresh list excluding the first n elements of list.

    (lists/drop n list) → list

  • lists/drop-while — Returns list from the first element for which predicate is falsey, skipping the preceding elements.

    (lists/drop-while predicate list) → list

  • lists/every? — Returns false at the first falsey predicate result without visiting later elements. Returns true for an empty list.

    (lists/every? predicate list) → boolean

  • lists/filter — Calls predicate on each element, from left to right, and returns the elements whose results are truthy. Retains their input order.

    (lists/filter predicate list) → list

  • lists/find-first — Returns the first element of list for which predicate is truthy, or default if none matches. The default is null.

    (lists/find-first predicate list) → value
    (lists/find-first predicate list default) → value

  • lists/flatten — Returns a list of the non-list elements in list, recursively expanding nested lists in order. Empty lists contribute no elements. Non-list elements, including maps, strings, and null, are kept unchanged. list must be a list, otherwise produces #err <mismatch type>. Missing or extra arguments produce #err <arity mismatch>.

    (lists/flatten list) → list

  • lists/frequencies — Counts each string in the input list and returns a map from strings to integer counts. Non-string elements are errors; integer 1 is never coerced to string "1".

    (lists/frequencies strings) → map

  • lists/group-by — Calls function on each element, from left to right. Each result must be a string and becomes a map key. Each map value is the list of input elements with that key, preserving their input order. Non-string keys are errors.

    (lists/group-by function list) → map

  • lists/interleave — Returns a fresh list taking one element from each input list in turn, stopping at the shortest list. Returns [] with no inputs and a shallow copy with one.

    (lists/interleave) → list
    (lists/interleave list) → list
    (lists/interleave list1 list2) → list
    (lists/interleave list1 list2 lists*) → list

  • lists/interpose — Returns a fresh list with separator between adjacent elements of list.

    (lists/interpose separator list) → list

  • lists/keep — Returns the results of applying f to each element of list, excluding null but preserving false and input order.

    (lists/keep f list) → list

  • lists/last — Returns the last element, or null for an empty list.

    (lists/last list) → value

  • lists/mapcat — Applies f to corresponding elements of list and any additional lists, then concatenates the result lists one level deep. Stops at the shortest input list.

    (lists/mapcat f list lists*) → list

  • lists/nth — Returns the element at the nonnegative, zero-based integer index. An out-of-range index returns default if supplied; otherwise it is an error. A negative index is an error even when a default is supplied.

    (lists/nth list index default?) → value

  • lists/partition — Returns groups of up to n elements from list, starting step elements apart and including short trailing groups. step defaults to n.

    (lists/partition n list) → list
    (lists/partition n step list) → list

  • lists/partition-by — Returns consecutive groups from list, starting a new group whenever f returns a different value.

    (lists/partition-by f list) → list

  • lists/range — Returns integers from start up to, but excluding, end, incrementing by step. The defaults are zero for start and one for step. A negative step produces a descending range. A zero step is an error. All arguments must be integers.

    (lists/range end) → list
    (lists/range start end step?) → list

  • lists/repeat — Returns a list containing value the specified number of times. count must be a nonnegative integer. Values are reused rather than deep copied.

    (lists/repeat count value) → list

  • lists/reverse — Reverses list in place and returns the same list, without copying the elements. list must be a list, not null or a pointer.

    (lists/reverse list) → list

  • lists/second — Returns the second element of list, or null if list has fewer than two elements.

    (lists/second list) → value

  • lists/slice — Returns a fresh list from start up to, but excluding, end. Indexes are nonnegative, zero-based integers. An omitted end means the list's length. Indexes beyond the length are clamped, and an end before the start produces an empty list.

    (lists/slice list start end?) → list

  • lists/some — Returns the first truthy result of applying f to elements of list, without visiting later elements, or null if none matches.

    (lists/some f list) → value

  • lists/sort-by — Sorts list in place, stably, by the keys returned by f, and returns the same list. The list's order changes only after key extraction and all comparisons succeed. list must be a list, not null or a pointer. Calls f once per element, from left to right, before making comparisons. The key function must be an ordinary function and must not change the input list or its elements. Uses sort ordering, or the supplied comparator applied to the keys. Equal keys keep their input order. Elements are shared without copying. Key-function errors stop processing and are returned.

    (lists/sort-by f list) → list
    (lists/sort-by f comparator list) → list

  • lists/take — Returns a fresh list of the first n elements of list, or all elements if fewer are available.

    (lists/take n list) → list

  • lists/take-while — Returns the leading elements of list for which predicate is truthy, stopping at the first falsey result.

    (lists/take-while predicate list) → list

  • local? — Returns true if v is a local reference, such as the quoted form `name, otherwise false.

    (local? v) → boolean

  • m22? — Returns true for a #m22 value, a 2 by 2 matrix, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (m22? value) → boolean

  • m33? — Returns true for a #m33 value, a 3 by 3 matrix, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (m33? value) → boolean

  • m44? — Returns true for a #m44 value, a 4 by 4 matrix, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (m44? value) → boolean

  • macroexpand — Applies macroexpand-1 to the head again and again until it is not a macro call.

    (macroexpand form) → form

  • macroexpand-1 — Expands one macro call and returns the resulting form.

    (macroexpand-1 form) → form

  • map — Returns a list of the results of applying f to corresponding elements of xs and any additional lists.

    (map f xs) → list
    (map f xs lists*) → list

  • map? — Returns true if m is a map, otherwise false.

    (map? m) → boolean

  • maps/select-keys — Returns a fresh map containing the literal top-level keys in keys that are present in map.

    (maps/select-keys map keys) → map

  • maps/zipmap — Returns a fresh map pairing string keys with values, stopping at the shorter list. Later duplicate keys win.

    (maps/zipmap keys values) → map

  • math/aabbs/aabb — Returns an AABB from two #v3 values.

    (math/aabbs/aabb minimum maximum) → aabb

  • math/aabbs/aabb? — Returns true for #aabb values.

    (math/aabbs/aabb? value) → boolean

  • math/aabbs/transform — Transforms an AABB with a #m44 matrix and returns its axis-aligned bounds.

    (math/aabbs/transform box matrix) → aabb

  • math/abs — Returns the absolute value, preserving integer or float kind. The absolute value of the minimum integer overflows and is an error. Durations are also accepted and return a duration; the minimum tick duration likewise overflows. UTC timestamps are rejected.

    (math/abs value) → value

  • math/acos — Returns the arc cosine of n in radians, in the range from zero to pi.

    (math/acos n) → float

  • math/acosh — Returns the nonnegative inverse hyperbolic cosine of n.

    (math/acosh n) → float

  • math/asin — Returns the arc sine of n in radians, in the range from negative pi/2 to pi/2.

    (math/asin n) → float

  • math/asinh — Returns the inverse hyperbolic sine of n.

    (math/asinh n) → float

  • math/atan — Returns the arc tangent of n in radians, in the range from negative pi/2 to pi/2.

    (math/atan n) → float

  • math/atan2 — Returns the angle of the point (x, y) in radians, in the range from negative pi to pi, using both signs to select the quadrant.

    (math/atan2 y x) → float

  • math/atanh — Returns the inverse hyperbolic tangent of n.

    (math/atanh n) → float

  • math/cbrt — Returns the real cube root of n, with the same sign as n.

    (math/cbrt n) → float

  • math/ceil — Returns the least integral-valued float greater than or equal to n after conversion to a float.

    (math/ceil n) → float

  • math/clamp — Returns value limited to the inclusive interval from low through high. All three arguments must have the same numeric or temporal kind, and low must not exceed high.

    (math/clamp value low high) → value

  • math/contains? — Returns true when an AABB or sphere contains a #v3 point. A point on the boundary is contained. Other containers produce #err <mismatch type>. A squared distance from a sphere's center past the Float range produces #err <float overflow>.

    (math/contains? container point) → boolean

  • math/copy-sign — Returns the absolute value of magnitude with the sign of sign, including the sign of floating-point zero.

    (math/copy-sign magnitude sign) → float

  • math/cos — Returns the cosine of angle in radians.

    (math/cos angle) → float

  • math/cosh — Returns the hyperbolic cosine of n.

    (math/cosh n) → float

  • math/even? — Returns true if integer n is even, otherwise false.

    (math/even? n) → boolean

  • math/exp — Returns e raised to n.

    (math/exp n) → float

  • math/exp2 — Returns two raised to n.

    (math/exp2 n) → float

  • math/expm1 — Returns e raised to n minus one, computed without the loss of precision from subtracting one from math/exp's rounded result near zero.

    (math/expm1 n) → float

  • math/floor — Returns the greatest integral-valued float less than or equal to n after conversion to a float.

    (math/floor n) → float

  • math/floor-div — Returns the integer quotient of n divided by d, rounded toward negative infinity.

    (math/floor-div n d) → integer

  • math/floor-mod — Returns the integer remainder of n divided by d using a quotient rounded toward negative infinity.

    (math/floor-mod n d) → integer

  • math/frustums/frustum — Returns a frustum from six #plane values.

    (math/frustums/frustum left right bottom top near far) → frustum

  • math/frustums/frustum? — Returns true for #frustum values.

    (math/frustums/frustum? value) → boolean

  • math/hypot — Returns the square root of x*x + y*y without intermediate overflow or underflow.

    (math/hypot x y) → float

  • math/intersects? — Tests these unordered geometry pairs: AABB with AABB, ray, sphere, or frustum; ray with sphere, plane, or triangle; and sphere with sphere, plane, or frustum. Other pairs produce #err <mismatch type>. A test value that passes the Float range, such as the distance along a ray almost parallel to a plane, produces #err <float overflow>.

    (math/intersects? a b) → boolean

  • math/inverse-lerp — Returns the fraction locating value between start and end, without clamping. Equal endpoints are an error.

    (math/inverse-lerp start end value) → float

  • math/lerp — Returns start + (end - start) * fraction as a float. The fraction is not clamped, so values outside zero through one extrapolate beyond the endpoints.

    (math/lerp start end fraction) → float

  • math/log — Returns the natural logarithm of n, or its logarithm in the supplied base. When base is supplied, both numbers must have the same type. The base must be positive and cannot be one.

    (math/log n) → float
    (math/log n base) → float

  • math/log10 — Returns the base-ten logarithm of n.

    (math/log10 n) → float

  • math/log1p — Returns the natural logarithm of one plus n, computed without the loss of precision from rounding 1 + n near zero.

    (math/log1p n) → float

  • math/log2 — Returns the base-two logarithm of n.

    (math/log2 n) → float

  • math/matrices/m22 — Returns a row-major 2 by 2 matrix.

    (math/matrices/m22 m00 m01 m10 m11) → m22

  • math/matrices/m33 — Returns a row-major 3 by 3 matrix.

    (math/matrices/m33 m00 m01 m02 m10 m11 m12 m20 m21 m22) → m33

  • math/matrices/m44 — Returns a row-major 4 by 4 matrix.

    (math/matrices/m44 m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33) → m44

  • math/matrices/matrix? — Returns true for #m22, #m33, and #m44 values.

    (math/matrices/matrix? value) → boolean

  • math/max — Returns the greatest argument. Requires at least one argument, and all arguments must have the same numeric or temporal kind. Integer and temporal comparisons retain full 64-bit precision.

    (math/max value more*) → value

  • math/min — Returns the least argument. Requires at least one argument, and all arguments must have the same numeric or temporal kind. Integer and temporal comparisons retain full 64-bit precision.

    (math/min value more*) → value

  • math/noise/perlin2 — Returns deterministic two-dimensional Perlin noise for a #v2 point. The noise hash reduces each coordinate modulo 289. Past about 1e160 that reduction can pass the Float range, which produces #err <float overflow>.

    (math/noise/perlin2 point) → float

  • math/odd? — Returns true if integer n is odd, otherwise false.

    (math/odd? n) → boolean

  • math/planes/plane — Returns a plane from a #v3 normal and a numeric distance.

    (math/planes/plane normal distance) → plane

  • math/planes/plane? — Returns true for #plane values.

    (math/planes/plane? value) → boolean

  • math/pow — Returns base raised to exponent.

    (math/pow base exponent) → float

  • math/quaternions/quaternion — Returns #quat [x y z w].

    (math/quaternions/quaternion x y z w) → quat

  • math/quaternions/quaternion? — Returns true for #quat values.

    (math/quaternions/quaternion? value) → boolean

  • math/rays/intersect-sphere — Returns the near and far ray distances. Returns null when there is no hit. A zero ray direction does not intersect.

    (math/rays/intersect-sphere ray sphere) → list
    null

  • math/rays/ray — Returns a ray from two #v3 values. The direction need not have unit length.

    (math/rays/ray origin direction) → ray

  • math/rays/ray? — Returns true for #ray values.

    (math/rays/ray? value) → boolean

  • math/remap — Maps value from the input interval to the output interval, without clamping. Equal input endpoints are an error. Reversed intervals are accepted.

    (math/remap input-start input-end output-start output-end value) → float

  • math/rint — Returns the integral-valued float nearest to n after conversion to a float, choosing the even integer in halfway cases.

    (math/rint n) → float

  • math/round — Returns the integer nearest to n, rounding halfway cases away from zero.

    (math/round n) → integer

  • math/sign — Returns integer -1, 0, or 1 according to the argument's sign.

    (math/sign number) → integer

  • math/signum — Returns -1.0 for negative n, 1.0 for positive n, or zero with n's sign for zero.

    (math/signum n) → float

  • math/sin — Returns the sine of angle in radians.

    (math/sin angle) → float

  • math/sinh — Returns the hyperbolic sine of n.

    (math/sinh n) → float

  • math/spheres/sphere — Returns a sphere from a #v3 center and a numeric radius.

    (math/spheres/sphere center radius) → sphere

  • math/spheres/sphere? — Returns true for #sphere values.

    (math/spheres/sphere? value) → boolean

  • math/sqrt — Returns the square root of n.

    (math/sqrt n) → float

  • math/tan — Returns the tangent of angle in radians.

    (math/tan angle) → float

  • math/tanh — Returns the hyperbolic tangent of n.

    (math/tanh n) → float

  • math/triangles/triangle — Returns a triangle from three #v3 points.

    (math/triangles/triangle a b c) → triangle

  • math/triangles/triangle? — Returns true for #triangle values.

    (math/triangles/triangle? value) → boolean

  • math/trunc — Returns n converted to a float with its fractional part discarded, rounding toward zero.

    (math/trunc n) → float

  • math/vectors/normalize — Returns a vector with unit length. The vector is a #v2, #v3, #v4 or #vf. Only the zero vector returns a zero vector. The vector is divided by its largest component magnitude first, so no intermediate value leaves the Float range for a finite input.

    (math/vectors/normalize vector) → v2
    v3
    v4
    vf

  • math/vectors/swizzle — Returns the components of a #v2, #v3 or #v4 that pattern names, in its order. The pattern is one to four letters, all from xyzw or all from rgba, and letters can repeat. One letter returns a Float; two to four return the vector of that width. (v pattern) is the same swizzle. A literal pattern compiles to direct component reads.

    (math/vectors/swizzle vector pattern) → float
    v2
    v3
    v4

  • math/vectors/transform — Transforms a #v3 point with a #m44 matrix. The operation uses an implicit fourth component of one.

    (math/vectors/transform point matrix) → v3

  • math/vectors/v2 — Returns #v2 [x y].

    (math/vectors/v2 x y) → v2

  • math/vectors/v3 — Returns #v3 [x y z].

    (math/vectors/v3 x y z) → v3

  • math/vectors/v4 — Returns #v4 [x y z w].

    (math/vectors/v4 x y z w) → v4

  • math/vectors/vector? — Returns true for #v2, #v3, and #v4 values.

    (math/vectors/vector? value) → boolean

  • math/vectors/vf — Returns a #vf with the numbers of a list as its lanes. An Integer becomes the nearest Float. A #vi argument becomes a #vf with the same numbers, and a #vf argument is returned as it is.

    (math/vectors/vf numbers) → vf

  • math/vectors/vi — Returns a #vi with the Integers of a list as its lanes. A Float in the list is an error. A #vi argument is returned as it is.

    (math/vectors/vi integers) → vi

  • math/zero? — Returns true if n is zero, otherwise false.

    (math/zero? n) → boolean

  • not — Returns true if value is null or false, otherwise false.

    (not value) → boolean

  • null? — Returns true if x is null, otherwise false.

    (null? x) → boolean

  • number? — Returns true if n is an integer or a float, otherwise false. A link scalar is not a number.

    (number? n) → boolean

  • or — Evaluates forms once each, from left to right, and returns the first truthy value without evaluating later forms. If every form is falsey, returns the last value. With no forms, returns null.

    (or forms*) → value

  • pack — Builds a map from locals that have the same names as its keys.

    (pack members) → map

  • pairs — Returns [key value] pairs in the same ascending key order used by keys.

    (pairs map) → list

  • patch — Applies JSON Merge Patch member semantics to map in place and returns the same map. All arguments must be maps, checked before any patch is applied. With no changes maps, returns map unchanged.

    (patch map changes*) → map

  • peg? — Returns true for a compiled PEG, otherwise false.

    (peg? value) → boolean

  • plane? — Returns true for a #plane value, a plane, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (plane? value) → boolean

  • put — Stores value at path in root in place and returns the same root collection. Inserts or replaces a map entry, or replaces an existing list element. A list index equal to its length appends one element. Larger indices are errors. Values replace rather than merge, and null is stored rather than deleted. Creates maps, never lists, for missing or null intermediate values. Integer path segments require an existing list.

    (put root path value) → collection

  • quasiquote — Constructs data while evaluating unquotes at the matching nesting depth. List-element splices insert the elements of their evaluated list. See Quotation forms for prefix syntax and encoding.

    #quasiquote form

  • quasiquote? — Returns true for a quasiquote form, such as the value of `~x, otherwise false.

    (quasiquote? value) → boolean

  • quat? — Returns true for a #quat value, a quaternion, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (quat? value) → boolean

  • quote — Returns the enclosed form as data without evaluating it. References, invocations, and collection contents retain their form representation. See Quotation forms for prefix syntax and encoding.

    #quote form

  • quote? — Returns true for a quote form, such as the value of ``x, otherwise false.

    (quote? value) → boolean

  • random/bytes — Returns Bytes of count uniform random bytes. Each generator output gives eight bytes, least significant byte first. The bytes that the last output has left over are discarded, so two calls for four bytes each do not return the same bytes as one call for eight. count must be a nonnegative integer; a count of zero returns #b64 "" and leaves the generator unchanged.

    (random/bytes generator count) → bytes

  • random/choose — Returns one item of list, each with the same chance. An empty list or null produces #err <invalid value>.

    (random/choose generator list) → value

  • random/float — Returns a float x with lo < x < hi=. Both bounds are floats. The function takes the top 53 bits of the next output as u in [0, 1), and maps it to lo + u * (hi - lo). When hi - lo is too large for a float, it uses lo * (1 - u) + hi * u. A result that rounds up to hi is drawn again.

    (random/float generator lo hi) → float

  • random/int — Returns an integer x with lo < x < hi=, uniform over the range. The range can span all 64-bit integers. Integers use Lemire's multiply-and-reject method, so no value is more likely than another.

    (random/int generator lo hi) → integer

  • random/seeded — Returns a new generator for the integer seed. Every integer is a seed, negative ones included.

    (random/seeded seed) → generator

  • random/shuffle — Returns a new list with the items of list in a uniform random order, and leaves list unchanged. The order comes from a Fisher–Yates shuffle that swaps each position i, from the last down to the second, with a position from 0 to i. null shuffles to [].

    (random/shuffle generator list) → list

  • ray? — Returns true for a #ray value, a ray, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (ray? value) → boolean

  • reduce — Starts with initial and calls function with the accumulator and each list element, in list order. Each call's result becomes the next accumulator. Returns the final accumulator. An empty list or null returns initial without calling the function. The first argument must be an ordinary function value and the third must be a list, pointer, bytes, or null. Errors stop reduction immediately: a call that returns an #err value ends the reduction, and that value is the result.

    (reduce function initial list) → value

  • regex-matcher? — Returns true for a compiled regular expression matcher, otherwise false.

    (regex-matcher? value) → boolean

  • regex? — Returns true for a regular expression, otherwise false. A compiled matcher is not a regular expression; see regex-matcher?.

    (regex? value) → boolean

  • regexes/find — Returns the next match from matcher, or the first match of re in string s. Returns null if there is no match.

    (regexes/find matcher [opts]) → string, list, map, or null
    (regexes/find re s [opts]) → string, list, map, or null

  • regexes/find-all — Returns an eager list of successive, non-overlapping matches of re in string s. Each item uses the capture format of regexes/groups. Returns an empty list if there are no matches. After an empty match, the search first tries a nonempty match at the same position; if there is none, it advances by one code point.

    (regexes/find-all re s [opts]) → list

  • regexes/groups — Returns the current match from matcher without advancing it. Without options and with no capture groups, returns the matched string. Otherwise, returns a list containing the full match followed by each capture in group-number order. An unmatched group is null. Without a current match, produces an error.

    (regexes/groups matcher [opts]) → string, list, or map

  • regexes/matcher — Returns a new mutable matcher for re in string s, for use with regexes/find and regexes/groups. A matcher can be used across evaluations in the same session. It cannot be serialized or used in another session. The current match is cleared when a search reaches the end without a match.

    (regexes/matcher re s) → matcher

  • regexes/matches — Returns the match if re matches the entire string s, otherwise null. Results use the capture format of regexes/groups.

    (regexes/matches re s [opts]) → string, list, map, or null

  • regexes/pattern — Returns a regex value for string s, or s unchanged if it is already a pattern. Invalid patterns produce an error.

    (regexes/pattern s) → pattern

  • regexes/quote-replacement — Returns string replacement escaped for literal use with regexes/replace or regexes/replace-first.

    (regexes/quote-replacement replacement) → string

  • regexes/replace — Returns string s with all non-overlapping matches of re replaced by replacement.

    (regexes/replace s re replacement [opts]) → string

  • regexes/replace-first — Returns string s with the first match of re replaced by replacement. Uses the replacement rules of regexes/replace.

    (regexes/replace-first s re replacement [opts]) → string

  • regexes/split — Returns a list of parts of string s split on matches of re. The integer limit defaults to zero. A positive limit permits at most that many parts, with the unsplit suffix in the last part. Zero omits trailing empty strings. A negative limit preserves them. A zero-width match at the start of s does not create a leading empty part. If no split occurs, the result contains s as its only part.

    (regexes/split s re) → list
    (regexes/split s re limit) → list

  • rem — Returns the remainder with the sign of the dividend. Two integers produce an exact integer remainder; otherwise the result is a float. A zero divisor is an error. The minimum integer divided by -1 has remainder zero.

    (rem dividend divisor) → number

  • remove — Removes the entry selected by path from root in place and returns the same root collection. Removes a map member or a list element, shifting later list elements left. Empty parent collections are not removed. A missing key, out-of-range nonnegative index, or missing or null intermediate value leaves root unchanged. No containers are created.

    (remove root path) → collection

  • rest — Returns a fresh sequence without the first element. A pointer produces a pointer; an empty list produces [] and an empty pointer produces the root pointer.

    (rest list) → list

  • schemas/check — Generates isolated calls from a declared contract or an exact inferred signature. The default options are {seed 0 cases 1000 size 8192}. cases must be from 1 through 1,000,000; size must be from 1 through 8,192 choices per case. A declared contract is an obligation to test, not proof of correct behavior. Approximate inference alone returns <unsupported>.

    (schemas/check function) → report
    error
    (schemas/check function options) → report
    error

  • schemas/explain — Returns null when value matches schema. A mismatch returns a structured #err <schema-mismatch> value. An invalid schema returns a separate #err <invalid schema> value.

    (schemas/explain schema value) → null
    error

  • schemas/fakerize — Makes a random value that matches schema. The function advances the supplied random generator. Equal generator states and equal schemas produce equal values.

    (schemas/fakerize generator schema) → value
    error
    (schemas/fakerize generator schema options) → value
    error

  • schemas/join — Returns a schema accepting values from any operand.

    (schemas/join schemas*) → schema

  • schemas/load — Reconstructs a named schema from definition data returned by documents/value. A self-contained definition is a (defschema name description) source form. A definition that refers to other named schemas or predicate functions uses a finite graph with explicit definition identities and reference bindings. Same-named definitions in different namespaces remain distinct.

    (schemas/load definition) → schema

  • schemas/match — Evaluates candidate once. It checks branches in source order and selects the first matching pattern with a true guard.

    (schemas/match candidate (pattern [when guard] body...) ...)

  • schemas/materialize — Creates a concrete value only when the schema determines one. It can select a literal, a forced value, or a default preference. It does not convert values. Defaults do not restrict accepted values; schemas/valid? ignores them. Write a preference beside its constraint, for example [meet int? [default 8080]].

    (schemas/materialize schema) → value
    error

  • schemas/meet — Returns the intersection of its operands. Incompatible builtin constraints reduce to never: (schemas/meet int? string?) and (schemas/meet int? [not int?]) are never. Open shapes without a name meet field by field, so (schemas/meet {active [is = true]} {name string?}) is one shape with both fields. A field stays optional only when it is optional in every shape.

    (schemas/meet schemas*) → schema

  • schemas/simplify — Returns a simplified schema without changing its input. It reduces supported combinations at the root and within map fields, lists and collection constraints.

    (schemas/simplify schema) → schema

  • schemas/valid? — Tests a value against a schema without converting it. A schema is one of four things:

    (schemas/valid? schema value) → boolean

  • seq — Returns the elements of a list, pointer, Bytes or Bitset as a list. A Bitset supplies its members in ascending order. null gives an empty list.

    (seq value) → list

  • sort — Sorts list in place, stably, and returns the same list, without copying its elements. The list's order changes only after all comparisons succeed. list must be a list, not null or a pointer. By default, sorts in ascending order and requires all elements to have the same kind. Orderable kinds are null, boolean, integer, float, string, link, UTC, duration, SHA-256, and pointer. Pointer segments compare lexicographically, with an index before a key; a shorter prefix sorts before its extension. Integers and nominal integer payloads compare exactly. Strings compare by Unicode code point order, booleans put false before true, and SHA-256 values compare their bytes. Null values tie.

    (sort list) → list
    (sort comparator list) → list

  • sphere? — Returns true for a #sphere value, a sphere, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (sphere? value) → boolean

  • str — Converts zero or more values to strings and concatenates them in argument order. It inserts no spaces or other separators. With no arguments, returns the empty string.

    (str values*) → string

  • string? — Returns true if s is a string, otherwise false.

    (string? s) → boolean

  • strings/blank? — Returns true if s is null, empty, or contains only whitespace, otherwise false.

    (strings/blank? s) → boolean

  • strings/case — Converts value with one case selector or a list of selectors. A list applies the conversions from left to right. An empty list returns the input unchanged. The selector and input must be strings. Unknown selectors produce an error.

    (strings/case case value) → string
    (strings/case cases value) → string

  • strings/ends-with? — Returns whether the string ends with the literal suffix. Every string ends with the empty string.

    (strings/ends-with? string suffix) → boolean

  • strings/escape — Escapes text for the specified mode. With only a mode, returns a unary function that escapes its argument, for use as a template's escape option. The function prints and hashes as its call, such as (strings/escape "html-text"), and renders a template argument before escaping it.

    (strings/escape mode text) → string
    (strings/escape mode) → function

  • strings/humanize — Formats an integer, float, duration, or UTC value as readable text. Options are a map with string keys. Unknown options and options irrelevant to the value's kind are errors.

    (strings/humanize value options?) → string

  • strings/includes? — Returns whether the string contains the literal search. Every string includes the empty string.

    (strings/includes? string search) → boolean

  • strings/index-of — Returns the first index of the string value in s at or after start, or null if not found.

    (strings/index-of s value) → integer or null
    (strings/index-of s value start) → integer or null

  • strings/join — Joins a list of strings with separator between consecutive elements. An empty list produces the empty string. Elements and the separator must be strings.

    (strings/join strings separator) → string

  • strings/last-index-of — Returns the last index of the string value in s at or before start, or null if not found.

    (strings/last-index-of s value) → integer or null
    (strings/last-index-of s value start) → integer or null

  • strings/normalize — Returns s normalized to the Unicode normalization form, defaulting to NFC.

    (strings/normalize s) → string
    (strings/normalize s form) → string

  • strings/of — Returns the string formed by the Unicode scalar values in the list points, in order.

    (strings/of points) → string

  • strings/replace — Replaces non-overlapping literal occurrences of search, from left to right. An empty search inserts replacement before, between, and after the input's Unicode code points: (strings/replace ab "" x) returns xaxbx.

    (strings/replace string search replacement) → string

  • strings/replace-first — Returns s with the first occurrence of match replaced by replacement.

    (strings/replace-first s match replacement) → string

  • strings/split — Splits at each literal occurrence of separator, preserving empty fields. An empty separator splits into Unicode code points; splitting an empty string with an empty separator returns a list containing the empty string.

    (strings/split string separator) → list
    (strings/split string separator limit) → list

  • strings/split-lines — Returns the lines of s separated by LF or CRLF, without their line endings.

    (strings/split-lines s) → list

  • strings/starts-with? — Returns whether the string begins with the literal prefix. Every string starts with the empty string.

    (strings/starts-with? string prefix) → boolean

  • strings/substring — Returns the code points from start up to, but excluding, end. Without end, returns the rest of the string. Both indices must be integers between zero and the string length, and start must not exceed end. Other indices produce #err <bounds index>.

    (strings/substring string start) → string
    (strings/substring string start end) → string

  • strings/trim — Returns s with whitespace or text removed from the ends selected by opts.

    (strings/trim s opts) → string
    (strings/trim s text opts) → string

  • strings/trim-prefix — Returns s without prefix when s starts with it, otherwise s. It removes one match. An empty prefix leaves s unchanged.

    (strings/trim-prefix s prefix) → string

  • strings/trim-suffix — Returns s without suffix when s ends with it, otherwise s. It removes one match. An empty suffix leaves s unchanged.

    (strings/trim-suffix s suffix) → string

  • strings/unescape — Decodes text for the same modes as strings/escape. With only a mode, returns a unary decoding function that prints and hashes as its call, such as (strings/unescape "url-query-value"). Invalid JSON Pointer, URL percent, CSV, and quoted string escapes produce #err <invalid value>, as do URL percent escapes whose bytes are not UTF-8, since strings are always Unicode text. HTML decoding recognizes semicolon-terminated named and numeric character references.

    (strings/unescape mode text) → string
    (strings/unescape mode) → function

  • strings/words — Splits text at runs of Unicode WhiteSpace, omitting empty fields. Leading and trailing whitespace need no separate trim. Empty or whitespace-only text returns []. Punctuation remains part of each word.

    (strings/words text) → list

  • tagged? — Returns true for a tagged value, otherwise false. An error is not tagged data: error? tests for one.

    (tagged? value) → boolean

  • template? — Returns true if value is a string template, otherwise false.

    (template? value) → boolean

  • time/duration — With one argument, a number supplies a raw 100 ns tick count and a string supplies an ISO duration. A float is rounded to the nearest tick, with halfway cases rounded away from zero and a minimum of one tick in magnitude for nonzero values: (time/duration 1.5) is two ticks.

    (time/duration value) → duration
    (time/duration amount unit) → duration

  • time/duration? — Returns whether the value has the duration kind. UTC timestamps and integers return false.

    (time/duration? value) → boolean

  • time/format — Formats a UTC timestamp or duration as its canonical ISO string, without a DUST tag prefix. The full 100 ns tick precision is retained. For readable display text, use the String library's strings/humanize function.

    (time/format value) → string

  • time/now — This function requires the io plugin. It reads the host clock. The clock setting of the io plugin can stop the calls (Scheduled reactor settings). A stopped call returns #err <clock denied>.

    (time/now) → UTC

  • time/parts — Returns integer fields year, month, day, hour, minute, second, nanosecond, and weekday. Months and days start at one. ISO weekdays run from one for Monday through seven for Sunday. The nanosecond field is the fractional part of the second, from zero through 999999900 in multiples of 100.

    (time/parts timestamp) → map

  • time/round — Returns the nearest multiple of quantum, with halfway cases rounded away from zero. At a one-second quantum, 1.5s becomes 2s and -1.5s becomes -2s.

    (time/round duration quantum) → duration

  • time/shift — Shifts by a map containing integer years, months, and days offsets. Omitted offsets are zero; negative offsets move backward. Unknown fields and non-integer offsets are errors.

    (time/shift timestamp changes) → UTC

  • time/start-of — Returns the start of the containing UTC calendar unit. The unit is one of year, month, week, day, hour, minute, or second. This floors to the earlier boundary, including for times before the Unix epoch. A week's Monday can fall in the preceding month or year.

    (time/start-of timestamp unit) → UTC

  • time/truncate — Returns the multiple of quantum reached by truncating toward zero. For example, 1.9s becomes 1s and -1.9s becomes -1s at a one-second quantum.

    (time/truncate duration quantum) → duration

  • time/units — Expresses a UTC timestamp or duration in the requested unit. The unit argument comes first. For UTC, the result measures time since the Unix epoch; for a duration, it measures the elapsed interval. The underlying value remains a signed count of 100 ns ticks.

    (time/units unit value) → number

  • time/utc — An integer supplies a raw count of 100 ns ticks since the Unix epoch. A string supplies a UTC timestamp ending in Z. A float supplies a Julian day, following SQLite's Julian-day convention: day 0.0 is -4713-11-24T12:00:00Z, 2440587.5 is the Unix epoch, and 2451545.0 is 2000-01-01T12:00:00Z.

    (time/utc value) → UTC

  • time/utc? — Returns whether the value has the UTC kind. Durations and integers return false.

    (time/utc? value) → boolean

  • triangle? — Returns true for a #triangle value, a triangle, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (triangle? value) → boolean

  • true? — Returns true if value is the boolean true, otherwise false.

    (true? value) → boolean

  • unquote — Evaluates the enclosed form within its matching quasiquote and substitutes the resulting value. Outside quasiquote, this is an error. See Quotation forms for prefix syntax and encoding.

    #unquote form

  • unquote-splicing — Evaluates the enclosed list within its matching quasiquote and inserts its elements into the surrounding list. A non-list result or a splice outside a list-element position is an error. See Quotation forms for prefix syntax and encoding.

    #unquote-splicing form

  • unquote-splicing? — Returns true for an unquote-splicing form, such as the value of `,@x, otherwise false.

    (unquote-splicing? value) → boolean

  • unquote? — Returns true for an unquote form, such as the value of `,x, otherwise false.

    (unquote? value) → boolean

  • utc? — Returns true for a UTC timestamp, otherwise false. It is the kind predicate that time/utc? also provides.

    (utc? value) → boolean

  • uuid? — Returns true for a UUID, otherwise false. A string that spells a UUID is not one.

    (uuid? value) → boolean

  • v2? — Returns true for a #v2 value, a two-dimensional vector, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (v2? value) → boolean

  • v3? — Returns true for a #v3 value, a three-dimensional vector, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one. As a schema, v3? accepts a #v3 field value.

    (v3? value) → boolean

  • v4? — Returns true for a #v4 value, a four-dimensional vector, otherwise false. Another packed kind with the same number of components, or a list of the components, is not one.

    (v4? value) → boolean

  • values — Returns map values in the same ascending key order used by keys.

    (values map) → list

  • vf? — Returns true for a #vf value, a packed vector of Float lanes, otherwise false. A #vi value, a fixed packed value such as #v3, or a list of numbers is not one.

    (vf? value) → boolean

  • vi? — Returns true for a #vi value, a packed vector of Integer lanes, otherwise false. A #vf value or a list of integers is not one.

    (vi? value) → boolean

  • when — Runs a body when its test is truthy.

    (when test body...)

  • when-not — Runs a body when its test is falsey.

    (when-not test body...)