API for clojure.core - Clojure v1.1 (legacy)


Full namespace name: clojure.core

Overview

Fundamental library of the Clojure language

Public Variables and Functions



&

special syntax

    
Syntax for use with fn.

Please see https://clojure.org/reference/special_forms#fn

    Added in Clojure version 1.0


*

function
Usage: (*)
       (* x)
       (* x y)
       (* x y & more)
Returns the product of nums. (*) returns 1.

    
    
    Source
  


*1

var

    
bound in a repl thread to the most recent value printed

    
    
    Source
  


*2

var

    
bound in a repl thread to the second most recent value printed

    
    
    Source
  


*3

var

    
bound in a repl thread to the third most recent value printed

    
    
    Source
  


*agent*

var

    
The agent currently running an action on this thread, else nil

    
    
    
  


*clojure-version*

var

    
The version info for Clojure core, as a map containing :major :minor 
:incremental and :qualifier keys. Feature releases may increment 
:minor and/or :major, bugfix releases will increment :incremental. 
Possible values of :qualifier include "GA", "SNAPSHOT", "RC-x" "BETA-x"

    
    
    Source
  


*command-line-args*

var

    
A sequence of the supplied command line arguments, or nil if
none were supplied

    
    
    
  


*compile-files*

var

    
Set to true when compiling files, false otherwise.

    
    
    
  


*compile-path*

var

    
Specifies the directory where 'compile' will write out .class
files. This directory must be in the classpath for 'compile' to
work.

Defaults to "classes"

    
    
    
  


*e

var

    
bound in a repl thread to the most recent exception caught by the repl

    
    
    Source
  


*err*

var

    
A java.io.Writer object representing standard error for print operations.

Defaults to System/err, wrapped in a PrintWriter

    
    
    
  


*file*

var

    
The path of the file being evaluated, as a String.

Evaluates to nil when there is no file, eg. in the REPL.

    
    
    
  


*flush-on-newline*

var

    
When set to true, output will be flushed whenever a newline is printed.

Defaults to true.

    
    
    
  


*in*

var

    
A java.io.Reader object representing standard input for read operations.

Defaults to System/in, wrapped in a LineNumberingPushbackReader

    
    
    
  


*ns*

var

    
A clojure.lang.Namespace object representing the current namespace.

    
    
    
  


*out*

var

    
A java.io.Writer object representing standard output for print operations.

Defaults to System/out

    
    
    
  


*print-dup*

var

    
When set to logical true, objects will be printed in a way that preserves
their type when read in later.

Defaults to false.

    
    
    
  


*print-length*

var

    
*print-length* controls how many items of each collection the
printer will print. If it is bound to logical false, there is no
limit. Otherwise, it must be bound to an integer indicating the maximum
number of items of each collection to print. If a collection contains
more items, the printer will print items up to the limit followed by
'...' to represent the remaining items. The root binding is nil
indicating no limit.

    
    
    Source
  


*print-level*

var

    
*print-level* controls how many levels deep the printer will
print nested objects. If it is bound to logical false, there is no
limit. Otherwise, it must be bound to an integer indicating the maximum
level to print. Each argument to print is at level 0; if an argument is a
collection, its items are at level 1; and so on. If an object is a
collection and is at a level greater than or equal to the value bound to
*print-level*, the printer prints '#' to represent it. The root binding
is nil indicating no limit.

    
    
    Source
  


*print-meta*

var

    
If set to logical true, when printing an object, its metadata will also
be printed in a form that can be read back by the reader.

Defaults to false.

    
    
    
  


*print-readably*

var

    
When set to logical false, strings and characters will be printed with
non-alphanumeric characters converted to the appropriate escape sequences.

Defaults to true

    
    
    
  


*read-eval*

var

    
When set to logical false, the EvalReader (#=(...)) is disabled in the 
read/load in the thread-local binding.
Example: (binding [*read-eval* false] (read-string "#=(eval (def x 3))"))

Defaults to true

    
    
    
  


*warn-on-reflection*

var

    
When set to true, the compiler will emit warnings when reflection is
needed to resolve Java method calls or field accesses.

Defaults to false.

    
    
    
  


+

function
Usage: (+)
       (+ x)
       (+ x y)
       (+ x y & more)
Returns the sum of nums. (+) returns 0.

    
    
    Source
  


-

function
Usage: (- x)
       (- x y)
       (- x y & more)
If no ys are supplied, returns the negation of x, else subtracts
the ys from x and returns the result.

    
    
    Source
  


->

macro
Usage: (-> x)
       (-> x form)
       (-> x form & more)
Threads the expr through the forms. Inserts x as the
second item in the first form, making a list of it if it is not a
list already. If there are more forms, inserts the first form as the
second item in second form, etc.

    
    
    Source
  


->>

macro
Usage: (->> x form)
       (->> x form & more)
Threads the expr through the forms. Inserts x as the
last item in the first form, making a list of it if it is not a
list already. If there are more forms, inserts the first form as the
last item in second form, etc.

    
    
    Source
  


.

special form
Usage: (.instanceMember instance args*)
       (.instanceMember Classname args*)
       (Classname/staticMethod args*)
       Classname/staticField
The instance member form works for both fields and methods.
They all expand into calls to the dot operator at macroexpansion time.

Please see https://clojure.org/java_interop#dot

    Added in Clojure version 1.0


..

macro
Usage: (.. x form)
       (.. x form & more)
form => fieldName-symbol or (instanceMethodName-symbol args*)

Expands into a member access (.) of the first member on the first
argument, followed by the next member on the result, etc. For
instance:

(.. System (getProperties) (get "os.name"))

expands to:

(. (. System (getProperties)) (get "os.name"))

but is easier to write, read, and understand.

    
    
    Source
  


/

function
Usage: (/ x)
       (/ x y)
       (/ x y & more)
If no denominators are supplied, returns 1/numerator,
else returns numerator divided by all of the denominators.

    
    
    Source
  


<

function
Usage: (< x)
       (< x y)
       (< x y & more)
Returns non-nil if nums are in monotonically increasing order,
otherwise false.

    
    
    Source
  


<=

function
Usage: (<= x)
       (<= x y)
       (<= x y & more)
Returns non-nil if nums are in monotonically non-decreasing order,
otherwise false.

    
    
    Source
  


=

function
Usage: (= x)
       (= x y)
       (= x y & more)
Equality. Returns true if x equals y, false if not. Same as
Java x.equals(y) except it also works for nil, and compares
numbers and collections in a type-independent manner.  Clojure's immutable data
structures define equals() (and thus =) as a value, not an identity,
comparison.

    
    
    Source
  


==

function
Usage: (== x)
       (== x y)
       (== x y & more)
Returns non-nil if nums all have the same value, otherwise false

    
    
    Source
  


>

function
Usage: (> x)
       (> x y)
       (> x y & more)
Returns non-nil if nums are in monotonically decreasing order,
otherwise false.

    
    
    Source
  


>=

function
Usage: (>= x)
       (>= x y)
       (>= x y & more)
Returns non-nil if nums are in monotonically non-increasing order,
otherwise false.

    
    
    Source
  


accessor

function
Usage: (accessor s key)
Returns a fn that, given an instance of a structmap with the basis,
returns the value at the key.  The key must be in the basis. The
returned function should be (slightly) more efficient than using
get, but such use of accessors should be limited to known
performance-critical areas.

    
    
    Source
  


aclone

function
Usage: (aclone array)
Returns a clone of the Java array. Works on arrays of known
types.

    
    
    Source
  


add-classpath

function
Usage: (add-classpath url)
DEPRECATED 

Adds the url (String or URL object) to the classpath per
URLClassLoader.addURL

    
    
    Source
  


add-watch

function
Usage: (add-watch reference key fn)
Alpha - subject to change.
Adds a watch function to an agent/atom/var/ref reference. The watch
fn must be a fn of 4 args: a key, the reference, its old-state, its
new-state. Whenever the reference's state might have been changed,
any registered watches will have their functions called. The watch fn
will be called synchronously, on the agent's thread if an agent,
before any pending sends if agent or ref. Note that an atom's or
ref's state may have changed again prior to the fn call, so use
old/new-state rather than derefing the reference. Note also that watch
fns may be called from multiple threads simultaneously. Var watchers
are triggered only by root binding changes, not thread-local
set!s. Keys must be unique per reference, and can be used to remove
the watch with remove-watch, but are otherwise considered opaque by
the watch mechanism.

    
    
    Source
  


agent

function
Usage: (agent state)
       (agent state & options)
Creates and returns an agent with an initial value of state and
zero or more options (in any order):

:meta metadata-map

:validator validate-fn

If metadata-map is supplied, it will be come the metadata on the
agent. validate-fn must be nil or a side-effect-free fn of one
argument, which will be passed the intended new state on any state
change. If the new state is unacceptable, the validate-fn should
return false or throw an exception.

    
    
    Source
  


agent-errors

function
Usage: (agent-errors a)
Returns a sequence of the exceptions thrown during asynchronous
actions of the agent.

    
    
    Source
  


aget

function
Usage: (aget array idx)
       (aget array idx & idxs)
Returns the value at the index/indices. Works on Java arrays of all
types.

    
    
    Source
  


alength

function
Usage: (alength array)
Returns the length of the Java array. Works on arrays of all
types.

    
    
    Source
  


alias

function
Usage: (alias alias namespace-sym)
Add an alias in the current namespace to another
namespace. Arguments are two symbols: the alias to be used, and
the symbolic name of the target namespace. Use :as in the ns macro in preference
to calling this directly.

    
    
    Source
  


all-ns

function
Usage: (all-ns)
Returns a sequence of all namespaces.

    
    
    Source
  


alter

function
Usage: (alter ref fun & args)
Must be called in a transaction. Sets the in-transaction-value of
ref to:

(apply fun in-transaction-value-of-ref args)

and returns the in-transaction-value of ref.

    
    
    Source
  


alter-meta!

function
Usage: (alter-meta! iref f & args)
Atomically sets the metadata for a namespace/var/ref/agent/atom to be:

(apply f its-current-meta args)

f must be free of side-effects

    
    
    Source
  


alter-var-root

function
Usage: (alter-var-root v f & args)
Atomically alters the root binding of var v by applying f to its
current value plus any args

    
    
    Source
  


amap

macro
Usage: (amap a idx ret expr)
Maps an expression across an array a, using an index named idx, and
return value named ret, initialized to a clone of a, then setting 
each element of ret to the evaluation of expr, returning the new 
array ret.

    
    
    Source
  


ancestors

function
Usage: (ancestors tag)
       (ancestors h tag)
Returns the immediate and indirect parents of tag, either via a Java type
inheritance relationship or a relationship established via derive. h
must be a hierarchy obtained from make-hierarchy, if not supplied
defaults to the global hierarchy

    
    
    Source
  


and

macro
Usage: (and)
       (and x)
       (and x & next)
Evaluates exprs one at a time, from left to right. If a form
returns logical false (nil or false), and returns that value and
doesn't evaluate any of the other expressions, otherwise it returns
the value of the last expr. (and) returns true.

    
    
    Source
  


apply

function
Usage: (apply f args* argseq)
Applies fn f to the argument list formed by prepending args to argseq.

    
    
    Source
  


areduce

macro
Usage: (areduce a idx ret init expr)
Reduces an expression across an array a, using an index named idx,
and return value named ret, initialized to init, setting ret to the 
evaluation of expr at each step, returning ret.

    
    
    Source
  


array-map

function
Usage: (array-map)
       (array-map & keyvals)
Constructs an array-map.

    
    
    Source
  


aset

function
Usage: (aset array idx val)
       (aset array idx idx2 & idxv)
Sets the value at the index/indices. Works on Java arrays of
reference types. Returns val.

    
    
    Source
  


aset-boolean

function
Usage: (aset-boolean array idx val)
       (aset-boolean array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of boolean. Returns val.

    
    
    Source
  


aset-byte

function
Usage: (aset-byte array idx val)
       (aset-byte array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of byte. Returns val.

    
    
    Source
  


aset-char

function
Usage: (aset-char array idx val)
       (aset-char array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of char. Returns val.

    
    
    Source
  


aset-double

function
Usage: (aset-double array idx val)
       (aset-double array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of double. Returns val.

    
    
    Source
  


aset-float

function
Usage: (aset-float array idx val)
       (aset-float array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of float. Returns val.

    
    
    Source
  


aset-int

function
Usage: (aset-int array idx val)
       (aset-int array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of int. Returns val.

    
    
    Source
  


aset-long

function
Usage: (aset-long array idx val)
       (aset-long array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of long. Returns val.

    
    
    Source
  


aset-short

function
Usage: (aset-short array idx val)
       (aset-short array idx idx2 & idxv)
Sets the value at the index/indices. Works on arrays of short. Returns val.

    
    
    Source
  


assert

macro
Usage: (assert x)
Evaluates expr and throws an exception if it does not evaluate to
logical true.

    
    
    Source
  


assoc

function
Usage: (assoc map key val)
       (assoc map key val & kvs)
assoc[iate]. When applied to a map, returns a new map of the
same (hashed/sorted) type, that contains the mapping of key(s) to
val(s). When applied to a vector, returns a new vector that
contains val at index. Note - index must be <= (count vector).

    
    
    Source
  


assoc!

function
Usage: (assoc! coll key val)
       (assoc! coll key val & kvs)
Alpha - subject to change.
When applied to a transient map, adds mapping of key(s) to
val(s). When applied to a transient vector, sets the val at index.
Note - index must be <= (count vector). Returns coll.

    
    
    Source
  


assoc-in

function
Usage: (assoc-in m [k & ks] v)
Associates a value in a nested associative structure, where ks is a
sequence of keys and v is the new value and returns a new nested structure.
If any levels do not exist, hash-maps will be created.

    
    
    Source
  


associative?

function
Usage: (associative? coll)
Returns true if coll implements Associative

    
    
    Source
  


atom

function
Usage: (atom x)
       (atom x & options)
Creates and returns an Atom with an initial value of x and zero or
more options (in any order):

:meta metadata-map

:validator validate-fn

If metadata-map is supplied, it will be come the metadata on the
atom. validate-fn must be nil or a side-effect-free fn of one
argument, which will be passed the intended new state on any state
change. If the new state is unacceptable, the validate-fn should
return false or throw an exception.

    
    
    Source
  


await

function
Usage: (await & agents)
Blocks the current thread (indefinitely!) until all actions
dispatched thus far, from this thread or agent, to the agent(s) have
occurred.

    
    
    Source
  


await-for

function
Usage: (await-for timeout-ms & agents)
Blocks the current thread until all actions dispatched thus
far (from this thread or agent) to the agents have occurred, or the
timeout (in milliseconds) has elapsed. Returns nil if returning due
to timeout, non-nil otherwise.

    
    
    Source
  


bases

function
Usage: (bases c)
Returns the immediate superclass and direct interfaces of c, if any

    
    
    Source
  


bean

function
Usage: (bean x)
Takes a Java object and returns a read-only implementation of the
map abstraction based upon its JavaBean properties.

    
    
    Source
  


bigdec

function
Usage: (bigdec x)
Coerce to BigDecimal

    
    
    Source
  


bigint

function
Usage: (bigint x)
Coerce to BigInteger

    
    
    Source
  


binding

macro
Usage: (binding bindings & body)
binding => var-symbol init-expr

Creates new bindings for the (already-existing) vars, with the
supplied initial values, executes the exprs in an implicit do, then
re-establishes the bindings that existed before.  The new bindings
are made in parallel (unlike let); all init-exprs are evaluated
before the vars are bound to their new values.

    
    
    Source
  


bit-and

function
Usage: (bit-and x y)
Bitwise and

    
    
    Source
  


bit-and-not

function
Usage: (bit-and-not x y)
Bitwise and with complement

    
    
    Source
  


bit-clear

function
Usage: (bit-clear x n)
Clear bit at index n

    
    
    Source
  


bit-flip

function
Usage: (bit-flip x n)
Flip bit at index n

    
    
    Source
  


bit-not

function
Usage: (bit-not x)
Bitwise complement

    
    
    Source
  


bit-or

function
Usage: (bit-or x y)
Bitwise or

    
    
    Source
  


bit-set

function
Usage: (bit-set x n)
Set bit at index n

    
    
    Source
  


bit-shift-left

function
Usage: (bit-shift-left x n)
Bitwise shift left

    
    
    Source
  


bit-shift-right

function
Usage: (bit-shift-right x n)
Bitwise shift right

    
    
    Source
  


bit-test

function
Usage: (bit-test x n)
Test bit at index n

    
    
    Source
  


bit-xor

function
Usage: (bit-xor x y)
Bitwise exclusive or

    
    
    Source
  


boolean

function
Usage: (boolean x)
Coerce to boolean

    
    
    Source
  


boolean-array

function
Usage: (boolean-array size-or-seq)
       (boolean-array size init-val-or-seq)
Creates an array of booleans

    
    
    Source
  


booleans

function
Usage: (booleans xs)
Casts to boolean[]

    
    
    Source
  


bound-fn

macro
Usage: (bound-fn & fntail)
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.
This may be used to define a helper function which runs on a different
thread, but needs the same bindings in place.

    
    
    Source
  


bound-fn*

function
Usage: (bound-fn* f)
Returns a function, which will install the same bindings in effect as in
the thread at the time bound-fn* was called and then call f with any given
arguments. This may be used to define a helper function which runs on a
different thread, but needs the same bindings in place.

    
    
    Source
  


butlast

function
Usage: (butlast coll)
Return a seq of all but the last item in coll, in linear time

    
    
    Source
  


byte

function
Usage: (byte x)
Coerce to byte

    
    
    Source
  


byte-array

function
Usage: (byte-array size-or-seq)
       (byte-array size init-val-or-seq)
Creates an array of bytes

    
    
    Source
  


bytes

function
Usage: (bytes xs)
Casts to bytes[]

    
    
    Source
  


cast

function
Usage: (cast c x)
Throws a ClassCastException if x is not a c, else returns x.

    
    
    Source
  


catch

special syntax

    
Syntax for use with try.

Please see https://clojure.org/reference/special_forms#try

    Added in Clojure version 1.0


char

function
Usage: (char x)
Coerce to char

    
    
    Source
  


char-array

function
Usage: (char-array size-or-seq)
       (char-array size init-val-or-seq)
Creates an array of chars

    
    
    Source
  


char-escape-string

var

    
Returns escape string for char or nil if none

    
    
    Source
  


char-name-string

var

    
Returns name string for char or nil if none

    
    
    Source
  


char?

function
Usage: (char? x)
Return true if x is a Character

    
    
    Source
  


chars

function
Usage: (chars xs)
Casts to chars[]

    
    
    Source
  


class

function
Usage: (class x)
Returns the Class of x

    
    
    Source
  


class?

function
Usage: (class? x)
Returns true if x is an instance of Class

    
    
    Source
  


clear-agent-errors

function
Usage: (clear-agent-errors a)
Clears any exceptions thrown during asynchronous actions of the
agent, allowing subsequent actions to occur.

    
    
    Source
  


clojure-version

function
Usage: (clojure-version)
Returns clojure version as a printable string.

    
    
    Source
  


coll?

function
Usage: (coll? x)
Returns true if x implements IPersistentCollection

    
    
    Source
  


comment

macro
Usage: (comment & body)
Ignores body, yields nil

    
    
    Source
  


commute

function
Usage: (commute ref fun & args)
Must be called in a transaction. Sets the in-transaction-value of
ref to:

(apply fun in-transaction-value-of-ref args)

and returns the in-transaction-value of ref.

At the commit point of the transaction, sets the value of ref to be:

(apply fun most-recently-committed-value-of-ref args)

Thus fun should be commutative, or, failing that, you must accept
last-one-in-wins behavior.  commute allows for more concurrency than
ref-set.

    
    
    Source
  


comp

function
Usage: (comp f)
       (comp f g)
       (comp f g h)
       (comp f1 f2 f3 & fs)
Takes a set of functions and returns a fn that is the composition
of those fns.  The returned fn takes a variable number of args,
applies the rightmost of fns to the args, the next
fn (right-to-left) to the result, etc.

    
    
    Source
  


comparator

function
Usage: (comparator pred)
Returns an implementation of java.util.Comparator based upon pred.

    
    
    Source
  


compare

function
Usage: (compare x y)
Comparator. Returns a negative number, zero, or a positive number
when x is logically 'less than', 'equal to', or 'greater than'
y. Same as Java x.compareTo(y) except it also works for nil, and
compares numbers and collections in a type-independent manner. x
must implement Comparable

    
    
    Source
  


compare-and-set!

function
Usage: (compare-and-set! atom oldval newval)
Atomically sets the value of atom to newval if and only if the
current value of the atom is identical to oldval. Returns true if
set happened, else false

    
    
    Source
  


compile

function
Usage: (compile lib)
Compiles the namespace named by the symbol lib into a set of
classfiles. The source for the lib must be in a proper
classpath-relative directory. The output files will go into the
directory specified by *compile-path*, and that directory too must
be in the classpath.

    
    
    Source
  


complement

function
Usage: (complement f)
Takes a fn f and returns a fn that takes the same arguments as f,
has the same effects, if any, and returns the opposite truth value.

    
    
    Source
  


concat

function
Usage: (concat)
       (concat x)
       (concat x y)
       (concat x y & zs)
Returns a lazy seq representing the concatenation of the elements in the supplied colls.

    
    
    Source
  


cond

macro
Usage: (cond & clauses)
Takes a set of test/expr pairs. It evaluates each test one at a
time.  If a test returns logical true, cond evaluates and returns
the value of the corresponding expr and doesn't evaluate any of the
other tests or exprs. (cond) returns nil.

    
    
    Source
  


condp

macro
Usage: (condp pred expr & clauses)
Takes a binary predicate, an expression, and a set of clauses.
Each clause can take the form of either:

test-expr result-expr

test-expr :>> result-fn

Note :>> is an ordinary keyword.

For each clause, (pred test-expr expr) is evaluated. If it returns
logical true, the clause is a match. If a binary clause matches, the
result-expr is returned, if a ternary clause matches, its result-fn,
which must be a unary function, is called with the result of the
predicate as its argument, the result of that call being the return
value of condp. A single default expression can follow the clauses,
and its value will be returned if no clause matches. If no default
expression is provided and no clause matches, an
IllegalArgumentException is thrown.

    
    
    Source
  


conj

function
Usage: (conj coll x)
       (conj coll x & xs)
conj[oin]. Returns a new collection with the xs
'added'. (conj nil item) returns (item).  The 'addition' may
happen at different 'places' depending on the concrete type.

    
    
    Source
  


conj!

function
Usage: (conj! coll x)
Alpha - subject to change.
Adds x to the transient collection, and return coll. The 'addition'
may happen at different 'places' depending on the concrete type.

    
    
    Source
  


cons

function
Usage: (cons x seq)
Returns a new seq where x is the first element and seq is
the rest.

    
    
    Source
  


constantly

function
Usage: (constantly x)
Returns a function that takes any number of arguments and returns x.

    
    
    Source
  


construct-proxy

function
Usage: (construct-proxy c & ctor-args)
Takes a proxy class and any arguments for its superclass ctor and
creates and returns an instance of the proxy.

    
    
    Source
  


contains?

function
Usage: (contains? coll key)
Returns true if key is present in the given collection, otherwise
returns false.  Note that for numerically indexed collections like
vectors and Java arrays, this tests if the numeric key is within the
range of indexes. 'contains?' operates constant or logarithmic time;
it will not perform a linear search for a value.  See also 'some'.

    
    
    Source
  


count

function
Usage: (count coll)
Returns the number of items in the collection. (count nil) returns
0.  Also works on strings, arrays, and Java Collections and Maps

    
    
    Source
  


counted?

function
Usage: (counted? coll)
Returns true if coll implements count in constant time

    
    
    Source
  


create-ns

function
Usage: (create-ns sym)
Create a new namespace named by the symbol if one doesn't already
exist, returns it or the already-existing namespace of the same
name.

    
    
    Source
  


create-struct

function
Usage: (create-struct & keys)
Returns a structure basis object.

    
    
    Source
  


cycle

function
Usage: (cycle coll)
Returns a lazy (infinite!) sequence of repetitions of the items in coll.

    
    
    Source
  


dec

function
Usage: (dec x)
Returns a number one less than num.

    
    
    Source
  


decimal?

function
Usage: (decimal? n)
Returns true if n is a BigDecimal

    
    
    Source
  


declare

macro
Usage: (declare & names)
defs the supplied var names with no bindings, useful for making forward declarations.

    
    
    Source
  


def

special form
Usage: (def symbol doc-string? init?)
Creates and interns a global var with the name
of symbol in the current namespace (*ns*) or locates such a var if
it already exists.  If init is supplied, it is evaluated, and the
root binding of the var is set to the resulting value.  If init is
not supplied, the root binding of the var is unaffected.

Please see https://clojure.org/reference/special_forms#def

    Added in Clojure version 1.0


definline

macro
Usage: (definline name & decl)
Experimental - like defmacro, except defines a named function whose
body is the expansion, calls to which may be expanded inline as if
it were a macro. Cannot be used with variadic (&) args.

    
    
    Source
  


defmacro

macro
Usage: (defmacro name doc-string? attr-map? [params*] body)
       (defmacro name doc-string? attr-map? ([params*] body) + attr-map?)
Like defn, but the resulting function name is declared as a
macro and will be used as a macro by the compiler when it is
called.

    
    
    Source
  


defmethod

macro
Usage: (defmethod multifn dispatch-val & fn-tail)
Creates and installs a new method of multimethod associated with dispatch-value. 

    
    
    Source
  


defmulti

macro
Usage: (defmulti name docstring? attr-map? dispatch-fn & options)
Creates a new multimethod with the associated dispatch function.
The docstring and attribute-map are optional.

Options are key-value pairs and may be one of:
  :default    the default dispatch value, defaults to :default
  :hierarchy  the isa? hierarchy to use for dispatching
              defaults to the global hierarchy

    
    
    Source
  


defn

macro
Usage: (defn name doc-string? attr-map? [params*] body)
       (defn name doc-string? attr-map? ([params*] body) + attr-map?)
Same as (def name (fn [params* ] exprs*)) or (def
name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
to the var metadata

    
    
    Source
  


defn-

macro
Usage: (defn- name & decls)
same as defn, yielding non-public def

    
    
    Source
  


defonce

macro
Usage: (defonce name expr)
defs name to have the root value of the expr iff the named var has no root value,
else expr is unevaluated

    
    
    Source
  


defstruct

macro
Usage: (defstruct name & keys)
Same as (def name (create-struct keys...))

    
    
    Source
  


delay

macro
Usage: (delay & body)
Takes a body of expressions and yields a Delay object that will
invoke the body only the first time it is forced (with force), and
will cache the result and return it on all subsequent force
calls.

    
    
    Source
  


delay?

function
Usage: (delay? x)
returns true if x is a Delay created with delay

    
    
    Source
  


deliver

function
Usage: (deliver promise val)
Alpha - subject to change.
Delivers the supplied value to the promise, releasing any pending
derefs. A subsequent call to deliver on a promise will throw an exception.

    
    
    Source
  


deref

function
Usage: (deref ref)
Also reader macro: @ref/@agent/@var/@atom/@delay/@future. Within a transaction,
returns the in-transaction-value of ref, else returns the
most-recently-committed value of ref. When applied to a var, agent
or atom, returns its current state. When applied to a delay, forces
it if not already forced. When applied to a future, will block if
computation not complete

    
    
    Source
  


derive

function
Usage: (derive tag parent)
       (derive h tag parent)
Establishes a parent/child relationship between parent and
tag. Parent must be a namespace-qualified symbol or keyword and
child can be either a namespace-qualified symbol or keyword or a
class. h must be a hierarchy obtained from make-hierarchy, if not
supplied defaults to, and modifies, the global hierarchy.

    
    
    Source
  


descendants

function
Usage: (descendants tag)
       (descendants h tag)
Returns the immediate and indirect children of tag, through a
relationship established via derive. h must be a hierarchy obtained
from make-hierarchy, if not supplied defaults to the global
hierarchy. Note: does not work on Java type inheritance
relationships.

    
    
    Source
  


disj

function
Usage: (disj set)
       (disj set key)
       (disj set key & ks)
disj[oin]. Returns a new set of the same (hashed/sorted) type, that
does not contain key(s).

    
    
    Source
  


disj!

function
Usage: (disj! set)
       (disj! set key)
       (disj! set key & ks)
Alpha - subject to change.
disj[oin]. Returns a transient set of the same (hashed/sorted) type, that
does not contain key(s).

    
    
    Source
  


dissoc

function
Usage: (dissoc map)
       (dissoc map key)
       (dissoc map key & ks)
dissoc[iate]. Returns a new map of the same (hashed/sorted) type,
that does not contain a mapping for key(s).

    
    
    Source
  


dissoc!

function
Usage: (dissoc! map key)
       (dissoc! map key & ks)
Alpha - subject to change.
Returns a transient map that doesn't contain a mapping for key(s).

    
    
    Source
  


distinct

function
Usage: (distinct coll)
Returns a lazy sequence of the elements of coll with duplicates removed

    
    
    Source
  


distinct?

function
Usage: (distinct? x)
       (distinct? x y)
       (distinct? x y & more)
Returns true if no two of the arguments are =

    
    
    Source
  


do

special form
Usage: (do exprs*)
Evaluates the expressions in order and returns the value of
the last. If no expressions are supplied, returns nil.

Please see https://clojure.org/reference/special_forms#do

    Added in Clojure version 1.0


doall

function
Usage: (doall coll)
       (doall n coll)
When lazy sequences are produced via functions that have side
effects, any effects other than those needed to produce the first
element in the seq do not occur until the seq is consumed. doall can
be used to force any effects. Walks through the successive nexts of
the seq, retains the head and returns it, thus causing the entire
seq to reside in memory at one time.

    
    
    Source
  


doc

macro
Usage: (doc name)
Prints documentation for a var or special form given its name

    
    
    Source
  


dorun

function
Usage: (dorun coll)
       (dorun n coll)
When lazy sequences are produced via functions that have side
effects, any effects other than those needed to produce the first
element in the seq do not occur until the seq is consumed. dorun can
be used to force any effects. Walks through the successive nexts of
the seq, does not retain the head and returns nil.

    
    
    Source
  


doseq

macro
Usage: (doseq seq-exprs & body)
Repeatedly executes body (presumably for side-effects) with
bindings and filtering as provided by "for".  Does not retain
the head of the sequence. Returns nil.

    
    
    Source
  


dosync

macro
Usage: (dosync & exprs)
Runs the exprs (in an implicit do) in a transaction that encompasses
exprs and any nested calls.  Starts a transaction if none is already
running on this thread. Any uncaught exception will abort the
transaction and flow out of dosync. The exprs may be run more than
once, but any effects on Refs will be atomic.

    
    
    Source
  


dotimes

macro
Usage: (dotimes bindings & body)
bindings => name n

Repeatedly executes body (presumably for side-effects) with name
bound to integers from 0 through n-1.

    
    
    Source
  


doto

macro
Usage: (doto x & forms)
Evaluates x then calls all of the methods and functions with the
value of x supplied at the from of the given arguments.  The forms
are evaluated in order.  Returns x.

(doto (new java.util.HashMap) (.put "a" 1) (.put "b" 2))

    
    
    Source
  


double

function
Usage: (double x)
Coerce to double

    
    
    Source
  


double-array

function
Usage: (double-array size-or-seq)
       (double-array size init-val-or-seq)
Creates an array of doubles

    
    
    Source
  


doubles

function
Usage: (doubles xs)
Casts to double[]

    
    
    Source
  


drop

function
Usage: (drop n coll)
Returns a lazy sequence of all but the first n items in coll.

    
    
    Source
  


drop-last

function
Usage: (drop-last s)
       (drop-last n s)
Return a lazy sequence of all but the last n (default 1) items in coll

    
    
    Source
  


drop-while

function
Usage: (drop-while pred coll)
Returns a lazy sequence of the items in coll starting from the first
item for which (pred item) returns nil.

    
    
    Source
  


empty

function
Usage: (empty coll)
Returns an empty collection of the same category as coll, or nil

    
    
    Source
  


empty?

function
Usage: (empty? coll)
Returns true if coll has no items - same as (not (seq coll)).
Please use the idiom (seq x) rather than (not (empty? x))

    
    
    Source
  


ensure

function
Usage: (ensure ref)
Must be called in a transaction. Protects the ref from modification
by other transactions.  Returns the in-transaction-value of
ref. Allows for more concurrency than (ref-set ref @ref)

    
    
    Source
  


enumeration-seq

function
Usage: (enumeration-seq e)
Returns a seq on a java.util.Enumeration

    
    
    Source
  


eval

function
Usage: (eval form)
Evaluates the form data structure (not text!) and returns the result.

    
    
    Source
  


even?

function
Usage: (even? n)
Returns true if n is even, throws an exception if n is not an integer

    
    
    Source
  


every?

function
Usage: (every? pred coll)
Returns true if (pred x) is logical true for every x in coll, else
false.

    
    
    Source
  


false?

function
Usage: (false? x)
Returns true if x is the value false, false otherwise.

    
    
    Source
  


ffirst

function
Usage: (ffirst x)
Same as (first (first x))

    
    
    Source
  


file-seq

function
Usage: (file-seq dir)
A tree seq on java.io.Files

    
    
    Source
  


filter

function
Usage: (filter pred coll)
Returns a lazy sequence of the items in coll for which
(pred item) returns true. pred must be free of side-effects.

    
    
    Source
  


finally

special syntax

    
Syntax for use with try.

Please see https://clojure.org/reference/special_forms#try

    Added in Clojure version 1.0


find

function
Usage: (find map key)
Returns the map entry for key, or nil if key not present.

    
    
    Source
  


find-doc

function
Usage: (find-doc re-string-or-pattern)
Prints documentation for any var whose documentation or name
contains a match for re-string-or-pattern

    
    
    Source
  


find-ns

function
Usage: (find-ns sym)
Returns the namespace named by the symbol or nil if it doesn't exist.

    
    
    Source
  


find-var

function
Usage: (find-var sym)
Returns the global var named by the namespace-qualified symbol, or
nil if no var with that name.

    
    
    Source
  


first

function
Usage: (first coll)
Returns the first item in the collection. Calls seq on its
argument. If coll is nil, returns nil.

    
    
    Source
  


float

function
Usage: (float x)
Coerce to float

    
    
    Source
  


float-array

function
Usage: (float-array size-or-seq)
       (float-array size init-val-or-seq)
Creates an array of floats

    
    
    Source
  


float?

function
Usage: (float? n)
Returns true if n is a floating point number

    
    
    Source
  


floats

function
Usage: (floats xs)
Casts to float[]

    
    
    Source
  


flush

function
Usage: (flush)
Flushes the output stream that is the current value of
*out*

    
    
    Source
  


fn

macro
Usage: (fn & sigs)
(fn name? [params* ] exprs*)
(fn name? ([params* ] exprs*)+)

params => positional-params* , or positional-params* & next-param
positional-param => binding-form
next-param => binding-form
name => symbol

Defines a function

    
    
    Source
  


fn?

function
Usage: (fn? x)
Returns true if x implements Fn, i.e. is an object created via fn.

    
    
    Source
  


fnext

function
Usage: (fnext x)
Same as (first (next x))

    
    
    Source
  


for

macro
Usage: (for seq-exprs body-expr)
List comprehension. Takes a vector of one or more
 binding-form/collection-expr pairs, each followed by zero or more
 modifiers, and yields a lazy sequence of evaluations of expr.
 Collections are iterated in a nested fashion, rightmost fastest,
 and nested coll-exprs can refer to bindings created in prior
 binding-forms.  Supported modifiers are: :let [binding-form expr ...],
 :while test, :when test.

(take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))

    
    
    Source
  


force

function
Usage: (force x)
If x is a Delay, returns the (possibly cached) value of its expression, else returns x

    
    
    Source
  


format

function
Usage: (format fmt & args)
Formats a string using java.lang.String.format, see java.util.Formatter for format
string syntax

    
    
    Source
  


future

macro
Usage: (future & body)
Takes a body of expressions and yields a future object that will
invoke the body in another thread, and will cache the result and
return it on all subsequent calls to deref/@. If the computation has
not yet finished, calls to deref/@ will block.

    
    
    Source
  


future-call

function
Usage: (future-call f)
Takes a function of no args and yields a future object that will
invoke the function in another thread, and will cache the result and
return it on all subsequent calls to deref/@. If the computation has
not yet finished, calls to deref/@ will block.

    
    
    Source
  


future-cancel

function
Usage: (future-cancel f)
Cancels the future, if possible.

    
    
    Source
  


future-cancelled?

function
Usage: (future-cancelled? f)
Returns true if future f is cancelled

    
    
    Source
  


future-done?

function
Usage: (future-done? f)
Returns true if future f is done

    
    
    Source
  


future?

function
Usage: (future? x)
Returns true if x is a future

    
    
    Source
  


gen-class

macro
Usage: (gen-class & options)
When compiling, generates compiled bytecode for a class with the
given package-qualified :name (which, as all names in these
parameters, can be a string or symbol), and writes the .class file
to the *compile-path* directory.  When not compiling, does
nothing. The gen-class construct contains no implementation, as the
implementation will be dynamically sought by the generated class in
functions in an implementing Clojure namespace. Given a generated
class org.mydomain.MyClass with a method named mymethod, gen-class
will generate an implementation that looks for a function named by 
(str prefix mymethod) (default prefix: "-") in a
Clojure namespace specified by :impl-ns
(defaults to the current namespace). All inherited methods,
generated methods, and init and main functions (see :methods, :init,
and :main below) will be found similarly prefixed. By default, the
static initializer for the generated class will attempt to load the
Clojure support code for the class as a resource from the classpath,
e.g. in the example case, ``org/mydomain/MyClass__init.class``. This
behavior can be controlled by :load-impl-ns

Note that methods with a maximum of 18 parameters are supported.

In all subsequent sections taking types, the primitive types can be
referred to by their Java names (int, float etc), and classes in the
java.lang package can be used without a package qualifier. All other
classes must be fully qualified.

Options should be a set of key/value pairs, all except for :name are optional:

:name aname

The package-qualified name of the class to be generated

:extends aclass

Specifies the superclass, the non-private methods of which will be
overridden by the class. If not provided, defaults to Object.

:implements [interface ...]

One or more interfaces, the methods of which will be implemented by the class.

:init name

If supplied, names a function that will be called with the arguments
to the constructor. Must return [ [superclass-constructor-args] state] 
If not supplied, the constructor args are passed directly to
the superclass constructor and the state will be nil

:constructors {[param-types] [super-param-types], ...}

By default, constructors are created for the generated class which
match the signature(s) of the constructors for the superclass. This
parameter may be used to explicitly specify constructors, each entry
providing a mapping from a constructor signature to a superclass
constructor signature. When you supply this, you must supply an :init
specifier. 

:post-init name

If supplied, names a function that will be called with the object as
the first argument, followed by the arguments to the constructor.
It will be called every time an object of this class is created,
immediately after all the inherited constructors have completed.
It's return value is ignored.

:methods [ [name [param-types] return-type], ...]

The generated class automatically defines all of the non-private
methods of its superclasses/interfaces. This parameter can be used
to specify the signatures of additional methods of the generated
class. Static methods can be specified with #^{:static true} in the
signature's metadata. Do not repeat superclass/interface signatures
here.

:main boolean

If supplied and true, a static public main function will be generated. It will
pass each string of the String[] argument as a separate argument to
a function called (str prefix main).

:factory name

If supplied, a (set of) public static factory function(s) will be
created with the given name, and the same signature(s) as the
constructor(s).

:state name

If supplied, a public final instance field with the given name will be
created. You must supply an :init function in order to provide a
value for the state. Note that, though final, the state can be a ref
or agent, supporting the creation of Java objects with transactional
or asynchronous mutation semantics.

:exposes {protected-field-name {:get name :set name}, ...}

Since the implementations of the methods of the generated class
occur in Clojure functions, they have no access to the inherited
protected fields of the superclass. This parameter can be used to
generate public getter/setter methods exposing the protected field(s)
for use in the implementation.

:exposes-methods {super-method-name exposed-name, ...}

It is sometimes necessary to call the superclass' implementation of an
overridden method.  Those methods may be exposed and referred in 
the new method implementation by a local name.

:prefix string

Default: "-" Methods called e.g. Foo will be looked up in vars called
prefixFoo in the implementing ns.

:impl-ns name

Default: the name of the current ns. Implementations of methods will be 
looked up in this namespace.

:load-impl-ns boolean

Default: true. Causes the static initializer for the generated class
to reference the load code for the implementing namespace. Should be
true when implementing-ns is the default, false if you intend to
load the code via some other method.

    
    
    Source
  


gen-interface

macro
Usage: (gen-interface & options)
When compiling, generates compiled bytecode for an interface with
 the given package-qualified :name (which, as all names in these
 parameters, can be a string or symbol), and writes the .class file
 to the *compile-path* directory.  When not compiling, does nothing.

 In all subsequent sections taking types, the primitive types can be
 referred to by their Java names (int, float etc), and classes in the
 java.lang package can be used without a package qualifier. All other
 classes must be fully qualified.

 Options should be a set of key/value pairs, all except for :name are
 optional:

 :name aname

 The package-qualified name of the class to be generated

 :extends [interface ...]

 One or more interfaces, which will be extended by this interface.

 :methods [ [name [param-types] return-type], ...]

 This parameter is used to specify the signatures of the methods of
 the generated interface.  Do not repeat superinterface signatures
 here.

    
    
    Source
  


gensym

function
Usage: (gensym)
       (gensym prefix-string)
Returns a new symbol with a unique name. If a prefix string is
supplied, the name is prefix# where # is some unique number. If
prefix is not supplied, the prefix is 'G__'.

    
    
    Source
  


get

function
Usage: (get map key)
       (get map key not-found)
Returns the value mapped to key, not-found or nil if key not present.

    
    
    Source
  


get-in

function
Usage: (get-in m ks)
returns the value in a nested associative structure, where ks is a sequence of keys

    
    
    Source
  


get-method

function
Usage: (get-method multifn dispatch-val)
Given a multimethod and a dispatch value, returns the dispatch fn
that would apply to that value, or nil if none apply and no default

    
    
    Source
  


get-proxy-class

function
Usage: (get-proxy-class & bases)
Takes an optional single class followed by zero or more
interfaces. If not supplied class defaults to Object.  Creates an
returns an instance of a proxy class derived from the supplied
classes. The resulting value is cached and used for any subsequent
requests for the same class set. Returns a Class object.

    
    
    Source
  


get-thread-bindings

function
Usage: (get-thread-bindings)
Get a map with the Var/value pairs which is currently in effect for the
current thread.

    
    
    Source
  


get-validator

function
Usage: (get-validator iref)
Gets the validator-fn for a var/ref/agent/atom.

    
    
    Source
  


hash

function
Usage: (hash x)
Returns the hash code of its argument

    
    
    Source
  


hash-map

function
Usage: (hash-map)
       (hash-map & keyvals)
keyval => key val
Returns a new hash map with supplied mappings.

    
    
    Source
  


hash-set

function
Usage: (hash-set)
       (hash-set & keys)
Returns a new hash set with supplied keys.

    
    
    Source
  


identical?

function
Usage: (identical? x y)
Tests if 2 arguments are the same object

    
    
    
  


identity

function
Usage: (identity x)
Returns its argument.

    
    
    Source
  


if

special form
Usage: (if test then else?)
Evaluates test. If not the singular values nil or false,
evaluates and yields then, otherwise, evaluates and yields else. If
else is not supplied it defaults to nil.

Please see https://clojure.org/reference/special_forms#if

    Added in Clojure version 1.0


if-let

macro
Usage: (if-let bindings then)
       (if-let bindings then else & oldform)
bindings => binding-form test

If test is true, evaluates then with binding-form bound to the value of 
test, if not, yields else

    
    
    Source
  


if-not

macro
Usage: (if-not test then)
       (if-not test then else)
Evaluates test. If logical false, evaluates and returns then expr, 
otherwise else expr, if supplied, else nil.

    
    
    Source
  


ifn?

function
Usage: (ifn? x)
Returns true if x implements IFn. Note that many data structures
(e.g. sets and maps) implement IFn

    
    
    Source
  


import

macro
Usage: (import & import-symbols-or-lists)
import-list => (package-symbol class-name-symbols*)

For each name in class-name-symbols, adds a mapping from name to the
class named by package.name to the current namespace. Use :import in the ns
macro in preference to calling this directly.

    
    
    Source
  


in-ns

function
Usage: (in-ns name)
Sets *ns* to the namespace named by the symbol, creating it if needed.

    
    
    
  


inc

function
Usage: (inc x)
Returns a number one greater than num.

    
    
    Source
  


init-proxy

function
Usage: (init-proxy proxy mappings)
Takes a proxy instance and a map of strings (which must
correspond to methods of the proxy superclass/superinterfaces) to
fns (which must take arguments matching the corresponding method,
plus an additional (explicit) first arg corresponding to this, and
sets the proxy's fn map.

    
    
    Source
  


instance?

function
Usage: (instance? c x)
Evaluates x and tests if it is an instance of the class
c. Returns true or false

    
    
    Source
  


int

function
Usage: (int x)
Coerce to int

    
    
    Source
  


int-array

function
Usage: (int-array size-or-seq)
       (int-array size init-val-or-seq)
Creates an array of ints

    
    
    Source
  


integer?

function
Usage: (integer? n)
Returns true if n is an integer

    
    
    Source
  


interleave

function
Usage: (interleave c1 c2)
       (interleave c1 c2 & colls)
Returns a lazy seq of the first item in each coll, then the second etc.

    
    
    Source
  


intern

function
Usage: (intern ns name)
       (intern ns name val)
Finds or creates a var named by the symbol name in the namespace
ns (which can be a symbol or a namespace), setting its root binding
to val if supplied. The namespace must exist. The var will adopt any
metadata from the name symbol.  Returns the var.

    
    
    Source
  


interpose

function
Usage: (interpose sep coll)
Returns a lazy seq of the elements of coll separated by sep

    
    
    Source
  


into

function
Usage: (into to from)
Returns a new coll consisting of to-coll with all of the items of
from-coll conjoined.

    
    
    Source
  


into-array

function
Usage: (into-array aseq)
       (into-array type aseq)
Returns an array with components set to the values in aseq. The array's
component type is type if provided, or the type of the first value in
aseq if present, or Object. All values in aseq must be compatible with
the component type. Class objects for the primitive types can be obtained
using, e.g., Integer/TYPE.

    
    
    Source
  


ints

function
Usage: (ints xs)
Casts to int[]

    
    
    Source
  


io!

macro
Usage: (io! & body)
If an io! block occurs in a transaction, throws an
IllegalStateException, else runs body in an implicit do. If the
first expression in body is a literal string, will use that as the
exception message.

    
    
    Source
  


isa?

function
Usage: (isa? child parent)
       (isa? h child parent)
Returns true if (= child parent), or child is directly or indirectly derived from
parent, either via a Java type inheritance relationship or a
relationship established via derive. h must be a hierarchy obtained
from make-hierarchy, if not supplied defaults to the global
hierarchy

    
    
    Source
  


iterate

function
Usage: (iterate f x)
Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects

    
    
    Source
  


iterator-seq

function
Usage: (iterator-seq iter)
Returns a seq on a java.util.Iterator. Note that most collections
providing iterators implement Iterable and thus support seq directly.

    
    
    Source
  


juxt

function
Usage: (juxt f)
       (juxt f g)
       (juxt f g h)
       (juxt f g h & fs)
Alpha - name subject to change.
Takes a set of functions and returns a fn that is the juxtaposition
of those fns.  The returned fn takes a variable number of args, and
returns a vector containing the result of applying each fn to the
args (left-to-right).
((juxt a b c) x) => [(a x) (b x) (c x)]

    
    
    Source
  


key

function
Usage: (key e)
Returns the key of the map entry.

    
    
    Source
  


keys

function
Usage: (keys map)
Returns a sequence of the map's keys.

    
    
    Source
  


keyword

function
Usage: (keyword name)
       (keyword ns name)
Returns a Keyword with the given namespace and name.  Do not use :
in the keyword strings, it will be added automatically.

    
    
    Source
  


keyword?

function
Usage: (keyword? x)
Return true if x is a Keyword

    
    
    Source
  


last

function
Usage: (last coll)
Return the last item in coll, in linear time

    
    
    Source
  


lazy-cat

macro
Usage: (lazy-cat & colls)
Expands to code which yields a lazy sequence of the concatenation
of the supplied colls.  Each coll expr is not evaluated until it is
needed. 

(lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))

    
    
    Source
  


lazy-seq

macro
Usage: (lazy-seq & body)
Takes a body of expressions that returns an ISeq or nil, and yields
a Seqable object that will invoke the body only the first time seq
is called, and will cache the result and return it on all subsequent
seq calls.

    
    
    Source
  


let

macro
Usage: (let bindings & body)
Evaluates the exprs in a lexical context in which the symbols in
the binding-forms are bound to their respective init-exprs or parts
therein.

    
    
    Source
  


letfn

macro
Usage: (letfn fnspecs & body)
Takes a vector of function specs and a body, and generates a set of
bindings of functions to their names. All of the names are available
in all of the definitions of the functions, as well as the body.

fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)

    
    
    Source
  


line-seq

function
Usage: (line-seq rdr)
Returns the lines of text from rdr as a lazy sequence of strings.
rdr must implement java.io.BufferedReader.

    
    
    Source
  


list

function
Usage: (list & items)
Creates a new list containing the items.

    
    
    Source
  


list*

function
Usage: (list* args)
       (list* a args)
       (list* a b args)
       (list* a b c args)
       (list* a b c d & more)
Creates a new list containing the items prepended to the rest, the
last of which will be treated as a sequence.

    
    
    Source
  


list?

function
Usage: (list? x)
Returns true if x implements IPersistentList

    
    
    Source
  


load

function
Usage: (load & paths)
Loads Clojure code from resources in classpath. A path is interpreted as
classpath-relative if it begins with a slash or relative to the root
directory for the current namespace otherwise.

    
    
    Source
  


load-file

function
Usage: (load-file name)
Sequentially read and evaluate the set of forms contained in the file.

    
    
    
  


load-reader

function
Usage: (load-reader rdr)
Sequentially read and evaluate the set of forms contained in the
stream/file

    
    
    Source
  


load-string

function
Usage: (load-string s)
Sequentially read and evaluate the set of forms contained in the
string

    
    
    Source
  


loaded-libs

function
Usage: (loaded-libs)
Returns a sorted set of symbols naming the currently loaded libs

    
    
    Source
  


locking

macro
Usage: (locking x & body)
Executes exprs in an implicit do, while holding the monitor of x.
Will release the monitor of x in all circumstances.

    
    
    Source
  


long

function
Usage: (long x)
Coerce to long

    
    
    Source
  


long-array

function
Usage: (long-array size-or-seq)
       (long-array size init-val-or-seq)
Creates an array of longs

    
    
    Source
  


longs

function
Usage: (longs xs)
Casts to long[]

    
    
    Source
  


loop

macro
Usage: (loop bindings & body)
Evaluates the exprs in a lexical context in which the symbols in
the binding-forms are bound to their respective init-exprs or parts
therein. Acts as a recur target.

    
    
    Source
  


macroexpand

function
Usage: (macroexpand form)
Repeatedly calls macroexpand-1 on form until it no longer
represents a macro form, then returns it.  Note neither
macroexpand-1 nor macroexpand expand macros in subforms.

    
    
    Source
  


macroexpand-1

function
Usage: (macroexpand-1 form)
If form represents a macro form, returns its expansion,
else returns form.

    
    
    Source
  


make-array

function
Usage: (make-array type len)
       (make-array type dim & more-dims)
Creates and returns an array of instances of the specified class of
the specified dimension(s).  Note that a class object is required.
Class objects can be obtained by using their imported or
fully-qualified name.  Class objects for the primitive types can be
obtained using, e.g., Integer/TYPE.

    
    
    Source
  


make-hierarchy

function
Usage: (make-hierarchy)
Creates a hierarchy object for use with derive, isa? etc.

    
    
    Source
  


map

function
Usage: (map f coll)
       (map f c1 c2)
       (map f c1 c2 c3)
       (map f c1 c2 c3 & colls)
Returns a lazy sequence consisting of the result of applying f to the
set of first items of each coll, followed by applying f to the set
of second items in each coll, until any one of the colls is
exhausted.  Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments.

    
    
    Source
  


map?

function
Usage: (map? x)
Return true if x implements IPersistentMap

    
    
    Source
  


mapcat

function
Usage: (mapcat f & colls)
Returns the result of applying concat to the result of applying map
to f and colls.  Thus function f should return a collection.

    
    
    Source
  


max

function
Usage: (max x)
       (max x y)
       (max x y & more)
Returns the greatest of the nums.

    
    
    Source
  


max-key

function
Usage: (max-key k x)
       (max-key k x y)
       (max-key k x y & more)
Returns the x for which (k x), a number, is greatest.

    
    
    Source
  


memfn

macro
Usage: (memfn name & args)
Expands into code that creates a fn that expects to be passed an
object and any args and calls the named instance method on the
object passing the args. Use when you want to treat a Java method as
a first-class fn.

    
    
    Source
  


memoize

function
Usage: (memoize f)
Returns a memoized version of a referentially transparent function. The
memoized version of the function keeps a cache of the mapping from arguments
to results and, when calls with the same arguments are repeated often, has
higher performance at the expense of higher memory use.

    
    
    Source
  


merge

function
Usage: (merge & maps)
Returns a map that consists of the rest of the maps conj-ed onto
the first.  If a key occurs in more than one map, the mapping from
the latter (left-to-right) will be the mapping in the result.

    
    
    Source
  


merge-with

function
Usage: (merge-with f & maps)
Returns a map that consists of the rest of the maps conj-ed onto
the first.  If a key occurs in more than one map, the mapping(s)
from the latter (left-to-right) will be combined with the mapping in
the result by calling (f val-in-result val-in-latter).

    
    
    Source
  


meta

function
Usage: (meta obj)
Returns the metadata of obj, returns nil if there is no metadata.

    
    
    Source
  


methods

function
Usage: (methods multifn)
Given a multimethod, returns a map of dispatch values -> dispatch fns

    
    
    Source
  


min

function
Usage: (min x)
       (min x y)
       (min x y & more)
Returns the least of the nums.

    
    
    Source
  


min-key

function
Usage: (min-key k x)
       (min-key k x y)
       (min-key k x y & more)
Returns the x for which (k x), a number, is least.

    
    
    Source
  


mod

function
Usage: (mod num div)
Modulus of num and div. Truncates toward negative infinity.

    
    
    Source
  


monitor-enter

special form
Usage: (monitor-enter x)
Synchronization primitive that should be avoided
in user code. Use the 'locking' macro.

Please see https://clojure.org/reference/special_forms#monitor-enter

    Added in Clojure version 1.0


monitor-exit

special form
Usage: (monitor-exit x)
Synchronization primitive that should be avoided
in user code. Use the 'locking' macro.

Please see https://clojure.org/reference/special_forms#monitor-exit

    Added in Clojure version 1.0


name

function
Usage: (name x)
Returns the name String of a symbol or keyword.

    
    
    Source
  


namespace

function
Usage: (namespace x)
Returns the namespace String of a symbol or keyword, or nil if not present.

    
    
    Source
  


neg?

function
Usage: (neg? x)
Returns true if num is less than zero, else false

    
    
    Source
  


new

special form
Usage: (Classname. args*)
       (new Classname args*)
The args, if any, are evaluated from left to right, and
passed to the constructor of the class named by Classname. The
constructed object is returned.

Please see https://clojure.org/java_interop#new

    Added in Clojure version 1.0


newline

function
Usage: (newline)
Writes a newline to the output stream that is the current value of
*out*

    
    
    Source
  


next

function
Usage: (next coll)
Returns a seq of the items after the first. Calls seq on its
argument.  If there are no more items, returns nil.

    
    
    Source
  


nfirst

function
Usage: (nfirst x)
Same as (next (first x))

    
    
    Source
  


nil?

function
Usage: (nil? x)
Returns true if x is nil, false otherwise.

    
    
    Source
  


nnext

function
Usage: (nnext x)
Same as (next (next x))

    
    
    Source
  


not

function
Usage: (not x)
Returns true if x is logical false, false otherwise.

    
    
    Source
  


not-any?

function
Usage: (not-any? pred coll)
Returns false if (pred x) is logical true for any x in coll,
else true.

    
    
    Source
  


not-empty

function
Usage: (not-empty coll)
If coll is empty, returns nil, else coll

    
    
    Source
  


not-every?

function
Usage: (not-every? pred coll)
Returns false if (pred x) is logical true for every x in
coll, else true.

    
    
    Source
  


not=

function
Usage: (not= x)
       (not= x y)
       (not= x y & more)
Same as (not (= obj1 obj2))

    
    
    Source
  


ns

macro
Usage: (ns name & references)
Sets *ns* to the namespace named by name (unevaluated), creating it
if needed.  references can be zero or more of: (:refer-clojure ...)
(:require ...) (:use ...) (:import ...) (:load ...) (:gen-class)
with the syntax of refer-clojure/require/use/import/load/gen-class
respectively, except the arguments are unevaluated and need not be
quoted. (:gen-class ...), when supplied, defaults to :name
corresponding to the ns name, :main true, :impl-ns same as ns, and
:init-impl-ns true. All options of gen-class are
supported. The :gen-class directive is ignored when not
compiling. If :gen-class is not supplied, when compiled only an
nsname__init.class will be generated. If :refer-clojure is not used, a
default (refer 'clojure) is used.  Use of ns is preferred to
individual calls to in-ns/require/use/import:

(ns foo.bar
  (:refer-clojure :exclude [ancestors printf])
  (:require (clojure.contrib sql sql.tests))
  (:use (my.lib this that))
  (:import (java.util Date Timer Random)
            (java.sql Connection Statement)))

    
    
    Source
  


ns-aliases

function
Usage: (ns-aliases ns)
Returns a map of the aliases for the namespace.

    
    
    Source
  


ns-imports

function
Usage: (ns-imports ns)
Returns a map of the import mappings for the namespace.

    
    
    Source
  


ns-interns

function
Usage: (ns-interns ns)
Returns a map of the intern mappings for the namespace.

    
    
    Source
  


ns-map

function
Usage: (ns-map ns)
Returns a map of all the mappings for the namespace.

    
    
    Source
  


ns-name

function
Usage: (ns-name ns)
Returns the name of the namespace, a symbol.

    
    
    Source
  


ns-publics

function
Usage: (ns-publics ns)
Returns a map of the public intern mappings for the namespace.

    
    
    Source
  


ns-refers

function
Usage: (ns-refers ns)
Returns a map of the refer mappings for the namespace.

    
    
    Source
  


ns-resolve

function
Usage: (ns-resolve ns sym)
Returns the var or Class to which a symbol will be resolved in the
namespace, else nil.  Note that if the symbol is fully qualified,
the var/Class to which it resolves need not be present in the
namespace.

    
    
    Source
  


ns-unalias

function
Usage: (ns-unalias ns sym)
Removes the alias for the symbol from the namespace.

    
    
    Source
  


ns-unmap

function
Usage: (ns-unmap ns sym)
Removes the mappings for the symbol from the namespace.

    
    
    Source
  


nth

function
Usage: (nth coll index)
       (nth coll index not-found)
Returns the value at the index. get returns nil if index out of
bounds, nth throws an exception unless not-found is supplied.  nth
also works for strings, Java arrays, regex Matchers and Lists, and,
in O(n) time, for sequences.

    
    
    Source
  


nthnext

function
Usage: (nthnext coll n)
Returns the nth next of coll, (seq coll) when n is 0.

    
    
    Source
  


num

function
Usage: (num x)
Coerce to Number

    
    
    Source
  


number?

function
Usage: (number? x)
Returns true if x is a Number

    
    
    Source
  


odd?

function
Usage: (odd? n)
Returns true if n is odd, throws an exception if n is not an integer

    
    
    Source
  


or

macro
Usage: (or)
       (or x)
       (or x & next)
Evaluates exprs one at a time, from left to right. If a form
returns a logical true value, or returns that value and doesn't
evaluate any of the other expressions, otherwise it returns the
value of the last expression. (or) returns nil.

    
    
    Source
  


parents

function
Usage: (parents tag)
       (parents h tag)
Returns the immediate parents of tag, either via a Java type
inheritance relationship or a relationship established via derive. h
must be a hierarchy obtained from make-hierarchy, if not supplied
defaults to the global hierarchy

    
    
    Source
  


partial

function
Usage: (partial f arg1)
       (partial f arg1 arg2)
       (partial f arg1 arg2 arg3)
       (partial f arg1 arg2 arg3 & more)
Takes a function f and fewer than the normal arguments to f, and
returns a fn that takes a variable number of additional args. When
called, the returned function calls f with args + additional args.

    
    
    Source
  


partition

function
Usage: (partition n coll)
       (partition n step coll)
       (partition n step pad coll)
Returns a lazy sequence of lists of n items each, at offsets step
apart. If step is not supplied, defaults to n, i.e. the partitions
do not overlap. If a pad collection is supplied, use its elements as
necessary to complete last partition upto n items. In case there are
not enough padding elements, return a partition with less than n items.

    
    
    Source
  


pcalls

function
Usage: (pcalls & fns)
Executes the no-arg fns in parallel, returning a lazy sequence of
their values

    
    
    Source
  


peek

function
Usage: (peek coll)
For a list or queue, same as first, for a vector, same as, but much
more efficient than, last. If the collection is empty, returns nil.

    
    
    Source
  


persistent!

function
Usage: (persistent! coll)
Alpha - subject to change.
Returns a new, persistent version of the transient collection, in
constant time. The transient collection cannot be used after this
call, any such use will throw an exception.

    
    
    Source
  


pmap

function
Usage: (pmap f coll)
       (pmap f coll & colls)
Like map, except f is applied in parallel. Semi-lazy in that the
parallel computation stays ahead of the consumption, but doesn't
realize the entire result unless required. Only useful for
computationally intensive functions where the time of f dominates
the coordination overhead.

    
    
    Source
  


pop

function
Usage: (pop coll)
For a list or queue, returns a new list/queue without the first
item, for a vector, returns a new vector without the last item. If
the collection is empty, throws an exception.  Note - not the same
as next/butlast.

    
    
    Source
  


pop!

function
Usage: (pop! coll)
Alpha - subject to change.
Removes the last item from a transient vector. If
the collection is empty, throws an exception. Returns coll

    
    
    Source
  


pop-thread-bindings

function
Usage: (pop-thread-bindings)
Pop one set of bindings pushed with push-binding before. It is an error to
pop bindings without pushing before.

    
    
    Source
  


pos?

function
Usage: (pos? x)
Returns true if num is greater than zero, else false

    
    
    Source
  


pr

function
Usage: (pr)
       (pr x)
       (pr x & more)
Prints the object(s) to the output stream that is the current value
of *out*.  Prints the object(s), separated by spaces if there is
more than one.  By default, pr and prn print in a way that objects
can be read by the reader

    
    
    Source
  


pr-str

function
Usage: (pr-str & xs)
pr to a string, returning it

    
    
    Source
  


prefer-method

function
Usage: (prefer-method multifn dispatch-val-x dispatch-val-y)
Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y 
when there is a conflict

    
    
    Source
  


prefers

function
Usage: (prefers multifn)
Given a multimethod, returns a map of preferred value -> set of other values

    
    
    Source
  


print

function
Usage: (print & more)
Prints the object(s) to the output stream that is the current value
of *out*.  print and println produce output for human consumption.

    
    
    Source
  


print-namespace-doc

function
Usage: (print-namespace-doc nspace)
Print the documentation string of a Namespace.

    
    
    Source
  


print-str

function
Usage: (print-str & xs)
print to a string, returning it

    
    
    Source
  


printf

function
Usage: (printf fmt & args)
Prints formatted output, as per format

    
    
    Source
  


println

function
Usage: (println & more)
Same as print followed by (newline)

    
    
    Source
  


println-str

function
Usage: (println-str & xs)
println to a string, returning it

    
    
    Source
  


prn

function
Usage: (prn & more)
Same as pr followed by (newline). Observes *flush-on-newline*

    
    
    Source
  


prn-str

function
Usage: (prn-str & xs)
prn to a string, returning it

    
    
    Source
  


promise

function
Usage: (promise)
Alpha - subject to change.
Returns a promise object that can be read with deref/@, and set,
once only, with deliver. Calls to deref/@ prior to delivery will
block. All subsequent derefs will return the same delivered value
without blocking.

    
    
    Source
  


proxy

macro
Usage: (proxy class-and-interfaces args & fs)
class-and-interfaces - a vector of class names

args - a (possibly empty) vector of arguments to the superclass
constructor.

f => (name [params*] body) or
(name ([params*] body) ([params+] body) ...)

Expands to code which creates a instance of a proxy class that
implements the named class/interface(s) by calling the supplied
fns. A single class, if provided, must be first. If not provided it
defaults to Object.

The interfaces names must be valid interface types. If a method fn
is not provided for a class method, the superclass methd will be
called. If a method fn is not provided for an interface method, an
UnsupportedOperationException will be thrown should it be
called. Method fns are closures and can capture the environment in
which proxy is called. Each method fn takes an additional implicit
first arg, which is bound to 'this. Note that while method fns can
be provided to override protected methods, they have no other access
to protected members, nor to super, as these capabilities cannot be
proxied.

    
    
    Source
  


proxy-mappings

function
Usage: (proxy-mappings proxy)
Takes a proxy instance and returns the proxy's fn map.

    
    
    Source
  


proxy-super

macro
Usage: (proxy-super meth & args)
Use to call a superclass method in the body of a proxy method. 
Note, expansion captures 'this

    
    
    Source
  


push-thread-bindings

function
Usage: (push-thread-bindings bindings)
WARNING: This is a low-level function. Prefer high-level macros like
binding where ever possible.

Takes a map of Var/value pairs. Binds each Var to the associated value for
the current thread. Each call *MUST* be accompanied by a matching call to
pop-thread-bindings wrapped in a try-finally!

    (push-thread-bindings bindings)
    (try
      ...
      (finally
        (pop-thread-bindings)))

    
    
    Source
  


pvalues

macro
Usage: (pvalues & exprs)
Returns a lazy sequence of the values of the exprs, which are
evaluated in parallel

    
    
    Source
  


quot

function
Usage: (quot num div)
quot[ient] of dividing numerator by denominator.

    
    
    Source
  


quote

special form
Usage: (quote form)
Yields the unevaluated form.

Please see https://clojure.org/reference/special_forms#quote

    Added in Clojure version 1.0


rand

function
Usage: (rand)
       (rand n)
Returns a random floating point number between 0 (inclusive) and
n (default 1) (exclusive).

    
    
    Source
  


rand-int

function
Usage: (rand-int n)
Returns a random integer between 0 (inclusive) and n (exclusive).

    
    
    Source
  


range

function
Usage: (range end)
       (range start end)
       (range start end step)
Returns a lazy seq of nums from start (inclusive) to end
(exclusive), by step, where start defaults to 0 and step to 1.

    
    
    Source
  


ratio?

function
Usage: (ratio? n)
Returns true if n is a Ratio

    
    
    Source
  


rationalize

function
Usage: (rationalize num)
returns the rational value of num

    
    
    Source
  


re-find

function
Usage: (re-find m)
       (re-find re s)
Returns the next regex match, if any, of string to pattern, using
java.util.regex.Matcher.find().  Uses re-groups to return the
groups.

    
    
    Source
  


re-groups

function
Usage: (re-groups m)
Returns the groups from the most recent match/find. If there are no
nested groups, returns a string of the entire match. If there are
nested groups, returns a vector of the groups, the first element
being the entire match.

    
    
    Source
  


re-matcher

function
Usage: (re-matcher re s)
Returns an instance of java.util.regex.Matcher, for use, e.g. in
re-find.

    
    
    Source
  


re-matches

function
Usage: (re-matches re s)
Returns the match, if any, of string to pattern, using
java.util.regex.Matcher.matches().  Uses re-groups to return the
groups.

    
    
    Source
  


re-pattern

function
Usage: (re-pattern s)
Returns an instance of java.util.regex.Pattern, for use, e.g. in
re-matcher.

    
    
    Source
  


re-seq

function
Usage: (re-seq re s)
Returns a lazy sequence of successive matches of pattern in string,
using java.util.regex.Matcher.find(), each such match processed with
re-groups.

    
    
    Source
  


read

function
Usage: (read)
       (read stream)
       (read stream eof-error? eof-value)
       (read stream eof-error? eof-value recursive?)
Reads the next object from stream, which must be an instance of
java.io.PushbackReader or some derivee.  stream defaults to the
current value of *in* .

    
    
    Source
  


read-line

function
Usage: (read-line)
Reads the next line from stream that is the current value of *in* .

    
    
    Source
  


read-string

function
Usage: (read-string s)
Reads one object from the string s

    
    
    Source
  


recur

special form
Usage: (recur exprs*)
Evaluates the exprs in order, then, in parallel, rebinds
the bindings of the recursion point to the values of the exprs.
Execution then jumps back to the recursion point, a loop or fn method.

Please see https://clojure.org/reference/special_forms#recur

    Added in Clojure version 1.0


reduce

function
Usage: (reduce f coll)
       (reduce f val coll)
f should be a function of 2 arguments. If val is not supplied,
returns the result of applying f to the first 2 items in coll, then
applying f to that result and the 3rd item, etc. If coll contains no
items, f must accept no arguments as well, and reduce returns the
result of calling f with no arguments.  If coll has only 1 item, it
is returned and f is not called.  If val is supplied, returns the
result of applying f to val and the first item in coll, then
applying f to that result and the 2nd item, etc. If coll contains no
items, returns val and f is not called.

    
    
    Source
  


ref

function
Usage: (ref x)
       (ref x & options)
Creates and returns a Ref with an initial value of x and zero or
more options (in any order):

:meta metadata-map

:validator validate-fn

:min-history (default 0)
:max-history (default 10)

If metadata-map is supplied, it will be come the metadata on the
ref. validate-fn must be nil or a side-effect-free fn of one
argument, which will be passed the intended new state on any state
change. If the new state is unacceptable, the validate-fn should
return false or throw an exception. validate-fn will be called on
transaction commit, when all refs have their final values.

Normally refs accumulate history dynamically as needed to deal with
read demands. If you know in advance you will need history you can
set :min-history to ensure it will be available when first needed (instead
of after a read fault). History is limited, and the limit can be set
with :max-history.

    
    
    Source
  


ref-history-count

function
Usage: (ref-history-count ref)
Returns the history count of a ref

    
    
    Source
  


ref-max-history

function
Usage: (ref-max-history ref)
       (ref-max-history ref n)
Gets the max-history of a ref, or sets it and returns the ref

    
    
    Source
  


ref-min-history

function
Usage: (ref-min-history ref)
       (ref-min-history ref n)
Gets the min-history of a ref, or sets it and returns the ref

    
    
    Source
  


ref-set

function
Usage: (ref-set ref val)
Must be called in a transaction. Sets the value of ref.
Returns val.

    
    
    Source
  


refer

function
Usage: (refer ns-sym & filters)
refers to all public vars of ns, subject to filters.
filters can include at most one each of:

:exclude list-of-symbols
:only list-of-symbols
:rename map-of-fromsymbol-tosymbol

For each public interned var in the namespace named by the symbol,
adds a mapping from the name of the var to the var to the current
namespace.  Throws an exception if name is already mapped to
something else in the current namespace. Filters can be used to
select a subset, via inclusion or exclusion, or to provide a mapping
to a symbol different from the var's name, in order to prevent
clashes. Use :use in the ns macro in preference to calling this directly.

    
    
    Source
  


refer-clojure

macro
Usage: (refer-clojure & filters)
Same as (refer 'clojure.core <filters>)

    
    
    Source
  


release-pending-sends

function
Usage: (release-pending-sends)
Normally, actions sent directly or indirectly during another action
are held until the action completes (changes the agent's
state). This function can be used to dispatch any pending sent
actions immediately. This has no impact on actions sent during a
transaction, which are still held until commit. If no action is
occurring, does nothing. Returns the number of actions dispatched.

    
    
    Source
  


rem

function
Usage: (rem num div)
remainder of dividing numerator by denominator.

    
    
    Source
  


remove

function
Usage: (remove pred coll)
Returns a lazy sequence of the items in coll for which
(pred item) returns false. pred must be free of side-effects.

    
    
    Source
  


remove-method

function
Usage: (remove-method multifn dispatch-val)
Removes the method of multimethod associated with dispatch-value.

    
    
    Source
  


remove-ns

function
Usage: (remove-ns sym)
Removes the namespace named by the symbol. Use with caution.
Cannot be used to remove the clojure namespace.

    
    
    Source
  


remove-watch

function
Usage: (remove-watch reference key)
Alpha - subject to change.
Removes a watch (set by add-watch) from a reference

    
    
    Source
  


repeat

function
Usage: (repeat x)
       (repeat n x)
Returns a lazy (infinite!, or length n if supplied) sequence of xs.

    
    
    Source
  


repeatedly

function
Usage: (repeatedly f)
Takes a function of no args, presumably with side effects, and returns an infinite
lazy sequence of calls to it

    
    
    Source
  


replace

function
Usage: (replace smap coll)
Given a map of replacement pairs and a vector/collection, returns a
vector/seq with any elements = a key in smap replaced with the
corresponding val in smap

    
    
    Source
  


replicate

function
Usage: (replicate n x)
Returns a lazy seq of n xs.

    
    
    Source
  


require

function
Usage: (require & args)
Loads libs, skipping any that are already loaded. Each argument is
either a libspec that identifies a lib, a prefix list that identifies
multiple libs whose names share a common prefix, or a flag that modifies
how all the identified libs are loaded. Use :require in the ns macro
in preference to calling this directly.

Libs

A 'lib' is a named set of resources in classpath whose contents define a
library of Clojure code. Lib names are symbols and each lib is associated
with a Clojure namespace and a Java package that share its name. A lib's
name also locates its root directory within classpath using Java's
package name to classpath-relative path mapping. All resources in a lib
should be contained in the directory structure under its root directory.
All definitions a lib makes should be in its associated namespace.

'require loads a lib by loading its root resource. The root resource path
is derived from the lib name in the following manner:
Consider a lib named by the symbol 'x.y.z; it has the root directory
<classpath>/x/y/, and its root resource is <classpath>/x/y/z.clj. The root
resource should contain code to create the lib's namespace (usually by using
the ns macro) and load any additional lib resources.

Libspecs

A libspec is a lib name or a vector containing a lib name followed by
options expressed as sequential keywords and arguments.

Recognized options: :as
:as takes a symbol as its argument and makes that symbol an alias to the
  lib's namespace in the current namespace.

Prefix Lists

It's common for Clojure code to depend on several libs whose names have
the same prefix. When specifying libs, prefix lists can be used to reduce
repetition. A prefix list contains the shared prefix followed by libspecs
with the shared prefix removed from the lib names. After removing the
prefix, the names that remain must not contain any periods.

Flags

A flag is a keyword.
Recognized flags: :reload, :reload-all, :verbose
:reload forces loading of all the identified libs even if they are
  already loaded
:reload-all implies :reload and also forces loading of all libs that the
  identified libs directly or indirectly load via require or use
:verbose triggers printing information about each load, alias, and refer

Example:

The following would load the libraries clojure.zip and clojure.set
abbreviated as 's'.

(require '(clojure zip [set :as s]))

    
    
    Source
  


reset!

function
Usage: (reset! atom newval)
Sets the value of atom to newval without regard for the
current value. Returns newval.

    
    
    Source
  


reset-meta!

function
Usage: (reset-meta! iref metadata-map)
Atomically resets the metadata for a namespace/var/ref/agent/atom

    
    
    Source
  


resolve

function
Usage: (resolve sym)
same as (ns-resolve *ns* symbol)

    
    
    Source
  


rest

function
Usage: (rest coll)
Returns a possibly empty seq of the items after the first. Calls seq on its
argument.

    
    
    Source
  


resultset-seq

function
Usage: (resultset-seq rs)
Creates and returns a lazy sequence of structmaps corresponding to
the rows in the java.sql.ResultSet rs

    
    
    Source
  


reverse

function
Usage: (reverse coll)
Returns a seq of the items in coll in reverse order. Not lazy.

    
    
    Source
  


reversible?

function
Usage: (reversible? coll)
Returns true if coll implements Reversible

    
    
    Source
  


rseq

function
Usage: (rseq rev)
Returns, in constant time, a seq of the items in rev (which
can be a vector or sorted-map), in reverse order. If rev is empty returns nil

    
    
    Source
  


rsubseq

function
Usage: (rsubseq sc test key)
       (rsubseq sc start-test start-key end-test end-key)
sc must be a sorted collection, test(s) one of <, <=, > or
>=. Returns a reverse seq of those entries with keys ek for
which (test (.. sc comparator (compare ek key)) 0) is true

    
    
    Source
  


second

function
Usage: (second x)
Same as (first (next x))

    
    
    Source
  


select-keys

function
Usage: (select-keys map keyseq)
Returns a map containing only those entries in map whose key is in keys

    
    
    Source
  


send

function
Usage: (send a f & args)
Dispatch an action to an agent. Returns the agent immediately.
Subsequently, in a thread from a thread pool, the state of the agent
will be set to the value of:

(apply action-fn state-of-agent args)

    
    
    Source
  


send-off

function
Usage: (send-off a f & args)
Dispatch a potentially blocking action to an agent. Returns the
agent immediately. Subsequently, in a separate thread, the state of
the agent will be set to the value of:

(apply action-fn state-of-agent args)

    
    
    Source
  


seq

function
Usage: (seq coll)
Returns a seq on the collection. If the collection is
empty, returns nil.  (seq nil) returns nil. seq also works on
Strings, native Java arrays (of reference types) and any objects
that implement Iterable.

    
    
    Source
  


seq?

function
Usage: (seq? x)
Return true if x implements ISeq

    
    
    Source
  


seque

function
Usage: (seque s)
       (seque n-or-q s)
Creates a queued seq on another (presumably lazy) seq s. The queued
seq will produce a concrete seq in the background, and can get up to
n items ahead of the consumer. n-or-q can be an integer n buffer
size, or an instance of java.util.concurrent BlockingQueue. Note
that reading from a seque can block if the reader gets ahead of the
producer.

    
    
    Source
  


sequence

function
Usage: (sequence coll)
Coerces coll to a (possibly empty) sequence, if it is not already
one. Will not force a lazy seq. (sequence nil) yields ()

    
    
    Source
  


sequential?

function
Usage: (sequential? coll)
Returns true if coll implements Sequential

    
    
    Source
  


set

function
Usage: (set coll)
Returns a set of the distinct elements of coll.

    
    
    Source
  


set!

special form
Usage: (set! var-symbol expr)
       (set! (. instance-expr instanceFieldName-symbol) expr)
       (set! (. Classname-symbol staticFieldName-symbol) expr)
Used to set thread-local-bound vars, Java object instance
fields, and Java class static fields.

Please see https://clojure.org/vars#set

    Added in Clojure version 1.0


set-validator!

function
Usage: (set-validator! iref validator-fn)
Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a
side-effect-free fn of one argument, which will be passed the intended
new state on any state change. If the new state is unacceptable, the
validator-fn should return false or throw an exception. If the current state (root
value if var) is not acceptable to the new validator, an exception
will be thrown and the validator will not be changed.

    
    
    Source
  


set?

function
Usage: (set? x)
Returns true if x implements IPersistentSet

    
    
    Source
  


short

function
Usage: (short x)
Coerce to short

    
    
    Source
  


short-array

function
Usage: (short-array size-or-seq)
       (short-array size init-val-or-seq)
Creates an array of shorts

    
    
    Source
  


shorts

function
Usage: (shorts xs)
Casts to shorts[]

    
    
    Source
  


shutdown-agents

function
Usage: (shutdown-agents)
Initiates a shutdown of the thread pools that back the agent
system. Running actions will complete, but no new actions will be
accepted

    
    
    Source
  


slurp

function
Usage: (slurp f)
       (slurp f enc)
Reads the file named by f using the encoding enc into a string
and returns it.

    
    
    Source
  


some

function
Usage: (some pred coll)
Returns the first logical true value of (pred x) for any x in coll,
else nil.  One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)

    
    
    Source
  


sort

function
Usage: (sort coll)
       (sort comp coll)
Returns a sorted sequence of the items in coll. If no comparator is
supplied, uses compare. comparator must
implement java.util.Comparator.

    
    
    Source
  


sort-by

function
Usage: (sort-by keyfn coll)
       (sort-by keyfn comp coll)
Returns a sorted sequence of the items in coll, where the sort
order is determined by comparing (keyfn item).  If no comparator is
supplied, uses compare. comparator must
implement java.util.Comparator.

    
    
    Source
  


sorted-map

function
Usage: (sorted-map & keyvals)
keyval => key val
Returns a new sorted map with supplied mappings.

    
    
    Source
  


sorted-map-by

function
Usage: (sorted-map-by comparator & keyvals)
keyval => key val
Returns a new sorted map with supplied mappings, using the supplied comparator.

    
    
    Source
  


sorted-set

function
Usage: (sorted-set & keys)
Returns a new sorted set with supplied keys.

    
    
    Source
  


sorted-set-by

function
Usage: (sorted-set-by comparator & keys)
Returns a new sorted set with supplied keys, using the supplied comparator.

    
    
    Source
  


sorted?

function
Usage: (sorted? coll)
Returns true if coll implements Sorted

    
    
    Source
  


special-form-anchor

function
Usage: (special-form-anchor x)
Returns the anchor tag on http://clojure.org/special_forms for the
special form x, or nil

    
    
    Source
  


special-symbol?

function
Usage: (special-symbol? s)
Returns true if s names a special form

    
    
    Source
  


split-at

function
Usage: (split-at n coll)
Returns a vector of [(take n coll) (drop n coll)]

    
    
    Source
  


split-with

function
Usage: (split-with pred coll)
Returns a vector of [(take-while pred coll) (drop-while pred coll)]

    
    
    Source
  


str

function
Usage: (str)
       (str x)
       (str x & ys)
With no args, returns the empty string. With one arg x, returns
x.toString().  (str nil) returns the empty string. With more than
one arg, returns the concatenation of the str values of the args.

    
    
    Source
  


stream?

function
Usage: (stream? x)
Returns true if x is an instance of Stream

    
    
    Source
  


string?

function
Usage: (string? x)
Return true if x is a String

    
    
    Source
  


struct

function
Usage: (struct s & vals)
Returns a new structmap instance with the keys of the
structure-basis. vals must be supplied for basis keys in order -
where values are not supplied they will default to nil.

    
    
    Source
  


struct-map

function
Usage: (struct-map s & inits)
Returns a new structmap instance with the keys of the
structure-basis. keyvals may contain all, some or none of the basis
keys - where values are not supplied they will default to nil.
keyvals can also contain keys not in the basis.

    
    
    Source
  


subs

function
Usage: (subs s start)
       (subs s start end)
Returns the substring of s beginning at start inclusive, and ending
at end (defaults to length of string), exclusive.

    
    
    Source
  


subseq

function
Usage: (subseq sc test key)
       (subseq sc start-test start-key end-test end-key)
sc must be a sorted collection, test(s) one of <, <=, > or
>=. Returns a seq of those entries with keys ek for
which (test (.. sc comparator (compare ek key)) 0) is true

    
    
    Source
  


subvec

function
Usage: (subvec v start)
       (subvec v start end)
Returns a persistent vector of the items in vector from
start (inclusive) to end (exclusive).  If end is not supplied,
defaults to (count vector). This operation is O(1) and very fast, as
the resulting vector shares structure with the original and no
trimming is done.

    
    
    Source
  


supers

function
Usage: (supers class)
Returns the immediate and indirect superclasses and interfaces of c, if any

    
    
    Source
  


swap!

function
Usage: (swap! atom f)
       (swap! atom f x)
       (swap! atom f x y)
       (swap! atom f x y & args)
Atomically swaps the value of atom to be:
(apply f current-value-of-atom args). Note that f may be called
multiple times, and thus should be free of side effects.  Returns
the value that was swapped in.

    
    
    Source
  


symbol

function
Usage: (symbol name)
       (symbol ns name)
Returns a Symbol with the given namespace and name.

    
    
    Source
  


symbol?

function
Usage: (symbol? x)
Return true if x is a Symbol

    
    
    Source
  


sync

macro
Usage: (sync flags-ignored-for-now & body)
transaction-flags => TBD, pass nil for now

Runs the exprs (in an implicit do) in a transaction that encompasses
exprs and any nested calls.  Starts a transaction if none is already
running on this thread. Any uncaught exception will abort the
transaction and flow out of sync. The exprs may be run more than
once, but any effects on Refs will be atomic.

    
    
    Source
  


syntax-symbol-anchor

function
Usage: (syntax-symbol-anchor x)
Returns the anchor tag on http://clojure.org/special_forms for the
special form that uses syntax symbol x, or nil

    
    
    Source
  


take

function
Usage: (take n coll)
Returns a lazy sequence of the first n items in coll, or all items if
there are fewer than n.

    
    
    Source
  


take-last

function
Usage: (take-last n coll)
Returns a seq of the last n items in coll.  Depending on the type
of coll may be no better than linear time.  For vectors, see also subvec.

    
    
    Source
  


take-nth

function
Usage: (take-nth n coll)
Returns a lazy seq of every nth item in coll.

    
    
    Source
  


take-while

function
Usage: (take-while pred coll)
Returns a lazy sequence of successive items from coll while
(pred item) returns true. pred must be free of side-effects.

    
    
    Source
  


test

function
Usage: (test v)
test [v] finds fn at key :test in var metadata and calls it,
presuming failure will throw exception

    
    
    Source
  


the-ns

function
Usage: (the-ns x)
If passed a namespace, returns it. Else, when passed a symbol,
returns the namespace named by it, throwing an exception if not
found.

    
    
    Source
  


throw

special form
Usage: (throw expr)
The expr is evaluated and thrown, therefore it should
yield an instance of some derivee of Throwable.

Please see https://clojure.org/reference/special_forms#throw

    Added in Clojure version 1.0


time

macro
Usage: (time expr)
Evaluates expr and prints the time it took.  Returns the value of
expr.

    
    
    Source
  


to-array

function
Usage: (to-array coll)
Returns an array of Objects containing the contents of coll, which
can be any Collection.  Maps to java.util.Collection.toArray().

    
    
    Source
  


to-array-2d

function
Usage: (to-array-2d coll)
Returns a (potentially-ragged) 2-dimensional array of Objects
containing the contents of coll, which can be any Collection of any
Collection.

    
    
    Source
  


trampoline

function
Usage: (trampoline f)
       (trampoline f & args)
trampoline can be used to convert algorithms requiring mutual
recursion without stack consumption. Calls f with supplied args, if
any. If f returns a fn, calls that fn with no arguments, and
continues to repeat, until the return value is not a fn, then
returns that non-fn value. Note that if you want to return a fn as a
final value, you must wrap it in some data structure and unpack it
after trampoline returns.

    
    
    Source
  


transient

function
Usage: (transient coll)
Alpha - subject to change.
Returns a new, transient version of the collection, in constant time.

    
    
    Source
  


tree-seq

function
Usage: (tree-seq branch? children root)
Returns a lazy sequence of the nodes in a tree, via a depth-first walk.
 branch? must be a fn of one arg that returns true if passed a node
 that can have children (but may not).  children must be a fn of one
 arg that returns a sequence of the children. Will only be called on
 nodes for which branch? returns true. Root is the root node of the
tree.

    
    
    Source
  


true?

function
Usage: (true? x)
Returns true if x is the value true, false otherwise.

    
    
    Source
  


try

special form
Usage: (try expr* catch-clause* finally-clause?)
catch-clause => (catch classname name expr*)
finally-clause => (finally expr*)

Catches and handles Java exceptions.

Please see https://clojure.org/reference/special_forms#try

    Added in Clojure version 1.0


type

function
Usage: (type x)
Returns the :type metadata of x, or its Class if none

    
    
    Source
  


unchecked-add

function
Usage: (unchecked-add x y)
Returns the sum of x and y, both int or long.
Note - uses a primitive operator subject to overflow.

    
    
    Source
  


unchecked-dec

function
Usage: (unchecked-dec x)
Returns a number one less than x, an int or long.
Note - uses a primitive operator subject to overflow.

    
    
    Source
  


unchecked-divide

function
Usage: (unchecked-divide x y)
Returns the division of x by y, both int or long.
Note - uses a primitive operator subject to truncation.

    
    
    Source
  


unchecked-inc

function
Usage: (unchecked-inc x)
Returns a number one greater than x, an int or long.
Note - uses a primitive operator subject to overflow.

    
    
    Source
  


unchecked-multiply

function
Usage: (unchecked-multiply x y)
Returns the product of x and y, both int or long.
Note - uses a primitive operator subject to overflow.

    
    
    Source
  


unchecked-negate

function
Usage: (unchecked-negate x)
Returns the negation of x, an int or long.
Note - uses a primitive operator subject to overflow.

    
    
    Source
  


unchecked-remainder

function
Usage: (unchecked-remainder x y)
Returns the remainder of division of x by y, both int or long.
Note - uses a primitive operator subject to truncation.

    
    
    Source
  


unchecked-subtract

function
Usage: (unchecked-subtract x y)
Returns the difference of x and y, both int or long.
Note - uses a primitive operator subject to overflow.

    
    
    Source
  


underive

function
Usage: (underive tag parent)
       (underive h tag parent)
Removes a parent/child relationship between parent and
tag. h must be a hierarchy obtained from make-hierarchy, if not
supplied defaults to, and modifies, the global hierarchy.

    
    
    Source
  


update-in

function
Usage: (update-in m [k & ks] f & args)
'Updates' a value in a nested associative structure, where ks is a
sequence of keys and f is a function that will take the old value
and any supplied args and return the new value, and returns a new
nested structure.  If any levels do not exist, hash-maps will be
created.

    
    
    Source
  


update-proxy

function
Usage: (update-proxy proxy mappings)
Takes a proxy instance and a map of strings (which must
correspond to methods of the proxy superclass/superinterfaces) to
fns (which must take arguments matching the corresponding method,
plus an additional (explicit) first arg corresponding to this, and
updates (via assoc) the proxy's fn map. nil can be passed instead of
a fn, in which case the corresponding method will revert to the
default behavior. Note that this function can be used to update the
behavior of an existing instance without changing its identity.

    
    
    Source
  


use

function
Usage: (use & args)
Like 'require, but also refers to each lib's namespace using
clojure.core/refer. Use :use in the ns macro in preference to calling
this directly.

'use accepts additional options in libspecs: :exclude, :only, :rename.
The arguments and semantics for :exclude, :only, and :rename are the same
as those documented for clojure.core/refer.

    
    
    Source
  


val

function
Usage: (val e)
Returns the value in the map entry.

    
    
    Source
  


vals

function
Usage: (vals map)
Returns a sequence of the map's values.

    
    
    Source
  


var

special form
Usage: (var symbol)
The symbol must resolve to a var, and the Var object
itself (not its value) is returned. The reader macro #'x
expands to (var x).

Please see https://clojure.org/reference/special_forms#var

    Added in Clojure version 1.0


var-get

function
Usage: (var-get x)
Gets the value in the var object

    
    
    Source
  


var-set

function
Usage: (var-set x val)
Sets the value in the var object to val. The var must be
thread-locally bound.

    
    
    Source
  


var?

function
Usage: (var? v)
Returns true if v is of type clojure.lang.Var

    
    
    Source
  


vary-meta

function
Usage: (vary-meta obj f & args)
Returns an object of the same type and value as obj, with
(apply f (meta obj) args) as its metadata.

    
    
    Source
  


vec

function
Usage: (vec coll)
Creates a new vector containing the contents of coll.

    
    
    Source
  


vector

function
Usage: (vector)
       (vector & args)
Creates a new vector containing the args.

    
    
    Source
  


vector?

function
Usage: (vector? x)
Return true if x implements IPersistentVector 

    
    
    Source
  


when

macro
Usage: (when test & body)
Evaluates test. If logical true, evaluates body in an implicit do.

    
    
    Source
  


when-first

macro
Usage: (when-first bindings & body)
bindings => x xs

Same as (when (seq xs) (let [x (first xs)] body))

    
    
    Source
  


when-let

macro
Usage: (when-let bindings & body)
bindings => binding-form test

When test is true, evaluates body with binding-form bound to the value of test

    
    
    Source
  


when-not

macro
Usage: (when-not test & body)
Evaluates test. If logical false, evaluates body in an implicit do.

    
    
    Source
  


while

macro
Usage: (while test & body)
Repeatedly executes body while test expression is true. Presumes
some side-effect will cause test to become false/nil. Returns nil

    
    
    Source
  


with-bindings

macro
Usage: (with-bindings binding-map & body)
Takes a map of Var/value pairs. Installs for the given Vars the associated
values as thread-local bindings. The executes body. Pops the installed
bindings after body was evaluated. Returns the value of body.

    
    
    Source
  


with-bindings*

function
Usage: (with-bindings* binding-map f & args)
Takes a map of Var/value pairs. Installs for the given Vars the associated
values as thread-local bindings. Then calls f with the supplied arguments.
Pops the installed bindings after f returned. Returns whatever f returns.

    
    
    Source
  


with-in-str

macro
Usage: (with-in-str s & body)
Evaluates body in a context in which *in* is bound to a fresh
StringReader initialized with the string s.

    
    
    Source
  


with-local-vars

macro
Usage: (with-local-vars name-vals-vec & body)
varbinding=> symbol init-expr

Executes the exprs in a context in which the symbols are bound to
vars with per-thread bindings to the init-exprs.  The symbols refer
to the var objects themselves, and must be accessed with var-get and
var-set

    
    
    Source
  


with-meta

function
Usage: (with-meta obj m)
Returns an object of the same type and value as obj, with
map m as its metadata.

    
    
    Source
  


with-open

macro
Usage: (with-open bindings & body)
bindings => [name init ...]

Evaluates body in a try expression with names bound to the values
of the inits, and a finally clause that calls (.close name) on each
name in reverse order.

    
    
    Source
  


with-out-str

macro
Usage: (with-out-str & body)
Evaluates exprs in a context in which *out* is bound to a fresh
StringWriter.  Returns the string created by any nested printing
calls.

    
    
    Source
  


with-precision

macro
Usage: (with-precision precision & exprs)
Sets the precision and rounding mode to be used for BigDecimal operations.

Usage: (with-precision 10 (/ 1M 3))
or:    (with-precision 10 :rounding HALF_DOWN (/ 1M 3))

The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN,
HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP.

    
    
    Source
  


xml-seq

function
Usage: (xml-seq root)
A tree seq on the xml elements as per xml/parse

    
    
    Source
  


zero?

function
Usage: (zero? x)
Returns true if num is zero, else false

    
    
    Source
  


zipmap

function
Usage: (zipmap keys vals)
Returns a map with the keys mapped to the corresponding vals.

    
    
    Source
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.