Language Reference

Every built-in function, special form, and macro in the mino language. Organized by category with usage examples from the test suite. Coming from Clojure?

Other

clojure.core/*

Returns the product of the arguments. Throws on long overflow; use *' to auto-promote.

clojure.core/*'

Returns the product of the arguments. Auto-promotes to bigint on long overflow.

clojure.core/*1

clojure.core/*2

clojure.core/*3

clojure.core/*agent*

clojure.core/*assert*

Controls assertion compilation. When false, `assert` is a no-op. Defaults to true.

clojure.core/*clojure-version*

The Clojure compatibility version for this runtime, as a map with :major :minor :incremental and :qualifier keys.

clojure.core/*command-line-args*

clojure.core/*compile-files*

clojure.core/*compile-path*

clojure.core/*data-readers*

clojure.core/*default-data-reader-fn*

clojure.core/*e

clojure.core/*err*

clojure.core/*file*

clojure.core/*flush-on-newline*

When true (the default), the I/O sink behind `*out*` is flushed automatically after any write that contains a newline. When false, the sink stays buffered so consecutive writes coalesce.

clojure.core/*in*

clojure.core/*math-context*

Precision/rounding-mode for bigdec division. nil means exact-or- throw (mirrors java.math.BigDecimal.divide without MathContext). When set, the value is a map of {:precision N :rounding-mode K} where N is a positive integer and K is one of: :half-up (default), :down, :up, :floor, :ceiling, :half-down, :half-even, :unnecessary. :unnecessary throws when rounding would change the value (mirrors JVM's ArithmeticException). Resolved by mino_bigdec_div on each call.

clojure.core/*ns*

clojure.core/*out*

clojure.core/*print-dup*

When true, the printer emits forms a reader can reconstruct exactly. mino's built-in record / collection / scalar prints are already reader-roundtrip-compatible, so the flag is currently an information channel for user-installed print-method implementations that branch on dup vs. non-dup output. Default false.

clojure.core/*print-length*

Maximum number of items printed in a single collection (vector, list, map, set, chunk, chunked-cons). nil means no limit (the default). The remainder is replaced with `...`. Resolved once per top-level pr / prn / print / println / pr-str call; nested collections share the same limit.

clojure.core/*print-level*

Maximum nesting depth printed. A collection found at depth >= this limit is replaced with `#`. nil means no limit (the default). Resolved once per top-level pr / print call.

clojure.core/*print-meta*

When true, every value carrying non-nil metadata is printed with its meta map prefixed as `^{...} `. When false (the default), meta is silent. Resolved once per top-level pr / print call.

clojure.core/*print-namespace-maps*

When true, a map whose keys are keywords (or symbols) sharing a common non-empty namespace is printed as `#:ns{:k1 v1, :k2 v2}` instead of `{:ns/k1 v1, :ns/k2 v2}`. Default false.

clojure.core/*print-readably*

When true (the default), strings are emitted with their quote characters and characters with their escape form so the printed output round-trips through the reader. When false, strings and characters print their underlying bytes — pr/prn behave like print/println. Resolved once per top-level pr / print call.

clojure.core/*repl*

Bound to true in an interactive read-eval-print context, false in script execution. Defaults to false.

clojure.core/*source-path*

clojure.core/*unchecked-math*

clojure.core/*warn-on-reflection*

clojure.core/+

Returns the sum of the arguments. Throws on long overflow; use +' to auto-promote to bigint.

(clojure.core/+ 2 1 1)
4

clojure.core/+'

Returns the sum of the arguments. Auto-promotes to bigint on long overflow; use + to throw on overflow.

clojure.core/-

Returns the difference of the arguments. With one arg, returns the negation. Throws on long overflow; use -' to auto-promote.

clojure.core/-'

Returns the difference of the arguments. With one arg, returns the negation. Auto-promotes to bigint on long overflow.

clojure.core/->

Thread-first. Inserts x as the second item in the first form, then inserts the result as the second item in the next form, and so on.

clojure.core/->>

Thread-last. Inserts x as the last item in the first form, then inserts the result as the last item in the next form, and so on.

clojure.core/->Eduction

Factory matching the value (eduction xform coll) returns. mino's eduction values are sequences, so the factory applies xform to coll the same way eduction does.

clojure.core/-empty-queue

Internal: return an empty PersistentQueue. Public surface is clojure.lang.PersistentQueue/EMPTY (a bound var) plus conj.

clojure.core/-thread-bound?

(-thread-bound? var) — true iff the var has a thread-local binding on the current dyn-stack. Clojure-level thread-bound? wraps this and is variadic.

clojure.core/-var-root-bound?

Return true if the var has a root binding. Internal helper backing the variadic Clojure-level bound?.

clojure.core//

Returns the quotient of the arguments.

clojure.core/<

Returns true if nums are in monotonically increasing order.

clojure.core/<=

Returns true if nums are in monotonically non-decreasing order.

clojure.core/=

Returns true if all arguments are equal.

clojure.core/==

Returns true if nums are numerically equal, treating ints and floats uniformly.

clojure.core/>

Returns true if nums are in monotonically decreasing order.

clojure.core/>=

Returns true if nums are in monotonically non-increasing order.

clojure.core/Boolean/parseBoolean

Parses "true" (case-insensitive) to true; everything else to false.

clojure.core/Character/toString

JVM Character.toString; routes to mino's str.

clojure.core/CollReduce

clojure.core/CollReduce--coll-reduce

clojure.core/Datafiable

clojure.core/Datafiable--datafy

clojure.core/Double/isInfinite

True when the argument is +inf or -inf.

clojure.core/Double/isNaN

True when the argument is NaN.

clojure.core/Double/parseDouble

Parses a floating-point string. JVM Double static.

clojure.core/Float/parseFloat

Alias for Double/parseDouble; mino has one float tier.

clojure.core/IKVReduce

clojure.core/IKVReduce--kv-reduce

clojure.core/Inst

clojure.core/Inst--inst-ms*

clojure.core/Integer/parseInt

Alias for Long/parseLong; mino has one integer tier.

clojure.core/Integer/toBinaryString

JVM Integer.toBinaryString; unsigned base-2 digit string.

clojure.core/Integer/toHexString

JVM Integer.toHexString; unsigned base-16 digit string.

clojure.core/Integer/toOctalString

JVM Integer.toOctalString; unsigned base-8 digit string.

clojure.core/Long/parseLong

Parses an integer string. JVM Long static.

clojure.core/Long/toBinaryString

JVM Long.toBinaryString; unsigned base-2 digit string.

clojure.core/Long/toHexString

JVM Long.toHexString; unsigned base-16 digit string.

clojure.core/Long/toOctalString

JVM Long.toOctalString; unsigned base-8 digit string.

clojure.core/Math/abs

Absolute value (preserves int/double type).

clojure.core/Math/atan

Arctangent.

clojure.core/Math/atan2

Two-argument arctangent.

clojure.core/Math/ceil

Ceiling (rounds toward positive infinity).

clojure.core/Math/cos

Cosine (radians).

clojure.core/Math/exp

e^x.

clojure.core/Math/floor

Floor (rounds toward negative infinity).

clojure.core/Math/log

Natural log.

clojure.core/Math/log10

Base-10 log.

clojure.core/Math/max

Numeric maximum of two values.

clojure.core/Math/min

Numeric minimum of two values.

clojure.core/Math/pow

Exponentiation.

clojure.core/Math/round

Round to nearest long.

clojure.core/Math/sin

Sine (radians).

clojure.core/Math/sqrt

Square root.

clojure.core/Math/tan

Tangent (radians).

clojure.core/NaN?

Returns true if x is NaN.

clojure.core/Navigable

clojure.core/Navigable--nav

clojure.core/String/valueOf

JVM String.valueOf; routes to mino's str.

clojure.core/System/currentTimeMillis

Epoch millis from the host clock.

clojure.core/System/exit

Exits the host process with the given status code.

clojure.core/System/getProperty

JVM system-properties lookup. mino has no JVM properties table; throws :mino/unsupported.

clojure.core/System/getenv

Reads an environment variable from the host process.

clojure.core/System/nanoTime

Monotonic nanosecond counter from the host clock.

clojure.core/Thread/sleep

Suspends the current thread for the given number of milliseconds.

clojure.core/Throwable->map

Constructs a data representation of an error value, shaped {:cause m :data d :via [...] :trace []}: :cause is the root cause's message, :data its ex-data (absent when nil), :via a vector of {:type <symbol> :message <str> :at [] :data <optional>} maps from the outermost error to the root, and :trace an empty vector (mino error values do not retain call-stack frames). Works on caught diagnostic maps and on ex-info values alike; the cause chain is walked via ex-cause.

clojure.core/abs

Returns the absolute value of x. Matches JVM Math/abs 2's-complement semantics: (abs Long/MIN_VALUE) returns Long/MIN_VALUE rather than overflowing, since the true absolute value is unrepresentable in a signed 64-bit int.

clojure.core/add-load-path!

Appends a directory to the runtime's extra-load-paths list (consulted by `require` after project paths). Returns nil; idempotent.

clojure.core/add-tap

Registers f as a tap target. Each call to tap> invokes every registered tap with the tapped value. Returns nil.

clojure.core/add-watch

Adds a watch function to an atom, called on state changes.

clojure.core/agent

Creates an asynchronous agent holding the given initial state. Mutate via send / send-off; read via @agent. The action runs on a per-state worker thread; await blocks until queued actions complete. Capability: :agent

clojure.core/agent-error

Returns the exception captured by the agent's most recent failed action or watch, or nil if the agent is in a clean state. Capability: :agent

clojure.core/agent?

Returns true if x is an agent. Capability: :agent

clojure.core/aget

Reads slot `index` from a host array or a bytes value. On a bytes value, returns the byte at that index as an unsigned int (0..255).

clojure.core/alength

Returns the slot count of a host array or the byte length of a bytes value.

clojure.core/alias

Add an alias to a namespace.

clojure.core/all-ns

Return a vector of all known namespace symbols.

clojure.core/alloc-profile-dump!

Dump the top-N allocation call sites to stderr. Defaults to 30; pass 0 for all.

clojure.core/alloc-profile-enabled?

Returns true if this binary was built with -DMINO_ALLOC_PROFILE=1.

clojure.core/alloc-profile-reset!

Zero the per-callsite allocation counters. No-op in non-profile builds.

clojure.core/alter

Sets ref to (apply f current-value args). Must be in dosync. Returns the new value. Capability: :stm

clojure.core/alter-meta!

Atomically applies f to the metadata of a reference.

clojure.core/alter-var-root

Apply a function to a var's root and store the result.

clojure.core/ancestors

Returns all ancestors of tag in the hierarchy.

clojure.core/and

Returns the first falsy value, or the last value if all are truthy.

(clojure.core/and 1 2 3)
3

clojure.core/any?

Returns true for any argument.

clojure.core/apply

Applies f to the arguments, with the last argument spread as a sequence.

clojure.core/array-map

Creates a hash-map.

clojure.core/as->

Binds expr to sym, then threads it through each form where sym can appear anywhere.

clojure.core/aset

Mutates the host array at index, storing val. Returns val. The host-array tier is the only path that exposes in-place mutation outside MINO_ATOM / MINO_VOLATILE. Throws :mino/state on a MINO_BYTES value -- the immutable bytes tier rejects in-place writes.

clojure.core/assert

clojure.core/assoc

Returns a new map with the given key-value pairs added.

clojure.core/assoc!

Associates key with val in a transient map or vector.

clojure.core/assoc-in

Associates a value in a nested associative structure at the given key path.

clojure.core/associative?

Returns true if x supports assoc (maps and vectors).

clojure.core/async-next-timer-ms*

Milliseconds until the next pending timer, or nil when none. Capability: :async

clojure.core/async-sched-enqueue*

Enqueue a callback on the async scheduler run queue. Capability: :async

clojure.core/async-schedule-timer*

Schedule a callback to fire after ms milliseconds. Capability: :async

clojure.core/atom

Creates an atom with the given initial value.

clojure.core/atom?

Returns true if x is an atom.

clojure.core/await

Blocks the calling thread until every named agent's queued actions have finished. Throws MST002 if called from inside an agent action body (would self-deadlock). Capability: :agent

clojure.core/await-for

Like await with a millisecond timeout. Returns true if every named agent reached zero in-flight actions before the deadline, false on timeout. Capability: :agent

clojure.core/bigdec

Coerces a value to an arbitrary-precision decimal. Capability: :bignum

clojure.core/bigint

Coerces a value to an arbitrary-precision integer. Accepts int, bigint, float (truncated toward zero), or a base-10 string. Capability: :bignum

clojure.core/bigint?

Returns true if x is an arbitrary-precision integer. Capability: :bignum

clojure.core/biginteger

Alias of bigint. Coerces a value to an arbitrary-precision integer. Capability: :bignum

clojure.core/binding

Establishes thread-local bindings for dynamic vars over the extent of the body, restoring the prior roots when the body returns or unwinds.

(clojure.core/binding [qsf-dyn 42] qsf-dyn)
42

clojure.core/bit-and

Returns the bitwise AND of the arguments.

clojure.core/bit-and-not

Returns the bitwise AND of x and the complement of y.

clojure.core/bit-clear

Returns x with bit n cleared.

clojure.core/bit-flip

Returns x with bit n flipped.

clojure.core/bit-not

Returns the bitwise complement of n.

clojure.core/bit-or

Returns the bitwise OR of the arguments.

clojure.core/bit-set

Returns x with bit n set.

clojure.core/bit-shift-left

Returns n shifted left by count bits.

clojure.core/bit-shift-right

Returns n arithmetically shifted right by count bits.

clojure.core/bit-test

Returns true if bit n of x is set.

clojure.core/bit-xor

Returns the bitwise XOR of the arguments.

clojure.core/bits

Pack a sequence of [value & options] segments into an immutable MINO_BYTES value. Options: :size (bits), :type (:int/:uint/:float/:bytes), :endian (:big/:little), :signed? (true/false). Bit-aligned totals leave a 1..7 bit_tail; the result satisfies bitstring? but not necessarily bytes?.

clojure.core/bits-get

Read a bit field out of a bytes value. Required: :offset and :size. Optional: :type (:int/:uint/:float/:bytes), :endian, :signed?. For :type :bytes returns a MINO_BYTES slice; for :float returns a double; otherwise returns an integer.

clojure.core/bitstring?

Returns true if x is any mino bytes value -- byte-aligned or bit-aligned. bytes? is the byte-aligned subset.

clojure.core/boolean

Coerces x to a boolean value.

clojure.core/boolean-array

Creates a host-style boolean array. Fills with false on size; copies elements from a collection.

clojure.core/boolean?

Returns true if x is true or false.

clojure.core/bound-fn

Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called.

clojure.core/bound-fn*

Returns a function which installs the same bindings in effect as in the thread at the time bound-fn* was called and then invokes f.

clojure.core/bound?

Returns true if all of the vars provided as arguments have any bindings — either a root binding or a thread-local binding.

clojure.core/bounded-count

Returns the count of coll, but stops counting at n.

clojure.core/butlast

Returns a seq of all but the last item in coll.

clojure.core/byte

Coerces x to a byte (8-bit integer). Throws on out-of-range values, NaN, or infinity. Returns the value as a long since mino has only one integer tier.

clojure.core/byte-array

Creates a host-style byte array. Zero-fills on size argument; copies elements from a collection.

clojure.core/bytes?

Returns true if x is a byte-aligned mino bytes value (the immutable binary-data type returned by byte-array).

clojure.core/car

Returns the first element of a cons cell.

clojure.core/case

Dispatches on the value of expr. Matches constants in pairs, with an optional default.

clojure.core/cat

A transducer that concatenates the contents of each input.

clojure.core/cdr

Returns the rest of a cons cell.

clojure.core/chan-buf-add

Direct buffer push: (chan-buf-add ch val). Used by xform rf. Capability: :async

clojure.core/chan-buf-count

Number of buffered values. Capability: :async

clojure.core/chan-buf-full?

True if buffer is full (or unbuffered/promise-set). Capability: :async

clojure.core/chan-close

Close channel: (chan-close ch). Capability: :async

clojure.core/chan-closed?

True if channel is closed. Capability: :async

clojure.core/chan-flush-buf-to-takers

Wake every parked taker with a buffered value handoff. Capability: :async

clojure.core/chan-get-ex-handler

Read installed ex-handler, or nil if none. Capability: :async

clojure.core/chan-get-xform

Read installed transducer rf, or nil if none. Capability: :async

clojure.core/chan-has-pending-putter?

True if any non-committed putter is parked. Capability: :async

clojure.core/chan-has-pending-taker?

True if any non-committed taker is parked. Capability: :async

clojure.core/chan-instance?

True if x is a channel (MINO_CHAN tag). Public chan? lives in clojure.core.async to avoid shadowing on :refer :all. Capability: :async

clojure.core/chan-new

Construct a channel: (chan-new buf-kind buf-cap xform ex-handler). Capability: :async

clojure.core/chan-offer

Non-blocking put: (chan-offer ch val). Returns true/false. Capability: :async

clojure.core/chan-poll

Non-blocking take: (chan-poll ch). Returns value or nil. Capability: :async

clojure.core/chan-put

Async put: (chan-put ch val cb-or-nil). Capability: :async

clojure.core/chan-put-alts

alts-flavoured put: (chan-put-alts ch val cb flag). Capability: :async

clojure.core/chan-set-xform

Install transducer rf: (chan-set-xform ch rf ex-handler). Capability: :async

clojure.core/chan-take

Async take: (chan-take ch cb-or-nil). Capability: :async

clojure.core/chan-take-alts

alts-flavoured take: (chan-take-alts ch cb flag). Capability: :async

clojure.core/char

Coerces x to a character: integer codepoint (0..0x10FFFF) becomes the Unicode scalar value, character is identity. Throws on out-of-range values, non-integer types.

clojure.core/char-array

Creates a host-style char array. Nul-fills on size argument; copies elements from a collection.

clojure.core/char-at

Returns the character at the given index as a string.

clojure.core/char-escape-string

Returns escape string for char or nil if none.

clojure.core/char-name-string

Returns name string for char or nil if none.

clojure.core/char?

Returns true if x is a one-character string.

clojure.core/chdir

Changes the current working directory. Capability: :io

clojure.core/chunk

Seals chunk-buffer buf so no further appends are accepted, and returns the chunk.

clojure.core/chunk-append

Appends elem to chunk-buffer buf and returns buf. Throws if buf is full or already sealed.

clojure.core/chunk-buffer

Returns a fresh chunk-buffer of the given capacity. Append values with chunk-append, then seal with chunk.

clojure.core/chunk-cons

Returns a chunked seq prepending the given chunk to the seq more.

clojure.core/chunk-first

Returns the chunk at the head of a chunked seq.

clojure.core/chunk-next

Returns the rest of a chunked seq as a seq, or nil if empty.

clojure.core/chunk-rest

Returns the rest of a chunked seq after the head chunk, or () if none.

clojure.core/chunked-seq?

Returns true if x is a chunked seq.

clojure.core/class

Returns the concrete type tag keyword of a value, like type but ignoring :type metadata; (class nil) is nil. Records return their type descriptor rather than a keyword. Deviation from Clojure (JVM): there are no host classes, so this yields a keyword tag, not a java.lang.Class.

clojure.core/clojure-version

Returns the Clojure compatibility version as a printable string.

clojure.core/coll-reduce

clojure.core/coll?

Returns true if x is a collection.

clojure.core/comment

Ignores body, returns nil.

clojure.core/commute

Sets ref to (apply f current-value args). Like alter but does not participate in read-set validation -- two transactions commuting on the same ref do not conflict. The fn is replayed against the latest committed value at commit time. Must be in dosync. Capability: :stm

clojure.core/comp

Returns a function that is the composition of the given functions.

clojure.core/comparator

Returns a comparator function from a two-arg predicate.

clojure.core/compare

Returns a negative, zero, or positive integer comparing x and y.

clojure.core/compare-and-set!

Atomically sets the atom to new-val if its current value equals expected. Returns true on swap, false otherwise.

clojure.core/complement

Returns a function that returns the logical opposite of f.

clojure.core/completing

Returns a reducing function with a completion step.

clojure.core/concat

Returns a lazy sequence of the concatenation of the given collections.

clojure.core/cond

Takes pairs of test/expr. Returns the expr for the first truthy test.

clojure.core/cond->

Thread-first through forms whose tests are truthy.

clojure.core/cond->>

Thread-last through forms whose tests are truthy.

clojure.core/condp

Takes a binary predicate, an expression, and clauses. Returns the first clause value where (pred test-val expr) is truthy. The special clause shape `test :>> result-fn` calls `(result-fn p)` on the truthy pred-result whenever `(pred test expr)` is truthy.

clojure.core/conj

Returns a new collection with items added.

clojure.core/conj!

Conjoins val onto a transient vector, map, or set.

clojure.core/cons

Returns a new list with x prepended to coll.

clojure.core/cons?

Returns true if x is a list (cons cell).

clojure.core/constantly

Returns a function that always returns x.

clojure.core/contains?

Returns true if the collection contains the key.

clojure.core/count

Returns the number of items in a collection.

clojure.core/counted?

Returns true if (count x) is a constant-time operation. Per Clojure this is the Counted protocol -- vectors, maps, sets, and sorted variants. Strings are not Counted on the JVM (their count walks java.lang.CharSequence).

clojure.core/create-ns

Ensure the namespace exists and return its symbol.

clojure.core/cycle

Returns a lazy infinite sequence of repetitions of the items in coll.

clojure.core/datafy

clojure.core/dec

Returns x minus 1. Throws on long overflow; use dec' to auto-promote.

clojure.core/dec'

Returns x minus 1. Auto-promotes to bigint on long overflow.

clojure.core/decimal?

Returns true if x is an arbitrary-precision decimal. Capability: :bignum

clojure.core/declare

Interns one or more names as unbound vars so they can be referred to before their defining form appears.

clojure.core/dedupe

Returns a lazy sequence removing consecutive duplicates. When called with no collection, returns a transducer.

clojure.core/default-data-readers

Default map of data reader functions keyed by tag symbol: 'inst and 'uuid.

clojure.core/definterface

clojure.core/defmacro

Defines a macro: a named function, invoked at expansion time, whose return value replaces the calling form before it is evaluated.

clojure.core/defmethod

Defines a method for a multimethod.

clojure.core/defmulti

Defines a multimethod with the given dispatch function.

clojure.core/defn

Defines a named function. Supports docstrings, multi-arity, and :pre/:post conditions.

clojure.core/defn-

Same as defn, yielding a non-public def.

clojure.core/defonce

Defines name only if it has no root binding.

clojure.core/defprotocol

Defines a protocol with the given method signatures.

clojure.core/defrecord

Defines a record type Name with the given fields and optional inline protocol specs. Establishes: Name — the MINO_TYPE value (used by extend-type and instance? as the dispatch key) ->Name — positional constructor: (->Name f1 f2 ...) returns a record value map->Name — map constructor: (map->Name {:f1 v1 :f2 v2}) reads declared fields from the map; non-field keys land in ext. Fields must be a vector of symbols; they are stored as keywords on the type. Specs follow the same shape as extend-type: protocol-name followed by one or more (method [args] body) forms. Inside an inline protocol method body, field names resolve as locals bound to (get this :field) -- matches Clojure's defrecord contract so (defrecord R [a b] IFoo (bar [this] (+ a b))) works without writing (:a this) / (:b this) by hand.

clojure.core/defrecord*

Runtime constructor for record types. Takes ns name fields-vector and returns the MINO_TYPE value, idempotent across calls.

clojure.core/deftype

Alias for defrecord. mino has no separate JVM-class layer to expose, so the deftype/defrecord distinction collapses; values created either way are real types with map-isomorphic behaviour.

clojure.core/delay

Creates a delay that evaluates body on first deref. The body runs at most once: a failure is recorded and rethrown on every later force.

clojure.core/delay?

Returns true if x is a delay.

clojure.core/deliver

Deliver a value to a promise. Returns the promise on success, nil if already realized.

clojure.core/denominator

Returns the denominator of a rational number. Capability: :bignum

clojure.core/deref

Returns the current value of a reference (atom, delay, etc.).

clojure.core/deref-delay

Forces evaluation of a delay and returns its value.

clojure.core/derive

Establishes a parent/child relationship between child and parent in a hierarchy.

clojure.core/descendants

Returns all descendants of tag in the hierarchy.

clojure.core/destructure

Takes a binding-pairs vector [lhs1 rhs1 lhs2 rhs2 ...] and returns a flat vector of [name init ...] suitable as a let binding form.

clojure.core/directory?

Returns true if the path is a directory. Capability: :fs

clojure.core/disj

Returns a set with the given keys removed.

clojure.core/disj!

Removes key from a transient set.

clojure.core/dissoc

Returns a map with the given keys removed.

clojure.core/dissoc!

Removes key from a transient map.

clojure.core/distinct

Returns a lazy sequence of the distinct items in coll. When called with no collection, returns a transducer.

clojure.core/distinct?

Returns true if no two of the arguments are equal.

clojure.core/doall

Forces realization of a lazy sequence. With a leading count, forces at most that many steps. Returns coll.

clojure.core/dorun

Forces realization of a lazy sequence. With a leading count, forces at most that many steps. Returns nil.

clojure.core/doseq

Iterates over collections for side effects, evaluating body once per binding combination, and returns nil. Supports nested bindings and the modifier clauses :let, :when, and :while -- the same surface clojure.core/doseq exposes: :let [name expr ...] introduces locals visible to inner clauses :when expr skips this iteration when expr is falsy :while expr halts all iteration when expr is falsy Implementation note: :while needs to stop the outer loop too, not just the inner one. We encode that with a shared 'stop' atom that the outer driver inspects each iteration. Without it, an outer infinite seq paired with a later :while would never terminate.

clojure.core/dosync

Runs body in an STM transaction. Refs may be altered, set, ensured, or commuted within. The transaction retries on write conflicts in multi-threaded mode. Side effects via (io! ...) inside the body throw. Requires STM to be installed (mino_install_stm).

clojure.core/dosync*

Runs a zero-arg thunk inside an STM transaction. The `dosync` macro expands to (dosync* (fn [] body...)). Capability: :stm

clojure.core/dotimes

Evaluates body n times with sym bound to 0 through n-1.

clojure.core/doto

Evaluates x, then calls each form with x as the first argument. Returns x.

clojure.core/double

Coerces x to a 64-bit double (returns a MINO_FLOAT). Identity on existing doubles.

clojure.core/double-array

Creates a host-style double array. Zero-fills (0.0) on size; copies elements from a collection.

clojure.core/double?

Returns true if x is a 64-bit double (mino's `:float` tier). Distinct from `float?`, which also returns true for the 32-bit `:float32` tier produced by `(float x)`. Matches JVM Clojure where `double?` is `(instance? Double x)`.

clojure.core/drain!

Drain the async run queue once. Capability: :async

clojure.core/drain-loop!

Drain until done-thunk returns truthy or no progress. Capability: :async

clojure.core/drop

Returns a lazy sequence of all but the first n items in coll. When called with no collection, returns a transducer.

clojure.core/drop-last

Returns a lazy sequence of all but the last n items in coll.

clojure.core/drop-seq

Internal fast path for eager drop.

clojure.core/drop-while

Returns a lazy sequence of items from coll after pred returns falsy. When called with no collection, returns a transducer.

clojure.core/eduction

Returns a lazy sequence of applying the given transducers to coll.

clojure.core/empty

Returns an empty collection of the same type.

clojure.core/empty?

Returns true if coll has no items.

clojure.core/ensure

Reads ref and prevents any other transaction from changing it before this transaction commits. Must be in dosync. Returns the current in-tx value. Capability: :stm

clojure.core/ensure-reduced

Wraps x in reduced if it is not already reduced.

clojure.core/error-handler

Returns the agent's current error-handler fn or nil. Capability: :agent

clojure.core/error-mode

Returns the agent's current error mode. Capability: :agent

clojure.core/error?

Returns true if the value is a diagnostic map.

clojure.core/eval

Evaluates the given form.

clojure.core/even?

Returns true if x is an even integer.

clojure.core/every-pred

Returns a function that returns true when all preds are satisfied by all its arguments.

clojure.core/every?

Returns true if (pred x) is truthy for every x in coll.

clojure.core/ex-cause

Returns the cause attached to the given exception, or nil.

clojure.core/ex-data

Extract the data map from an exception. Handles diagnostic maps (from catch), ex-info maps, and plain thrown values.

clojure.core/ex-info

Create an exception map with a message and data map. The 3-arity form additionally attaches a cause; ex-cause walks the chain via metadata so the visible map structure stays the same as the 2-arity form. The data argument must be a map (or nil).

clojure.core/ex-message

Extract the message from an exception. Handles both diagnostic maps and ex-info maps.

clojure.core/exit

Exits the process with the given status code. Capability: :io

clojure.core/extend

Registers method implementations for one or more protocols on type t without generating wrapper code: (extend T P {:m (fn [x] ...)}). The fn-map keys are keywordized method names; values are the implementation fns.

clojure.core/extend-protocol

Extends a protocol with implementations for multiple types.

clojure.core/extend-type

Extends a protocol with method implementations for the given type.

clojure.core/extenders

Returns a seq of the types explicitly extended to proto, or nil when there are none.

clojure.core/extends?

Returns true if type t has been extended to proto (an explicit registration for at least one method; :default does not count).

clojure.core/false?

Returns true if x is the value false.

clojure.core/ffirst

Returns the first item of the first item in coll.

clojure.core/file-exists?

Returns true if the path exists (file or directory). Capability: :fs

clojure.core/file-mtime

Returns the file modification time in milliseconds, or nil. Capability: :fs

clojure.core/file-seq

Returns a vector of all file paths under a directory, recursively. Capability: :io

clojure.core/filter

Returns a lazy sequence of items in coll for which pred returns truthy. When called with no collection, returns a transducer.

clojure.core/filterv

Returns a vector of items in coll for which pred returns logical true.

clojure.core/find

Returns the map entry for the key, or nil.

clojure.core/find-keyword

Returns the keyword for the given string. In mino keywords are always interned, so this is equivalent to keyword for string input and nil for other input.

clojure.core/find-ns

Return the namespace symbol if it exists, else nil.

clojure.core/find-var

Return the var named by a qualified symbol, or nil.

clojure.core/first

Returns the first item in a collection, or nil if empty.

clojure.core/flatten

Returns a lazy sequence of the non-sequential items from a nested structure.

clojure.core/float

Coerces x to a 32-bit float (returns a MINO_FLOAT32). Throws on out-of-float32-range, +/-Infinity. NaN passes through. Underflow rounds toward zero.

clojure.core/float-array

Creates a host-style float array. Zero-fills (0.0) on size; copies elements from a collection.

clojure.core/float?

Returns true if x is a float.

clojure.core/flush

Flushes pending output on *out* and *err*. No-op for string-atom bindings.

clojure.core/fn

Defines an anonymous function. Takes an optional name, a vector of parameters, and a body; supports multiple arities and a variadic & rest parameter.

((clojure.core/fn [x] (* x x)) 5)
25
((clojure.core/fn [a b] (+ a b)) 3 4)
7

clojure.core/fn?

Returns true if x is callable as a function (fn or prim).

clojure.core/fnext

Same as (first (next coll)).

clojure.core/fnil

Returns a function like f, but replaces nil arguments with the given defaults.

clojure.core/for

List comprehension. Takes binding vectors and body, returns a lazy sequence.

clojure.core/force

Forces evaluation of a delay. If x is not a delay, returns x.

clojure.core/format

Returns a formatted string using a format specifier and arguments.

clojure.core/frequencies

Returns a map from distinct items in coll to the number of times they appear.

clojure.core/future

Takes a body of expressions and yields a future object that will evaluate the body in another thread, blocking on deref until the value is available. Throws :mino/unsupported when host threads are not granted; see mino-thread-limit.

clojure.core/future-call

Spawn a worker thread to evaluate the given thunk; return a future.

clojure.core/future-cancel

Cancel a pending future. Returns true if the future was newly cancelled.

clojure.core/future-cancelled?

Return true if the future was cancelled.

clojure.core/future-deref

Block until the future is realized; return result, rethrow exception, or throw :mino/cancelled.

clojure.core/future-done?

Return true if the future has reached a terminal state (resolved/failed/cancelled).

clojure.core/future?

Return true if x is a future or promise.

clojure.core/gc!

Forces a full garbage collection. Returns nil. Capability: :io

clojure.core/gc-stats

Returns a map of GC statistics. Capability: :io

clojure.core/gen-class

clojure.core/gensym

Returns a new symbol with a unique name.

clojure.core/get

Returns the value mapped to key in a collection, or not-found.

clojure.core/get-in

Returns the value in a nested associative structure at the given key path.

clojure.core/get-method

Returns the method for dispatch-val, or nil.

clojure.core/get-thread-bindings

Returns a map of symbol->value for the active dynamic bindings, or nil if no binding frames are active.

clojure.core/get-validator

Returns the validator function of an atom, or nil.

clojure.core/getcwd

Returns the current working directory. Capability: :io

clojure.core/getenv

Returns the value of an environment variable, or nil. Capability: :io

clojure.core/group-by

Returns a map of the items in coll grouped by the result of f.

clojure.core/halt-when

Returns a transducer that halts reduction when pred is satisfied.

clojure.core/hash

Returns the hash code of the value. Note: mino uses FNV-1a internally; hash values are NOT compatible with JVM Clojure's Murmur3-based hasheq.

clojure.core/hash-combine

Boost-style hash combiner: mixes seed and hash into a single 32-bit hash. Matches clojure.core/hash-combine bit-for-bit so user code that manually composes hashes via this helper sees the same result on mino as on JVM Clojure. seed ^= hash + 0x9e3779b9 + (seed << 6) + (seed >> 2) The operation is performed in unchecked 32-bit arithmetic; the result is truncated to the low 32 bits.

clojure.core/hash-map

Returns a new hash map with the given key-value pairs.

clojure.core/hash-ordered-coll

Computes a sequence-position-aware hash for an ordered collection.

clojure.core/hash-set

Returns a new hash set containing the arguments.

clojure.core/hash-unordered-coll

Computes a position-independent hash for an unordered collection.

clojure.core/host/call

Calls a method on a host handle. Capability: :host

clojure.core/host/get

Returns the value of a field on a host handle. Capability: :host

clojure.core/host/new

Creates a new instance of a host-registered type. Capability: :host

clojure.core/host/static-call

Calls a static method on a host-registered type. Capability: :host

clojure.core/ident?

Returns true if x is a symbol or keyword.

clojure.core/identical?

Returns true if the arguments are the same object.

clojure.core/identity

Returns its argument.

clojure.core/if-let

Binds the result of expr, evaluates then if truthy, else otherwise.

clojure.core/if-not

Evaluates then when test is falsy, else otherwise.

clojure.core/if-some

Binds the result of expr, evaluates then if non-nil, else otherwise.

clojure.core/ifn?

Returns true if x can be called as a function.

clojure.core/import

clojure.core/in-ns

Set the current namespace, creating it if necessary.

clojure.core/in-transaction?

Returns true when called from inside a `dosync` body. Capability: :stm

clojure.core/inc

Returns x plus 1. Throws on long overflow; use inc' to auto-promote.

clojure.core/inc'

Returns x plus 1. Auto-promotes to bigint on long overflow.

clojure.core/indexed?

Returns true if x supports nth in constant time (vectors).

clojure.core/infinite?

Returns true if x is positive or negative infinity.

clojure.core/inst-ms

Returns epoch millis (since 1970-01-01T00:00:00Z) for an inst value as returned by clojure.instant/read-instant-date or the `#inst "..."` reader literal. Throws on a non-inst argument.

clojure.core/inst-ms*

clojure.core/inst?

clojure.core/instance?

Returns true if x is an instance of t. For record types defined with defrecord, t is the type value and the test is type-pointer identity. For built-in types or ad-hoc :type-tagged values, t may be the keyword (type x) returns and the test is keyword equality.

clojure.core/int

Coerces x to an int (32-bit integer). Throws on out-of-range values, NaN, or infinity. Returns the value as a MINO_INT (mino has only one integer tier); only the contract narrows.

clojure.core/int-array

Creates a host-style int array. Zero-fills on size argument; copies elements from a collection.

clojure.core/int?

Returns true if x is an integer.

clojure.core/integer?

Returns true if x is an integer (long or bigint).

clojure.core/interleave

Returns a lazy sequence of the first item in each collection, then the second, and so on.

clojure.core/intern

Intern a value into a namespace by name.

clojure.core/internal-reduce

clojure.core/internal-reduce-kv

clojure.core/interpose

Returns a lazy sequence of the items in coll separated by sep. When called with no collection, returns a transducer.

clojure.core/into

Adds all items from from into to. With a transducer, transforms items first.

clojure.core/into-array

Converts a collection to an Object array.

clojure.core/io!

If invoked within an STM transaction, throws an IllegalStateException-equivalent before evaluating body. Marks a body as having unsafe side effects so dosync can refuse it.

clojure.core/io!-check

Internal: throws when called inside a transaction. The io! macro expands to (do (io!-check) body...) so the check runs before the body evaluates. Capability: :stm

clojure.core/isa?

Returns true if child is equal to or derives from parent.

clojure.core/iterate

Returns a lazy sequence of x, (f x), (f (f x)), and so on.

clojure.core/iteration

Creates a seqable via repeated calls to step, a function of some continuation token 'k'. The first call to step is passed initk, returning 'ret'. If (somef ret) is true, (vf ret) is included in the iteration; else iteration terminates and vf/kf are not called. If (kf ret) is non-nil it is passed to the next step call; else iteration terminates. Used to consume APIs that return paginated or batched data. step - (possibly impure) fn of 'k' -> 'ret' :somef - fn of 'ret' -> truthy/falsy, default some? :vf - fn of 'ret' -> 'v', default identity :kf - fn of 'ret' -> 'next-k' or nil, default identity :initk - first value passed to step, default nil Step with non-initk is presumed unreproducible. The first step call is deferred until the result is realized.

clojure.core/java.util.List/of

JVM List.of static; routes to mino's list constructor.

clojure.core/java.util.Map/of

JVM Map.of static; routes to mino's hash-map constructor.

clojure.core/java.util.Set/of

JVM Set.of static; routes to mino's hash-set constructor.

clojure.core/java.util.UUID/fromString

Parses a UUID from its canonical string form.

clojure.core/java.util.UUID/randomUUID

Generates a random UUID v4.

clojure.core/juxt

Returns a function that returns a vector of applying each f to its args.

clojure.core/keep

Returns a lazy sequence of non-nil results of (f item). When called with no collection, returns a transducer.

clojure.core/keep-indexed

Returns a lazy sequence of non-nil results of (f index item). When called with no collection, returns a transducer.

clojure.core/key

Returns the key of a map entry. Throws on values that are not map entries (a literal 2-vector, for instance).

clojure.core/keys

Returns a sequence of the keys in a map.

clojure.core/keyword

Returns a keyword with the given name.

clojure.core/keyword?

Returns true if x is a keyword.

clojure.core/kv-reduce

clojure.core/last

Returns the last item in coll.

clojure.core/last-error

Returns the last error as a diagnostic map, or nil.

clojure.core/lazy-cat

Expands to code that yields a lazy concatenation of the given collections.

clojure.core/lazy-filter

Internal fast path for lazy filter.

clojure.core/lazy-map-1

Internal fast path for single-collection lazy map.

clojure.core/lazy-seq

Returns a sequence whose body is not evaluated until the first element is requested, then caches the realized sequence for later traversals.

clojure.core/lazy-take

Internal fast path for lazy take.

clojure.core/let

Evaluates the body with a sequence of local bindings established left to right from the binding vector; later bindings may refer to earlier ones.

(clojure.core/let [x 1 y 2] (+ x y))
3
(clojure.core/let [x 1 y (+ x 4)] (+ x y))
6
(macroexpand-1 '(clojure.core/let [x 1] x))
'(clojure.core/let [x 1] x)

clojure.core/let-bits

Destructure-shaped binding over a bytes value. (let-bits [bytes-val [sym & opts] ...] body...) See documentation in core.clj just above this definition.

clojure.core/letfn

Binds local functions. Each binding is (name [params] body...). Expands to the `letfn*` special form so the bound fns can refer to each other (mutual recursion) — every name is placeholder- bound before any fn body is evaluated, so each fn's closure captures the shared scope.

clojure.core/line-seq

Returns the lines of text from rdr as a lazy sequence of strings. rdr is a string-cursor atom (the *in* model that read-line consumes from): each realized element takes one line off the cursor. Returns nil when the cursor is exhausted.

clojure.core/list

Returns a list of the supplied arguments; () with no args.

clojure.core/list*

Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence.

clojure.core/list?

Returns true if x is a list (cons chain or the empty-list singleton). Excludes lazy-seq and chunked-cons; for the broader 'is a sequence' predicate, use seq?.

clojure.core/load-file

Reads and evaluates all forms in the file at the given path. Returns the value of the last form.

clojure.core/load-image-into

Load an image file into the current state. Capability: :fs

clojure.core/load-string

Reads and evaluates all forms in the given source string. Returns the value of the last form.

clojure.core/loaded-libs

Return a vector of names that have been required.

clojure.core/locking

Executes body while holding a monitor of x. Reentrant per thread; released on normal exit and on throw. Exclusion is cooperative: contending threads wait for the holder to release across yield points.

clojure.core/long

Coerces x to a long (64-bit integer). Throws on out-of-range values, NaN, or infinity, including bigint and bigdec out of long range.

clojure.core/long-array

Creates a host-style long array. Zero-fills on size argument; copies elements from a collection.

clojure.core/loop

Like let, but establishes a recursion point: a recur in tail position rebinds the loop locals and jumps back to the top without growing the stack.

(clojure.core/loop [i 0 acc 0]
(if (= i 5) acc (recur (inc i) (+ acc i))))
10
(clojure.core/loop [] 0)
0

clojure.core/macroexpand

Repeatedly expands a macro form until it is no longer a macro call.

clojure.core/macroexpand-1

Expands a macro form once.

clojure.core/make-hierarchy

Returns an empty hierarchy.

clojure.core/map

Returns a lazy sequence of applying f to each item in coll. When called with multiple collections, maps f across them in parallel. When called with no collection, returns a transducer.

clojure.core/map-entry

Constructs a (k, v) map entry. Distinct from a 2-vector: key/val accept only map entries, not plain vectors. Equality with [k v] still compares element-wise.

clojure.core/map-entry?

Returns true if x is a map entry (mino represents entries as 2-vectors).

clojure.core/map-indexed

Returns a lazy sequence of (f index item) for each item in coll. When called with no collection, returns a transducer.

clojure.core/map?

Returns true if x is a map (including sorted-map).

clojure.core/mapcat

Returns the result of applying concat to the result of mapping f over coll. When called with no collection, returns a transducer.

clojure.core/mapv

Returns a vector of applying f to each item in one or more collections.

clojure.core/math-acos

Returns the arc-cosine of n; n in [-1, 1]; result in [0, PI].

clojure.core/math-asin

Returns the arc-sine of n; n in [-1, 1]; result in [-PI/2, PI/2].

clojure.core/math-atan

Returns the arc-tangent of n; result in [-PI/2, PI/2].

clojure.core/math-atan2

Returns the angle in radians between the positive x-axis and the point (x, y).

clojure.core/math-cbrt

Returns the cube root of n.

clojure.core/math-ceil

Returns the smallest integer not less than n.

clojure.core/math-copy-sign

Returns a value with the magnitude of mag and the sign of sgn.

clojure.core/math-cos

Returns the cosine of n (in radians).

clojure.core/math-cosh

Returns the hyperbolic cosine of n.

clojure.core/math-exp

Returns e raised to the power of n.

clojure.core/math-expm1

Returns exp(n) - 1, accurate for small n.

clojure.core/math-floor

Returns the largest integer not greater than n.

clojure.core/math-get-exponent

Returns the unbiased binary exponent of n.

clojure.core/math-hypot

Returns sqrt(a^2 + b^2) avoiding intermediate overflow.

clojure.core/math-ieee-remainder

Returns IEEE 754 remainder of a by b.

clojure.core/math-log

Returns the natural logarithm of n.

clojure.core/math-log10

Returns the base-10 logarithm of n.

clojure.core/math-log1p

Returns the natural logarithm of (1 + n), accurate for small n.

clojure.core/math-next-after

Returns the adjacent double to start in the direction of direction.

clojure.core/math-next-down

Returns the next representable double less than n (toward -Inf).

clojure.core/math-next-up

Returns the next representable double greater than n (toward +Inf).

clojure.core/math-pow

Returns base raised to the power of exp.

clojure.core/math-rint

Returns the double closest to n and equal to a mathematical integer, ties to even.

clojure.core/math-round

Returns the closest integer to n.

clojure.core/math-scalb

Returns n scaled by 2 to the power of the integer scale factor.

clojure.core/math-signum

Returns -1.0, 0.0, or 1.0 depending on the sign of n (preserves -0.0).

clojure.core/math-sin

Returns the sine of n (in radians).

clojure.core/math-sinh

Returns the hyperbolic sine of n.

clojure.core/math-sqrt

Returns the square root of n.

clojure.core/math-tan

Returns the tangent of n (in radians).

clojure.core/math-tanh

Returns the hyperbolic tangent of n.

clojure.core/math-to-degrees

Converts the angle n (in radians) to degrees.

clojure.core/math-to-radians

Converts the angle n (in degrees) to radians.

clojure.core/math-ulp

Returns the size of an ulp (unit in last place) of n.

clojure.core/max

Returns the greatest of the given values.

clojure.core/max-key

Returns the x for which (k x) is greatest.

clojure.core/memoize

Returns a memoized version of f that caches return values by arguments.

clojure.core/merge

Returns a map that is the merge of the maps. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result. Per Clojure, position-2+ args use `conj` semantics, so MapEntries / 2-element vectors are accepted.

clojure.core/merge-with

Returns the merge of the given maps, calling f to combine values at shared keys.

clojure.core/meta

Returns the metadata map of the given value, or nil.

clojure.core/methods

Returns the method table of multimethod mm.

clojure.core/min

Returns the least of the given values.

clojure.core/min-key

Returns the x for which (k x) is least.

clojure.core/mino-capability

Return the install-group capability label for the named binding as a keyword, or nil when the binding is part of the always-installed core.

clojure.core/mino-installed?

Returns true if a named capability has been installed on this runtime. Argument is a keyword, symbol, or string; supported names include :floor :regex :bignum :multimethods :protocols :transducers :io :fs :proc :stm :agent :host :async. Used by core.clj sections to gate optional surface on the host's install picks.

clojure.core/mino-thread-count

Return the live host-thread count for this state.

clojure.core/mino-thread-id*

Stable identity of the calling thread's runtime context.

clojure.core/mino-thread-limit

Return the host-granted thread limit for this state. 1 means single-threaded; >1 means the host has granted that many concurrent worker threads.

clojure.core/mix-collection-hash

Combines a hash-basis with the collection's count.

clojure.core/mkdir-p

Creates a directory and any missing parent directories. Capability: :fs

clojure.core/mod

Returns the modulus of dividing num by div. Truncates toward negative infinity.

clojure.core/monitor-exit

Release one level of x for owner; drops the entry at depth zero.

clojure.core/monitor-registry

clojure.core/monitor-try-enter

Claim x for owner, or reenter if owner already holds it. Returns true when the claim succeeded, false when another thread holds x.

clojure.core/name

Returns the name string of a symbol, keyword, or string.

(clojure.core/name kw)
name
(clojure.core/name sym)
name
(clojure.core/name :foo/bar)
"bar"

clojure.core/namespace

Returns the namespace string of a symbol or keyword, or nil.

clojure.core/nano-time

Returns monotonic wall-clock time in nanoseconds. Capability: :io

clojure.core/nat-int?

Returns true if x is a non-negative integer (long tier).

clojure.core/nav

clojure.core/neg-int?

Returns true if x is a negative integer (long tier).

clojure.core/neg?

Returns true if x is less than zero.

clojure.core/newline

Writes a line separator to *out*.

clojure.core/next

Returns a seq of the items after the first. Returns nil if no more items.

clojure.core/nfirst

Same as (next (first coll)).

clojure.core/nil?

Returns true if x is nil.

clojure.core/nnext

Same as (next (next coll)).

clojure.core/not

Returns true if x is logical false, false otherwise.

clojure.core/not-any?

Returns true if (pred x) is falsy for every x in coll.

clojure.core/not-empty

Returns coll if it has items, nil otherwise.

clojure.core/not-every?

Returns true if (pred x) is falsy for at least one x in coll.

clojure.core/not=

Returns true if the arguments are not equal.

clojure.core/ns

Selects or creates a namespace and applies its require / refer / import clauses, becoming the current namespace for the forms that follow.

clojure.core/ns-aliases

Return the alias map of a namespace.

clojure.core/ns-imports

Returns the import map of the namespace (always empty: no host classes).

clojure.core/ns-interns

Return the interned bindings of a namespace as a map.

clojure.core/ns-map

Return all bindings visible in a namespace as a map.

clojure.core/ns-name

Return the symbol name of a namespace.

clojure.core/ns-publics

Return the public bindings of a namespace as a map.

clojure.core/ns-refers

Return the refer'd bindings of a namespace as a map.

clojure.core/ns-resolve

Resolve a symbol to a var in the given namespace.

clojure.core/ns-unalias

Remove an alias from a namespace.

clojure.core/ns-unmap

Remove a binding from a namespace.

clojure.core/nth

Returns the item at index n in a collection.

clojure.core/nthnext

Returns the result of calling next n times on coll.

clojure.core/nthrest

Returns the result of calling rest n times on coll.

clojure.core/num

Returns x if it is a number, nil if x is nil, otherwise throws. Nil pass-through matches the cross-dialect convention used by the `:default` arm of `clojure.core-test.num` (no-op on numeric inputs plus nil), where JVM Clojure's NPE-on-nil is platform-specific.

clojure.core/number?

Returns true if x is a number (int or float).

clojure.core/numerator

Returns the numerator of a rational number. Capability: :bignum

clojure.core/object-array

Creates a host-style Object array. With a non-negative integer, returns an array of that length filled with nil. With a collection, returns an array of its elements. Distinct from vector: vector? / coll? / counted? / sequential? / associative? all return false on the result, matching JVM Java arrays.

clojure.core/odd?

Returns true if x is an odd integer.

clojure.core/or

Returns the first truthy value, or the last value if none are truthy.

(clojure.core/or false nil :z)
:z

clojure.core/parents

Returns the immediate parents of tag in the hierarchy.

clojure.core/parse-boolean

Parses 'true' or 'false' (case-sensitive) and returns the boolean. Returns nil for strings that don't match. Per Clojure's contract raises an error on non-string input (analogous to JVM's ClassCastException / NullPointerException).

clojure.core/parse-double

Parses a string into a double, or returns nil on failure.

clojure.core/parse-long

Parses a string into a long integer, or returns nil on failure.

clojure.core/parse-uuid

Parses s as a UUID; returns a UUID value or nil if s is not a valid canonical UUID string.

clojure.core/partial

Returns a function that applies f with the given arguments prepended.

clojure.core/partition

Returns a lazy sequence of lists of n items each, at offsets step apart. With pad, the final partition is filled from pad to reach n; if pad is shorter than needed, returns a partition with fewer than n items.

clojure.core/partition-all

Like partition, but includes a final partial group if items remain. The transducer arity emits each group as a vector (matching JVM Clojure's `(vec (.toArray buf))`); the seq arities emit lists per `partition`'s shape.

clojure.core/partition-by

Splits coll into lazy sequences of consecutive items with the same (f item) value. When called with no collection, returns a transducer.

clojure.core/partitionv

Like partition but returns a lazy seq of vectors instead of lists.

clojure.core/partitionv-all

Like partition-all but returns a lazy seq of vectors instead of lists.

clojure.core/pcalls

Executes the no-arg fns in parallel, returning a lazy sequence of their values. Mirrors clojure.core/pcalls. When host threads aren't granted (mino-thread-limit <= 1), falls back to sequential map so the surface is portable across embedded and CLI runs.

clojure.core/peek

Returns the first item of a list or last item of a vector.

clojure.core/persistent!

Seals a transient and returns its persistent collection.

clojure.core/pmap

Like map, except f is applied in parallel via futures. Semi-lazy in that the parallel computation stays no more than thread-limit-1 items ahead of the consumer. f's invocations across the collection are independent; do not pmap with a side-effectful f if order of effects matters. Single-arity collection only: (pmap f coll). When host threads are not granted (mino-thread-limit <= 1), falls back to (map f coll) so callers don't need a conditional.

clojure.core/pop

Returns a collection without the peek item.

clojure.core/pop!

Removes the last element from a transient vector.

clojure.core/pop-thread-bindings

Pop the topmost dynamic-binding frame. Throws when no frame is active. Pair with push-thread-bindings.

clojure.core/pop-thread-bindings*

(pop-thread-bindings*) — pop and free the top dynamic-binding frame. Throws when no frame is active.

clojure.core/pos-int?

Returns true if x is a positive integer (long tier).

clojure.core/pos?

Returns true if x is greater than zero.

clojure.core/postwalk

Walks form depth-first, applying f to each sub-form after its children.

clojure.core/postwalk-replace

Replaces items in form that appear as keys in smap, walking bottom-up.

clojure.core/pr

Prints the arguments readably to *out*, without a trailing newline.

clojure.core/pr-builtin

Prints a value readably via the built-in C formatter, bypassing print-method.

clojure.core/pr-str

Returns a readable string representation of the arguments.

clojure.core/prefer-method

Prefers dispatch-val x over y in multimethod mm.

clojure.core/prefers

Returns the prefer-table of multimethod mm.

clojure.core/prewalk

Walks form depth-first, applying f to each sub-form before its children.

clojure.core/prewalk-replace

Replaces items in form that appear as keys in smap, walking top-down.

clojure.core/print

Prints the arguments space-separated to *out*, without a trailing newline.

clojure.core/print-method

clojure.core/print-simple

Writes the plain text form of o (its str form, bypassing the print-method dispatch) to w, a string-collecting atom like the one *out* is bound to inside with-out-str. Returns nil.

clojure.core/print-str

Returns the print-string of args, space-separated, no trailing newline.

clojure.core/printf

Formats and prints to *out*: equivalent to (print (apply format fmt args)).

clojure.core/println

Prints the arguments to *out*, followed by a newline.

clojure.core/println-str

Returns the print-string of args followed by a newline.

clojure.core/prn

Prints the arguments readably to *out*, followed by a newline.

clojure.core/prn-str

Returns the readable-string of args followed by a newline.

clojure.core/promise

Return a fresh promise that can be deliver'd a value once.

clojure.core/protocol-dispatch

clojure.core/proxy

clojure.core/push-thread-bindings

Push a fresh dynamic-binding frame whose entries come from the map. Symbols-or-strings are accepted as keys. Must be paired with pop-thread-bindings in a try/finally.

clojure.core/push-thread-bindings*

(push-thread-bindings* bindings-map) — push a fresh dynamic-binding frame. Must be paired with pop-thread-bindings* in a try/finally.

clojure.core/pvalues

Returns a lazy sequence of the values of the exprs, which are evaluated in parallel via pcalls. Mirrors clojure.core/pvalues.

clojure.core/qualified-ident?

Returns true if x is a namespace-qualified symbol or keyword.

clojure.core/qualified-keyword?

Returns true if x is a namespace-qualified keyword.

clojure.core/qualified-symbol?

Returns true if x is a namespace-qualified symbol.

clojure.core/queue?

Returns true if x is a PersistentQueue.

clojure.core/quot

Returns the quotient of dividing num by div, truncated toward zero.

clojure.core/rand

Returns a random float between 0 inclusive and 1 exclusive, or between 0 and n.

clojure.core/rand-int

Returns a random integer between 0 (inclusive) and n (exclusive).

clojure.core/rand-nth

Returns a random element from coll.

clojure.core/random-sample

Returns items from coll with probability prob. When called with no collection, returns a transducer.

clojure.core/random-seed!

Seeds the per-state PRNG to a known integer value so subsequent rand calls produce a reproducible stream. Returns the seed.

clojure.core/random-uuid

Returns a random UUID v4 string.

clojure.core/range

Returns a lazy sequence of nums from start (inclusive) to end (exclusive), by step. With no args, returns an infinite sequence from 0.

clojure.core/rangev

Returns a vector of integers from start (inclusive) to end (exclusive).

clojure.core/ratio?

Returns true if x is a ratio. Capability: :bignum

clojure.core/rational?

Returns true if x is a rational number (int, bigint, or ratio). Capability: :bignum

clojure.core/rationalize

Returns the rational value nearest to the argument. Capability: :bignum

clojure.core/re-find

Find the first match. (re-find pattern text) returns a string (no groups) or [whole g1 g2 ...] (groups). (re-find m) advances a matcher. Capability: :regex

clojure.core/re-find-from

Internal: finds the first match at or after a codepoint index; returns [match start end] or nil. Capability: :regex

clojure.core/re-groups

Returns the most recent match groups for matcher m: a vector [whole g1 g2 ...] when the pattern has groups, the whole-match string otherwise. Throws when the matcher has no recorded match yet.

clojure.core/re-matcher

Returns a matcher value for repeated find/match operations on text using pattern. The resulting value is consumed by re-find, re-groups and so on.

clojure.core/re-matches

Like re-find but anchored to the whole string. Returns a string (no groups) or [whole g1 g2 ...] (groups), or nil. Capability: :regex

clojure.core/re-pattern

Returns a regex from a string pattern (no-op on an existing regex). Capability: :regex

clojure.core/re-seq

Returns a lazy sequence of all matches of pattern in string s. Each match is a string when the pattern has no groups, or a vector [whole g1 g2 ...] when it does.

clojure.core/read

clojure.core/read*

Reads one form from *in*. Atom-bound *in* consumes from the head; stdin-backed *in* is unsupported. The user-facing `read` in core.clj dispatches on arity.

clojure.core/read+string

Like read: consumes one form from the source and returns [form text] where text is the exactly-consumed input, whitespace- trimmed. The source may be a string or a string-cursor atom of the kind *in* / with-in-str use (the cursor advances past the form).

clojure.core/read-line

Reads one line from *in*. Returns the line without trailing newline, or nil at EOF.

clojure.core/read-string

Reads one form from the string.

clojure.core/reader-conditional

Builds a reader-conditional record with form and splicing? fields. Predicate reader-conditional? returns true on the result.

clojure.core/reader-conditional?

Returns true if x is a reader-conditional record produced by reader-conditional.

clojure.core/realized?

Returns true if a delay, lazy sequence, future, or promise has been realized.

clojure.core/realpath

Resolves a path to its canonical absolute form, or nil. Capability: :fs

clojure.core/record*

Runtime constructor for record values. Takes a record type and a vector of declared field values. Used by the ->Type macro expansion.

clojure.core/record-fields

Returns the declared field-name vector for a record type.

clojure.core/record-from-map

Builds a record by reading declared fields from a map; non-field keys land in ext. Used by the map->Type macro expansion.

clojure.core/record-type?

Returns true if x is a record type (the value defrecord defines).

clojure.core/record?

Returns true if x is a record value.

clojure.core/reduce

Reduces coll using f. With 2 args, uses the first element as init. With 3 args, uses init explicitly. Consults CollReduce: a user type or :default override on coll-reduce takes precedence over the built-in seq-driven reduction.

clojure.core/reduce-kv

Reduces a map (or any associative source) with f taking accumulator, key, and value. Consults IKVReduce; falls back to walking the seq.

clojure.core/reduced

Wraps a value to signal early termination of reduce.

clojure.core/reduced?

Returns true if x is a reduced value.

clojure.core/reductions

Returns a lazy sequence of the intermediate values of a reduction.

clojure.core/ref

Creates an STM ref holding the given initial value. Mutate via ref-set / alter / commute inside dosync. Capability: :stm

clojure.core/ref-history-count

Returns the ref's current history-count. mino uses single-version optimistic locking; this stub always returns 0. Capability: :stm

clojure.core/ref-max-history

Returns the ref's max-history. mino uses single-version optimistic locking; this stub always returns 10. Capability: :stm

clojure.core/ref-min-history

Returns the ref's min-history. mino uses single-version optimistic locking; this stub always returns 0. Capability: :stm

clojure.core/ref-set

Sets the value of ref. Must be in dosync. Returns the new value. Capability: :stm

clojure.core/ref?

Returns true if x is an STM ref. Capability: :stm

clojure.core/refer

Bring all publics of a namespace into the current namespace.

clojure.core/refer-clojure

Refers public vars from clojure.core into the current namespace, accepting the same filter options as the ns :refer-clojure clause: :exclude, :only, :rename. Exclusions and :only limits are honored by re-applying the ns form on the current namespace, which cuts the clojure.core parent chain and rebuilds the filtered mapping — the same path the (ns ...) special form takes.

clojure.core/regex?

Returns true if x is a regex value.

clojure.core/reify

Returns an instance of a fresh anonymous record type that satisfies the named protocols. Each reify form generates one type at expansion time; repeated invocations of the form share that type, so (= (type r1) (type r2)) is true for two values produced by the same reify form.

clojure.core/release-pending-sends

Returns the count of sends queued by the current transaction and clears them so they will NOT fire on commit. Outside a transaction returns 0. Capability: :agent

clojure.core/rem

Returns the remainder of dividing num by div.

clojure.core/remove

Returns a lazy sequence of items in coll for which pred returns falsy. When called with no collection, returns a transducer.

clojure.core/remove-all-methods

Removes all methods from multimethod mm.

clojure.core/remove-method

Removes the method for dispatch-val from multimethod mm.

clojure.core/remove-ns

Remove a namespace from the runtime.

clojure.core/remove-tap

Unregisters f from the tap registry. Returns nil.

clojure.core/remove-watch

Removes a watch function from an atom by key.

clojure.core/repeat

Returns a lazy sequence of xs. With two args, returns n repetitions of x. n must be a number; floats and ratios truncate toward zero (so 3.14 and 3.99 both yield three repetitions), matching JVM Clojure's RT/longCast. Booleans, strings, keywords, and other non-numeric counts throw.

clojure.core/repeatedly

Returns a lazy sequence of calls to f. With two args, returns n calls.

clojure.core/replace

Returns a collection with items in coll replaced by entries in smap.

clojure.core/replicate

Returns a lazy seq of n copies of x. Deprecated alias for (take n (repeat x)).

clojure.core/require

Loads and evaluates a mino source file.

clojure.core/requiring-resolve

Require the namespace if needed, then resolve a qualified symbol.

clojure.core/reset!

Sets the value of an atom to newval and returns newval.

clojure.core/reset-meta!

Atomically resets the metadata for a reference type to meta-map. Returns meta-map.

clojure.core/reset-vals!

Sets the value of an atom and returns [old new].

clojure.core/resolve

Returns the var to which a symbol resolves, or nil.

clojure.core/rest

Returns all but the first item in a collection.

clojure.core/restart-agent

Clears the agent's error and resets its state to the given value. Trailing :clear-actions true also drops every queued action targeting this agent. Capability: :agent

clojure.core/reverse

Returns a sequence of the items in coll in reverse order.

clojure.core/reversible?

Returns true if x supports rseq (vectors and sorted collections).

clojure.core/rm-rf

Recursively removes a file or directory. Capability: :fs

clojure.core/rseq

Returns a reverse sequence of a vector, or nil if empty.

clojure.core/rsubseq

Returns the entries of a sorted collection whose keys fall in the given range, descending.

clojure.core/run

Runs a command with separate stdout, stderr, and exit. Returns {:out "" :err "" :exit n}. Accepts optional {:dir ""} map. Capability: :proc

clojure.core/run!

Applies f to each item in coll for side effects. Returns nil.

clojure.core/satisfies?

Returns true if x's type has implementations for all methods of proto.

clojure.core/save-image

Save the full runtime state to an image file. Capability: :fs

clojure.core/second

Returns the second item in coll.

clojure.core/select-keys

Returns a map containing only the entries whose keys are in ks.

clojure.core/send

Dispatches an action onto the agent's POOLED run-queue and returns the agent immediately. The action runs on the POOLED worker under state_lock. Throws MTH001 if the host has not granted a thread budget for the worker. Capability: :agent

clojure.core/send-off

Dispatches an action onto the agent's SOLO run-queue. mino's per-state eval lock means actions across the two pools still serialize, but the queues are independent: a long-running send-off action does not stall pending sends, and vice versa. Throws MTH001 if the host has not granted a thread budget. Capability: :agent

clojure.core/send-via

JVM-canon dispatches the action through a host-supplied Executor. mino has no public Executor type yet; this prim throws MST008 rather than aliasing to send and dropping the executor argument. Use send / send-off. Capability: :agent

clojure.core/seq

Returns a seq on the collection, or nil if empty.

clojure.core/seq-to-map-for-destructuring

Builds a map from a sequence of keyword/value pairs, possibly with a trailing override map. Used by JVM Clojure's 1.11+ map-destructure over a varargs seq. Public so portable code can call it directly.

clojure.core/seq?

Returns true if x is a cons cell or lazy-seq.

clojure.core/seqable?

Returns true if (seq x) is supported.

clojure.core/seque

Returns a seq with the same elements and order as s, where a producer running on another thread stays up to n elements (default 128) ahead of the consumer. The producer realizes s in n-sized batches, each batch filling while the consumer walks the previous one. When host threads are not granted (mino-thread-limit <= 1), falls back to (seq s) so callers don't need a conditional.

clojure.core/sequence

Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (). With a transducer xf, returns a lazy sequence of applying xf to coll, or to the pair-wise step of multiple collections. Parallel collections stop at the shortest.

clojure.core/sequential?

Returns true if x is a sequential collection (list, vector, lazy-seq, or queue).

clojure.core/set

Returns a set of the items in coll.

clojure.core/set!

Mutates a thread-local dynamic-var binding to the given value. The target must be a dynamic var with an enclosing (binding ...) form on the call stack; without one, throws "Can't change/establish root binding". Matches Clojure JVM's contract for set! on Vars. Returns the new value. The JVM-only field-mutation shape (set! (.-field obj) val) is not supported -- mino has no JVM fields.

clojure.core/set-dyn-binding!

(set-dyn-binding! 'name value) — mutate the topmost active dynamic binding for `name`. Returns the value. Throws when no binding frame is active for `name`. Backs (set! *var* expr).

clojure.core/set-error-handler!

Sets the agent's error-handler fn (called with [agent ex] when an action throws). Capability: :agent

clojure.core/set-error-mode!

Sets the agent's error mode (:fail or :continue). Capability: :agent

clojure.core/set-fail-alloc-at!

Make the n-th GC allocation fail (simulated OOM). Pass 0 to disable.

clojure.core/set-print-method!

Installs a fn to dispatch pr / prn output; nil removes the hook.

clojure.core/set-validator!

Sets a validator function on an atom.

clojure.core/set?

Returns true if x is a set (including sorted-set).

clojure.core/sh

Runs an external command. Returns {:exit n :out "..."}. Capability: :proc

clojure.core/sh!

Runs an external command. Returns stdout; throws on non-zero exit. Capability: :proc

clojure.core/sha256

Returns the hex-encoded SHA-256 digest of a string. Capability: :fs

clojure.core/short

Coerces x to a short (16-bit integer). Throws on out-of-range values, NaN, or infinity. Returns the value as a long since mino has only one integer tier.

clojure.core/short-array

Creates a host-style short array. Zero-fills on size argument; copies elements from a collection.

clojure.core/shuffle

Returns a randomly shuffled vector of the items in coll.

clojure.core/shutdown-agents

Quiesces both per-state agent workers: signals each to drain its remaining queue, joins the pthreads, seals the agent surface so subsequent send / send-off throw MST008. Idempotent. Throws MST002 if called from inside an action body (self-join). Capability: :agent

clojure.core/simple-ident?

Returns true if x is a non-namespace-qualified symbol or keyword.

clojure.core/simple-keyword?

Returns true if x is a keyword with no namespace.

clojure.core/simple-symbol?

Returns true if x is a symbol with no namespace.

clojure.core/slurp

Reads the entire contents of a file as a string. Capability: :io

clojure.core/some

Returns the first truthy value of (pred x) for any x in coll, else nil.

clojure.core/some->

Thread-first through forms, short-circuiting on nil.

clojure.core/some->>

Thread-last through forms, short-circuiting on nil.

clojure.core/some-fn

Returns a function that returns the first truthy value from any pred applied to any argument.

clojure.core/some?

Returns true if x is not nil.

clojure.core/sort

Returns a sorted sequence of the items in coll.

clojure.core/sort-by

Returns a sorted sequence of the items in coll, ordered by (keyfn item).

clojure.core/sorted-map

Returns a new sorted map with the given key-value pairs.

clojure.core/sorted-map-by

Returns a sorted map using the given comparator function.

clojure.core/sorted-set

Returns a new sorted set containing the arguments.

clojure.core/sorted-set-by

Returns a sorted set using the given comparator function.

clojure.core/sorted?

Returns true if x is a sorted collection.

clojure.core/special-symbol?

Returns true if x is a symbol that names a special form.

clojure.core/spit

Writes the string content to a file. Capability: :io

clojure.core/split-at

Returns a vector of [(take n coll) (drop n coll)].

clojure.core/split-with

Returns a vector of [(take-while pred coll) (drop-while pred coll)].

clojure.core/splitv-at

Returns a vector [(vec (take n coll)) (vec (drop n coll))].

clojure.core/store-checkpoint*

Write the db value to disk and truncate the WAL if durable. Capability: :store

clojure.core/store-clock*

Return the current instant from the store's clock. Capability: :store

clojure.core/store-close*

Close the store, flushing if durable. Capability: :store

clojure.core/store-commit*

Publish a new db value to the store, optionally appending to WAL. Capability: :store

clojure.core/store-open*

Create a store connection from a db value and optional path. Capability: :store

clojure.core/store-read-snapshot*

Read a snapshot file and return the db value, or nil. Capability: :store

clojure.core/store-read-wal*

Read the WAL and return a vector of tx-info maps, or nil. Capability: :store

clojure.core/store?

Return true if x is a store connection. Capability: :store

clojure.core/str

Returns the string representation of the arguments concatenated.

clojure.core/string?

Returns true if x is a string.

clojure.core/subbits

Zero-copy-semantics slice of a bytes value over a half-open bit range [start..end). Result satisfies bitstring? and is byte-aligned when (- end start) is a multiple of 8.

clojure.core/subs

Returns a substring from start (inclusive) to end (exclusive).

clojure.core/subseq

Returns the entries of a sorted collection whose keys fall in the given range, ascending.

clojure.core/subvec

Returns a subvector from start (inclusive) to end (exclusive).

clojure.core/swap!

Atomically applies f to the current value of the atom and any additional args.

clojure.core/swap-vals!

Atomically applies f to the atom and returns [old new].

clojure.core/symbol

Returns a symbol with the given name.

clojure.core/symbol?

Returns true if x is a symbol.

clojure.core/sync

Like dosync: runs the exprs (which may be nil) in an STM transaction. flags-ignored is accepted for arglist parity and currently ignored.

clojure.core/tagged-literal

Builds a tagged-literal record with tag and form fields. Predicate tagged-literal? returns true on the result.

clojure.core/tagged-literal?

Returns true if x is a tagged-literal record produced by tagged-literal.

clojure.core/take

Returns a lazy sequence of the first n items in coll. When called with no collection, returns a transducer.

clojure.core/take-last

Returns a seq of the last n items in coll.

clojure.core/take-nth

Returns a lazy sequence of every nth item in coll. When called with no collection, returns a transducer.

clojure.core/take-while

Returns a lazy sequence of items from coll while pred returns truthy. When called with no collection, returns a transducer.

clojure.core/tap>

Sends x to every registered tap. Tap fns that throw are silently skipped so a misbehaving subscriber does not poison the stream. Returns true.

clojure.core/test

Finds fn at key :test in v's metadata, calls it (presumably with no side effects on the wider system), and reports :ok when it returns, :no-test when no :test fn is present. An error thrown by the :test fn flows out unwrapped.

clojure.core/the-ns

Return the namespace symbol or throw if not found.

clojure.core/thread

Executes the body in another thread, returning a future-like value that can be deref'd. Shares the same worker pool as future. Throws :mino/unsupported when host threads are not granted.

clojure.core/thread-bound?

Returns true if all of the vars provided as arguments have thread-local bindings active on the current dyn-stack.

clojure.core/thread-sleep

Blocks the current thread for the given number of milliseconds. Returns nil. Capability: :proc

clojure.core/throw

Throws an exception with the given value.

clojure.core/time

Evaluates body, prints elapsed time, and returns the result.

clojure.core/time-ms

Returns the current time in milliseconds. Capability: :io

clojure.core/to-array

Converts a collection to an Object array (host-style).

clojure.core/trampoline

Calls f with args, then repeatedly calls the result if it is a function.

clojure.core/transduce

Reduces coll using the transducer xf applied to the reducing function f.

clojure.core/transient

Returns a transient view of coll for batch mutation.

clojure.core/transient?

Returns true if x is a transient.

clojure.core/tree-seq

Returns a lazy depth-first sequence of nodes in a tree.

clojure.core/true?

Returns true if x is the value true.

clojure.core/type

Returns a keyword indicating the type of the value.

clojure.core/unchecked-add

Returns x + y as a long with two's-complement wraparound. Operands must be ints. Opt-in fast path for code that knows overflow can't occur or wants wraparound semantics.

clojure.core/unchecked-add-int

Returns x + y with 32-bit two's-complement wraparound.

clojure.core/unchecked-byte

Coerce x to an 8-bit signed byte (stored in a long with sign extension).

clojure.core/unchecked-char

Coerce x to a Unicode char by truncating to 16 bits (matching JVM char).

clojure.core/unchecked-dec

Returns x - 1 as a long with two's-complement wraparound. Argument must be an int.

clojure.core/unchecked-dec-int

Returns x - 1 with 32-bit two's-complement wraparound.

clojure.core/unchecked-divide-int

Returns the truncating integer division of x by y. Both must be ints. Aliased to quot — the truncating semantic matches canon's unchecked-divide-int (no overflow check; on the JVM this is the primitive idiv instruction).

clojure.core/unchecked-double

Coerce x to a 64-bit double.

clojure.core/unchecked-float

Coerce x to a 32-bit float.

clojure.core/unchecked-inc

Returns x + 1 as a long with two's-complement wraparound. Argument must be an int.

clojure.core/unchecked-inc-int

Returns x + 1 with 32-bit two's-complement wraparound.

clojure.core/unchecked-int

Coerce x to a 32-bit signed int (stored in a long with sign extension). Truncates toward zero; 32-bit wraparound.

clojure.core/unchecked-long

Coerce x to a 64-bit long by truncating toward zero. No overflow check; out-of-range doubles clamp to long-long range.

clojure.core/unchecked-multiply

Returns x * y as a long with two's-complement wraparound. Operands must be ints.

clojure.core/unchecked-multiply-int

Returns x * y with 32-bit two's-complement wraparound.

clojure.core/unchecked-negate

Returns -x as a long with two's-complement wraparound. Argument must be an int.

clojure.core/unchecked-negate-int

Returns -x with 32-bit two's-complement wraparound.

clojure.core/unchecked-remainder-int

Returns the 32-bit signed remainder of x divided by y. Matches JVM int `%`; throws on division by zero; INT_MIN % -1 = 0.

clojure.core/unchecked-short

Coerce x to a 16-bit signed short (stored in a long with sign extension).

clojure.core/unchecked-subtract

Returns x - y as a long with two's-complement wraparound. Operands must be ints.

clojure.core/unchecked-subtract-int

Returns x - y with 32-bit two's-complement wraparound.

clojure.core/underive

Removes a parent/child relationship between child and parent.

clojure.core/unquote

Placeholder for the ~ reader form. Only meaningful inside syntax-quote; calling it directly throws.

clojure.core/unquote-splicing

Placeholder for the ~@ reader form. Only meaningful inside syntax-quote; calling it directly throws.

clojure.core/unreduced

Unwraps a reduced value. If not reduced, returns x.

clojure.core/unsigned-bit-shift-right

Returns n logically shifted right by count bits.

clojure.core/update

Updates the value at key k in map m by applying f to the old value and any args.

clojure.core/update-in

Updates a value in a nested associative structure by applying f at the given key path.

clojure.core/update-keys

Returns a map with f applied to each key.

clojure.core/update-vals

Returns a map with f applied to each value.

clojure.core/uri?

clojure.core/use

Loads a module and refers all of its public names by default.

clojure.core/uuid?

Returns true if x is a UUID value.

clojure.core/val

Returns the value of a map entry. Throws on values that are not map entries (a literal 2-vector, for instance).

clojure.core/vals

Returns a sequence of the values in a map.

clojure.core/var-get

Return the current value of a var: the thread-local binding if one is active, otherwise the root value.

clojure.core/var-set

Set the root value of a var.

clojure.core/var?

Returns true if x is a var.

clojure.core/vary-meta

Returns a copy of the value with (apply f meta args) as its metadata.

clojure.core/vec

Converts coll into a vector. Coll must be nil, a sequential collection, a string, a map, a set, or a host array. Booleans, numbers, keywords, characters, regexes, and transients throw (matching JVM Clojure's `vec` rejecting non-seqable scalars).

clojure.core/vector

Returns a new vector containing the arguments.

clojure.core/vector?

Returns true if x is a vector.

clojure.core/volatile!

Creates a volatile cell with the given initial value. A volatile is a single-slot mutable reference with no watches, validators, or atomic publish — intended for transducer state where the reducing fn already implies single-thread access.

clojure.core/volatile?

Returns true if x is a volatile.

clojure.core/vreset!

Sets the value of a volatile to newval and returns newval. No watches, no validators, no atomicity.

clojure.core/vswap!

Non-atomically swaps the value of the volatile to be: (apply f current-value-of-vol args). Returns the new value.

clojure.core/walk

Traverses form, applying inner to each element and outer to the result.

clojure.core/when

Evaluates body when test is truthy. Returns nil otherwise.

(clojure.core/when true :yes)
:yes
(macroexpand-1 '(clojure.core/when true 1))
'(clojure.core/when true 1)

clojure.core/when-first

Binds the first element of a collection, evaluates body if the collection is non-empty.

clojure.core/when-let

Binds the result of expr, evaluates body if truthy.

clojure.core/when-not

Evaluates body when test is falsy.

clojure.core/when-some

Binds the result of expr, evaluates body if non-nil.

clojure.core/which

Searches PATH for an executable, returns its absolute path or nil. Capability: :fs

clojure.core/while

Repeatedly evaluates body while test is truthy.

clojure.core/with-bindings

Takes a map of var->value pairs. Installs the bindings, executes body, and pops the bindings in a finally clause.

clojure.core/with-bindings*

(with-bindings* bindings-map fn) — pushes the bindings as a dynamic frame and invokes fn with no args.

clojure.core/with-in-str

Evaluates body with *in* bound to a string-cursor atom holding s. read and read-line consume from the cursor as forms or lines are taken; the body's value is returned.

clojure.core/with-local-vars

Binds names to fresh, lexically-scoped vars holding init values. Within body the names refer to vars: read with @name, mutate with (var-set name val). The vars are interned in the current namespace under gensym'd suffixes so they don't collide with named defs.

clojure.core/with-meta

Returns a copy of the value with the given metadata map.

clojure.core/with-open

Binds resources, evaluates body, then closes each resource.

clojure.core/with-out-str

Evaluates body with *out* bound to a fresh string-collecting atom, and returns the accumulated string.

clojure.core/with-precision

Sets *math-context* to {:precision precision :rounding-mode mode} around body. The keyword :rounding takes the next form as a rounding-mode keyword (e.g. (with-precision 5 :rounding :half-up (/ 1M 3M))) or as a JVM RoundingMode enum symbol (e.g. HALF_UP, CEILING). Without :rounding, the mode defaults to :half-up.

clojure.core/with-redefs

Temporarily rebinds the root bindings of vars while body executes, restoring them in a finally clause. Bindings is a vector of var-name/value pairs. The temp-value exprs are evaluated in parallel BEFORE any rebind fires, so a later binding-value that names an earlier-listed var sees that var's pre-redef value (matching Clojure JVM).

clojure.core/with-redefs-fn

Temporarily rebinds the root values of vars to new-values while thunk runs, restoring originals afterward. bindings-map is a map of var -> new-value.

clojure.core/xml-seq

A tree seq on the xml elements as per xml/parse: nodes are maps with :tag and :content keys, leaves are strings.

clojure.core/zero?

Returns true if x is zero.

clojure.core/zipmap

Returns a map with keys mapped to corresponding vals.

clojure.lang.PersistentQueue/EMPTY

clojure.repl/apropos

Given a regular expression or stringable thing, return a sorted seq of all public definitions in all currently-loaded namespaces whose names match str-or-pattern (substring for strings, re-find for regexes), as namespace-qualified symbols. Parity with clojure.repl/apropos.

clojure.repl/dir

Prints a sorted list of public names in the given namespace symbol.

clojure.repl/dir-fn

Returns a sorted seq of symbols for public names in the namespace named by `ns-sym`. Helper for the `dir` macro.

clojure.repl/doc

Prints documentation for the named var. Takes an unquoted symbol naming a var, prints its documentation, and returns nil.

clojure.repl/doc-string

Returns the documentation string for the named var, or nil.

clojure.repl/find-doc

Prints documentation for any var whose documentation or name contains a match for `re-string-or-pattern`, where the pattern is a regex or a plain substring (substring matches case-sensitively).

clojure.repl/pst

Prints the most recent exception (`*e`) as a formatted summary. With no argument, prints `*e`; with an explicit map argument, prints that map. Returns nil.

clojure.repl/source

Prints the source form of the named var.

clojure.repl/source-form

Returns the source form for the named var, or nil.

clojure.string/ends-with?

Returns true if the string ends with the given suffix.

clojure.string/includes?

Returns true if the string contains the given substring.

clojure.string/join

Returns a string of the items in coll joined by separator.

clojure.string/lower-case

Returns the string converted to lower case.

clojure.string/replace

Returns a collection with items in coll replaced by entries in smap.

(clojure.string/replace "abc" #"x*" "-")
"-a-b-c-"

clojure.string/replace-first

Replaces the first occurrence of match in s with replacement.

clojure.string/split

Splits a string on a regex pattern.

(vec (clojure.string/split "a\tb" #"\t"))
["a" "b"]

clojure.string/starts-with?

Returns true if the string starts with the given prefix.

clojure.string/trim

Returns the string with leading and trailing whitespace removed.

clojure.string/upper-case

Returns the string converted to upper case.

Special forms

These forms are recognized directly by the evaluator and cannot be redefined.

quote

(str (quote Foo.))
"Foo."

quasiquote

unquote

unquote-splicing

def

(eval (read-string "(do (ns foo) (def x 1) (ns bar) (def x 2) (in-ns 'baz) (def x 3) (require 'foo 'bar) [foo/x bar/x x])"))
[1 2 3]
(eval (read-string "(do (ns foo) (def x 1) (ns bar) (def x 2) (in-ns 'baz) (def x 3) (require (symbol \"foo\") (symbol \"bar\")) [foo/x bar/x x])"))
[1 2 3]
(eval (read-string "(do (ns rc1 (:require [clojure.string :refer [split]])) (def split :mine) split)"))
:mine

defmacro

if

(a/<!! (a/go (if (even? (a/<! ch)) :even :odd)))
:even
(loop [a 1]
(if (< a 3)
  (recur (inc a))
  a))
3
(loop [a []
     b [1 2 3]]
(if (seq b)
  (recur (conj a (* 2 (first b)))
         (next b))
  a))
[2 4 6]

do

(do 1 2 3)
3
(eval (read-string
"(do (ns cs-strict-only.a (:refer-clojure :only [+ -])) (+ 1 2))"))
3
(eval (read-string "(do (in-ns 'cs-strict-foo) (ns-name *ns*))"))
'cs-strict-foo

let

(a/<!! (a/go (let [x (+ 1 (a/<! ch))] (* 2 x))))
42
(let [x 5] x)
5
(let [x 1 y 2] (+ x y))
3

fn

((fn [n] (+ n 0)) tag-max)
tag-max
((fn [n] (+ n 1)) tag-max)
(+' tag-max 1)
((fn [n] (dec n)) tag-max)
(- tag-max 1)

loop

(loop [] 1)
1
(loop [a 1]
(if (< a 3)
  (recur (inc a))
  a))
3
(loop [a []
     b [1 2 3]]
(if (seq b)
  (recur (conj a (* 2 (first b)))
         (next b))
  a))
[2 4 6]

recur

(loop [a 1]
(if (< a 3)
  (recur (inc a))
  a))
3
(loop [a []
     b [1 2 3]]
(if (seq b)
  (recur (conj a (* 2 (first b)))
         (next b))
  a))
[2 4 6]
(loop [a ()
     b [1 2 3]]
(if (seq b)
  (recur (conj a (* 2 (first b)))
         (next b))
  a))
[6 4 2]

try

(try ((fn f [n] (if (pos? n) (recur (dec n)) n)) 3)
(catch e :wrong))
0
(:n (ex-data (try @d (catch e e))))
1
(:n (ex-data (try @d (catch e e))))
1

Standard library

Defined in mino source at startup. View with (source name) at the REPL.

whenmacro

Evaluates body when test is truthy. Returns nil otherwise.

Source
(defmacro when
  "Evaluates body when test is truthy. Returns nil otherwise."
  [c & body]
  `(if ~c (do ~@body)))
(when true 1)
1
(when true)
nil
(when false)
nil

condmacro

Takes pairs of test/expr. Returns the expr for the first truthy test.

Source
(defmacro cond
  "Takes pairs of test/expr. Returns the expr for the first truthy test."
  [& clauses]
  (if (< (count clauses) 2)
    nil
    `(if ~(first clauses)
         ~(first (rest clauses))
         (cond ~@(rest (rest clauses))))))
(cond)
nil
(cond nil true)
nil
(cond false true)
nil

andmacro

Returns the first falsy value, or the last value if all are truthy.

Source
(defmacro and
  "Returns the first falsy value, or the last value if all are truthy."
  [& xs]
  (if (= 0 (count xs))
    true
    (if (= 1 (count xs))
      (first xs)
      (let [g (gensym)]
        `(let [~g ~(first xs)]
           (if ~g (and ~@(rest xs)) ~g))))))
(and)
true
(and true)
true
(and nil)
nil

ormacro

Returns the first truthy value, or the last value if none are truthy.

Source
(defmacro or
  "Returns the first truthy value, or the last value if none are truthy."
  [& xs]
  (if (= 0 (count xs))
    nil
    (if (= 1 (count xs))
      (first xs)
      (let [g (gensym)]
        `(let [~g ~(first xs)]
           (if ~g ~g (or ~@(rest xs))))))))
(or)
nil
(or true)
true
(or nil)
nil

->macro

Thread-first. Inserts x as the second item in the first form, then inserts the result as the second item in the next form, and so on.

Source
(defmacro ->
  "Thread-first. Inserts x as the second item in the first form, then
  inserts the result as the second item in the next form, and so on."
  [x & forms]
  (if (= 0 (count forms))
    x
    (let [step (first forms)]
      (if (cons? step)
        `(-> (~(first step) ~x ~@(rest step)) ~@(rest forms))
        `(-> (~step ~x) ~@(rest forms))))))
(meta (-> x (dissoc :foo) (dissoc :bar)))
xm
(meta (-> x (disj 1) (disj 2) (disj 3)))
xm
(-> 10 (- 3) (- 2))
5

->>macro

Thread-last. Inserts x as the last item in the first form, then inserts the result as the last item in the next form, and so on.

Source
(defmacro ->>
  "Thread-last. Inserts x as the last item in the first form, then
  inserts the result as the last item in the next form, and so on."
  [x & forms]
  (if (= 0 (count forms))
    x
    (let [step (first forms)]
      (if (cons? step)
        `(->> (~(first step) ~@(rest step) ~x) ~@(rest forms))
        `(->> (~step ~x) ~@(rest forms))))))
(->> 10 (- 3) (- 2))
9

dosyncmacro

Runs body in an STM transaction. Refs may be altered, set, ensured, or commuted within. The transaction retries on write conflicts in multi-threaded mode. Side effects via (io! ...) inside the body throw. Requires STM to be installed (mino_install_stm).

Source
(defmacro dosync
  "Runs body in an STM transaction. Refs may be altered, set, ensured,
  or commuted within. The transaction retries on write conflicts in
  multi-threaded mode. Side effects via (io! ...) inside the body
  throw. Requires STM to be installed (mino_install_stm)."
  [& body]
  `(dosync* (fn [] ~@body)))

syncmacro

Like dosync: runs the exprs (which may be nil) in an STM transaction. flags-ignored is accepted for arglist parity and currently ignored.

Source
(defmacro sync
  "Like dosync: runs the exprs (which may be nil) in an STM
  transaction. flags-ignored is accepted for arglist parity and
  currently ignored."
  [flags-ignored & body]
  `(dosync ~@body))
(sync nil (alter r + 1 2 3))
16

io!macro

If invoked within an STM transaction, throws an IllegalStateException-equivalent before evaluating body. Marks a body as having unsafe side effects so dosync can refuse it.

Source
(defmacro io!
  "If invoked within an STM transaction, throws an
  IllegalStateException-equivalent before evaluating body. Marks a
  body as having unsafe side effects so dosync can refuse it."
  [& body]
  `(do (io!-check) ~@body))

^:privatefunction

Source
(def ^:private fn-arity-with-prepost
  (fn [arity]
    (let [params (first arity)
          body   (rest arity)
          head   (first body)]
      (if (and (map? head)
               (or (contains? head :pre) (contains? head :post)))
        (let [pre   (get head :pre [])
              post  (get head :post [])
              rest-body (rest body)
              assert-pre
              (map (fn [p]
                     (list 'when-not p
                           (list 'throw
                                 (list 'ex-info
                                       (str "Pre-condition failed: "
                                            (pr-str p))
                                       {:pre (list 'quote p)}))))
                   pre)
              assert-post
              (map (fn [p]
                     (list 'when-not p
                           (list 'throw
                                 (list 'ex-info
                                       (str "Post-condition failed: "
                                            (pr-str p))
                                       {:post (list 'quote p)}))))
                   post)
              wrapped
              (apply list
                     (concat assert-pre
                             [(apply list 'let
                                     ['% (apply list 'do rest-body)]
                                     [(apply list 'do
                                             (concat assert-post
                                                     ['%]))])]))]
          (cons params wrapped))
        arity))))

defnmacro

Defines a named function. Supports docstrings, multi-arity, and :pre/:post conditions.

Source
(defmacro defn
  "Defines a named function. Supports docstrings, multi-arity, and
   :pre/:post conditions."
  [name & fdecl]
  (let [has-doc  (string? (first fdecl))
        doc      (if has-doc (first fdecl) nil)
        fdecl    (if has-doc (rest fdecl) fdecl)
        has-attr (map? (first fdecl))
        fdecl    (if has-attr (rest fdecl) fdecl)
        ;; If the first remaining form is a vector, this is single-arity
        ;; (params-vec body...). Otherwise it's a sequence of arity
        ;; lists (params-vec body...) (params-vec body...). Handle the
        ;; :pre/:post map either way.
        rewritten (if (vector? (first fdecl))
                    (fn-arity-with-prepost fdecl)
                    (mapv fn-arity-with-prepost fdecl))
        form     (if (vector? (first fdecl))
                   (cons 'fn rewritten)
                   (apply list 'fn rewritten))]
    (if doc
      `(def ~name ~doc ~form)
      `(def ~name ~form))))
(eval (read-string "(do (ns foo) (defn foo [] 1) (ns bar) (apply require ['[foo :as f]]) (f/foo))"))
1
(eval (read-string "(do (defn inc [x] :foo) ((get (ns-map *ns*) 'inc) 1))"))
:foo
(load-string "(defn __ls_sq [x] (* x x)) (__ls_sq 5)")
25

defn-macro

Same as defn, yielding a non-public def.

Source
(defmacro defn-
  "Same as defn, yielding a non-public def."
  [name & body]
  (apply list 'defn (vary-meta name assoc :private true) body))

defoncemacro

Defines name only if it has no root binding.

Source
(defmacro defonce
  "Defines name only if it has no root binding."
  [name expr]
  `(when-not (resolve '~name)
     (def ~name ~expr)))

vswap!macro

Non-atomically swaps the value of the volatile to be: (apply f current-value-of-vol args). Returns the new value.

Source
(defmacro vswap!
  "Non-atomically swaps the value of the volatile to be:
   (apply f current-value-of-vol args). Returns the new value."
  [vol f & args]
  `(vreset! ~vol (~f (deref ~vol) ~@args)))
(vswap! v inc)
1
(vswap! v + 2 3)
6
(vswap! v * 2)
20

^:privatefunction

Source
(def ^:private map1 lazy-map-1)

lazy-catmacro

Expands to code that yields a lazy concatenation of the given collections.

Source
(defmacro lazy-cat
  "Expands to code that yields a lazy concatenation of the given
   collections."
  [& colls]
  (if (seq colls)
    `(lazy-seq (concat ~(first colls) (lazy-cat ~@(rest colls))))
    `(lazy-seq nil)))

interleavefunction

Returns a lazy sequence of the first item in each collection, then the second, and so on.

Source
(def interleave
  "Returns a lazy sequence of the first item in each collection, then
   the second, and so on."
  (let [interleave2
        (fn interleave2 [c1 c2]
          (lazy-seq
            (let [s1 (seq c1) s2 (seq c2)]
              (when (and s1 s2)
                (cons (first s1)
                      (cons (first s2)
                            (interleave2 (rest s1)
                                         (rest s2))))))))]
    (fn
      ([] ())
      ([c1] (lazy-seq (seq c1)))
      ([c1 c2] (interleave2 c1 c2))
      ([c1 c2 & colls]
       (lazy-seq
         (let [ss (map seq (cons c1 (cons c2 colls)))]
           (when (every? identity ss)
             (concat (map first ss)
                     (apply interleave (map rest ss))))))))))
(interleave [1 2 3] [:a :b :c])
'(1 :a 2 :b 3 :c)

partitionfunction

Returns a lazy sequence of lists of n items each, at offsets step apart. With pad, the final partition is filled from pad to reach n; if pad is shorter than needed, returns a partition with fewer than n items.

Source
(def partition
  "Returns a lazy sequence of lists of n items each, at offsets step
   apart. With pad, the final partition is filled from pad to reach
   n; if pad is shorter than needed, returns a partition with fewer
   than n items."
  (let [part-impl
        (fn part-impl [n step coll]
          (lazy-seq
            (when-let [s (seq coll)]
              (let [p (doall (take n s))]
                (when (= n (count p))
                  (cons p (part-impl n step (drop step s))))))))
        part-pad-impl
        (fn part-pad-impl [n step pad coll]
          (lazy-seq
            (when-let [s (seq coll)]
              (let [p (doall (take n s))]
                (if (= n (count p))
                  (cons p (part-pad-impl n step pad (drop step s)))
                  (list (take n (concat p pad))))))))]
    (fn
      ([n coll]            (part-impl n n coll))
      ([n step coll]       (part-impl n step coll))
      ([n step pad coll]   (part-pad-impl n step pad coll)))))
(partition 2 [1 2 3 4])
'((1 2) (3 4))
(partition 2 [1 2 3])
'((1 2))
(partition 2 1 [1 2 3 4])
'((1 2) (2 3) (3 4))

array-mapfunction

Creates a hash-map.

Source
(def array-map    "Creates a hash-map." hash-map)

delaymacro

Creates a delay that evaluates body on first deref. The body runs at most once: a failure is recorded and rethrown on every later force.

Source
(defmacro delay
  "Creates a delay that evaluates body on first deref. The body runs
  at most once: a failure is recorded and rethrown on every later
  force."
  [& body]
  `(let [state# (atom {:status :pending})]
     {:delay/fn  (fn []
                   (let [s# @state#]
                     (cond
                       (= (:status s#) :done)
                       (:value s#)

                       (= (:status s#) :failed)
                       (throw (:error s#))

                       :else
                       (try
                         (let [v# (do ~@body)]
                           (reset! state# {:status :done :value v#})
                           v#)
                         (catch e#
                           (reset! state# {:status :failed :error e#})
                           (throw e#))))))
      :delay/state state#}))

monitor-registryfunction

Source
(def monitor-registry
  ;; Vector of [monitor-object owner-thread-id depth] entries. Identity
  ;; keyed (identical?) like canonical monitors; held-monitor counts
  ;; are tiny, so a linear scan is the simple correct structure. The
  ;; single-mutator scheduling model makes each swap! a critical
  ;; section on its own: claims and releases cannot interleave with
  ;; another thread's between yield points.
  (atom []))

lockingmacro

Executes body while holding a monitor of x. Reentrant per thread; released on normal exit and on throw. Exclusion is cooperative: contending threads wait for the holder to release across yield points.

Source
(defmacro locking
  "Executes body while holding a monitor of x. Reentrant per thread;
  released on normal exit and on throw. Exclusion is cooperative:
  contending threads wait for the holder to release across yield
  points."
  [x & body]
  `(let [mon# ~x
         owner# (mino-thread-id*)]
     (loop []
       (when-not (monitor-try-enter mon# owner#)
         (thread-sleep 1)
         (recur)))
     (try
       (do ~@body)
       (finally
         (monitor-exit mon# owner#)))))
(locking m (locking m :inner))
:inner
(try (locking m (throw (ex-info "x" {})))
(catch e :caught))
:caught
(locking m :again)
:again

if-notmacro

Evaluates then when test is falsy, else otherwise.

Source
(defmacro if-not
  "Evaluates then when test is falsy, else otherwise."
  [test then & else]
  (if (seq else)
    `(if (not ~test) ~then ~(first else))
    `(if (not ~test) ~then)))
(if-not false :yes :no)
:yes
(if-not true :yes :no)
:no
(if-not nil :yes)
:yes

when-notmacro

Evaluates body when test is falsy.

Source
(defmacro when-not "Evaluates body when test is falsy." [test & body]
  `(when (not ~test) ~@body))
(when-not false 1)
1
(when-not true)
nil
(when-not false)
nil

if-letmacro

Binds the result of expr, evaluates then if truthy, else otherwise.

Source
(defmacro if-let
  "Binds the result of expr, evaluates then if truthy, else otherwise."
  [bindings then & else]
  (when-not (and (vector? bindings) (= 2 (count bindings)))
    (throw "if-let requires a binding vector of exactly one symbol/expr pair"))
  (let [sym  (first bindings)
        expr (first (rest bindings))
        g    (gensym)]
    (if (seq else)
      `(let [~g ~expr]
         (if ~g (let [~sym ~g] ~then) ~(first else)))
      `(let [~g ~expr]
         (if ~g (let [~sym ~g] ~then))))))
(if-let [a 1] a)
1
(if-let [[a b] '(1 2)] b)
2
(if-let [a false] (throw (ex-info "boom" {})))
nil

when-letmacro

Binds the result of expr, evaluates body if truthy.

Source
(defmacro when-let
  "Binds the result of expr, evaluates body if truthy."
  [bindings & body]
  (when-not (and (vector? bindings) (= 2 (count bindings)))
    (throw "when-let requires a binding vector of exactly one symbol/expr pair"))
  (let [sym  (first bindings)
        expr (first (rest bindings))
        g    (gensym)]
    `(let [~g ~expr]
       (when ~g (let [~sym ~g] ~@body)))))
(when-let [a 1] a)
1
(when-let [[a b] '(1 2)] b)
2
(when-let [a false] (throw (ex-info "boom" {})))
nil

when-firstmacro

Binds the first element of a collection, evaluates body if the collection is non-empty.

Source
(defmacro when-first
  "Binds the first element of a collection, evaluates body if the
   collection is non-empty."
  [[x coll] & body]
  `(when-let [s# (seq ~coll)]
     (let [~x (first s#)] ~@body)))

letfnmacro

Binds local functions. Each binding is (name [params] body...). Expands to the `letfn*` special form so the bound fns can refer to each other (mutual recursion) — every name is placeholder- bound before any fn body is evaluated, so each fn's closure captures the shared scope.

Source
(defmacro letfn
  "Binds local functions. Each binding is (name [params] body...).
   Expands to the `letfn*` special form so the bound fns can refer
   to each other (mutual recursion) — every name is placeholder-
   bound before any fn body is evaluated, so each fn's closure
   captures the shared scope."
  [bindings & body]
  (let [pairs (vec (mapcat
                     (fn [b]
                       [(first b)
                        (apply list 'fn (first b) (rest b))])
                     bindings))]
    `(letfn* ~pairs ~@body)))
(letfn [(double [x] (* 2 x))]
(double 5))
10
(letfn [(double [x] (* 2 x))
       (add1 [x] (+ x 1))]
(add1 (double 5)))
11
(letfn [(factorial [n]
         (if (<= n 1) 1 (* n (factorial (dec n)))))]
(factorial 5))
120

set!macro

Mutates a thread-local dynamic-var binding to the given value. The target must be a dynamic var with an enclosing (binding ...) form on the call stack; without one, throws \

Source
(defmacro set!
  "Mutates a thread-local dynamic-var binding to the given value.
   The target must be a dynamic var with an enclosing (binding ...)
   form on the call stack; without one, throws \"Can't
   change/establish root binding\". Matches Clojure JVM's contract
   for set! on Vars. Returns the new value.

   The JVM-only field-mutation shape (set! (.-field obj) val) is not
   supported -- mino has no JVM fields."
  [target value]
  (when-not (symbol? target)
    (throw "set!: first argument must be a symbol naming a dynamic var"))
  (list 'set-dyn-binding! (list 'quote target) value))
(set! *set-bang-test* 1)
1

commentmacro

Ignores body, returns nil.

Source
(defmacro comment "Ignores body, returns nil." [& body] nil)

if-somemacro

Binds the result of expr, evaluates then if non-nil, else otherwise.

Source
(defmacro if-some
  "Binds the result of expr, evaluates then if non-nil, else
   otherwise."
  [bindings then & else]
  (when-not (and (vector? bindings) (= 2 (count bindings)))
    (throw "if-some requires a binding vector of exactly one symbol/expr pair"))
  (let [sym  (first bindings)
        expr (first (rest bindings))
        g    (gensym)]
    (if (seq else)
      `(let [~g ~expr]
         (if (not (nil? ~g)) (let [~sym ~g] ~then) ~(first else)))
      `(let [~g ~expr]
         (if (not (nil? ~g)) (let [~sym ~g] ~then))))))
(if-some [x false] x :none)
false
(if-some [x nil] x :none)
:none
(if-some [x 42] x :none)
42

when-somemacro

Binds the result of expr, evaluates body if non-nil.

Source
(defmacro when-some
  "Binds the result of expr, evaluates body if non-nil."
  [bindings & body]
  (when-not (and (vector? bindings) (= 2 (count bindings)))
    (throw "when-some requires a binding vector of exactly one symbol/expr pair"))
  (let [sym  (first bindings)
        expr (first (rest bindings))
        g    (gensym)]
    `(let [~g ~expr]
       (when (not (nil? ~g)) (let [~sym ~g] ~@body)))))
(when-some [x 0] (str "got " x))
"got 0"
(when-some [x nil] :nope)
nil

^:privatefunction

Source
(def ^:private -lock-first first)

^:privatefunction

Source
(def ^:private -lock-next  next)

get-infunction

Returns the value in a nested associative structure at the given key path.

Source
(def get-in
  "Returns the value in a nested associative structure at the given
   key path."
  (let [step (fn step [m ks nf sentinel]
               (if ks
                 (let [v (get m (first ks) sentinel)]
                   (if (= v sentinel)
                     nf
                     (step v (next ks) nf sentinel)))
                 m))]
    (fn
      ([m ks]     (reduce get m ks))
      ([m ks nf]  (step m (seq ks) nf (gensym))))))
(meta (get-in y [:guh]))
xm
(meta (get-in y [1]))
xm
(get-in {:a {:b 42}} [:a :b])
42

as->macro

Binds expr to sym, then threads it through each form where sym can appear anywhere.

Source
(defmacro as->
  "Binds expr to sym, then threads it through each form where sym can
   appear anywhere."
  [expr sym & forms]
  (if (= 0 (count forms))
    expr
    `(let [~sym ~expr]
       (as-> ~(first forms) ~sym ~@(rest forms)))))
(as-> 1 x (+ x 2) (* x 3))
9

cond->macro

Thread-first through forms whose tests are truthy.

Source
(defmacro cond->
  "Thread-first through forms whose tests are truthy."
  [expr & clauses]
  (if (< (count clauses) 2)
    expr
    (let [g    (gensym)
          test (first clauses)
          step (first (rest clauses))]
      `(let [~g ~expr]
         (cond-> (if ~test
                   ~(if (cons? step)
                      `(~(first step) ~g ~@(rest step))
                      `(~step ~g))
                   ~g)
                 ~@(rest (rest clauses)))))))
(cond-> 1 true inc false (* 100) true (* 2))
4

cond->>macro

Thread-last through forms whose tests are truthy.

Source
(defmacro cond->>
  "Thread-last through forms whose tests are truthy."
  [expr & clauses]
  (if (< (count clauses) 2)
    expr
    (let [g    (gensym)
          test (first clauses)
          step (first (rest clauses))]
      `(let [~g ~expr]
         (cond->> (if ~test
                    ~(if (cons? step)
                       `(~(first step) ~@(rest step) ~g)
                       `(~step ~g))
                    ~g)
                  ~@(rest (rest clauses)))))))
(cond->> [4 3 2 1] true (sort <))
'(1 2 3 4)

some->macro

Thread-first through forms, short-circuiting on nil.

Source
(defmacro some->
  "Thread-first through forms, short-circuiting on nil."
  [expr & forms]
  (if (= 0 (count forms))
    expr
    (let [g (gensym)]
      `(let [~g ~expr]
         (if (nil? ~g)
           nil
           (some-> (-> ~g ~(first forms)) ~@(rest forms)))))))
(some-> {:a 1} :a inc)
2
(some-> 0 inc)
1
(some-> 1 inc inc)
3

some->>macro

Thread-last through forms, short-circuiting on nil.

Source
(defmacro some->>
  "Thread-last through forms, short-circuiting on nil."
  [expr & forms]
  (if (= 0 (count forms))
    expr
    (let [g (gensym)]
      `(let [~g ~expr]
         (if (nil? ~g)
           nil
           (some->> (->> ~g ~(first forms)) ~@(rest forms)))))))
(some->> [1 2 3] (map inc))
'(2 3 4)
(some->> [1 2 3] (reduce +))
6
(some->> [1 2 3] (map inc) (filter even?))
'(2 4)

dotomacro

Evaluates x, then calls each form with x as the first argument. Returns x.

Source
(defmacro doto
  "Evaluates x, then calls each form with x as the first argument.
   Returns x."
  [x & forms]
  (let [g       (gensym)
        stmts   (apply list (map (fn [f] (if (cons? f)
                                            `(~(first f) ~g ~@(rest f))
                                            `(~f ~g)))
                                  forms))]
    `(let [~g ~x]
       ~@stmts
       ~g)))

dotimesmacro

Evaluates body n times with sym bound to 0 through n-1.

Source
(defmacro dotimes
  "Evaluates body n times with sym bound to 0 through n-1."
  [bindings & body]
  (let [sym (first bindings)
        n   (first (rest bindings))
        gn  (gensym)
        go  (gensym)]
    ;; Named fn so the body can self-reference; mino's let is
    ;; sequential (init exprs do not see their own binding) per
    ;; Clojure semantics, so a plain `(let [go (fn [...] (go))])`
    ;; would leave (go) unbound at fn-body evaluation.
    `(let [~gn ~n
           ~go (fn ~go [~sym]
                 (when (< ~sym ~gn)
                   ~@body
                   (~go (inc ~sym))))]
       (~go 0))))
(dotimes [n 1] n)
nil
(let [a (atom 0)]
(dotimes [n 3] (swap! a inc))
@a)
3
(let [a (atom [])]
(dotimes [n 3] (swap! a conj n))
@a)
[0 1 2]

whilemacro

Repeatedly evaluates body while test is truthy.

Source
(defmacro while
  "Repeatedly evaluates body while test is truthy."
  [test & body]
  (let [go (gensym)]
    `(let [~go (fn ~go [] (when ~test ~@body (~go)))]
       (~go))))

doseqmacro

Iterates over collections for side effects, evaluating body once per binding combination, and returns nil. Supports nested bindings and the modifier clauses :let, :when, and :while -- the same surface clojure.core/doseq exposes: :let [name expr ...] introduces locals visible to inner clauses :when expr skips this iteration when expr is falsy :while expr halts all iteration when expr is falsy Implementation note: :while needs to stop the outer loop too, not just the inner one. We encode that with a shared 'stop' atom that the outer driver inspects each iteration. Without it, an outer infinite seq paired with a later :while would never terminate.

Source
(defmacro doseq
  "Iterates over collections for side effects, evaluating body once
   per binding combination, and returns nil. Supports nested
   bindings and the modifier clauses :let, :when, and :while -- the
   same surface clojure.core/doseq exposes:
     :let [name expr ...]  introduces locals visible to inner clauses
     :when expr            skips this iteration when expr is falsy
     :while expr           halts all iteration when expr is falsy

  Implementation note: :while needs to stop the outer loop too, not
  just the inner one. We encode that with a shared 'stop' atom that
  the outer driver inspects each iteration. Without it, an outer
  infinite seq paired with a later :while would never terminate."
  [bindings & body]
  (let [stop-sym (gensym "doseq-stop_")]
    (letfn [(emit [bindings]
              (cond
                (zero? (count bindings))
                `(do ~@body nil)

                (= :let (first bindings))
                (let [bs            (first (rest bindings))
                      rest-bindings (into [] (drop 2 bindings))]
                  `(let ~bs ~(emit rest-bindings)))

                (= :when (first bindings))
                (let [pred          (first (rest bindings))
                      rest-bindings (into [] (drop 2 bindings))]
                  `(when ~pred ~(emit rest-bindings)))

                (= :while (first bindings))
                (let [pred          (first (rest bindings))
                      rest-bindings (into [] (drop 2 bindings))]
                  `(if ~pred
                     ~(emit rest-bindings)
                     (do (reset! ~stop-sym true) nil)))

                ;; Plain binding sym/coll. Drive a recursive loop.
                :else
                (let [sym           (first bindings)
                      coll          (first (rest bindings))
                      rest-bindings (into [] (drop 2 bindings))
                      gs            (gensym)
                      go            (gensym)]
                  ;; Use a named fn so the body can self-reference;
                  ;; mino's `let` follows Clojure's sequential
                  ;; semantics where init exprs do not see their own
                  ;; binding, so a plain `(let [go (fn [...] (go))])`
                  ;; would leave (go) unbound at fn-body evaluation.
                  `(let [~go (fn ~go [~gs]
                               (when (and ~gs (not @~stop-sym))
                                 (let [~sym (first ~gs)]
                                   ~(emit rest-bindings)
                                   (~go (next ~gs)))))]
                     (~go (seq ~coll))))))]
      `(let [~stop-sym (atom false)]
         ~(emit bindings)
         nil))))

timemacro

Evaluates body, prints elapsed time, and returns the result.

Source
(defmacro time
  "Evaluates body, prints elapsed time, and returns the result."
  [& body]
  (let [start  (gensym)
        result (gensym)]
    `(let [~start  (time-ms)
           ~result (do ~@body)]
       (println (str "Elapsed time: " (- (time-ms) ~start) " ms"))
       ~result)))

^:privatefunction

Source
(def ^:private prim-re-find    re-find)

^:privatefunction

Source
(def ^:private prim-re-matches re-matches)

condpmacro

Takes a binary predicate, an expression, and clauses. Returns the first clause value where (pred test-val expr) is truthy. The special clause shape `test :>> result-fn` calls `(result-fn p)` on the truthy pred-result whenever `(pred test expr)` is truthy.

Source
(defmacro condp
  "Takes a binary predicate, an expression, and clauses. Returns the
   first clause value where (pred test-val expr) is truthy. The
   special clause shape `test :>> result-fn` calls `(result-fn p)`
   on the truthy pred-result whenever `(pred test expr)` is truthy."
  [pred expr & clauses]
  (let [gpred (gensym "pred__")
        gexpr (gensym "expr__")
        build (fn build [cls]
                (cond
                  (empty? cls) nil
                  (= (count cls) 1) (first cls)
                  (and (>= (count cls) 3) (= (second cls) :>>))
                  (let [test   (first cls)
                        res-fn (nth cls 2)
                        more   (drop 3 cls)
                        gp     (gensym "p__")]
                    `(if-let [~gp (~gpred ~test ~gexpr)]
                       (~res-fn ~gp)
                       ~(build more)))
                  :else
                  (let [test (first cls)
                        then (second cls)
                        more (drop 2 cls)]
                    `(if (~gpred ~test ~gexpr)
                       ~then
                       ~(build more)))))]
    `(let [~gpred ~pred ~gexpr ~expr]
       ~(build clauses))))
(condp = 1  1 :pass  2 :fail)
:pass
(condp = 1  2 :fail  1 :pass)
:pass
(condp = 1  2 :fail  :pass)
:pass

casemacro

Dispatches on the value of expr. Matches constants in pairs, with an optional default.

Source
(defmacro case
  "Dispatches on the value of expr. Matches constants in pairs, with
   an optional default."
  [expr & clauses]
  (let [gexpr   (gensym)
        quote-c (fn [c]
                  (cond
                    (nil? c)     nil
                    (keyword? c) c
                    (number? c)  c
                    (string? c)  c
                    (= c true)  true
                    (= c false) false
                    :else        (list 'quote c)))
        match1  (fn [g c]
                  (if (cons? c)
                    ;; Multi-match list: (a b c) => (or (= g 'a) (= g 'b) ...)
                    (apply list 'or (map (fn [v] (list '= g (quote-c v))) c))
                    (list '= g (quote-c c))))
        build   (fn build [cls]
                  (if (< (count cls) 2)
                    (if (= (count cls) 1)
                      (first cls)
                      (list 'throw (list 'ex-info "no matching case" {})))
                    (list 'if (match1 gexpr (first cls))
                          (first (rest cls))
                          (build (rest (rest cls))))))]
    `(let [~gexpr ~expr]
       ~(build clauses))))
(case nil nil :nil :default)
:nil
(case 999 1 :one :default)
:default
(case :b :a 1 :b 2 :c 3)
2

formacro

List comprehension. Takes binding vectors and body, returns a lazy sequence.

Source
(defmacro for
  "List comprehension. Takes binding vectors and body, returns a lazy
   sequence."
  [bindings & body]
  (let [sym  (first bindings)
        coll (first (rest bindings))
        rest-bindings (drop 2 bindings)]
    (if (empty? rest-bindings)
      ;; Last binding pair: produce elements
      `(map (fn [~sym] ~@body) ~coll)
      (let [modifier (first rest-bindings)]
        (cond
          ;; :when filter
          (= modifier :when)
          (let [pred (first (rest rest-bindings))
                remaining (into [] (drop 2 rest-bindings))]
            (if (empty? remaining)
              `(map (fn [~sym] ~@body)
                    (filter (fn [~sym] ~pred) ~coll))
              `(for ~(into [sym (list 'filter (list 'fn [sym] pred) coll)]
                           remaining)
                 ~@body)))
          ;; :while stop iteration
          (= modifier :while)
          (let [pred (first (rest rest-bindings))
                remaining (into [] (drop 2 rest-bindings))]
            (if (empty? remaining)
              `(map (fn [~sym] ~@body)
                    (take-while (fn [~sym] ~pred) ~coll))
              `(for ~(into [sym (list 'take-while (list 'fn [sym] pred) coll)]
                           remaining)
                 ~@body)))
          ;; :let local bindings
          (= modifier :let)
          (let [let-bindings (first (rest rest-bindings))
                after-let (into [] (drop 2 rest-bindings))
                ;; Collect :when/:while modifiers that follow the :let
                next-mod (first after-let)]
            (cond
              (empty? after-let)
              `(map (fn [~sym]
                      (let ~let-bindings ~@body))
                    ~coll)
              ;; :when after :let on same binding
              (= next-mod :when)
              (let [pred (first (rest after-let))
                    remaining (into [] (drop 2 after-let))]
                (if (empty? remaining)
                  `(map (fn [~sym]
                          (let ~let-bindings ~@body))
                        (filter (fn [~sym]
                                  (let ~let-bindings ~pred))
                                ~coll))
                  `(mapcat (fn [~sym]
                             (let ~let-bindings
                               (when ~pred
                                 (for ~remaining ~@body))))
                           ~coll)))
              ;; :while after :let on same binding
              (= next-mod :while)
              (let [pred (first (rest after-let))
                    remaining (into [] (drop 2 after-let))]
                (if (empty? remaining)
                  `(map (fn [~sym]
                          (let ~let-bindings ~@body))
                        (take-while (fn [~sym]
                                      (let ~let-bindings ~pred))
                                    ~coll))
                  `(mapcat (fn [~sym]
                             (let ~let-bindings
                               (for ~remaining ~@body)))
                           (take-while (fn [~sym]
                                         (let ~let-bindings ~pred))
                                       ~coll))))
              ;; Other bindings after :let
              :else
              `(mapcat (fn [~sym]
                         (let ~let-bindings
                           (for ~after-let ~@body)))
                       ~coll)))
          ;; Another binding pair: nested iteration
          :else
          `(mapcat (fn [~sym]
                     (for ~(into [] rest-bindings) ~@body))
                   ~coll))))))
(into [] (for (x [1 2 3 4 5]) (* x x)))
[1 4 9 16 25]
(into [] (for (x [1 2 3 4 5] :when (even? x)) (* x x)))
[4 16]
(into [] (for [x [1 2 3]] (* x x)))
[1 4 9]

futuremacro

Takes a body of expressions and yields a future object that will evaluate the body in another thread, blocking on deref until the value is available. Throws :mino/unsupported when host threads are not granted; see mino-thread-limit.

Source
(defmacro future
  "Takes a body of expressions and yields a future object that will
  evaluate the body in another thread, blocking on deref until the
  value is available. Throws :mino/unsupported when host threads are
  not granted; see mino-thread-limit."
  [& body]
  `(if (<= (mino-thread-limit) 1)
     (throw (ex-info (mino-no-grant-msg "future")
                     {:mino/unsupported :future
                      :mino/thread-limit (mino-thread-limit)}))
     (future-call (fn [] ~@body))))
@(future (try ((fn deep [n] (+ 1 (deep (inc n)))) 0)
(catch e :caught)))
:caught

threadmacro

Executes the body in another thread, returning a future-like value that can be deref'd. Shares the same worker pool as future. Throws :mino/unsupported when host threads are not granted.

Source
(defmacro thread
  "Executes the body in another thread, returning a future-like value
  that can be deref'd. Shares the same worker pool as future. Throws
  :mino/unsupported when host threads are not granted."
  [& body]
  `(if (<= (mino-thread-limit) 1)
     (throw (ex-info (mino-no-grant-msg "thread")
                     {:mino/unsupported :thread
                      :mino/thread-limit (mino-thread-limit)}))
     (future-call (fn [] ~@body))))

pvaluesmacro

Returns a lazy sequence of the values of the exprs, which are evaluated in parallel via pcalls. Mirrors clojure.core/pvalues.

Source
(defmacro pvalues
  "Returns a lazy sequence of the values of the exprs, which are
   evaluated in parallel via pcalls. Mirrors clojure.core/pvalues."
  [& exprs]
  `(pcalls ~@(map (fn [e] `(fn [] ~e)) exprs)))
(vec (pvalues 1 (+ 2 3) :x))
[1 5 :x]

defprotocolmacro

Defines a protocol with the given method signatures.

Source
(defmacro defprotocol
  "Defines a protocol with the given method signatures."
  [proto-name & methods]
  (let [pname (name proto-name)]
    (letfn [(method-meta [m]
              (let [mname (first m)
                    sigs  (vec (take-while vector? (rest m)))]
                {:mname mname
                 :sigs sigs
                 :dsym (symbol (str pname "--" (name mname)))}))
            (method-defn [mi]
              ;; Single-signature methods keep the exact single-arity
              ;; shape the BC compiler's protocol-IC recognizer keys
              ;; on; multi-signature methods emit an arity-dispatching
              ;; fn (correct, falls back to the generic call path).
              (if (= 1 (count (:sigs mi)))
                (let [params (first (:sigs mi))]
                  (list 'defn (:mname mi) params
                        (apply list 'protocol-dispatch
                               (:dsym mi)
                               (str (:mname mi))
                               params)))
                (apply list 'defn (:mname mi)
                       (map (fn [params]
                              (list params
                                    (apply list 'protocol-dispatch
                                           (:dsym mi)
                                           (str (:mname mi))
                                           params)))
                            (:sigs mi)))))]
      (let [methods     (remove string? methods)
            methods     (loop [ms methods result []]
                          (if (or (nil? ms) (empty? ms))
                            result
                            (if (keyword? (first ms))
                              (recur (drop 2 ms) result)
                              (recur (rest ms)
                                     (conj result (first ms))))))
            method-info (into [] (map method-meta methods))
            atom-defs   (into [] (map (fn [mi]
                                        (list 'def (:dsym mi)
                                              '(atom {})))
                                      method-info))
            fn-defs     (into [] (map method-defn method-info))
            proto-map   (into {} (map (fn [mi]
                                        [(keyword (str (:mname mi)))
                                         (:dsym mi)])
                                      method-info))
            proto-def   (list 'def proto-name
                              {:name pname :methods proto-map})
            all-forms   (concat atom-defs fn-defs
                                (list proto-def))]
        (apply list 'do all-forms)))))

extend-typemacro

Extends a protocol with method implementations for the given type.

Source
(defmacro extend-type
  "Extends a protocol with method implementations for the given type."
  [type-kw & specs]
  (let [groups (loop [remaining specs
                      result []
                      cur-proto nil
                      cur-methods []]
                 (if (empty? remaining)
                   (if cur-proto
                     (conj result [cur-proto cur-methods])
                     result)
                   (let [item (first remaining)]
                     (if (and (symbol? item) (not (list? item)))
                       (recur (rest remaining)
                              (if cur-proto
                                (conj result [cur-proto cur-methods])
                                result)
                              item [])
                       (recur (rest remaining) result cur-proto
                              (conj cur-methods item))))))
        swaps (mapcat (fn [[proto methods]]
                (let [pname (name proto)
                      pns   (namespace proto)]
                  (map (fn [m]
                    (let [mname (first m)
                          tail  (rest m)]
                      (when-not (symbol? mname)
                        (throw (str "extend-type: method must start with a"
                                    " name symbol, got: " (pr-str m))))
                      ;; Single arity: (m [params] body...).
                      ;; Multi-arity: (m ([p] body...) ([p k] body...)).
                      (when-not (or (vector? (first tail))
                                    (and (seq tail)
                                         (every? (fn [clause]
                                                   (and (seq? clause)
                                                        (vector? (first clause))))
                                                 tail)))
                        (throw (str "extend-type: method " (pr-str mname)
                                    " must have a params vector or arity"
                                    " clauses, got: " (pr-str (first tail)))))
                      (let [dsym (symbol pns (str pname "--" (name mname)))
                            fn-form (apply list 'fn tail)]
                        (list 'swap! dsym 'assoc type-kw fn-form))))
                   methods)))
              groups)]
    (apply list 'do (vec swaps))))

extend-protocolmacro

Extends a protocol with implementations for multiple types.

Source
(defmacro extend-protocol
  "Extends a protocol with implementations for multiple types."
  [proto & specs]
  (let [groups (partition-protocol-specs specs)
        forms (into [] (map (fn [group]
                              (apply list 'extend-type
                                     (first group) proto
                                     (rest group)))
                            groups))]
    (apply list 'do forms)))

internal-reducefunction

Source
(def internal-reduce reduce)

internal-reduce-kvfunction

Source
(def internal-reduce-kv reduce-kv)

^:privatefunction

Source
(def ^:private global-hierarchy
  (atom {:parents {} :ancestors {} :descendants {}}))

^:privatefunction

Source
(def ^:private hierarchy-version (atom 0))

defmultimacro

Defines a multimethod with the given dispatch function.

Source
(defmacro defmulti
  "Defines a multimethod with the given dispatch function."
  [mm-name & options]
  (let [options  (if (string? (first options)) (rest options) options)
        options  (if (map? (first options)) (rest options) options)
        dispatch-fn-form (first options)
        kw-opts  (apply hash-map (rest options))
        default-val (get kw-opts :default :default)
        hierarchy-form (get kw-opts :hierarchy)]
    (list 'def mm-name
          (if (some? hierarchy-form)
            (list 'create-multimethod dispatch-fn-form default-val
                  hierarchy-form)
            (list 'create-multimethod dispatch-fn-form default-val)))))

defmethodmacro

Defines a method for a multimethod.

Source
(defmacro defmethod
  "Defines a method for a multimethod."
  [mm-name dispatch-val & fn-tail]
  (list 'register-method mm-name dispatch-val
        (apply list 'fn fn-tail)))

with-out-strmacro

Evaluates body with *out* bound to a fresh string-collecting atom, and returns the accumulated string.

Source
(defmacro with-out-str
  "Evaluates body with *out* bound to a fresh string-collecting atom,
  and returns the accumulated string."
  [& body]
  `(let [a# (atom "")]
     (binding [*out* a#]
       ~@body)
     (deref a#)))
(with-out-str
(binding [*test-out* *out*]
  (with-test-out (print "routed"))))
"routed"
(with-out-str (pr 42))
"42"
(with-out-str (pr "hello"))
"\"hello\""

with-in-strmacro

Evaluates body with *in* bound to a string-cursor atom holding s. read and read-line consume from the cursor as forms or lines are taken; the body's value is returned.

Source
(defmacro with-in-str
  "Evaluates body with *in* bound to a string-cursor atom holding
  s. read and read-line consume from the cursor as forms or lines
  are taken; the body's value is returned."
  [s & body]
  `(let [a# (atom ~s)]
     (binding [*in* a#]
       ~@body)))
(with-in-str "hello\nworld" (read-line))
"hello"
(with-in-str "a\nb\nc"
[(read-line) (read-line) (read-line) (read-line)])
["a" "b" "c" nil]
(with-in-str "no-newline" (read-line))
"no-newline"

char-escape-stringfunction

Returns escape string for char or nil if none.

Source
(def char-escape-string
  "Returns escape string for char or nil if none."
  {\newline   "\\n"
   \tab       "\\t"
   \return    "\\r"
   \"         "\\\""
   \\         "\\\\"
   \formfeed  "\\f"
   \backspace "\\b"})
(char-escape-string \newline)
"\\n"
(char-escape-string \tab)
"\\t"
(char-escape-string \return)
"\\r"

char-name-stringfunction

Returns name string for char or nil if none.

Source
(def char-name-string
  "Returns name string for char or nil if none."
  {\newline   "newline"
   \tab       "tab"
   \space     "space"
   \backspace "backspace"
   \formfeed  "formfeed"
   \return    "return"
   \delete    "delete"})
(char-name-string \newline)
"newline"
(char-name-string \tab)
"tab"
(char-name-string \space)
"space"

with-openmacro

Binds resources, evaluates body, then closes each resource.

Source
(defmacro with-open
  "Binds resources, evaluates body, then closes each resource."
  [bindings & body]
  (if (empty? bindings)
    `(do ~@body)
    (let [name (first bindings)
          init (nth bindings 1)
          rest-bindings (drop 2 bindings)]
      `(let [~name ~init]
         (try
           (with-open ~(into [] rest-bindings) ~@body)
           (finally (close ~name)))))))

^:privatefunction

Source
(def ^:private prim-into into)

^:dynamicfunction

Source
(def ^:dynamic *clojure-version*
  "The Clojure compatibility version for this runtime, as a map with :major :minor :incremental and :qualifier keys."
  {:major 1 :minor 11 :incremental 0 :qualifier nil})

^:dynamicfunction

Source
(def ^:dynamic *compile-path* nil)

^:dynamicfunction

Source
(def ^:dynamic *source-path*  "NO_SOURCE_PATH")

^:dynamicfunction

Source
(def ^:dynamic *compile-files* false)

^:dynamicfunction

Source
(def ^:dynamic *warn-on-reflection* false)

^:dynamicfunction

Source
(def ^:dynamic *unchecked-math* false)

^:dynamicfunction

Source
(def ^:dynamic *repl*
  "Bound to true in an interactive read-eval-print context, false in
   script execution. Defaults to false."
  false)

assertmacro

Source
(defmacro assert
  ([x] (list 'when-not x (list 'throw "Assert failed")))
  ([x msg] (list 'when-not x (list 'throw msg))))

^:dynamicfunction

Source
(def ^:dynamic *assert*
  "Controls assertion compilation. When false, `assert` is a no-op.
   Defaults to true."
  true)

^:dynamicfunction

Source
(def ^:dynamic *print-length*
  "Maximum number of items printed in a single collection (vector,
   list, map, set, chunk, chunked-cons). nil means no limit (the
   default). The remainder is replaced with `...`. Resolved once per
   top-level pr / prn / print / println / pr-str call; nested
   collections share the same limit."
  nil)

^:dynamicfunction

Source
(def ^:dynamic *print-level*
  "Maximum nesting depth printed. A collection found at depth >= this
   limit is replaced with `#`. nil means no limit (the default).
   Resolved once per top-level pr / print call."
  nil)

^:dynamicfunction

Source
(def ^:dynamic *print-readably*
  "When true (the default), strings are emitted with their quote
   characters and characters with their escape form so the printed
   output round-trips through the reader. When false, strings and
   characters print their underlying bytes — pr/prn behave like
   print/println. Resolved once per top-level pr / print call."
  true)

^:dynamicfunction

Source
(def ^:dynamic *print-meta*
  "When true, every value carrying non-nil metadata is printed with
   its meta map prefixed as `^{...} `. When false (the default), meta
   is silent. Resolved once per top-level pr / print call."
  false)

^:dynamicfunction

Source
(def ^:dynamic *print-dup*
  "When true, the printer emits forms a reader can reconstruct
   exactly. mino's built-in record / collection / scalar prints are
   already reader-roundtrip-compatible, so the flag is currently an
   information channel for user-installed print-method implementations
   that branch on dup vs. non-dup output. Default false."
  false)

^:dynamicfunction

Source
(def ^:dynamic *print-namespace-maps*
  "When true, a map whose keys are keywords (or symbols) sharing a
   common non-empty namespace is printed as `#:ns{:k1 v1, :k2 v2}`
   instead of `{:ns/k1 v1, :ns/k2 v2}`. Default false."
  false)

^:dynamicfunction

Source
(def ^:dynamic *flush-on-newline*
  "When true (the default), the I/O sink behind `*out*` is flushed
   automatically after any write that contains a newline. When false,
   the sink stays buffered so consecutive writes coalesce."
  true)

^:dynamicfunction

Source
(def ^:dynamic *math-context*
  "Precision/rounding-mode for bigdec division. nil means exact-or-
   throw (mirrors java.math.BigDecimal.divide without MathContext).
   When set, the value is a map of {:precision N :rounding-mode K}
   where N is a positive integer and K is one of: :half-up (default),
   :down, :up, :floor, :ceiling, :half-down, :half-even, :unnecessary.
   :unnecessary throws when rounding would change the value (mirrors
   JVM's ArithmeticException). Resolved by mino_bigdec_div on each
   call."
  nil)

^:privatefunction

Source
(def ^:private rounding-symbol->keyword
  ;; JVM RoundingMode enum constants → mino's :keyword surface. Lets
  ;; canonical clojuredocs-shaped examples (which write the mode as a
  ;; bare symbol, e.g. (with-precision 1 :rounding HALF_UP ...)) paste
  ;; through without translation.
  '{UP          :up
    DOWN        :down
    CEILING     :ceiling
    FLOOR       :floor
    HALF_UP     :half-up
    HALF_DOWN   :half-down
    HALF_EVEN   :half-even
    UNNECESSARY :unnecessary})

with-precisionmacro

Sets *math-context* to {:precision precision :rounding-mode mode} around body. The keyword :rounding takes the next form as a rounding-mode keyword (e.g. (with-precision 5 :rounding :half-up (/ 1M 3M))) or as a JVM RoundingMode enum symbol (e.g. HALF_UP, CEILING). Without :rounding, the mode defaults to :half-up.

Source
(defmacro with-precision
  "Sets *math-context* to {:precision precision :rounding-mode mode}
  around body. The keyword :rounding takes the next form as a
  rounding-mode keyword (e.g. (with-precision 5 :rounding :half-up
  (/ 1M 3M))) or as a JVM RoundingMode enum symbol (e.g. HALF_UP,
  CEILING). Without :rounding, the mode defaults to :half-up."
  [precision & body]
  (let [has-rounding? (and (seq body) (= :rounding (first body)))
        raw-mode      (if has-rounding? (second body) :half-up)
        mode          (if (symbol? raw-mode)
                        (or (rounding-symbol->keyword raw-mode)
                            (throw (str "with-precision: unknown rounding mode "
                                        raw-mode
                                        " (expected UP, DOWN, CEILING, FLOOR, "
                                        "HALF_UP, HALF_DOWN, HALF_EVEN, "
                                        "or UNNECESSARY)")))
                        raw-mode)
        actual-body   (if has-rounding? (drop 2 body) body)]
    `(binding [*math-context* {:precision ~precision
                               :rounding-mode ~mode}]
       ~@actual-body)))
(with-precision 5 (/ 1M 3M))
0.33333M
(with-precision 3 (/ 2M 3M))
0.667M
(with-precision 2 (/ 25M 33M))
0.76M

^:privatefunction

Source
(def ^:private special-symbols-set
  '#{& . case* catch def deftype* do finally fn fn* if let let* letfn*
     loop loop* new ns quote recur set! throw try var
     binding lazy-seq})

refer-clojuremacro

Refers public vars from clojure.core into the current namespace, accepting the same filter options as the ns :refer-clojure clause: :exclude, :only, :rename. Exclusions and :only limits are honored by re-applying the ns form on the current namespace, which cuts the clojure.core parent chain and rebuilds the filtered mapping — the same path the (ns ...) special form takes.

Source
(defmacro refer-clojure
  "Refers public vars from clojure.core into the current namespace,
   accepting the same filter options as the ns :refer-clojure clause:
   :exclude, :only, :rename.  Exclusions and :only limits are honored
   by re-applying the ns form on the current namespace, which cuts the
   clojure.core parent chain and rebuilds the filtered mapping — the
   same path the (ns ...) special form takes."
  [& filters]
  (let [clause (list* :refer-clojure filters)]
    `(eval (list 'ns *ns* '~clause))))

let-bitsmacro

Destructure-shaped binding over a bytes value. (let-bits [bytes-val [sym & opts] ...] body...) See documentation in core.clj just above this definition.

Source
(defmacro let-bits
  "Destructure-shaped binding over a bytes value.
   (let-bits [bytes-val [sym & opts] ...] body...)
   See documentation in core.clj just above this definition."
  [bindings & body]
  (when-not (vector? bindings)
    (throw (ex-info "let-bits: first form must be a binding vector"
                    {:got bindings})))
  (let [packet-form (first bindings)
        segments    (rest bindings)
        packet-sym  (gensym "packet__")
        total-sym   (gensym "totalbits__")]
    (loop [segs   segments
           offset 0
           pairs  []]
      (if (empty? segs)
        `(let [~packet-sym ~packet-form
               ~total-sym  (* 8 (count ~packet-sym))
               ~@(mapcat identity pairs)]
           ~@body)
        (let [seg (first segs)]
          (when-not (vector? seg)
            (throw (ex-info "let-bits: each segment must be a vector"
                            {:got seg})))
          (let [sym         (first seg)
                opts        (rest seg)
                opts-map    (apply hash-map opts)
                seg-size    (bits-let-seg-size opts-map)
                type        (or (:type opts-map) :int)
                endian      (:endian opts-map)
                signed?     (:signed? opts-map)
                size-form   (if (= seg-size :rest)
                              `(- ~total-sym ~offset)
                              seg-size)
                next-offset (if (= seg-size :rest)
                              total-sym
                              (+ offset seg-size))
                bg          `(bits-get ~packet-sym
                                       :offset ~offset
                                       :size   ~size-form
                                       :type   ~type
                                       ~@(when endian [:endian endian])
                                       ~@(when (some? signed?) [:signed? signed?]))]
            (recur (rest segs)
                   next-offset
                   (conj pairs [sym bg]))))))))

^:privatefunction

Source
(def ^:private uuid-hex-pattern #"[0-9a-fA-F]+")

with-bindingsmacro

Takes a map of var->value pairs. Installs the bindings, executes body, and pops the bindings in a finally clause.

Source
(defmacro with-bindings
  "Takes a map of var->value pairs. Installs the bindings, executes
   body, and pops the bindings in a finally clause."
  [binding-map & body]
  `(let [vmap# ~binding-map]
     (push-thread-bindings vmap#)
     (try
       ~@body
       (finally
         (pop-thread-bindings)))))

bound-fnmacro

Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called.

Source
(defmacro bound-fn
  "Returns a function defined by the given fntail, which will install
   the same bindings in effect as in the thread at the time bound-fn
   was called."
  [& fntail]
  `(bound-fn* (fn ~@fntail)))

^:privatefunction

Source
(def ^:private tap-fns (atom #{}))

EMPTYfunction

Source
(def EMPTY (-empty-queue))

defrecordmacro

Defines a record type Name with the given fields and optional inline protocol specs. Establishes: Name — the MINO_TYPE value (used by extend-type and instance? as the dispatch key) ->Name — positional constructor: (->Name f1 f2 ...) returns a record value map->Name — map constructor: (map->Name {:f1 v1 :f2 v2}) reads declared fields from the map; non-field keys land in ext. Fields must be a vector of symbols; they are stored as keywords on the type. Specs follow the same shape as extend-type: protocol-name followed by one or more (method [args] body) forms. Inside an inline protocol method body, field names resolve as locals bound to (get this :field) -- matches Clojure's defrecord contract so (defrecord R [a b] IFoo (bar [this] (+ a b))) works without writing (:a this) / (:b this) by hand.

Source
(defmacro defrecord
  "Defines a record type Name with the given fields and optional
   inline protocol specs. Establishes:
     Name       — the MINO_TYPE value (used by extend-type and
                  instance? as the dispatch key)
     ->Name     — positional constructor: (->Name f1 f2 ...) returns
                  a record value
     map->Name  — map constructor: (map->Name {:f1 v1 :f2 v2}) reads
                  declared fields from the map; non-field keys land
                  in ext.

   Fields must be a vector of symbols; they are stored as keywords
   on the type. Specs follow the same shape as extend-type:
   protocol-name followed by one or more (method [args] body) forms.

   Inside an inline protocol method body, field names resolve as
   locals bound to (get this :field) -- matches Clojure's defrecord
   contract so (defrecord R [a b] IFoo (bar [this] (+ a b))) works
   without writing (:a this) / (:b this) by hand."
  [name fields & specs]
  (when-not (vector? fields)
    (throw (str "defrecord: fields must be a vector, got: "
                (pr-str fields))))
  (let [ns-str     (str (ns-name *ns*))
        name-str   (str name)
        ctor       (symbol (str "->" name))
        map-ctor   (symbol (str "map->" name))
        field-kws  (mapv (fn [f] (keyword (str f))) fields)
        bind-meth  (fn [m] (defrecord-bind-fields-in-method fields m))
        wrap-spec  (fn [s]
                     (if (and (or (list? s) (cons? s))
                              (seq s)
                              (symbol? (first s)))
                       (bind-meth s)
                       s))
        specs*     (mapv wrap-spec specs)
        forms      [(list 'def name (list 'defrecord* ns-str name-str field-kws))
                    (list 'defn ctor fields
                          (list 'record* name (vec fields)))
                    (list 'defn map-ctor ['m]
                          (list 'record-from-map name 'm))]]
    (apply list 'do (if (seq specs*)
                      (conj forms (apply list 'extend-type name specs*))
                      forms))))

deftypemacro

Alias for defrecord. mino has no separate JVM-class layer to expose, so the deftype/defrecord distinction collapses; values created either way are real types with map-isomorphic behaviour.

Source
(defmacro deftype
  "Alias for defrecord. mino has no separate JVM-class layer to
   expose, so the deftype/defrecord distinction collapses; values
   created either way are real types with map-isomorphic behaviour."
  [name fields & specs]
  (when-not (vector? fields)
    (throw (str "deftype: fields must be a vector, got: "
                (pr-str fields))))
  (apply list 'defrecord name fields specs))

reifymacro

Returns an instance of a fresh anonymous record type that satisfies the named protocols. Each reify form generates one type at expansion time; repeated invocations of the form share that type, so (= (type r1) (type r2)) is true for two values produced by the same reify form.

Source
(defmacro reify
  "Returns an instance of a fresh anonymous record type that
   satisfies the named protocols. Each reify form generates one
   type at expansion time; repeated invocations of the form share
   that type, so (= (type r1) (type r2)) is true for two values
   produced by the same reify form."
  [& specs]
  (let [ns-str   (str (ns-name *ns*))
        sym      (gensym "reify_T_")
        name-str (str sym)
        T        (gensym "T")]
    (list 'let [T (list 'defrecord* ns-str name-str [])]
          (apply list 'extend-type T specs)
          (list 'record* T []))))

proxymacro

Source
(defmacro proxy [& _]
  (throw (ex-info
           "proxy is not supported on mino — there is no JVM to subclass"
           {:mino/unsupported :proxy})))

gen-classmacro

Source
(defmacro gen-class [& _]
  (throw (ex-info
           (str "gen-class is not supported on mino — there is no"
                " JVM to compile against")
           {:mino/unsupported :gen-class})))

definterfacemacro

Source
(defmacro definterface [& _]
  (throw (ex-info
           (str "definterface is not supported on mino — use"
                " defprotocol instead")
           {:mino/unsupported :definterface})))

importmacro

Source
(defmacro import [& _]
  (throw (ex-info
           (str "Java import is not supported on mino — there are no"
                " Java classes to import")
           {:mino/unsupported :import})))
(eval (read-string "(do (ns-unmap *ns* 'Object) (def o1 (resolve 'Object)) (import '[java.lang Object]) (def o2 (resolve 'Object)) [(some? o1) (some? o2)])"))
[false true]

with-redefsmacro

Temporarily rebinds the root bindings of vars while body executes, restoring them in a finally clause. Bindings is a vector of var-name/value pairs. The temp-value exprs are evaluated in parallel BEFORE any rebind fires, so a later binding-value that names an earlier-listed var sees that var's pre-redef value (matching Clojure JVM).

Source
(defmacro with-redefs
  "Temporarily rebinds the root bindings of vars while body executes, restoring
   them in a finally clause. Bindings is a vector of var-name/value pairs.

   The temp-value exprs are evaluated in parallel BEFORE any rebind fires, so a
   later binding-value that names an earlier-listed var sees that var's
   pre-redef value (matching Clojure JVM)."
  [bindings & body]
  (let [pairs    (partition 2 bindings)
        var-syms (map first pairs)
        new-vals (map second pairs)
        olds     (map (fn [_] (gensym "old")) pairs)
        news     (map (fn [_] (gensym "new")) pairs)
        sets     (map (fn [v new-sym]
                        (list 'alter-var-root (list 'var v)
                              (list 'fn ['_] new-sym)))
                      var-syms news)
        restores (map (fn [v old]
                        (list 'alter-var-root (list 'var v)
                              (list 'fn ['_] old)))
                      var-syms olds)
        finally-form (apply list 'finally restores)
        try-form     (apply list 'try (concat sets body (list finally-form)))]
    (list 'let
          (vec (concat
                 (mapcat (fn [old v] [old (list 'deref (list 'var v))])
                         olds var-syms)
                 (mapcat (fn [new-sym new-val] [new-sym new-val])
                         news new-vals)))
          try-form)))

with-local-varsmacro

Binds names to fresh, lexically-scoped vars holding init values. Within body the names refer to vars: read with @name, mutate with (var-set name val). The vars are interned in the current namespace under gensym'd suffixes so they don't collide with named defs.

Source
(defmacro with-local-vars
  "Binds names to fresh, lexically-scoped vars holding init values.
   Within body the names refer to vars: read with @name, mutate with
   (var-set name val). The vars are interned in the current namespace
   under gensym'd suffixes so they don't collide with named defs."
  [bindings & body]
  (let [pairs (partition 2 bindings)
        let-pairs (mapcat (fn [pair]
                            (let [n    (first pair)
                                  init (first (rest pair))]
                              [n (list 'intern '*ns*
                                       (list 'gensym (str (name n) "__lv__"))
                                       init)]))
                          pairs)]
    (apply list 'let (vec let-pairs) body)))

I/O primitives

Available only when the host installs MINO_CAP_IO (via mino_install(S, env, MINO_CAP_IO | ...)). Not present in sandboxed environments.

core.async

CSP channels and go blocks. Available after (require '[clojure.core.async :as a]).

^:privatedef

Source
(def ^:private BUF-KIND-NONE     0)

^:privatedef

Source
(def ^:private BUF-KIND-FIXED    1)

^:privatedef

Source
(def ^:private BUF-KIND-DROPPING 2)

^:privatedef

Source
(def ^:private BUF-KIND-SLIDING  3)

^:privatedef

Source
(def ^:private BUF-KIND-PROMISE  4)

bufferfn

Fixed-size buffer descriptor. Pairs with chan.

Source
(defn buffer
  "Fixed-size buffer descriptor. Pairs with chan."
  [n]
  {:kind :buf :buf-kind :fixed :capacity n})

dropping-bufferfn

Dropping buffer descriptor. New values are silently dropped once full.

Source
(defn dropping-buffer
  "Dropping buffer descriptor. New values are silently dropped once full."
  [n]
  {:kind :buf :buf-kind :dropping :capacity n})

sliding-bufferfn

Sliding buffer descriptor. Oldest value is evicted when full.

Source
(defn sliding-buffer
  "Sliding buffer descriptor. Oldest value is evicted when full."
  [n]
  {:kind :buf :buf-kind :sliding :capacity n})

chanfn

Source
(defn chan
  "Create a channel.
     ()                           -- unbuffered
     (buf-or-n)                   -- buffered (int or buffer descriptor)
     (buf-or-n xform)             -- buffered with a transducer
     (buf-or-n xform ex-handler)  -- also with an exception handler"
  ([] (chan nil nil nil))
  ([buf-or-n] (chan buf-or-n nil nil))
  ([buf-or-n xform] (chan buf-or-n xform nil))
  ([buf-or-n xform ex-handler]
   (let [[kind cap]
         (cond
           (nil? buf-or-n)                       [BUF-KIND-NONE 0]
           (and (integer? buf-or-n)
                (zero? buf-or-n))                [BUF-KIND-NONE 0]
           (integer? buf-or-n)                   [BUF-KIND-FIXED buf-or-n]
           (buffer? buf-or-n)                    [(buf-kind->int (:buf-kind buf-or-n))
                                                  (:capacity buf-or-n)]
           :else
           (throw (str "chan: buffer-or-n must be nil, a non-negative "
                       "integer, or a buffer")))
         ch (chan-new kind cap nil nil)]
     (when xform
       ;; Wrap the user xform around an `add-fn` reducing step whose
       ;; effect is to push outputs into the channel's buffer.
       (let [add-fn (fn
                      ([result] result)
                      ([result input]
                       (chan-buf-add ch input)
                       result))
             rf     (xform add-fn)]
         (chan-set-xform ch rf ex-handler)))
     ch)))

promise-chanfn

Create a promise channel. The first value latches; all takers see it.

Source
(defn promise-chan
  "Create a promise channel. The first value latches; all takers see it."
  ([] (promise-chan nil nil))
  ([xform] (promise-chan xform nil))
  ([xform ex-handler]
   (let [ch (chan-new BUF-KIND-PROMISE 1 nil nil)]
     (when xform
       (let [add-fn (fn
                      ([result] result)
                      ([result input]
                       (chan-buf-add ch input)
                       result))
             rf     (xform add-fn)]
         (chan-set-xform ch rf ex-handler)))
     ch)))

closed?fn

True if the channel is closed.

Source
(defn closed?
  "True if the channel is closed."
  [ch]
  (chan-closed? ch))

offer!fn

Put val on ch if immediately possible. Returns true/false. Never enqueues as pending.

Source
(defn offer!
  "Put val on ch if immediately possible. Returns true/false. Never
   enqueues as pending."
  [ch val]
  (when (nil? val)
    (throw "cannot put nil on a channel"))
  (cond
    (chan-closed? ch)
    false

    (chan-get-xform ch)
    (do (run-xform-step! ch val) true)

    :else
    (chan-offer ch val)))

poll!fn

Take from ch if immediately available. Returns the value or nil.

Source
(defn poll!
  "Take from ch if immediately available. Returns the value or nil."
  [ch]
  (chan-poll ch))

put!fn

Source
(defn put!
  "Asynchronously put val on ch. Optional cb receives true (delivered) or
   false (channel closed). Returns nil."
  ([ch val] (put! ch val nil))
  ([ch val cb]
   (when (nil? val)
     (throw "cannot put nil on a channel"))
   (cond
     (chan-closed? ch)
     (do (when cb (async-sched-enqueue* cb false)) nil)

     (chan-get-xform ch)
     (do (run-xform-step! ch val)
         (when cb (async-sched-enqueue* cb (if (chan-closed? ch) false true)))
         nil)

     :else
     (do (chan-put ch val cb) nil))))

take!fn

Asynchronously take from ch. cb receives the value, or nil if ch is closed and empty. Returns nil.

Source
(defn take!
  "Asynchronously take from ch. cb receives the value, or nil if ch is
   closed and empty. Returns nil."
  [ch cb]
  (chan-take ch cb)
  nil)

close!fn

Close the channel. Pending takers receive nil; pending putters false. Buffered values still flow to waiting takers.

Source
(defn close!
  "Close the channel. Pending takers receive nil; pending putters false.
   Buffered values still flow to waiting takers."
  [ch]
  (when-not (chan-closed? ch)
    ;; If the channel has a transducer, run its completion arity to
    ;; flush any held state into the buffer before closing.
    (when-let [rf (chan-get-xform ch)]
      (try (rf nil) (catch _ nil))
      (chan-flush-buf-to-takers ch))
    (chan-close ch)
    ;; Drain wake-callbacks the close pushed onto the scheduler so
    ;; blocking <!! / >!! callers see the resolution before any other
    ;; producer's wake has a chance to leave them parked.
    (drain!))
  nil)

chan?fn

True if x is a channel.

Source
(defn chan?
  "True if x is a channel."
  [x]
  (chan-instance? x))

alts!fn

Source
(defn alts!
  "Atomically complete one of several channel operations.
   ops is a vector. Each element is either a channel (take) or
   [ch val] (put). opts (kwargs or a single map):
     :priority true  -- try in order (no shuffle)
     :default val    -- return [val :default] if no op is ready
   Returns [result channel]."
  [ops & opts]
  (let [opts-m (alts-opts-map opts)
        result (atom nil)
        cb     (fn [r] (reset! result r))]
    (alts-start ops opts-m cb)
    (drain!)
    @result))

alts-callbackfn

Source
(defn alts-callback
  "Callback-style alts matching the old C alts* contract. cb fires with
   [val ch]. If an op completes immediately, cb is scheduled; otherwise
   ops register pending on a shared flag and cb fires when one wins.
   Returns 1 (matches the old C contract)."
  [ops opts cb]
  (alts-start ops opts cb)
  1)

alt!macro

Source
(defmacro alt!
  "Sugar for alts! plus a cond over which clause completed. See the
  alts! docstring for the underlying contract.

  Each pair: `(channel-or-vec result)` or `:default expr` or
  `:priority bool`. Result may be:
    - a plain expression
    - `([v] body...)` to bind the value
    - `([v c] body...)` to bind value and channel

  Returns the result expression for the winning clause, or the
  :default expression when no port was ready (and :default was given)."
  [& clauses]
  (let [pairs       (partition 2 clauses)
        priority?   (some (fn [[k _]] (= k :priority)) pairs)
        priority-v  (when priority? (second (first (filter #(= :priority (first %)) pairs))))
        default?    (some (fn [[k _]] (= k :default)) pairs)
        default-expr (when default? (second (first (filter #(= :default (first %)) pairs))))
        port-pairs  (remove (fn [[k _]] (or (= k :priority) (= k :default))) pairs)
        port-vec    (vec (map first port-pairs))
        rsym (gensym "alt-result-")
        vsym (gensym "alt-val-")
        csym (gensym "alt-ch-")
        bind-result (fn [clause]
                      (if (and (seq? clause) (vector? (first clause)))
                        (let [bvec (first clause)
                              body (rest clause)]
                          (cond
                            (= 1 (count bvec))
                            `(let [~(first bvec) ~vsym] ~@body)
                            (= 2 (count bvec))
                            `(let [~(first bvec) ~vsym
                                   ~(second bvec) ~csym] ~@body)
                            :else clause))
                        clause))
        cond-clauses
        (mapcat (fn [[op result]]
                  (let [port (if (vector? op) (first op) op)]
                    [`(identical? ~csym ~port) (bind-result result)]))
                port-pairs)
        opts (concat (when priority? [:priority priority-v])
                     (when default? [:default :alt!-default-fired]))]
    `(let [~rsym (alts! ~port-vec ~@opts)
           ~vsym (first ~rsym)
           ~csym (second ~rsym)]
       (cond ~@cond-clauses
             ~@(when default?
                 [`(identical? ~csym :default) default-expr])
             :else nil))))

>!macro

Source
(defmacro >!
  "puts a val into port. nil values are not allowed. Must be called
   inside a (go ...) block. Will park if no buffer space available."
  [_port _val]
  `(throw "(>! port val) used not in (go ...) block"))

<!macro

Source
(defmacro <!
  "takes a val from port. Must be called inside a (go ...) block.
   Will park if nothing is available."
  [_port]
  `(throw "(<! port) used not in (go ...) block"))

timeoutfn

Returns a channel that closes after ms milliseconds.

Source
(defn timeout
  "Returns a channel that closes after ms milliseconds."
  [ms]
  (let [ch (chan)]
    (async-schedule-timer* ms (fn [_] (close! ch)))
    ch))

gomacro

Asynchronously executes the body in a lightweight state machine. Returns a channel which will receive the result of the body when it completes. <! and >! are parking operations that suspend the go block until the channel operation completes.

Source
(defmacro go
  "Asynchronously executes the body in a lightweight state machine.
   Returns a channel which will receive the result of the body
   when it completes. <! and >! are parking operations that
   suspend the go block until the channel operation completes."
  [& body]
  (let [result-ch-sym (gensym "go_result_")
        machine-sym   (gensym "go_fn_")
        expanded      (go-expand-if (cons 'do body))
        states        (go-transform expanded result-ch-sym)]
    `(let [~result-ch-sym (chan* (buf-fixed* 1))
           ~machine-sym   ~(go-emit-machine states result-ch-sym)]
       (~machine-sym 0 nil)
       ~result-ch-sym)))

go-loopmacro

Source
(defmacro go-loop
  "Like (go (loop bindings body...))."
  [bindings & body]
  `(go (loop ~bindings ~@(seq body))))

<!!fn

Source
(defn <!!
  "Blocking take from a channel. When host threads are granted, parks
   the calling thread until a value is available (or the channel
   closes). Without threads, drains the scheduler in a loop and throws
   if no progress can be made. Returns the taken value (nil if closed)."
  [ch]
  (let [p (promise)]
    (take! ch (fn [v] (deliver p [v])))
    (drain!)
    (cond
      (realized? p)
      (first @p)

      (> (mino-thread-limit) 1)
      (first (block-on p))

      :else
      (if (drain-loop! (fn [] (realized? p)))
        (first @p)
        (throw "<!!: would deadlock -- no producer for this channel")))))

>!!fn

Blocking put onto a channel. When host threads are granted, parks the calling thread until the put completes. Without threads, drains the scheduler in a loop and throws if no progress can be made. Returns true if successful, false if the channel is closed.

Source
(defn >!!
  "Blocking put onto a channel. When host threads are granted, parks
   the calling thread until the put completes. Without threads, drains
   the scheduler in a loop and throws if no progress can be made.
   Returns true if successful, false if the channel is closed."
  [ch val]
  (let [p (promise)]
    (put! ch val (fn [v] (deliver p [v])))
    (drain!)
    (cond
      (realized? p)
      (first @p)

      (> (mino-thread-limit) 1)
      (first (block-on p))

      :else
      (if (drain-loop! (fn [] (realized? p)))
        (first @p)
        (throw ">!!: would deadlock -- no consumer for this channel")))))

alts!!fn

Blocking version of alts!. When host threads are granted, parks the calling thread until one operation completes. Without threads, drains the scheduler in a loop and throws on no progress. Returns [val ch].

Source
(defn alts!!
  "Blocking version of alts!. When host threads are granted, parks the
   calling thread until one operation completes. Without threads,
   drains the scheduler in a loop and throws on no progress.
   Returns [val ch]."
  ([ops] (alts!! ops {}))
  ([ops opts]
   (let [p (promise)]
     (alts* ops opts (fn [v] (deliver p [v])))
     (drain!)
     (cond
       (realized? p)
       (first @p)

       (> (mino-thread-limit) 1)
       (first (block-on p))

       :else
       (if (drain-loop! (fn [] (realized? p)))
         (first @p)
         (throw "alts!!: would deadlock -- no operations can complete"))))))

pipefn

Source
(defn pipe
  "Takes elements from the from channel and puts them on the to channel.
   Closes the to channel when from is exhausted (unless close? is false).
   Returns the to channel."
  ([from to] (pipe from to true))
  ([from to close?]
   (let [do-pipe (fn do-pipe [v]
                   (if (nil? v)
                     (when close? (close! to))
                     (do (put! to v)
                         (take! from do-pipe))))]
     (take! from do-pipe))
   to))

onto-chan!fn

Source
(defn onto-chan!
  "Puts each element of coll onto the channel ch, then closes ch
   (unless close? is false). Returns ch."
  ([ch coll] (onto-chan! ch coll true))
  ([ch coll close?]
   (doseq [v coll]
     (put! ch v))
   (when close? (close! ch))
   ch))

to-chan!fn

Creates and returns a channel that receives all elements of coll, then closes.

Source
(defn to-chan!
  "Creates and returns a channel that receives all elements of coll,
   then closes."
  [coll]
  (let [ch (chan (count coll))]
    (onto-chan! ch coll)))

intofn

Returns a channel containing the single result of reducing all values from ch into init using conj.

Source
(defn into
  "Returns a channel containing the single result of reducing
   all values from ch into init using conj."
  [init ch]
  (let [result-ch (chan 1)
        acc       (atom init)
        do-take   (fn do-take [v]
                    (if (nil? v)
                      (do (put! result-ch @acc)
                          (close! result-ch))
                      (do (swap! acc conj v)
                          (take! ch do-take))))]
    (take! ch do-take)
    result-ch))

mergefn

Takes a collection of source channels and returns a channel that contains all values from all source channels. Closes when all source channels are closed.

Source
(defn merge
  "Takes a collection of source channels and returns a channel that
   contains all values from all source channels. Closes when all
   source channels are closed."
  ([chs] (merge chs nil))
  ([chs buf-or-n]
   (let [out       (if buf-or-n (chan buf-or-n) (chan))
         remaining (atom (count chs))]
     (if (= 0 (count chs))
       (close! out)
       (doseq [ch chs]
         (let [do-take (fn do-take [v]
                         (if (nil? v)
                           (when (= 0 (swap! remaining dec))
                             (close! out))
                           (do (put! out v)
                               (take! ch do-take))))]
           (take! ch do-take))))
     out)))

reducefn

Asynchronously reduces ch with f, starting from init. Returns a channel that yields the final accumulated value when ch closes. Behaves like clojure.core/reduce but without the 2-arg form: in a channel context the seeded form is the only one that makes sense.

Source
(defn reduce
  "Asynchronously reduces ch with f, starting from init. Returns a
   channel that yields the final accumulated value when ch closes.
   Behaves like clojure.core/reduce but without the 2-arg form: in a
   channel context the seeded form is the only one that makes sense."
  [f init ch]
  (let [result-ch (chan 1)
        acc       (atom init)
        do-take   (fn do-take [v]
                    (cond
                      (nil? v)
                      (do (put! result-ch @acc)
                          (close! result-ch))

                      (reduced? @acc)
                      (do (put! result-ch (deref @acc))
                          (close! result-ch))

                      :else
                      (do (swap! acc f v)
                          (if (reduced? @acc)
                            (do (put! result-ch (deref @acc))
                                (close! result-ch))
                            (take! ch do-take)))))]
    (take! ch do-take)
    result-ch))

transducefn

Asynchronously reduces ch with the transducer xform applied to f, starting from init. Returns a channel that yields the result of the completing arity of the transducing reducer.

Source
(defn transduce
  "Asynchronously reduces ch with the transducer xform applied to f,
   starting from init. Returns a channel that yields the result of
   the completing arity of the transducing reducer."
  [xform f init ch]
  (let [xf        (xform f)
        result-ch (chan 1)
        acc       (atom init)
        finish    (fn finish []
                    (let [final (xf @acc)]
                      (put! result-ch final)
                      (close! result-ch)))
        do-take   (fn do-take [v]
                    (if (nil? v)
                      (finish)
                      (let [next-acc (xf @acc v)]
                        (reset! acc next-acc)
                        (if (reduced? next-acc)
                          (do (reset! acc (deref next-acc))
                              (finish))
                          (take! ch do-take)))))]
    (take! ch do-take)
    result-ch))

splitfn

Source
(defn split
  "Splits ch into two channels by predicate p. Values for which (p v)
   is truthy go to the first channel; the rest go to the second.
   Returns a vector [t-ch f-ch]. Both channels close when ch closes.
   Optional t-buf and f-buf set buffer sizes (or buffer instances)."
  ([p ch] (split p ch nil nil))
  ([p ch t-buf f-buf]
   (let [t-ch    (if t-buf (chan t-buf) (chan))
         f-ch    (if f-buf (chan f-buf) (chan))
         do-take (fn do-take [v]
                   (if (nil? v)
                     (do (close! t-ch)
                         (close! f-ch))
                     (let [out (if (p v) t-ch f-ch)]
                       (put! out v)
                       (take! ch do-take))))]
     (take! ch do-take)
     [t-ch f-ch])))

partition-byfn

Source
(defn partition-by
  "Returns a channel of vectors of consecutive items from ch with the
   same (f item). Closes when ch closes; flushes the in-progress
   partition before closing."
  ([f ch] (partition-by f ch nil))
  ([f ch buf-or-n]
   (let [out      (if buf-or-n (chan buf-or-n) (chan))
         current  (atom [])
         last-key (atom ::none)
         flush!   (fn []
                    (when (seq @current)
                      (put! out @current)
                      (reset! current [])))
         do-take  (fn do-take [v]
                    (if (nil? v)
                      (do (flush!)
                          (close! out))
                      (let [k (f v)]
                        (if (or (= ::none @last-key) (= k @last-key))
                          (do (swap! current conj v)
                              (reset! last-key k)
                              (take! ch do-take))
                          (do (flush!)
                              (swap! current conj v)
                              (reset! last-key k)
                              (take! ch do-take))))))]
     (take! ch do-take)
     out)))

multfn

Source
(defn mult
  "Creates a mult on source channel ch. Values taken from ch are
   distributed to all tapped channels. Returns a mult handle (map)."
  [ch]
  (let [taps   (atom #{})
        m      {:ch ch :taps taps}
        do-take (fn do-take [v]
                  (if (nil? v)
                    (doseq [t @taps]
                      (close! t))
                    (do (doseq [t @taps]
                          (put! t v))
                        (take! ch do-take))))]
    (take! ch do-take)
    m))

tapfn

Registers channel ch as a tap on mult m. Returns ch.

Source
(defn tap
  "Registers channel ch as a tap on mult m. Returns ch."
  ([m ch] (tap m ch true))
  ([m ch close?]
   (swap! (:taps m) conj ch)
   ch))

untapfn

Unregisters channel ch from mult m.

Source
(defn untap
  "Unregisters channel ch from mult m."
  [m ch]
  (swap! (:taps m) disj ch)
  nil)

pubfn

Source
(defn pub
  "Creates a pub on source channel ch with a topic-fn that extracts
   the topic from each value. Returns a pub handle (map)."
  [ch topic-fn]
  (let [subs    (atom {})
        p       {:ch ch :topic-fn topic-fn :subs subs}
        do-take (fn do-take [v]
                  (if (nil? v)
                    (doseq [[_ chs] @subs]
                      (doseq [c chs]
                        (close! c)))
                    (let [topic (topic-fn v)
                          chs   (get @subs topic)]
                      (when chs
                        (doseq [c chs]
                          (put! c v)))
                      (take! ch do-take))))]
    (take! ch do-take)
    p))

subfn

Subscribes channel ch to topic on pub p. Returns ch.

Source
(defn sub
  "Subscribes channel ch to topic on pub p. Returns ch."
  ([p topic ch] (sub p topic ch true))
  ([p topic ch close?]
   (swap! (:subs p) update topic
     (fn [chs] (conj (or chs #{}) ch)))
   ch))

unsubfn

Unsubscribes channel ch from topic on pub p.

Source
(defn unsub
  "Unsubscribes channel ch from topic on pub p."
  [p topic ch]
  (swap! (:subs p) update topic
    (fn [chs] (disj (or chs #{}) ch)))
  nil)

unsub-allfn

Unsubscribes all channels from pub p, or all channels from a specific topic if provided.

Source
(defn unsub-all
  "Unsubscribes all channels from pub p, or all channels from a
   specific topic if provided."
  ([p] (reset! (:subs p) {}) nil)
  ([p topic]
   (swap! (:subs p) dissoc topic)
   nil))

mixfn

Source
(defn mix
  "Creates a mix on the output channel out. Multiple input channels can
   be added with admix. Each input channel can have modes:
   :solo, :mute, :pause (all default false).
   solo-mode controls what happens to non-soloed channels: :mute or :pause."
  [out]
  {:out out
   :state (atom {:channels {} :solo-mode :mute})})

admixfn

Adds ch as an input to the mix. Starts reading from it. Always reads from the channel while it is in the mix; paused/muted values are consumed but not forwarded.

Source
(defn admix
  "Adds ch as an input to the mix. Starts reading from it.
   Always reads from the channel while it is in the mix; paused/muted
   values are consumed but not forwarded."
  [m ch]
  (swap! (:state m) update :channels assoc ch
         {:solo false :mute false :pause false})
  (let [do-read (fn do-read [v]
                  (let [s @(:state m)]
                    (if (nil? v)
                      ;; Channel closed: remove from mix
                      (swap! (:state m) update :channels dissoc ch)
                      (do
                        (when (mix-should-pass? s ch)
                          (put! (:out m) v))
                        ;; Continue reading while still in mix
                        (when (get (:channels @(:state m)) ch)
                          (take! ch do-read))))))]
    (take! ch do-read))
  nil)

unmixfn

Removes ch from the mix.

Source
(defn unmix
  "Removes ch from the mix."
  [m ch]
  (swap! (:state m) update :channels dissoc ch)
  nil)

unmix-allfn

Removes all inputs from the mix.

Source
(defn unmix-all
  "Removes all inputs from the mix."
  [m]
  (swap! (:state m) assoc :channels {})
  nil)

togglefn

Sets modes on channels in the mix. state-map is {ch {:solo bool :mute bool :pause bool}}.

Source
(defn toggle
  "Sets modes on channels in the mix.
   state-map is {ch {:solo bool :mute bool :pause bool}}."
  [m state-map]
  (doseq [entry state-map]
    (let [ch    (key entry)
          modes (val entry)]
      (swap! (:state m) update :channels
        (fn [channels]
          (if (get channels ch)
            (update channels ch (fn [old] (clojure.core/into old modes)))
            channels)))))
  nil)

solo-modefn

Sets the solo mode for the mix. mode is :mute or :pause.

Source
(defn solo-mode
  "Sets the solo mode for the mix. mode is :mute or :pause."
  [m mode]
  (swap! (:state m) assoc :solo-mode mode)
  nil)

pipelinefn

Source
(defn pipeline
  "Takes items from the from channel, applies xf to each (using n
   parallel go blocks), and puts results on the to channel.
   Closes to when from is exhausted (unless close? is false).
   Preserves input ordering regardless of worker completion order.

   ex-handler, when supplied, is invoked with any exception thrown by
   xf; its return value is used as the replacement output (nil drops)."
  ([n to xf from] (pipeline n to xf from true nil))
  ([n to xf from close?] (pipeline n to xf from close? nil))
  ([n to xf from close? ex-handler]
   (let [jobs    (chan n)
         results (chan n)
         done    (atom 0)
         apply-xf (fn [v]
                    (if ex-handler
                      (try (xf v)
                           (catch e (ex-handler e)))
                      (xf v)))]
     ;; Feed: for each input, create a result channel, send [val res-ch]
     ;; to workers, and send res-ch to collector (in order).
     ;; Uses callbacks to wait for puts, preventing stalls when channels fill.
     (let [feeder (fn feeder [v]
                    (if (nil? v)
                      (close! jobs)
                      (let [res-ch (chan 1)]
                        (put! jobs [v res-ch]
                          (fn [_] (put! results res-ch
                                    (fn [_] (take! from feeder))))))))]
       (take! from feeder))
     ;; Workers: take [val res-ch], apply xf, put result on res-ch
     (dotimes [_ n]
       (let [worker (fn worker [job]
                      (if (nil? job)
                        (when (= n (swap! done inc))
                          (close! results))
                        (let [v      (first job)
                              res-ch (second job)
                              out    (apply-xf v)]
                          (when (some? out)
                            (put! res-ch out))
                          (close! res-ch)
                          (take! jobs worker))))]
         (take! jobs worker)))
     ;; Collector: take res-chs in order, drain each to output
     (let [collector (fn collector [res-ch]
                       (if (nil? res-ch)
                         (when close? (close! to))
                         (let [drain (fn drain [v]
                                       (if (nil? v)
                                         (take! results collector)
                                         (do (put! to v)
                                             (take! res-ch drain))))]
                           (take! res-ch drain))))]
       (take! results collector))
     to)))

pipeline-asyncfn

Like pipeline, but af is an async function that takes [val result-ch]. af should put results on result-ch and close it when done. Preserves input ordering regardless of worker completion order.

Source
(defn pipeline-async
  "Like pipeline, but af is an async function that takes [val result-ch].
   af should put results on result-ch and close it when done.
   Preserves input ordering regardless of worker completion order."
  ([n to af from] (pipeline-async n to af from true))
  ([n to af from close?]
   (let [jobs    (chan n)
         results (chan n)
         done    (atom 0)]
     ;; Feed: for each input, create a result channel, send [val res-ch]
     ;; to workers, and send res-ch to collector (in order).
     ;; Uses callbacks to wait for puts, preventing stalls when channels fill.
     (let [feeder (fn feeder [v]
                    (if (nil? v)
                      (close! jobs)
                      (let [res-ch (chan 1)]
                        (put! jobs [v res-ch]
                          (fn [_] (put! results res-ch
                                    (fn [_] (take! from feeder))))))))]
       (take! from feeder))
     ;; Workers: take [val res-ch], call af which puts results on res-ch
     (dotimes [_ n]
       (let [worker (fn worker [job]
                      (if (nil? job)
                        (when (= n (swap! done inc))
                          (close! results))
                        (let [v      (first job)
                              res-ch (second job)]
                          (af v res-ch)
                          (take! jobs worker))))]
         (take! jobs worker)))
     ;; Collector: take res-chs in order, drain each to output
     (let [collector (fn collector [res-ch]
                       (if (nil? res-ch)
                         (when close? (close! to))
                         (let [drain (fn drain [v]
                                       (if (nil? v)
                                         (take! results collector)
                                         (do (put! to v)
                                             (take! res-ch drain))))]
                           (take! res-ch drain))))]
       (take! results collector))
     to)))

pipeline-blockingdef

Source
(def pipeline-blocking pipeline)