首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

clojure.core

完整名称空间名称:clojure.core

代码语言:javascript
复制
Fundamental library of the Clojure language

类型

ArrayChunktype

字段:am arr off end

议定书:

接口:clojure.lang.IChunk,clojure.lang.indeated

Eductiontype

字段:xform coll

议定书:

接口:clojure.lang.IReduceInit,clojure.lang-Sequential,java.lang.Iterable

向量型

字段:am cnt shift root tail _meta

议定书:

VecNodetype

字段:编辑ARR

议定书:

接口:

VecSeqtype

字段:am vec anode i offset

议定书:clojure.core.protocol/InternalReduce

接口:clojure.lang.IhunkedSeq,clojure.lang.ISeq,clojure.lang.Seqable

公共变量和函数

&特殊语法

代码语言:javascript
复制
Syntax for use with fn.

Please see http://clojure.org/special_forms#fn

在Clojure版本1.0中添加

函数

代码语言:javascript
复制
Usage: (*)
       (* x)
       (* x y)
       (* x y & more)
代码语言:javascript
复制
Returns the product of nums. (*) returns 1. Does not auto-promote
longs, will throw on overflow. See also: *'

在Clojure版本1.2中添加

*·函数

代码语言:javascript
复制
Usage: (*')
       (*' x)
       (*' x y)
       (*' x y & more)
代码语言:javascript
复制
Returns the product of nums. (*') returns 1. Supports arbitrary precision.
See also: *

在Clojure版本1.0中添加

*1动态变量

代码语言:javascript
复制
bound in a repl thread to the most recent value printed

在Clojure版本1.0中添加

*2动态变量

代码语言:javascript
复制
bound in a repl thread to the second most recent value printed

在Clojure版本1.0中添加

*3动态变量

代码语言:javascript
复制
bound in a repl thread to the third most recent value printed

在Clojure版本1.0中添加

*agent*var

代码语言:javascript
复制
The agent currently running an action on this thread, else nil

在Clojure版本1.0中添加

*Clojure-版本*动态变量

代码语言:javascript
复制
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"

在Clojure版本1.0中添加

*命令行-args*

代码语言:javascript
复制
A sequence of the supplied command line arguments, or nil if
none were supplied

在Clojure版本1.0中添加

*编译文件*var

代码语言:javascript
复制
Set to true when compiling files, false otherwise.

在Clojure版本1.0中添加

*编译路径*var

代码语言:javascript
复制
Specifies the directory where 'compile' will write out .class
files. This directory must be in the classpath for 'compile' to
work.

Defaults to "classes"

在Clojure版本1.0中添加

*编译器选项*var

代码语言:javascript
复制
A map of keys to options.
Note, when binding dynamically make sure to merge with previous value.
Supported options:
:elide-meta - a collection of metadata keys to elide during compilation.
:disable-locals-clearing - set to true to disable clearing, useful for using a debugger
Alpha, subject to change.

在 Clojure 版本1.4中添加

*数据阅读器*动态变量

代码语言:javascript
复制
Map from reader tag symbols to data reader Vars.

When Clojure starts, it searches for files named 'data_readers.clj'
at the root of the classpath. Each such file must contain a literal
map of symbols, like this:

    {foo/bar my.project.foo/bar
     foo/baz my.project/baz}

The first symbol in each pair is a tag that will be recognized by
the Clojure reader. The second symbol in the pair is the
fully-qualified name of a Var which will be invoked by the reader to
parse the form following the tag. For example, given the
data_readers.clj file above, the Clojure reader would parse this
form:

    #foo/bar [1 2 3]

by invoking the Var #'my.project.foo/bar on the vector [1 2 3]. The
data reader function is invoked on the form AFTER it has been read
as a normal Clojure data structure by the reader.

Reader tags without namespace qualifiers are reserved for
Clojure. Default reader tags are defined in
clojure.core/default-data-readers but may be overridden in
data_readers.clj or by rebinding this Var.

在Clojure版本1.4中添加

*默认-数据读取器-fn*动态变量

代码语言:javascript
复制
When no data reader is found for a tag and *default-data-reader-fn*
is non-nil, it will be called with two arguments,
the tag and the value.  If *default-data-reader-fn* is nil (the
default), an exception will be thrown for the unknown tag.

在Clojure版本1.5中添加

*edynamic var

代码语言:javascript
复制
bound in a repl thread to the most recent exception caught by the repl

在Clojure版本1.0中添加

*错误*var

代码语言:javascript
复制
A java.io.Writer object representing standard error for print operations.

Defaults to System/err, wrapped in a PrintWriter

在Clojure版本1.0中添加

*档案*var

代码语言:javascript
复制
The path of the file being evaluated, as a String.

When there is no file, e.g. in the REPL, the value is not defined.

在Clojure版本1.0中添加

*线上刷新*var

代码语言:javascript
复制
When set to true, output will be flushed whenever a newline is printed.

Defaults to true.

在Clojure版本1.0中添加

%2A在%2A瓦尔

代码语言:javascript
复制
A java.io.Reader object representing standard input for read operations.

Defaults to System/in, wrapped in a LineNumberingPushbackReader

在Clojure版本1.0中添加

*ns*var

代码语言:javascript
复制
A clojure.lang.Namespace object representing the current namespace.

在Clojure版本1.0中添加

*out*var

代码语言:javascript
复制
A java.io.Writer object representing standard output for print operations.

Defaults to System/out, wrapped in an OutputStreamWriter

在Clojure版本1.0中添加

*打印-DUP*var

代码语言:javascript
复制
When set to logical true, objects will be printed in a way that preserves
their type when read in later.

Defaults to false.

在Clojure版本1.0中添加

*印刷长度*动态变量

代码语言:javascript
复制
*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.

在Clojure版本1.0中添加

*打印级*动态变量

代码语言:javascript
复制
*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.

在Clojure版本1.0中添加

*印元*var

代码语言:javascript
复制
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.

在Clojure版本1.0中添加

*打印-可读的*var

代码语言:javascript
复制
When set to logical false, strings and characters will be printed with
non-alphanumeric characters converted to the appropriate escape sequences.

Defaults to true

在Clojure版本1.0中添加

*读法*var

代码语言:javascript
复制
Defaults to true (or value specified by system property, see below)
***This setting implies that the full power of the reader is in play,
including syntax that can cause code to execute. It should never be
used with untrusted sources. See also: clojure.edn/read.***

When set to logical false in the thread-local binding,
the eval reader (#=) and record/type literal syntax are disabled in read/load.
Example (will fail): (binding [*read-eval* false] (read-string "#=(* 2 21)"))

The default binding can be controlled by the system property
'clojure.read.eval' System properties can be set on the command line
like this:

java -Dclojure.read.eval=false ...

The system property can also be set to 'unknown' via
-Dclojure.read.eval=unknown, in which case the default binding
is :unknown and all reads will fail in contexts where *read-eval*
has not been explicitly bound to either true or false. This setting
can be a useful diagnostic tool to ensure that all of your reads
occur in considered contexts. You can also accomplish this in a
particular scope by binding *read-eval* to :unknown

在Clojure版本1.0中添加

*未检验-数学*var

代码语言:javascript
复制
While bound to true, compilations of +, -, *, inc, dec and the
coercions will be done without overflow checks. While bound
to :warn-on-boxed, same behavior as true, and a warning is emitted
when compilation uses boxed math. Default: false.

在Clojure版本1.3中添加

*反射警告*var

代码语言:javascript
复制
When set to true, the compiler will emit warnings when reflection is
needed to resolve Java method calls or field accesses.

Defaults to false.

在Clojure版本1.0中添加

+函数

代码语言:javascript
复制
Usage: (+)
       (+ x)
       (+ x y)
       (+ x y & more)
代码语言:javascript
复制
Returns the sum of nums. (+) returns 0. Does not auto-promote
longs, will throw on overflow. See also: +'

在Clojure版本1.2中添加

+%27函数

代码语言:javascript
复制
Usage: (+')
       (+' x)
       (+' x y)
       (+' x y & more)
代码语言:javascript
复制
Returns the sum of nums. (+') returns 0. Supports arbitrary precision.
See also: +

在Clojure版本1.0中添加

-职能

代码语言:javascript
复制
Usage: (- x)
       (- x y)
       (- x y & more)
代码语言:javascript
复制
If no ys are supplied, returns the negation of x, else subtracts
the ys from x and returns the result. Does not auto-promote
longs, will throw on overflow. See also: -'

在Clojure版本1.2中添加

-%27功能

代码语言:javascript
复制
Usage: (-' x)
       (-' x y)
       (-' x y & more)
代码语言:javascript
复制
If no ys are supplied, returns the negation of x, else subtracts
the ys from x and returns the result. Supports arbitrary precision.
See also: -

在Clojure版本1.0中添加

->宏

代码语言:javascript
复制
Usage: (-> x & forms)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

->>宏

代码语言:javascript
复制
Usage: (->> x & forms)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

->Array春克函数

代码语言:javascript
复制
Usage: (->ArrayChunk am arr off end)
代码语言:javascript
复制
Positional factory function for class clojure.core.ArrayChunk.

->教育职能

代码语言:javascript
复制
Usage: (->Eduction xform coll)
代码语言:javascript
复制
Positional factory function for class clojure.core.Eduction.

->向量函数

代码语言:javascript
复制
Usage: (->Vec am cnt shift root tail _meta)
代码语言:javascript
复制
Positional factory function for class clojure.core.Vec.

->VecNodefunction

代码语言:javascript
复制
Usage: (->VecNode edit arr)
代码语言:javascript
复制
Positional factory function for class clojure.core.VecNode.

->VecSeqfunction

代码语言:javascript
复制
Usage: (->VecSeq am vec anode i offset)
代码语言:javascript
复制
Positional factory function for class clojure.core.VecSeq.

.特殊形式

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

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

在Clojure版本1.0中添加

代码语言:javascript
复制
Usage: (.. x form)
       (.. x form & more)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

/职能

代码语言:javascript
复制
Usage: (/ x)
       (/ x y)
       (/ x y & more)
代码语言:javascript
复制
If no denominators are supplied, returns 1/numerator,
else returns numerator divided by all of the denominators.

在Clojure版本1.0中添加

<函数

代码语言:javascript
复制
Usage: (< x)
       (< x y)
       (< x y & more)
代码语言:javascript
复制
Returns non-nil if nums are in monotonically increasing order,
otherwise false.

在Clojure版本1.0中添加

<=函数

代码语言:javascript
复制
Usage: (<= x)
       (<= x y)
       (<= x y & more)
代码语言:javascript
复制
Returns non-nil if nums are in monotonically non-decreasing order,
otherwise false.

在Clojure版本1.0中添加

=函数

=函数

代码语言:javascript
复制
Usage: (= x)
       (= x y)
       (= x y & more)

Equality. Returns trueif x equals y,falseif 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.

在 Clojure 1.0 版中添加

==函数

代码语言:javascript
复制
Usage: (== x)
       (== x y)
       (== x y & more)
代码语言:javascript
复制
Returns non-nil if nums all have the equivalent
value (type-independent), otherwisefalse

在 Clojure 1.0 版中添加

>功能

代码语言:javascript
复制
Usage: (> x)
       (> x y)
       (> x y & more)
代码语言:javascript
复制
Returns non-nil if nums are in monotonically decreasing order,
otherwise false.

在Clojure版本1.0中添加

>=函数

代码语言:javascript
复制
Usage: (>= x)
       (>= x y)
       (>= x y & more)
代码语言:javascript
复制
Returns non-nil if nums are in monotonically non-increasing order,
otherwise false.

在Clojure版本1.0中添加

可抛->映射函数

代码语言:javascript
复制
Usage: (Throwable->map o)
代码语言:javascript
复制
Constructs a data representation for a Throwable.

在Clojure版本1.7中添加

辅助函数

代码语言:javascript
复制
Usage: (accessor s key)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

aclonefunction

代码语言:javascript
复制
Usage: (aclone array)
代码语言:javascript
复制
Returns a clone of the Java array. Works on arrays of known
types.

在Clojure版本1.0中添加

加类函数

代码语言:javascript
复制
Usage: (add-classpath url)
代码语言:javascript
复制
DEPRECATED 

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

在Clojure版本1.0中添加

自Clojure版本1.1以来就不再推荐了

加-监视函数

代码语言:javascript
复制
Usage: (add-watch reference key fn)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

代理函数

代码语言:javascript
复制
Usage: (agent state & options)
代码语言:javascript
复制
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

:error-handler handler-fn

:error-mode mode-keyword

If metadata-map is supplied, it will become 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.  handler-fn is called if an
action throws an exception or if validate-fn rejects a new state --
see set-error-handler! for details.  The mode-keyword may be either
:continue (the default if an error-handler is given) or :fail (the
default if no error-handler is given) -- see set-error-mode! for
details.

在Clojure版本1.0中添加

代理错误函数

代码语言:javascript
复制
Usage: (agent-error a)
代码语言:javascript
复制
Returns the exception thrown during an asynchronous action of the
agent if the agent is failed.  Returns nil if the agent is not
failed.

在Clojure版本1.2中添加

代理错误函数

代码语言:javascript
复制
Usage: (agent-errors a)
代码语言:javascript
复制
DEPRECATED: Use 'agent-error' instead.
Returns a sequence of the exceptions thrown during asynchronous
actions of the agent.

在Clojure版本1.0中添加

自Clojure版本1.2以来就不再推荐了

农业功能

代码语言:javascript
复制
Usage: (aget array idx)
       (aget array idx & idxs)
代码语言:javascript
复制
Returns the value at the index/indices. Works on Java arrays of all
types.

在Clojure版本1.0中添加

阿伦函数

代码语言:javascript
复制
Usage: (alength array)
代码语言:javascript
复制
Returns the length of the Java array. Works on arrays of all
types.

在Clojure版本1.0中添加

别名函数

代码语言:javascript
复制
Usage: (alias alias namespace-sym)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

全功能

代码语言:javascript
复制
Usage: (all-ns)
代码语言:javascript
复制
Returns a sequence of all namespaces.

在Clojure版本1.0中添加

变函数

代码语言:javascript
复制
Usage: (alter ref fun & args)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

Meta%21功能

代码语言:javascript
复制
Usage: (alter-meta! iref f & args)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

变变量根函数

代码语言:javascript
复制
Usage: (alter-var-root v f & args)
代码语言:javascript
复制
Atomically alters the root binding of var v by applying f to its
current value plus any args

在Clojure版本1.0中添加

阿帕宏

代码语言:javascript
复制
Usage: (amap a idx ret expr)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

祖先函数

代码语言:javascript
复制
Usage: (ancestors tag)
       (ancestors h tag)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

代码语言:javascript
复制
Usage: (and)
       (and x)
       (and x & next)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

应用函数

代码语言:javascript
复制
Usage: (apply f args)
       (apply f x args)
       (apply f x y args)
       (apply f x y z args)
       (apply f a b c d & args)
代码语言:javascript
复制
Applies fn f to the argument list formed by prepending intervening arguments to args.

在Clojure版本1.0中添加

双尾

代码语言:javascript
复制
Usage: (areduce a idx ret init expr)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

数组映射函数

代码语言:javascript
复制
Usage: (array-map)
       (array-map & keyvals)
代码语言:javascript
复制
Constructs an array-map. If any keys are equal, they are handled as
if by repeated uses of assoc.

在Clojure版本1.0中添加

As->宏

代码语言:javascript
复制
Usage: (as-> expr name & forms)
代码语言:javascript
复制
Binds name to expr, evaluates the first form in the lexical context
of that binding, then binds name to that result, repeating for each
successive form, returning the result of the last form.

在Clojure版本1.5中添加

asetfunction

代码语言:javascript
复制
Usage: (aset array idx val)
       (aset array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on Java arrays of
reference types. Returns val.

在Clojure版本1.0中添加

ASET-布尔函数

代码语言:javascript
复制
Usage: (aset-boolean array idx val)
       (aset-boolean array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of boolean. Returns val.

在Clojure版本1.0中添加

ASET-字节函数

代码语言:javascript
复制
Usage: (aset-byte array idx val)
       (aset-byte array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of byte. Returns val.

在Clojure版本1.0中添加

ASET-特征函数

代码语言:javascript
复制
Usage: (aset-char array idx val)
       (aset-char array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of char. Returns val.

在Clojure版本1.0中添加

ASET-双函数

代码语言:javascript
复制
Usage: (aset-double array idx val)
       (aset-double array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of double. Returns val.

在Clojure版本1.0中添加

浮点函数

代码语言:javascript
复制
Usage: (aset-float array idx val)
       (aset-float array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of float. Returns val.

在Clojure版本1.0中添加

ASET-int函数

代码语言:javascript
复制
Usage: (aset-int array idx val)
       (aset-int array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of int. Returns val.

在Clojure版本1.0中添加

ASET-长函数

代码语言:javascript
复制
Usage: (aset-long array idx val)
       (aset-long array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of long. Returns val.

在Clojure版本1.0中添加

ASET-短函数

代码语言:javascript
复制
Usage: (aset-short array idx val)
       (aset-short array idx idx2 & idxv)
代码语言:javascript
复制
Sets the value at the index/indices. Works on arrays of short. Returns val.

在Clojure版本1.0中添加

断言宏

代码语言:javascript
复制
Usage: (assert x)
       (assert x message)
代码语言:javascript
复制
Evaluates expr and throws an exception if it does not evaluate to
logical true.

在Clojure版本1.0中添加

助力函数

代码语言:javascript
复制
Usage: (assoc map key val)
       (assoc map key val & kvs)
代码语言:javascript
复制
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).

在Clojure版本1.0中添加

Assoc%21功能

代码语言:javascript
复制
Usage: (assoc! coll key val)
       (assoc! coll key val & kvs)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

Assoc-失灵

代码语言:javascript
复制
Usage: (assoc-in m [k & ks] v)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

联想?功能

代码语言:javascript
复制
Usage: (associative? coll)
代码语言:javascript
复制
Returns true if coll implements Associative

在Clojure版本1.0中添加

原子函数

代码语言:javascript
复制
Usage: (atom x)
       (atom x & options)
代码语言:javascript
复制
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 become 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.

在Clojure版本1.0中添加

等待函数

代码语言:javascript
复制
Usage: (await & agents)
代码语言:javascript
复制
Blocks the current thread (indefinitely!) until all actions
dispatched thus far, from this thread or agent, to the agent(s) have
occurred.  Will block on failed agents.  Will never return if
a failed agent is restarted with :clear-actions true.

在Clojure版本1.0中添加

等待功能

代码语言:javascript
复制
Usage: (await-for timeout-ms & agents)
代码语言:javascript
复制
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 logical false if
returning due to timeout, logical true otherwise.

在Clojure版本1.0中添加

基函数

代码语言:javascript
复制
Usage: (bases c)
代码语言:javascript
复制
Returns the immediate superclass and direct interfaces of c, if any

在Clojure版本1.0中添加

梁函数

代码语言:javascript
复制
Usage: (bean x)
代码语言:javascript
复制
Takes a Java object and returns a read-only implementation of the
map abstraction based upon its JavaBean properties.

在Clojure版本1.0中添加

大函数

代码语言:javascript
复制
Usage: (bigdec x)
代码语言:javascript
复制
Coerce to BigDecimal

在Clojure版本1.0中添加

双元函数

代码语言:javascript
复制
Usage: (bigint x)
代码语言:javascript
复制
Coerce to BigInt

在Clojure版本1.3中添加

双元函数

代码语言:javascript
复制
Usage: (biginteger x)
代码语言:javascript
复制
Coerce to BigInteger

在Clojure版本1.0中添加

绑定宏

代码语言:javascript
复制
Usage: (binding bindings & body)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

位函数

代码语言:javascript
复制
Usage: (bit-and x y)
       (bit-and x y & more)
代码语言:javascript
复制
Bitwise and

在Clojure版本1.0中添加

位与非函数

代码语言:javascript
复制
Usage: (bit-and-not x y)
       (bit-and-not x y & more)
代码语言:javascript
复制
Bitwise and with complement

在Clojure版本1.0中添加

位清除函数

代码语言:javascript
复制
Usage: (bit-clear x n)
代码语言:javascript
复制
Clear bit at index n

在Clojure版本1.0中添加

位触发器

代码语言:javascript
复制
Usage: (bit-flip x n)
代码语言:javascript
复制
Flip bit at index n

在Clojure版本1.0中添加

位-非函数

代码语言:javascript
复制
Usage: (bit-not x)
代码语言:javascript
复制
Bitwise complement

在Clojure版本1.0中添加

位或函数

代码语言:javascript
复制
Usage: (bit-or x y)
       (bit-or x y & more)
代码语言:javascript
复制
Bitwise or

在Clojure版本1.0中添加

位集函数

代码语言:javascript
复制
Usage: (bit-set x n)
代码语言:javascript
复制
Set bit at index n

在Clojure版本1.0中添加

位左移函数

代码语言:javascript
复制
Usage: (bit-shift-left x n)
代码语言:javascript
复制
Bitwise shift left

在Clojure版本1.0中添加

位移位-右函数

代码语言:javascript
复制
Usage: (bit-shift-right x n)
代码语言:javascript
复制
Bitwise shift right

在Clojure版本1.0中添加

位测试函数

代码语言:javascript
复制
Usage: (bit-test x n)
代码语言:javascript
复制
Test bit at index n

在Clojure版本1.0中添加

位函数

代码语言:javascript
复制
Usage: (bit-xor x y)
       (bit-xor x y & more)
代码语言:javascript
复制
Bitwise exclusive or

在Clojure版本1.0中添加

布尔函数

代码语言:javascript
复制
Usage: (boolean x)
代码语言:javascript
复制
Coerce to boolean

在Clojure版本1.0中添加

布尔列函数

代码语言:javascript
复制
Usage: (boolean-array size-or-seq)
       (boolean-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of booleans

在Clojure版本1.1中添加

布尔函数

代码语言:javascript
复制
Usage: (booleans xs)
代码语言:javascript
复制
Casts to boolean[]

在Clojure版本1.1中添加

绑定-fn宏

代码语言:javascript
复制
Usage: (bound-fn & fntail)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

绑定-FN%2A功能

代码语言:javascript
复制
Usage: (bound-fn* f)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

捆绑?功能

代码语言:javascript
复制
Usage: (bound? & vars)
代码语言:javascript
复制
Returns true if all of the vars provided as arguments have any bound value, root or thread-local.
Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided.

在Clojure版本1.2中添加

ButlastFunction

代码语言:javascript
复制
Usage: (butlast coll)
代码语言:javascript
复制
Return a seq of all but the last item in coll, in linear time

在Clojure版本1.0中添加

字节函数

代码语言:javascript
复制
Usage: (byte x)
代码语言:javascript
复制
Coerce to byte

在Clojure版本1.0中添加

字节数组函数

代码语言:javascript
复制
Usage: (byte-array size-or-seq)
       (byte-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of bytes

在Clojure版本1.1中添加

边函数

代码语言:javascript
复制
Usage: (bytes xs)
代码语言:javascript
复制
Casts to bytes[]

在Clojure版本1.1中添加

凯斯马克罗

代码语言:javascript
复制
Usage: (case e & clauses)
代码语言:javascript
复制
Takes an expression, and a set of clauses.

Each clause can take the form of either:

test-constant result-expr

(test-constant1 ... test-constantN)  result-expr

The test-constants are not evaluated. They must be compile-time
literals, and need not be quoted.  If the expression is equal to a
test-constant, the corresponding result-expr is returned. 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.

Unlike cond and condp, case does a constant-time dispatch, the
clauses are not considered sequentially.  All manner of constant
expressions are acceptable in case, including numbers, strings,
symbols, keywords, and (Clojure) composites thereof. Note that since
lists are used to group multiple constants that map to the same
expression, a vector can be used to match a list if needed. The
test-constants need not be all of the same type.

在Clojure版本1.2中添加

浇注函数

代码语言:javascript
复制
Usage: (cast c x)
代码语言:javascript
复制
Throws a ClassCastException if x is not a c, else returns x.

在Clojure版本1.0中添加

猫函数

代码语言:javascript
复制
Usage: (cat rf)
代码语言:javascript
复制
A transducer which concatenates the contents of each input, which must be a
collection, into the reduction.

在Clojure版本1.7中添加

集水区特殊语法

代码语言:javascript
复制
Syntax for use with try.

Please see http://clojure.org/special_forms#try

在Clojure版本1.0中添加

特征函数

代码语言:javascript
复制
Usage: (char x)
代码语言:javascript
复制
Coerce to char

在Clojure版本1.1中添加

查列函数

代码语言:javascript
复制
Usage: (char-array size-or-seq)
       (char-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of chars

在Clojure版本1.1中添加

查逸

代码语言:javascript
复制
Returns escape string for char or nil if none

在Clojure版本1.0中添加

查-名---

代码语言:javascript
复制
Returns name string for char or nil if none

在Clojure版本1.0中添加

查?功能

代码语言:javascript
复制
Usage: (char? x)
代码语言:javascript
复制
Return true if x is a Character

在Clojure版本1.0中添加

查函数

代码语言:javascript
复制
Usage: (chars xs)
代码语言:javascript
复制
Casts to chars[]

在Clojure版本1.1中添加

类函数

代码语言:javascript
复制
Usage: (class x)
代码语言:javascript
复制
Returns the Class of x

在Clojure版本1.0中添加

上课?功能

代码语言:javascript
复制
Usage: (class? x)
代码语言:javascript
复制
Returns true if x is an instance of Class

在Clojure版本1.0中添加

透明代理-错误函数

代码语言:javascript
复制
Usage: (clear-agent-errors a)
代码语言:javascript
复制
DEPRECATED: Use 'restart-agent' instead.
Clears any exceptions thrown during asynchronous actions of the
agent, allowing subsequent actions to occur.

在Clojure版本1.0中添加

自Clojure版本1.2以来就不再推荐了

闭包-版本函数

代码语言:javascript
复制
Usage: (clojure-version)
代码语言:javascript
复制
Returns clojure version as a printable string.

在Clojure版本1.0中添加

科尔?功能

代码语言:javascript
复制
Usage: (coll? x)
代码语言:javascript
复制
Returns true if x implements IPersistentCollection

在Clojure版本1.0中添加

评论宏

代码语言:javascript
复制
Usage: (comment & body)
代码语言:javascript
复制
Ignores body, yields nil

在Clojure版本1.0中添加

换能函数

代码语言:javascript
复制
Usage: (commute ref fun & args)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

复函数

代码语言:javascript
复制
Usage: (comp)
       (comp f)
       (comp f g)
       (comp f g & fs)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

比较函数

代码语言:javascript
复制
Usage: (comparator pred)
代码语言:javascript
复制
Returns an implementation of java.util.Comparator based upon pred.

在Clojure版本1.0中添加

比较函数

代码语言:javascript
复制
Usage: (compare x y)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

比较和设置%21功能

代码语言:javascript
复制
Usage: (compare-and-set! atom oldval newval)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

编译函数

代码语言:javascript
复制
Usage: (compile lib)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

互补函数

代码语言:javascript
复制
Usage: (complement f)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

完全函数

代码语言:javascript
复制
Usage: (completing f)
       (completing f cf)
代码语言:javascript
复制
Takes a reducing function f of 2 args and returns a fn suitable for
transduce by adding an arity-1 signature that calls cf (default -
identity) on the result argument.

在Clojure版本1.7中添加

级联函数

代码语言:javascript
复制
Usage: (concat)
       (concat x)
       (concat x y)
       (concat x y & zs)
代码语言:javascript
复制
Returns a lazy seq representing the concatenation of the elements in the supplied colls.

在Clojure版本1.0中添加

康宏

代码语言:javascript
复制
Usage: (cond & clauses)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

Cond->宏

代码语言:javascript
复制
Usage: (cond-> expr & clauses)
代码语言:javascript
复制
Takes an expression and a set of test/form pairs. Threads expr (via ->)
through each form for which the corresponding test
expression is true. Note that, unlike cond branching, cond-> threading does
not short circuit after the first true test expression.

在Clojure版本1.5中添加

>>宏

代码语言:javascript
复制
Usage: (cond->> expr & clauses)
代码语言:javascript
复制
Takes an expression and a set of test/form pairs. Threads expr (via ->>)
through each form for which the corresponding test expression
is true.  Note that, unlike cond branching, cond->> threading does not short circuit
after the first true test expression.

在Clojure版本1.5中添加

condp宏

代码语言:javascript
复制
Usage: (condp pred expr & clauses)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

附子函数

代码语言:javascript
复制
Usage: (conj coll x)
       (conj coll x & xs)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

Conj%21函数

代码语言:javascript
复制
Usage: (conj!)
       (conj! coll)
       (conj! coll x)
代码语言:javascript
复制
Adds x to the transient collection, and return coll. The 'addition'
may happen at different 'places' depending on the concrete type.

在Clojure版本1.1中添加

同意函数

代码语言:javascript
复制
Usage: (cons x seq)
代码语言:javascript
复制
Returns a new seq where x is the first element and seq is
the rest.

在Clojure版本1.0中添加

恒函数

代码语言:javascript
复制
Usage: (constantly x)
代码语言:javascript
复制
Returns a function that takes any number of arguments and returns x.

在Clojure版本1.0中添加

构造函数

代码语言:javascript
复制
Usage: (construct-proxy c & ctor-args)
代码语言:javascript
复制
Takes a proxy class and any arguments for its superclass ctor and
creates and returns an instance of the proxy.

在Clojure版本1.0中添加

包含?功能

代码语言:javascript
复制
Usage: (contains? coll key)
代码语言:javascript
复制
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'.

在Clojure版本1.0中添加

计数函数

代码语言:javascript
复制
Usage: (count coll)
代码语言:javascript
复制
Returns the number of items in the collection. (count nil) returns
0.  Also works on strings, arrays, and Java Collections and Maps

在Clojure版本1.0中添加

数数?功能

代码语言:javascript
复制
Usage: (counted? coll)
代码语言:javascript
复制
Returns true if coll implements count in constant time

在Clojure版本1.0中添加

创建函数

代码语言:javascript
复制
Usage: (create-ns sym)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

创建-结构函数

代码语言:javascript
复制
Usage: (create-struct & keys)
代码语言:javascript
复制
Returns a structure basis object.

在Clojure版本1.0中添加

循环函数

代码语言:javascript
复制
Usage: (cycle coll)
代码语言:javascript
复制
Returns a lazy (infinite!) sequence of repetitions of the items in coll.

在Clojure版本1.0中添加

解函数

代码语言:javascript
复制
Usage: (dec x)
代码语言:javascript
复制
Returns a number one less than num. Does not auto-promote
longs, will throw on overflow. See also: dec'

在Clojure版本1.2中添加

DEC%27功能

代码语言:javascript
复制
Usage: (dec' x)
代码语言:javascript
复制
Returns a number one less than num. Supports arbitrary precision.
See also: dec

在Clojure版本1.0中添加

十进制?功能

代码语言:javascript
复制
Usage: (decimal? n)
代码语言:javascript
复制
Returns true if n is a BigDecimal

在Clojure版本1.0中添加

申报表宏

代码语言:javascript
复制
Usage: (declare & names)
代码语言:javascript
复制
defs the supplied var names with no bindings, useful for making forward declarations.

在Clojure版本1.0中添加

降函数

代码语言:javascript
复制
Usage: (dedupe)
       (dedupe coll)
代码语言:javascript
复制
Returns a lazy sequence removing consecutive duplicates in coll.
Returns a transducer when no collection is provided.

在Clojure版本1.7中添加

防御特殊形式

代码语言:javascript
复制
Usage: (def symbol doc-string? init?)
代码语言:javascript
复制
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 http://clojure.org/special_forms#def

在Clojure版本1.0中添加

默认数据读取器

代码语言:javascript
复制
Default map of data reader functions provided by Clojure. May be
overridden by binding *data-readers*.

在Clojure版本1.4中添加

定线

代码语言:javascript
复制
Usage: (definline name & decl)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

防御工事

代码语言:javascript
复制
Usage: (definterface name & sigs)
代码语言:javascript
复制
Creates a new Java interface with the given name and method sigs.
The method return types and parameter types may be specified with type hints,
defaulting to Object if omitted.

(definterface MyInterface
  (^int method1 [x])
  (^Bar method2 [^Baz b ^Quux q]))

在Clojure版本1.2中添加

反宏

代码语言:javascript
复制
Usage: (defmacro name doc-string? attr-map? [params*] body)
       (defmacro name doc-string? attr-map? ([params*] body) + attr-map?)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

解方法宏

代码语言:javascript
复制
Usage: (defmethod multifn dispatch-val & fn-tail)
代码语言:javascript
复制
Creates and installs a new method of multimethod associated with dispatch-value. 

在Clojure版本1.0中添加

德穆提马克罗

代码语言:javascript
复制
Usage: (defmulti name docstring? attr-map? dispatch-fn & options)
代码语言:javascript
复制
Creates a new multimethod with the associated dispatch function.
The docstring and attr-map are optional.

Options are key-value pairs and may be one of:

:default

The default dispatch value, defaults to :default

:hierarchy

The value used for hierarchical dispatch (e.g. ::square is-a ::shape)

Hierarchies are type-like relationships that do not depend upon type
inheritance. By default Clojure's multimethods dispatch off of a
global hierarchy map.  However, a hierarchy relationship can be
created with the derive function used to augment the root ancestor
created with make-hierarchy.

Multimethods expect the value of the hierarchy option to be supplied as
a reference type e.g. a var (i.e. via the Var-quote dispatch macro #'
or the var special form).

在Clojure版本1.0中添加

防御宏

代码语言:javascript
复制
Usage: (defn name doc-string? attr-map? [params*] prepost-map? body)
       (defn name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?)
代码语言:javascript
复制
Same as (def name (fn [params* ] exprs*)) or (def
name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
to the var metadata. prepost-map defines a map with optional keys
:pre and :post that contain collections of pre or post conditions.

在Clojure版本1.0中添加

Defn-宏

代码语言:javascript
复制
Usage: (defn- name & decls)
代码语言:javascript
复制
same as defn, yielding non-public def

在Clojure版本1.0中添加

防腐剂

代码语言:javascript
复制
Usage: (defonce name expr)
代码语言:javascript
复制
defs name to have the root value of the expr iff the named var has no root value,
else expr is unevaluated

在Clojure版本1.0中添加

卸载协议宏

代码语言:javascript
复制
Usage: (defprotocol name & opts+sigs)
代码语言:javascript
复制
A protocol is a named set of named methods and their signatures:
(defprotocol AProtocolName

  ;optional doc string
  "A doc string for AProtocol abstraction"

;method signatures
  (bar [this a b] "bar docs")
  (baz [this a] [this a b] [this a b c] "baz docs"))

No implementations are provided. Docs can be specified for the
protocol overall and for each method. The above yields a set of
polymorphic functions and a protocol object. All are
namespace-qualified by the ns enclosing the definition The resulting
functions dispatch on the type of their first argument, which is
required and corresponds to the implicit target object ('this' in 
Java parlance). defprotocol is dynamic, has no special compile-time 
effect, and defines no new types or classes. Implementations of 
the protocol methods can be provided using extend.

defprotocol will automatically generate a corresponding interface,
with the same name as the protocol, i.e. given a protocol:
my.ns/Protocol, an interface: my.ns.Protocol. The interface will
have methods corresponding to the protocol functions, and the
protocol will automatically work with instances of the interface.

Note that you should not use this interface with deftype or
reify, as they support the protocol directly:

(defprotocol P 
  (foo [this]) 
  (bar-me [this] [this y]))

(deftype Foo [a b c] 
 P
  (foo [this] a)
  (bar-me [this] b)
  (bar-me [this y] (+ c y)))

(bar-me (Foo. 1 2 3) 42)
=> 45

(foo 
  (let [x 42]
    (reify P 
      (foo [this] 17)
      (bar-me [this] x)
      (bar-me [this y] x))))
=> 17

在Clojure版本1.2中添加

反录宏

代码语言:javascript
复制
Usage: (defrecord name [& fields] & opts+specs)
代码语言:javascript
复制
(defrecord name [fields*]  options* specs*)

Options are expressed as sequential keywords and arguments (in any order).

Supported options:
:load-ns - if true, importing the record class will cause the
           namespace in which the record was defined to be loaded.
           Defaults to false.

Each spec consists of a protocol or interface name followed by zero
or more method bodies:

protocol-or-interface-or-Object
(methodName [args*] body)*

Dynamically generates compiled bytecode for class with the given
name, in a package with the same name as the current namespace, the
given fields, and, optionally, methods for protocols and/or
interfaces.

The class will have the (immutable) fields named by
fields, which can have type hints. Protocols/interfaces and methods
are optional. The only methods that can be supplied are those
declared in the protocols/interfaces.  Note that method bodies are
not closures, the local environment includes only the named fields,
and those fields can be accessed directly.

Method definitions take the form:

(methodname [args*] body)

The argument and return types can be hinted on the arg and
methodname symbols. If not supplied, they will be inferred, so type
hints should be reserved for disambiguation.

Methods should be supplied for all methods of the desired
protocol(s) and interface(s). You can also define overrides for
methods of Object. Note that a parameter must be supplied to
correspond to the target object ('this' in Java parlance). Thus
methods for interfaces will take one more argument than do the
interface declarations. Note also that recur calls to the method
head should *not* pass the target object, it will be supplied
automatically and can not be substituted.

In the method bodies, the (unqualified) name can be used to name the
class (for calls to new, instance? etc).

The class will have implementations of several (clojure.lang)
interfaces generated automatically: IObj (metadata support) and
IPersistentMap, and all of their superinterfaces.

In addition, defrecord will define type-and-value-based =,
and will defined Java .hashCode and .equals consistent with the
contract for java.util.Map.

When AOT compiling, generates compiled bytecode for a class with the
given name (a symbol), prepends the current ns as the package, and
writes the .class file to the *compile-path* directory.

Two constructors will be defined, one taking the designated fields
followed by a metadata map (nil for none) and an extension field
map (nil for none), and one taking only the fields (using nil for
meta and extension fields). Note that the field names __meta
and __extmap are currently reserved and should not be used when
defining your own records.

Given (defrecord TypeName ...), two factory functions will be
defined: ->TypeName, taking positional parameters for the fields,
and map->TypeName, taking a map of keywords to field values.

在Clojure版本1.2中添加

防御宏

代码语言:javascript
复制
Usage: (defstruct name & keys)
代码语言:javascript
复制
Same as (def name (create-struct keys...))

在Clojure版本1.0中添加

脱脂emacro

代码语言:javascript
复制
Usage: (deftype name [& fields] & opts+specs)
代码语言:javascript
复制
(deftype name [fields*]  options* specs*)

Options are expressed as sequential keywords and arguments (in any order).

Supported options:
:load-ns - if true, importing the record class will cause the
           namespace in which the record was defined to be loaded.
           Defaults to false.

Each spec consists of a protocol or interface name followed by zero
or more method bodies:

protocol-or-interface-or-Object
(methodName [args*] body)*

Dynamically generates compiled bytecode for class with the given
name, in a package with the same name as the current namespace, the
given fields, and, optionally, methods for protocols and/or
interfaces. 

The class will have the (by default, immutable) fields named by
fields, which can have type hints. Protocols/interfaces and methods
are optional. The only methods that can be supplied are those
declared in the protocols/interfaces.  Note that method bodies are
not closures, the local environment includes only the named fields,
and those fields can be accessed directly. Fields can be qualified
with the metadata :volatile-mutable true or :unsynchronized-mutable
true, at which point (set! afield aval) will be supported in method
bodies. Note well that mutable fields are extremely difficult to use
correctly, and are present only to facilitate the building of higher
level constructs, such as Clojure's reference types, in Clojure
itself. They are for experts only - if the semantics and
implications of :volatile-mutable or :unsynchronized-mutable are not
immediately apparent to you, you should not be using them.

Method definitions take the form:

(methodname [args*] body)

The argument and return types can be hinted on the arg and
methodname symbols. If not supplied, they will be inferred, so type
hints should be reserved for disambiguation.

Methods should be supplied for all methods of the desired
protocol(s) and interface(s). You can also define overrides for
methods of Object. Note that a parameter must be supplied to
correspond to the target object ('this' in Java parlance). Thus
methods for interfaces will take one more argument than do the
interface declarations. Note also that recur calls to the method
head should *not* pass the target object, it will be supplied
automatically and can not be substituted.

In the method bodies, the (unqualified) name can be used to name the
class (for calls to new, instance? etc).

When AOT compiling, generates compiled bytecode for a class with the
given name (a symbol), prepends the current ns as the package, and
writes the .class file to the *compile-path* directory.

One constructor will be defined, taking the designated fields.  Note
that the field names __meta and __extmap are currently reserved and
should not be used when defining your own types.

Given (deftype TypeName ...), a factory function called ->TypeName
will be defined, taking positional parameters for the fields

在Clojure版本1.2中添加

延迟宏

代码语言:javascript
复制
Usage: (delay & body)
代码语言:javascript
复制
Takes a body of expressions and yields a Delay object that will
invoke the body only the first time it is forced (with force or deref/@), and
will cache the result and return it on all subsequent force
calls. See also - realized?

在Clojure版本1.0中添加

延迟?功能

代码语言:javascript
复制
Usage: (delay? x)
代码语言:javascript
复制
returns true if x is a Delay created with delay

在Clojure版本1.0中添加

交付功能

代码语言:javascript
复制
Usage: (deliver promise val)
代码语言:javascript
复制
Delivers the supplied value to the promise, releasing any pending
derefs. A subsequent call to deliver on a promise will have no effect.

在Clojure版本1.1中添加

分母函数

代码语言:javascript
复制
Usage: (denominator r)
代码语言:javascript
复制
Returns the denominator part of a Ratio.

在Clojure版本1.2中添加

脱钩

代码语言:javascript
复制
Usage: (deref ref)
       (deref ref timeout-ms timeout-val)
代码语言:javascript
复制
Also reader macro: @ref/@agent/@var/@atom/@delay/@future/@promise. 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. When applied to a promise, will block
until a value is delivered.  The variant taking a timeout can be
used for blocking references (futures and promises), and will return
timeout-val if the timeout (in milliseconds) is reached before a
value is available. See also - realized?.

在Clojure版本1.0中添加

导函数

代码语言:javascript
复制
Usage: (derive tag parent)
       (derive h tag parent)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

后代函数

代码语言:javascript
复制
Usage: (descendants tag)
       (descendants h tag)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

解函数

代码语言:javascript
复制
Usage: (disj set)
       (disj set key)
       (disj set key & ks)
代码语言:javascript
复制
disj[oin]. Returns a new set of the same (hashed/sorted) type, that
does not contain key(s).

在Clojure版本1.0中添加

DISJ%21函数

代码语言:javascript
复制
Usage: (disj! set)
       (disj! set key)
       (disj! set key & ks)
代码语言:javascript
复制
disj[oin]. Returns a transient set of the same (hashed/sorted) type, that
does not contain key(s).

在Clojure版本1.1中添加

解函数

代码语言:javascript
复制
Usage: (dissoc map)
       (dissoc map key)
       (dissoc map key & ks)
代码语言:javascript
复制
dissoc[iate]. Returns a new map of the same (hashed/sorted) type,
that does not contain a mapping for key(s).

在Clojure版本1.0中添加

Dissoc%21功能

代码语言:javascript
复制
Usage: (dissoc! map key)
       (dissoc! map key & ks)
代码语言:javascript
复制
Returns a transient map that doesn't contain a mapping for key(s).

在Clojure版本1.1中添加

区别函数

代码语言:javascript
复制
Usage: (distinct)
       (distinct coll)
代码语言:javascript
复制
Returns a lazy sequence of the elements of coll with duplicates removed.
Returns a stateful transducer when no collection is provided.

在Clojure版本1.0中添加

不同?功能

代码语言:javascript
复制
Usage: (distinct? x)
       (distinct? x y)
       (distinct? x y & more)
代码语言:javascript
复制
Returns true if no two of the arguments are =

在Clojure版本1.0中添加

剂量特异性形式

代码语言:javascript
复制
Usage: (do exprs*)
代码语言:javascript
复制
Evaluates the expressions in order and returns the value of
the last. If no expressions are supplied, returns nil.

Please see http://clojure.org/special_forms#do

在Clojure版本1.0中添加

点函数

代码语言:javascript
复制
Usage: (doall coll)
       (doall n coll)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

休眠功能

代码语言:javascript
复制
Usage: (dorun coll)
       (dorun n coll)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

剂量

代码语言:javascript
复制
Usage: (doseq seq-exprs & body)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

剂量宏

代码语言:javascript
复制
Usage: (dosync & exprs)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

时间宏

代码语言:javascript
复制
Usage: (dotimes bindings & body)
代码语言:javascript
复制
bindings => name n

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

在Clojure版本1.0中添加

多马克罗

代码语言:javascript
复制
Usage: (doto x & forms)
代码语言:javascript
复制
Evaluates x then calls all of the methods and functions with the
value of x supplied at the front of the given arguments.  The forms
are evaluated in order.  Returns x.

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

在Clojure版本1.0中添加

双函数

代码语言:javascript
复制
Usage: (double x)
代码语言:javascript
复制
Coerce to double

在Clojure版本1.0中添加

双列函数

代码语言:javascript
复制
Usage: (double-array size-or-seq)
       (double-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of doubles

在Clojure版本1.0中添加

双函数

代码语言:javascript
复制
Usage: (doubles xs)
代码语言:javascript
复制
Casts to double[]

在Clojure版本1.0中添加

降函数

代码语言:javascript
复制
Usage: (drop n)
       (drop n coll)
代码语言:javascript
复制
Returns a lazy sequence of all but the first n items in coll.
Returns a stateful transducer when no collection is provided.

在Clojure版本1.0中添加

落差函数

代码语言:javascript
复制
Usage: (drop-last s)
       (drop-last n s)
代码语言:javascript
复制
Return a lazy sequence of all but the last n (default 1) items in coll

在Clojure版本1.0中添加

随滴函数

代码语言:javascript
复制
Usage: (drop-while pred)
       (drop-while pred coll)
代码语言:javascript
复制
Returns a lazy sequence of the items in coll starting from the
first item for which (pred item) returns logical false.  Returns a
stateful transducer when no collection is provided.

在Clojure版本1.0中添加

教育功能

代码语言:javascript
复制
Usage: (eduction xform* coll)
代码语言:javascript
复制
Returns a reducible/iterable application of the transducers
to the items in coll. Transducers are applied in order as if
combined with comp. Note that these applications will be
performed every time reduce/iterator is called.

在Clojure版本1.7中添加

空函数

代码语言:javascript
复制
Usage: (empty coll)
代码语言:javascript
复制
Returns an empty collection of the same category as coll, or nil

在Clojure版本1.0中添加

空的?功能

代码语言:javascript
复制
Usage: (empty? coll)
代码语言:javascript
复制
Returns true if coll has no items - same as (not (seq coll)).
Please use the idiom (seq x) rather than (not (empty? x))

在Clojure版本1.0中添加

接续功能

代码语言:javascript
复制
Usage: (ensure ref)
代码语言:javascript
复制
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)

在Clojure版本1.0中添加

确保---减少功能

代码语言:javascript
复制
Usage: (ensure-reduced x)
代码语言:javascript
复制
If x is already reduced?, returns it, else returns (reduced x)

在Clojure版本1.7中添加

枚举-seq函数

代码语言:javascript
复制
Usage: (enumeration-seq e)
代码语言:javascript
复制
Returns a seq on a java.util.Enumeration

在Clojure版本1.0中添加

误差处理函数

代码语言:javascript
复制
Usage: (error-handler a)
代码语言:javascript
复制
Returns the error-handler of agent a, or nil if there is none.
See set-error-handler!

在Clojure版本1.2中添加

误差模函数

代码语言:javascript
复制
Usage: (error-mode a)
代码语言:javascript
复制
Returns the error-mode of agent a.  See set-error-mode!

在Clojure版本1.2中添加

评价函数

代码语言:javascript
复制
Usage: (eval form)
代码语言:javascript
复制
Evaluates the form data structure (not text!) and returns the result.

在Clojure版本1.0中添加

甚至?功能

代码语言:javascript
复制
Usage: (even? n)
代码语言:javascript
复制
Returns true if n is even, throws an exception if n is not an integer

在Clojure版本1.0中添加

每一个预函数

代码语言:javascript
复制
Usage: (every-pred p)
       (every-pred p1 p2)
       (every-pred p1 p2 p3)
       (every-pred p1 p2 p3 & ps)
代码语言:javascript
复制
Takes a set of predicates and returns a function f that returns true if all of its
composing predicates return a logical true value against all of its arguments, else it returns
false. Note that f is short-circuiting in that it will stop execution on the first
argument that triggers a logical false result against the original predicates.

在Clojure版本1.3中添加

每个人?功能

代码语言:javascript
复制
Usage: (every? pred coll)
代码语言:javascript
复制
Returns true if (pred x) is logical true for every x in coll, else
false.

在Clojure版本1.0中添加

前数据结

代码语言:javascript
复制
Usage: (ex-data ex)
代码语言:javascript
复制
Returns exception data (a map) if ex is an IExceptionInfo.
Otherwise returns nil.

在Clojure版本1.4中添加

前信息函数

代码语言:javascript
复制
Usage: (ex-info msg map)
       (ex-info msg map cause)
代码语言:javascript
复制
Create an instance of ExceptionInfo, a RuntimeException subclass
that carries a map of additional data.

在Clojure版本1.4中添加

扩展函数

代码语言:javascript
复制
Usage: (extend atype & proto+mmaps)
代码语言:javascript
复制
Implementations of protocol methods can be provided using the extend construct:

 (extend AType
   AProtocol
    {:foo an-existing-fn
     :bar (fn [a b] ...)
     :baz (fn ([a]...) ([a b] ...)...)}
   BProtocol 
     {...} 
   ...)

 extend takes a type/class (or interface, see below), and one or more
 protocol + method map pairs. It will extend the polymorphism of the
 protocol's methods to call the supplied methods when an AType is
 provided as the first argument. 

 Method maps are maps of the keyword-ized method names to ordinary
 fns. This facilitates easy reuse of existing fns and fn maps, for
 code reuse/mixins without derivation or composition. You can extend
 an interface to a protocol. This is primarily to facilitate interop
 with the host (e.g. Java) but opens the door to incidental multiple
 inheritance of implementation since a class can inherit from more
 than one interface, both of which extend the protocol. It is TBD how
 to specify which impl to use. You can extend a protocol on nil.

 If you are supplying the definitions explicitly (i.e. not reusing
 exsting functions or mixin maps), you may find it more convenient to
 use the extend-type or extend-protocol macros.

 Note that multiple independent extend clauses can exist for the same
 type, not all protocols need be defined in a single extend call.

 See also:
 extends?, satisfies?, extenders

在Clojure版本1.2中添加

扩展协议宏

代码语言:javascript
复制
Usage: (extend-protocol p & specs)
代码语言:javascript
复制
Useful when you want to provide several implementations of the same
protocol all at once. Takes a single protocol and the implementation
of that protocol for one or more types. Expands into calls to
extend-type:

(extend-protocol Protocol
  AType
    (foo [x] ...)
    (bar [x y] ...)
  BType
    (foo [x] ...)
    (bar [x y] ...)
  AClass
    (foo [x] ...)
    (bar [x y] ...)
  nil
    (foo [x] ...)
    (bar [x y] ...))

expands into:

(do
 (clojure.core/extend-type AType Protocol 
   (foo [x] ...) 
   (bar [x y] ...))
 (clojure.core/extend-type BType Protocol 
   (foo [x] ...) 
   (bar [x y] ...))
 (clojure.core/extend-type AClass Protocol 
   (foo [x] ...) 
   (bar [x y] ...))
 (clojure.core/extend-type nil Protocol 
   (foo [x] ...) 
   (bar [x y] ...)))

在Clojure版本1.2中添加

扩展型

代码语言:javascript
复制
Usage: (extend-type t & specs)
代码语言:javascript
复制
A macro that expands into an extend call. Useful when you are
supplying the definitions explicitly inline, extend-type
automatically creates the maps required by extend.  Propagates the
class as a type hint on the first argument of all fns.

(extend-type MyType 
  Countable
    (cnt [c] ...)
  Foo
    (bar [x y] ...)
    (baz ([x] ...) ([x y & zs] ...)))

expands into:

(extend MyType
 Countable
   {:cnt (fn [c] ...)}
 Foo
   {:baz (fn ([x] ...) ([x y & zs] ...))
    :bar (fn [x y] ...)})

在Clojure版本1.2中添加

扩展函数

代码语言:javascript
复制
Usage: (extenders protocol)
代码语言:javascript
复制
Returns a collection of the types explicitly extending protocol

在Clojure版本1.2中添加

延伸?功能

代码语言:javascript
复制
Usage: (extends? protocol atype)
代码语言:javascript
复制
Returns true if atype extends protocol

在Clojure版本1.2中添加

假的?功能

代码语言:javascript
复制
Usage: (false? x)
代码语言:javascript
复制
Returns true if x is the value false, false otherwise.

在Clojure版本1.0中添加

非函数

代码语言:javascript
复制
Usage: (ffirst x)
代码语言:javascript
复制
Same as (first (first x))

在Clojure版本1.0中添加

文件-seqfunction

代码语言:javascript
复制
Usage: (file-seq dir)
代码语言:javascript
复制
A tree seq on java.io.Files

在Clojure版本1.0中添加

滤波函数

代码语言:javascript
复制
Usage: (filter pred)
       (filter pred coll)
代码语言:javascript
复制
Returns a lazy sequence of the items in coll for which
(pred item) returns true. pred must be free of side-effects.
Returns a transducer when no collection is provided.

在Clojure版本1.0中添加

滤波函数

代码语言:javascript
复制
Usage: (filterv pred coll)
代码语言:javascript
复制
Returns a vector of the items in coll for which
(pred item) returns true. pred must be free of side-effects.

在Clojure版本1.4中添加

最终特殊语法

代码语言:javascript
复制
Syntax for use with try.

Please see http://clojure.org/special_forms#try

在Clojure版本1.0中添加

查找函数

代码语言:javascript
复制
Usage: (find map key)
代码语言:javascript
复制
Returns the map entry for key, or nil if key not present.

在Clojure版本1.0中添加

查找关键字函数

代码语言:javascript
复制
Usage: (find-keyword name)
       (find-keyword ns name)
代码语言:javascript
复制
Returns a Keyword with the given namespace and name if one already
exists.  This function will not intern a new keyword. If the keyword
has not already been interned, it will return nil.  Do not use :
in the keyword strings, it will be added automatically.

在Clojure版本1.3中添加

发现函数

代码语言:javascript
复制
Usage: (find-ns sym)
代码语言:javascript
复制
Returns the namespace named by the symbol or nil if it doesn't exist.

在Clojure版本1.0中添加

查变函数

代码语言:javascript
复制
Usage: (find-var sym)
代码语言:javascript
复制
Returns the global var named by the namespace-qualified symbol, or
nil if no var with that name.

在Clojure版本1.0中添加

第一函数

代码语言:javascript
复制
Usage: (first coll)
代码语言:javascript
复制
Returns the first item in the collection. Calls seq on its
argument. If coll is nil, returns nil.

在Clojure版本1.0中添加

平坦函数

代码语言:javascript
复制
Usage: (flatten x)
代码语言:javascript
复制
Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat sequence.
(flatten nil) returns an empty sequence.

在Clojure版本1.2中添加

浮动函数

代码语言:javascript
复制
Usage: (float x)
代码语言:javascript
复制
Coerce to float

在Clojure版本1.0中添加

浮动数组函数

代码语言:javascript
复制
Usage: (float-array size-or-seq)
       (float-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of floats

在Clojure版本1.0中添加

浮起来?功能

代码语言:javascript
复制
Usage: (float? n)
代码语言:javascript
复制
Returns true if n is a floating point number

在Clojure版本1.0中添加

浮子函数

代码语言:javascript
复制
Usage: (floats xs)
代码语言:javascript
复制
Casts to float[]

在Clojure版本1.0中添加

冲洗函数

代码语言:javascript
复制
Usage: (flush)
代码语言:javascript
复制
Flushes the output stream that is the current value of
*out*

在Clojure版本1.0中添加

特殊形式

代码语言:javascript
复制
Usage: (fn name? [params*] exprs*)
       (fn name? ([params*] exprs*) +)
代码语言:javascript
复制
params => positional-params* , or positional-params* & next-param
positional-param => binding-form
next-param => binding-form
name => symbol

Defines a function

在Clojure版本1.0中添加

FN?功能

代码语言:javascript
复制
Usage: (fn? x)
代码语言:javascript
复制
Returns true if x implements Fn, i.e. is an object created via fn.

在Clojure版本1.0中添加

fnextfunction

代码语言:javascript
复制
Usage: (fnext x)
代码语言:javascript
复制
Same as (first (next x))

在Clojure版本1.0中添加

fnilfunction

代码语言:javascript
复制
Usage: (fnil f x)
       (fnil f x y)
       (fnil f x y z)
代码语言:javascript
复制
Takes a function f, and returns a function that calls f, replacing
a nil first argument to f with the supplied value x. Higher arity
versions can replace arguments in the second and third
positions (y, z). Note that the function f can take any number of
arguments, not just the one(s) being nil-patched.

在Clojure版本1.2中添加

福尔马克罗

代码语言:javascript
复制
Usage: (for seq-exprs body-expr)
代码语言:javascript
复制
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]))

在Clojure版本1.0中添加

力函数

代码语言:javascript
复制
Usage: (force x)
代码语言:javascript
复制
If x is a Delay, returns the (possibly cached) value of its expression, else returns x

在Clojure版本1.0中添加

形函数

代码语言:javascript
复制
Usage: (format fmt & args)
代码语言:javascript
复制
Formats a string using java.lang.String.format, see java.util.Formatter for format
string syntax

在Clojure版本1.0中添加

频率函数

代码语言:javascript
复制
Usage: (frequencies coll)
代码语言:javascript
复制
Returns a map from distinct items in coll to the number of times
they appear.

在Clojure版本1.2中添加

未来宏

代码语言:javascript
复制
Usage: (future & body)
代码语言:javascript
复制
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, unless the variant of
deref with timeout is used. See also - realized?.

在Clojure版本1.1中添加

未来呼叫函数

代码语言:javascript
复制
Usage: (future-call f)
代码语言:javascript
复制
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, unless the variant
of deref with timeout is used. See also - realized?.

在Clojure版本1.1中添加

未来-取消功能

代码语言:javascript
复制
Usage: (future-cancel f)
代码语言:javascript
复制
Cancels the future, if possible.

在Clojure版本1.1中添加

未来-取消?功能

代码语言:javascript
复制
Usage: (future-cancelled? f)
代码语言:javascript
复制
Returns true if future f is cancelled

在Clojure版本1.1中添加

未来-结束?功能

代码语言:javascript
复制
Usage: (future-done? f)
代码语言:javascript
复制
Returns true if future f is done

在Clojure版本1.1中添加

未来?功能

代码语言:javascript
复制
Usage: (future? x)
代码语言:javascript
复制
Returns true if x is a future

在Clojure版本1.1中添加

GEN-class宏

代码语言:javascript
复制
Usage: (gen-class & options)
代码语言:javascript
复制
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.
Its 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.

在Clojure版本1.0中添加

GEN-Interfacemacro

代码语言:javascript
复制
Usage: (gen-interface & options)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

原辛函数

代码语言:javascript
复制
Usage: (gensym)
       (gensym prefix-string)
代码语言:javascript
复制
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__'.

在Clojure版本1.0中添加

吸气函数

代码语言:javascript
复制
Usage: (get map key)
       (get map key not-found)
代码语言:javascript
复制
Returns the value mapped to key, not-found or nil if key not present.

在Clojure版本1.0中添加

失功

代码语言:javascript
复制
Usage: (get-in m ks)
       (get-in m ks not-found)
代码语言:javascript
复制
Returns the value in a nested associative structure,
where ks is a sequence of keys. Returns nil if the key
is not present, or the not-found value if supplied.

在Clojure版本1.2中添加

获取方法函数

代码语言:javascript
复制
Usage: (get-method multifn dispatch-val)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

获取代理类函数

代码语言:javascript
复制
Usage: (get-proxy-class & bases)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

GET-线程绑定函数

代码语言:javascript
复制
Usage: (get-thread-bindings)
代码语言:javascript
复制
Get a map with the Var/value pairs which is currently in effect for the
current thread.

在Clojure版本1.1中添加

GET-验证函数

代码语言:javascript
复制
Usage: (get-validator iref)
代码语言:javascript
复制
Gets the validator-fn for a var/ref/agent/atom.

在Clojure版本1.0中添加

群逐函数

代码语言:javascript
复制
Usage: (group-by f coll)
代码语言:javascript
复制
Returns a map of the elements of coll keyed by the result of
f on each element. The value at each key will be a vector of the
corresponding elements, in the order they appeared in coll.

在Clojure版本1.2中添加

散列函数

代码语言:javascript
复制
Usage: (hash x)
代码语言:javascript
复制
Returns the hash code of its argument. Note this is the hash code
consistent with =, and thus is different than .hashCode for Integer,
Short, Byte and Clojure collections.

在Clojure版本1.0中添加

散列映射函数

代码语言:javascript
复制
Usage: (hash-map)
       (hash-map & keyvals)
代码语言:javascript
复制
keyval => key val
Returns a new hash map with supplied mappings.  If any keys are
equal, they are handled as if by repeated uses of assoc.

在Clojure版本1.0中添加

散列排序-排序函数

代码语言:javascript
复制
Usage: (hash-ordered-coll coll)
代码语言:javascript
复制
Returns the hash code, consistent with =, for an external ordered
collection implementing Iterable.
See http://clojure.org/data_structures#hash for full algorithms.

在Clojure版本1.6中添加

散列函数

代码语言:javascript
复制
Usage: (hash-set)
       (hash-set & keys)
代码语言:javascript
复制
Returns a new hash set with supplied keys.  Any equal keys are
handled as if by repeated uses of conj.

在Clojure版本1.0中添加

散列-无序-拼贴函数

代码语言:javascript
复制
Usage: (hash-unordered-coll coll)
代码语言:javascript
复制
Returns the hash code, consistent with =, for an external unordered
collection implementing Iterable. For maps, the iterator should
return map entries whose hash is computed as
  (hash-ordered-coll [k v]).
See http://clojure.org/data_structures#hash for full algorithms.

在Clojure版本1.6中添加

完全一样?功能

代码语言:javascript
复制
Usage: (identical? x y)
代码语言:javascript
复制
Tests if 2 arguments are the same object

在Clojure版本1.0中添加

标识函数

代码语言:javascript
复制
Usage: (identity x)
代码语言:javascript
复制
Returns its argument.

在Clojure版本1.0中添加

如果特殊形式

代码语言:javascript
复制
Usage: (if test then else?)
代码语言:javascript
复制
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 http://clojure.org/special_forms#if

在Clojure版本1.0中添加

如果---

代码语言:javascript
复制
Usage: (if-let bindings then)
       (if-let bindings then else & oldform)
代码语言:javascript
复制
bindings => binding-form test

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

在Clojure版本1.0中添加

如果-不是宏

代码语言:javascript
复制
Usage: (if-not test then)
       (if-not test then else)
代码语言:javascript
复制
Evaluates test. If logical false, evaluates and returns then expr, 
otherwise else expr, if supplied, else nil.

在Clojure版本1.0中添加

如果-

代码语言:javascript
复制
Usage: (if-some bindings then)
       (if-some bindings then else & oldform)
代码语言:javascript
复制
bindings => binding-form test

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

在Clojure版本1.6中添加

干扰素?功能

代码语言:javascript
复制
Usage: (ifn? x)
代码语言:javascript
复制
Returns true if x implements IFn. Note that many data structures
(e.g. sets and maps) implement IFn

在Clojure版本1.0中添加

进口宏

代码语言:javascript
复制
Usage: (import & import-symbols-or-lists)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

内函数

代码语言:javascript
复制
Usage: (in-ns name)
代码语言:javascript
复制
Sets *ns* to the namespace named by the symbol, creating it if needed.

在Clojure版本1.0中添加

不起作用

代码语言:javascript
复制
Usage: (inc x)
代码语言:javascript
复制
Returns a number one greater than num. Does not auto-promote
longs, will throw on overflow. See also: inc'

在Clojure版本1.2中添加

公司%27功能

代码语言:javascript
复制
Usage: (inc' x)
代码语言:javascript
复制
Returns a number one greater than num. Supports arbitrary precision.
See also: inc

在Clojure版本1.0中添加

init-proxyfunction

代码语言:javascript
复制
Usage: (init-proxy proxy mappings)
代码语言:javascript
复制
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.  Returns the proxy.

在Clojure版本1.0中添加

举个例子?功能

代码语言:javascript
复制
Usage: (instance? c x)
代码语言:javascript
复制
Evaluates x and tests if it is an instance of the class
c. Returns true or false

在Clojure版本1.0中添加

凹凸不平

代码语言:javascript
复制
Usage: (int x)
代码语言:javascript
复制
Coerce to int

在Clojure版本1.0中添加

整数列函数

代码语言:javascript
复制
Usage: (int-array size-or-seq)
       (int-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of ints

在Clojure版本1.0中添加

整数?功能

代码语言:javascript
复制
Usage: (integer? n)
代码语言:javascript
复制
Returns true if n is an integer

在Clojure版本1.0中添加

交织函数

代码语言:javascript
复制
Usage: (interleave)
       (interleave c1)
       (interleave c1 c2)
       (interleave c1 c2 & colls)
代码语言:javascript
复制
Returns a lazy seq of the first item in each coll, then the second etc.

在Clojure版本1.0中添加

内函数

代码语言:javascript
复制
Usage: (intern ns name)
       (intern ns name val)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

中间函数

代码语言:javascript
复制
Usage: (interpose sep)
       (interpose sep coll)
代码语言:javascript
复制
Returns a lazy seq of the elements of coll separated by sep.
Returns a stateful transducer when no collection is provided.

在Clojure版本1.0中添加

内函数

代码语言:javascript
复制
Usage: (into to from)
       (into to xform from)
代码语言:javascript
复制
Returns a new coll consisting of to-coll with all of the items of
from-coll conjoined. A transducer may be supplied.

在Clojure版本1.0中添加

成列函数

代码语言:javascript
复制
Usage: (into-array aseq)
       (into-array type aseq)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

整体函数

代码语言:javascript
复制
Usage: (ints xs)
代码语言:javascript
复制
Casts to int[]

在Clojure版本1.0中添加

IO%21宏

代码语言:javascript
复制
Usage: (io! & body)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

伊莎?功能

代码语言:javascript
复制
Usage: (isa? child parent)
       (isa? h child parent)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

迭代函数

代码语言:javascript
复制
Usage: (iterate f x)
代码语言:javascript
复制
Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects

在Clojure版本1.0中添加

迭代器-seq函数

代码语言:javascript
复制
Usage: (iterator-seq iter)
代码语言:javascript
复制
Returns a seq on a java.util.Iterator. Note that most collections
providing iterators implement Iterable and thus support seq directly.
Seqs cache values, thus iterator-seq should not be used on any
iterator that repeatedly returns the same mutable object.

在Clojure版本1.0中添加

并列函数

代码语言:javascript
复制
Usage: (juxt f)
       (juxt f g)
       (juxt f g h)
       (juxt f g h & fs)
代码语言:javascript
复制
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)]

在Clojure版本1.1中添加

保持函数

代码语言:javascript
复制
Usage: (keep f)
       (keep f coll)
代码语言:javascript
复制
Returns a lazy sequence of the non-nil results of (f item). Note,
this means false return values will be included.  f must be free of
side-effects.  Returns a transducer when no collection is provided.

在Clojure版本1.2中添加

保持索引函数

代码语言:javascript
复制
Usage: (keep-indexed f)
       (keep-indexed f coll)
代码语言:javascript
复制
Returns a lazy sequence of the non-nil results of (f index item). Note,
this means false return values will be included.  f must be free of
side-effects.  Returns a stateful transducer when no collection is
provided.

在Clojure版本1.2中添加

键函数

代码语言:javascript
复制
Usage: (key e)
代码语言:javascript
复制
Returns the key of the map entry.

在Clojure版本1.0中添加

键函数

代码语言:javascript
复制
Usage: (keys map)
代码语言:javascript
复制
Returns a sequence of the map's keys, in the same order as (seq map).

在Clojure版本1.0中添加

关键字函数

代码语言:javascript
复制
Usage: (keyword name)
       (keyword ns name)
代码语言:javascript
复制
Returns a Keyword with the given namespace and name.  Do not use :
in the keyword strings, it will be added automatically.

在Clojure版本1.0中添加

关键词?功能

代码语言:javascript
复制
Usage: (keyword? x)
代码语言:javascript
复制
Return true if x is a Keyword

在Clojure版本1.0中添加

最后函数

代码语言:javascript
复制
Usage: (last coll)
代码语言:javascript
复制
Return the last item in coll, in linear time

在Clojure版本1.0中添加

懒散

代码语言:javascript
复制
Usage: (lazy-cat & colls)
代码语言:javascript
复制
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))

在Clojure版本1.0中添加

懒惰

代码语言:javascript
复制
Usage: (lazy-seq & body)
代码语言:javascript
复制
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. See also - realized?

在Clojure版本1.0中添加

特殊形式

代码语言:javascript
复制
Usage: (let [bindings*] exprs*)
代码语言:javascript
复制
binding => binding-form init-expr

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.

在Clojure版本1.0中添加

特殊形式

代码语言:javascript
复制
Usage: (letfn [fnspecs*] exprs*)
代码语言:javascript
复制
fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)

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.

在Clojure版本1.0中添加

线-seq函数

代码语言:javascript
复制
Usage: (line-seq rdr)
代码语言:javascript
复制
Returns the lines of text from rdr as a lazy sequence of strings.
rdr must implement java.io.BufferedReader.

在Clojure版本1.0中添加

列表函数

代码语言:javascript
复制
Usage: (list & items)
代码语言:javascript
复制
Creates a new list containing the items.

在Clojure版本1.0中添加

列单%2A功能

代码语言:javascript
复制
Usage: (list* args)
       (list* a args)
       (list* a b args)
       (list* a b c args)
       (list* a b c d & more)
代码语言:javascript
复制
Creates a new seq containing the items prepended to the rest, the
last of which will be treated as a sequence.

在Clojure版本1.0中添加

名单?功能

代码语言:javascript
复制
Usage: (list? x)
代码语言:javascript
复制
Returns true if x implements IPersistentList

在Clojure版本1.0中添加

负荷函数

代码语言:javascript
复制
Usage: (load & paths)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

负载文件函数

代码语言:javascript
复制
Usage: (load-file name)
代码语言:javascript
复制
Sequentially read and evaluate the set of forms contained in the file.

在Clojure版本1.0中添加

负载读取函数

代码语言:javascript
复制
Usage: (load-reader rdr)
代码语言:javascript
复制
Sequentially read and evaluate the set of forms contained in the
stream/file

在Clojure版本1.0中添加

荷载-弦函数

代码语言:javascript
复制
Usage: (load-string s)
代码语言:javascript
复制
Sequentially read and evaluate the set of forms contained in the
string

在Clojure版本1.0中添加

加载-libsfunction

代码语言:javascript
复制
Usage: (loaded-libs)
代码语言:javascript
复制
Returns a sorted set of symbols naming the currently loaded libs

在Clojure版本1.0中添加

锁宏

代码语言:javascript
复制
Usage: (locking x & body)
代码语言:javascript
复制
Executes exprs in an implicit do, while holding the monitor of x.
Will release the monitor of x in all circumstances.

在Clojure版本1.0中添加

长函数

代码语言:javascript
复制
Usage: (long x)
代码语言:javascript
复制
Coerce to long

在Clojure版本1.0中添加

长列函数

代码语言:javascript
复制
Usage: (long-array size-or-seq)
       (long-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of longs

在Clojure版本1.0中添加

长函数

代码语言:javascript
复制
Usage: (longs xs)
代码语言:javascript
复制
Casts to long[]

在Clojure版本1.0中添加

环特殊形式

代码语言:javascript
复制
Usage: (loop [bindings*] exprs*)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

宏扩展函数

代码语言:javascript
复制
Usage: (macroexpand form)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

宏扩展-1函数

代码语言:javascript
复制
Usage: (macroexpand-1 form)
代码语言:javascript
复制
If form represents a macro form, returns its expansion,
else returns form.

在Clojure版本1.0中添加

造列函数

代码语言:javascript
复制
Usage: (make-array type len)
       (make-array type dim & more-dims)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

生成层次函数

代码语言:javascript
复制
Usage: (make-hierarchy)
代码语言:javascript
复制
Creates a hierarchy object for use with derive, isa? etc.

在Clojure版本1.0中添加

映射函数

代码语言:javascript
复制
Usage: (map f)
       (map f coll)
       (map f c1 c2)
       (map f c1 c2 c3)
       (map f c1 c2 c3 & colls)
代码语言:javascript
复制
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. Returns a transducer when
no collection is provided.

在Clojure版本1.0中添加

地图入口?功能

代码语言:javascript
复制
Usage: (map-entry? x)
代码语言:javascript
复制
Return true if x is a map entry

在Clojure版本1.8中添加

地图索引函数

代码语言:javascript
复制
Usage: (map-indexed f)
       (map-indexed f coll)
代码语言:javascript
复制
Returns a lazy sequence consisting of the result of applying f to 0
and the first item of coll, followed by applying f to 1 and the second
item in coll, etc, until coll is exhausted. Thus function f should
accept 2 arguments, index and item. Returns a stateful transducer when
no collection is provided.

在Clojure版本1.2中添加

地图?功能

代码语言:javascript
复制
Usage: (map? x)
代码语言:javascript
复制
Return true if x implements IPersistentMap

在Clojure版本1.0中添加

映射函数

代码语言:javascript
复制
Usage: (mapcat f)
       (mapcat f & colls)
代码语言:javascript
复制
Returns the result of applying concat to the result of applying map
to f and colls.  Thus function f should return a collection. Returns
a transducer when no collections are provided

在Clojure版本1.0中添加

映射函数

代码语言:javascript
复制
Usage: (mapv f coll)
       (mapv f c1 c2)
       (mapv f c1 c2 c3)
       (mapv f c1 c2 c3 & colls)
代码语言:javascript
复制
Returns a vector 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.

在Clojure版本1.4中添加

最大函数

代码语言:javascript
复制
Usage: (max x)
       (max x y)
       (max x y & more)
代码语言:javascript
复制
Returns the greatest of the nums.

在Clojure版本1.0中添加

最大键函数

代码语言:javascript
复制
Usage: (max-key k x)
       (max-key k x y)
       (max-key k x y & more)
代码语言:javascript
复制
Returns the x for which (k x), a number, is greatest.

在Clojure版本1.0中添加

模模宏

代码语言:javascript
复制
Usage: (memfn name & args)
代码语言:javascript
复制
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. name may be type-hinted with the method receiver's
type in order to avoid reflective calls.

在Clojure版本1.0中添加

回忆录功能

代码语言:javascript
复制
Usage: (memoize f)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

合并函数

代码语言:javascript
复制
Usage: (merge & maps)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

合并函数

代码语言:javascript
复制
Usage: (merge-with f & maps)
代码语言:javascript
复制
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).

在Clojure版本1.0中添加

元功能

代码语言:javascript
复制
Usage: (meta obj)
代码语言:javascript
复制
Returns the metadata of obj, returns nil if there is no metadata.

在Clojure版本1.0中添加

方法函数

代码语言:javascript
复制
Usage: (methods multifn)
代码语言:javascript
复制
Given a multimethod, returns a map of dispatch values -> dispatch fns

在Clojure版本1.0中添加

极小函数

代码语言:javascript
复制
Usage: (min x)
       (min x y)
       (min x y & more)
代码语言:javascript
复制
Returns the least of the nums.

在Clojure版本1.0中添加

min键函数

代码语言:javascript
复制
Usage: (min-key k x)
       (min-key k x y)
       (min-key k x y & more)
代码语言:javascript
复制
Returns the x for which (k x), a number, is least.

在Clojure版本1.0中添加

混合集合-哈希函数

代码语言:javascript
复制
Usage: (mix-collection-hash hash-basis count)
代码语言:javascript
复制
Mix final collection hash for ordered or unordered collections.
hash-basis is the combined collection hash, count is the number
of elements included in the basis. Note this is the hash code
consistent with =, different from .hashCode.
See http://clojure.org/data_structures#hash for full algorithms.

在Clojure版本1.6中添加

模函数

代码语言:javascript
复制
Usage: (mod num div)
代码语言:javascript
复制
Modulus of num and div. Truncates toward negative infinity.

在Clojure版本1.0中添加

监测器-肠胃特殊表格

代码语言:javascript
复制
Usage: (monitor-enter x)
代码语言:javascript
复制
Synchronization primitive that should be avoided
in user code. Use the 'locking' macro.

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

在Clojure版本1.0中添加

监控器---退出特别表格

代码语言:javascript
复制
Usage: (monitor-exit x)
代码语言:javascript
复制
Synchronization primitive that should be avoided
in user code. Use the 'locking' macro.

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

在Clojure版本1.0中添加

名函数

代码语言:javascript
复制
Usage: (name x)
代码语言:javascript
复制
Returns the name String of a string, symbol or keyword.

在Clojure版本1.0中添加

命名空间函数

代码语言:javascript
复制
Usage: (namespace x)
代码语言:javascript
复制
Returns the namespace String of a symbol or keyword, or nil if not present.

在Clojure版本1.0中添加

命名空间---市政函数

代码语言:javascript
复制
Usage: (namespace-munge ns)
代码语言:javascript
复制
Convert a Clojure namespace name to a legal Java package name.

在Clojure版本1.2中添加

内格?功能

代码语言:javascript
复制
Usage: (neg? x)
代码语言:javascript
复制
Returns true if num is less than zero, else false

在Clojure版本1.0中添加

新特殊形式

代码语言:javascript
复制
Usage: (Classname. args*)
       (new Classname args*)
代码语言:javascript
复制
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 http://clojure.org/java_interop#new

在Clojure版本1.0中添加

新线函数

代码语言:javascript
复制
Usage: (newline)
代码语言:javascript
复制
Writes a platform-specific newline to *out*

在Clojure版本1.0中添加

下项函数

代码语言:javascript
复制
Usage: (next coll)
代码语言:javascript
复制
Returns a seq of the items after the first. Calls seq on its
argument.  If there are no more items, returns nil.

在Clojure版本1.0中添加

nfirst函数

代码语言:javascript
复制
Usage: (nfirst x)
代码语言:javascript
复制
Same as (next (first x))

在Clojure版本1.0中添加

没有?功能

代码语言:javascript
复制
Usage: (nil? x)
代码语言:javascript
复制
Returns true if x is nil, false otherwise.

在Clojure版本1.0中添加

下位函数

代码语言:javascript
复制
Usage: (nnext x)
代码语言:javascript
复制
Same as (next (next x))

在Clojure版本1.0中添加

非函数

代码语言:javascript
复制
Usage: (not x)
代码语言:javascript
复制
Returns true if x is logical false, false otherwise.

在Clojure版本1.0中添加

没有-有吗?功能

代码语言:javascript
复制
Usage: (not-any? pred coll)
代码语言:javascript
复制
Returns false if (pred x) is logical true for any x in coll,
else true.

在Clojure版本1.0中添加

非空函数

代码语言:javascript
复制
Usage: (not-empty coll)
代码语言:javascript
复制
If coll is empty, returns nil, else coll

在Clojure版本1.0中添加

不是-每个人?功能

代码语言:javascript
复制
Usage: (not-every? pred coll)
代码语言:javascript
复制
Returns false if (pred x) is logical true for every x in
coll, else true.

在Clojure版本1.0中添加

不=函数

代码语言:javascript
复制
Usage: (not= x)
       (not= x y)
       (not= x y & more)
代码语言:javascript
复制
Same as (not (= obj1 obj2))

在Clojure版本1.0中添加

nsmacro

代码语言:javascript
复制
Usage: (ns name docstring? attr-map? references*)
代码语言:javascript
复制
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.core) 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 combinatorics))
  (:use (my.lib this that))
  (:import (java.util Date Timer Random)
           (java.sql Connection Statement)))

在Clojure版本1.0中添加

NS-别名函数

代码语言:javascript
复制
Usage: (ns-aliases ns)
代码语言:javascript
复制
Returns a map of the aliases for the namespace.

在Clojure版本1.0中添加

NS-重要函数

代码语言:javascript
复制
Usage: (ns-imports ns)
代码语言:javascript
复制
Returns a map of the import mappings for the namespace.

在Clojure版本1.0中添加

NS-内部函数

代码语言:javascript
复制
Usage: (ns-interns ns)
代码语言:javascript
复制
Returns a map of the intern mappings for the namespace.

在Clojure版本1.0中添加

NS-映射函数

代码语言:javascript
复制
Usage: (ns-map ns)
代码语言:javascript
复制
Returns a map of all the mappings for the namespace.

在Clojure版本1.0中添加

NS-名函数

代码语言:javascript
复制
Usage: (ns-name ns)
代码语言:javascript
复制
Returns the name of the namespace, a symbol.

在Clojure版本1.0中添加

NS-公共职能

代码语言:javascript
复制
Usage: (ns-publics ns)
代码语言:javascript
复制
Returns a map of the public intern mappings for the namespace.

在Clojure版本1.0中添加

NS-参考函数

代码语言:javascript
复制
Usage: (ns-refers ns)
代码语言:javascript
复制
Returns a map of the refer mappings for the namespace.

在Clojure版本1.0中添加

NS-分解函数

代码语言:javascript
复制
Usage: (ns-resolve ns sym)
       (ns-resolve ns env sym)
代码语言:javascript
复制
Returns the var or Class to which a symbol will be resolved in the
namespace (unless found in the environment), else nil.  Note that
if the symbol is fully qualified, the var/Class to which it resolves
need not be present in the namespace.

在Clojure版本1.0中添加

NS-unaliasfunction

代码语言:javascript
复制
Usage: (ns-unalias ns sym)
代码语言:javascript
复制
Removes the alias for the symbol from the namespace.

在Clojure版本1.0中添加

ns-unmapfunction

代码语言:javascript
复制
Usage: (ns-unmap ns sym)
代码语言:javascript
复制
Removes the mappings for the symbol from the namespace.

在Clojure版本1.0中添加

nthfunction

代码语言:javascript
复制
Usage: (nth coll index)
       (nth coll index not-found)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

nthnextfunction

代码语言:javascript
复制
Usage: (nthnext coll n)
代码语言:javascript
复制
Returns the nth next of coll, (seq coll) when n is 0.

在Clojure版本1.0中添加

n-函数

代码语言:javascript
复制
Usage: (nthrest coll n)
代码语言:javascript
复制
Returns the nth rest of coll, coll when n is 0.

在Clojure版本1.3中添加

数值函数

代码语言:javascript
复制
Usage: (num x)
代码语言:javascript
复制
Coerce to Number

在Clojure版本1.0中添加

电话号码?功能

代码语言:javascript
复制
Usage: (number? x)
代码语言:javascript
复制
Returns true if x is a Number

在Clojure版本1.0中添加

分子函数

代码语言:javascript
复制
Usage: (numerator r)
代码语言:javascript
复制
Returns the numerator part of a Ratio.

在Clojure版本1.2中添加

物列函数

代码语言:javascript
复制
Usage: (object-array size-or-seq)
代码语言:javascript
复制
Creates an array of objects

在Clojure版本1.2中添加

奇怪?功能

代码语言:javascript
复制
Usage: (odd? n)
代码语言:javascript
复制
Returns true if n is odd, throws an exception if n is not an integer

在Clojure版本1.0中添加

或宏

代码语言:javascript
复制
Usage: (or)
       (or x)
       (or x & next)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

父函数

代码语言:javascript
复制
Usage: (parents tag)
       (parents h tag)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

部分函数

代码语言:javascript
复制
Usage: (partial f)
       (partial f arg1)
       (partial f arg1 arg2)
       (partial f arg1 arg2 arg3)
       (partial f arg1 arg2 arg3 & more)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

分块函数

代码语言:javascript
复制
Usage: (partition n coll)
       (partition n step coll)
       (partition n step pad coll)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

分区-全函数

代码语言:javascript
复制
Usage: (partition-all n)
       (partition-all n coll)
       (partition-all n step coll)
代码语言:javascript
复制
Returns a lazy sequence of lists like partition, but may include
partitions with fewer than n items at the end.  Returns a stateful
transducer when no collection is provided.

在Clojure版本1.2中添加

分块-逐函数

代码语言:javascript
复制
Usage: (partition-by f)
       (partition-by f coll)
代码语言:javascript
复制
Applies f to each value in coll, splitting it each time f returns a
new value.  Returns a lazy seq of partitions.  Returns a stateful
transducer when no collection is provided.

在Clojure版本1.2中添加

pcallsfunction

代码语言:javascript
复制
Usage: (pcalls & fns)
代码语言:javascript
复制
Executes the no-arg fns in parallel, returning a lazy sequence of
their values

在Clojure版本1.0中添加

PEEK函数

代码语言:javascript
复制
Usage: (peek coll)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

持久%21功能

代码语言:javascript
复制
Usage: (persistent! coll)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

pmapfunction

代码语言:javascript
复制
Usage: (pmap f coll)
       (pmap f coll & colls)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

爆函数

代码语言:javascript
复制
Usage: (pop coll)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

POP%21功能

代码语言:javascript
复制
Usage: (pop! coll)
代码语言:javascript
复制
Removes the last item from a transient vector. If
the collection is empty, throws an exception. Returns coll

在Clojure版本1.1中添加

弹出线程绑定函数

代码语言:javascript
复制
Usage: (pop-thread-bindings)
代码语言:javascript
复制
Pop one set of bindings pushed with push-binding before. It is an error to
pop bindings without pushing before.

在Clojure版本1.1中添加

警察?功能

代码语言:javascript
复制
Usage: (pos? x)
代码语言:javascript
复制
Returns true if num is greater than zero, else false

在Clojure版本1.0中添加

PRDynamic函数

代码语言:javascript
复制
Usage: (pr)
       (pr x)
       (pr x & more)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

PR-结构函数

代码语言:javascript
复制
Usage: (pr-str & xs)
代码语言:javascript
复制
pr to a string, returning it

在Clojure版本1.0中添加

偏好-方法函数

代码语言:javascript
复制
Usage: (prefer-method multifn dispatch-val-x dispatch-val-y)
代码语言:javascript
复制
Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y 
when there is a conflict

在Clojure版本1.0中添加

偏好函数

代码语言:javascript
复制
Usage: (prefers multifn)
代码语言:javascript
复制
Given a multimethod, returns a map of preferred value -> set of other values

在Clojure版本1.0中添加

打印函数

代码语言:javascript
复制
Usage: (print & more)
代码语言:javascript
复制
Prints the object(s) to the output stream that is the current value
of *out*.  print and println produce output for human consumption.

在Clojure版本1.0中添加

印字函数

代码语言:javascript
复制
Usage: (print-str & xs)
代码语言:javascript
复制
print to a string, returning it

在Clojure版本1.0中添加

印刷结

代码语言:javascript
复制
Usage: (printf fmt & args)
代码语言:javascript
复制
Prints formatted output, as per format

在Clojure版本1.0中添加

printlnfunction

代码语言:javascript
复制
Usage: (println & more)
代码语言:javascript
复制
Same as print followed by (newline)

在Clojure版本1.0中添加

println-strfunction

代码语言:javascript
复制
Usage: (println-str & xs)
代码语言:javascript
复制
println to a string, returning it

在Clojure版本1.0中添加

prnfunction

代码语言:javascript
复制
Usage: (prn & more)
代码语言:javascript
复制
Same as pr followed by (newline). Observes *flush-on-newline*

在Clojure版本1.0中添加

PRN-结构函数

代码语言:javascript
复制
Usage: (prn-str & xs)
代码语言:javascript
复制
prn to a string, returning it

在Clojure版本1.0中添加

约定函数

代码语言:javascript
复制
Usage: (promise)
代码语言:javascript
复制
Returns a promise object that can be read with deref/@, and set,
once only, with deliver. Calls to deref/@ prior to delivery will
block, unless the variant of deref with timeout is used. All
subsequent derefs will return the same delivered value without
blocking. See also - realized?.

在Clojure版本1.1中添加

丙宏

代码语言:javascript
复制
Usage: (proxy class-and-interfaces args & fs)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

代理映射函数

代码语言:javascript
复制
Usage: (proxy-mappings proxy)
代码语言:javascript
复制
Takes a proxy instance and returns the proxy's fn map.

在Clojure版本1.0中添加

代理-超级宏

代码语言:javascript
复制
Usage: (proxy-super meth & args)
代码语言:javascript
复制
Use to call a superclass method in the body of a proxy method. 
Note, expansion captures 'this

在Clojure版本1.0中添加

推送线程绑定函数

代码语言:javascript
复制
Usage: (push-thread-bindings bindings)
代码语言:javascript
复制
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)))

在Clojure版本1.1中添加

pvalue宏

代码语言:javascript
复制
Usage: (pvalues & exprs)
代码语言:javascript
复制
Returns a lazy sequence of the values of the exprs, which are
evaluated in parallel

在Clojure版本1.0中添加

引号函数

代码语言:javascript
复制
Usage: (quot num div)
代码语言:javascript
复制
quot[ient] of dividing numerator by denominator.

在Clojure版本1.0中添加

引文特殊形式

代码语言:javascript
复制
Usage: (quote form)
代码语言:javascript
复制
Yields the unevaluated form.

Please see http://clojure.org/special_forms#quote

在Clojure版本1.0中添加

随机函数

代码语言:javascript
复制
Usage: (rand)
       (rand n)
代码语言:javascript
复制
Returns a random floating point number between 0 (inclusive) and
n (default 1) (exclusive).

在Clojure版本1.0中添加

Rand-intfunction

代码语言:javascript
复制
Usage: (rand-int n)
代码语言:javascript
复制
Returns a random integer between 0 (inclusive) and n (exclusive).

在Clojure版本1.0中添加

兰德函数

代码语言:javascript
复制
Usage: (rand-nth coll)
代码语言:javascript
复制
Return a random element of the (sequential) collection. Will have
the same performance characteristics as nth for the given
collection.

在Clojure版本1.2中添加

随机采样函数

代码语言:javascript
复制
Usage: (random-sample prob)
       (random-sample prob coll)
代码语言:javascript
复制
Returns items from coll with random probability of prob (0.0 -
1.0).  Returns a transducer when no collection is provided.

在Clojure版本1.7中添加

距离函数

代码语言:javascript
复制
Usage: (range)
       (range end)
       (range start end)
       (range start end step)
代码语言:javascript
复制
Returns a lazy seq of nums from start (inclusive) to end
(exclusive), by step, where start defaults to 0, step to 1, and end to
infinity. When step is equal to 0, returns an infinite sequence of
start. When start is equal to end, returns empty list.

在Clojure版本1.0中添加

比率?功能

代码语言:javascript
复制
Usage: (ratio? n)
代码语言:javascript
复制
Returns true if n is a Ratio

在Clojure版本1.0中添加

理性?功能

代码语言:javascript
复制
Usage: (rational? n)
代码语言:javascript
复制
Returns true if n is a rational number

在Clojure版本1.0中添加

理性化函数

代码语言:javascript
复制
Usage: (rationalize num)
代码语言:javascript
复制
returns the rational value of num

在Clojure版本1.0中添加

重查找函数

代码语言:javascript
复制
Usage: (re-find m)
       (re-find re s)
代码语言:javascript
复制
Returns the next regex match, if any, of string to pattern, using
java.util.regex.Matcher.find().  Uses re-groups to return the
groups.

在Clojure版本1.0中添加

再群函数

代码语言:javascript
复制
Usage: (re-groups m)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

再矩阵函数

代码语言:javascript
复制
Usage: (re-matcher re s)
代码语言:javascript
复制
Returns an instance of java.util.regex.Matcher, for use, e.g. in
re-find.

在Clojure版本1.0中添加

再匹配函数

代码语言:javascript
复制
Usage: (re-matches re s)
代码语言:javascript
复制
Returns the match, if any, of string to pattern, using
java.util.regex.Matcher.matches().  Uses re-groups to return the
groups.

在Clojure版本1.0中添加

再模式函数

代码语言:javascript
复制
Usage: (re-pattern s)
代码语言:javascript
复制
Returns an instance of java.util.regex.Pattern, for use, e.g. in
re-matcher.

在Clojure版本1.0中添加

再集函数

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

在Clojure版本1.0中添加

读函数

代码语言:javascript
复制
Usage: (read)
       (read stream)
       (read stream eof-error? eof-value)
       (read stream eof-error? eof-value recursive?)
       (read opts stream)
代码语言:javascript
复制
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*.

Opts is a persistent map with valid keys:
  :read-cond - :allow to process reader conditionals, or
               :preserve to keep all branches
  :features - persistent set of feature keywords for reader conditionals
  :eof - on eof, return value unless :eofthrow, then throw.
         if not specified, will throw

Note that read can execute code (controlled by *read-eval*),
and as such should be used only with trusted sources.

For data structure interop use clojure.edn/read

在Clojure版本1.0中添加

读行函数

代码语言:javascript
复制
Usage: (read-line)
代码语言:javascript
复制
Reads the next line from stream that is the current value of *in* .

在Clojure版本1.0中添加

读-串函数

代码语言:javascript
复制
Usage: (read-string s)
       (read-string opts s)
代码语言:javascript
复制
Reads one object from the string s. Optionally include reader
options, as specified in read.

Note that read-string can execute code (controlled by *read-eval*),
and as such should be used only with trusted sources.

For data structure interop use clojure.edn/read-string

在Clojure版本1.0中添加

读者条件函数

代码语言:javascript
复制
Usage: (reader-conditional form splicing?)
代码语言:javascript
复制
Construct a data representation of a reader conditional.
If true, splicing? indicates read-cond-splicing.

在Clojure版本1.7中添加

读者条件?功能

代码语言:javascript
复制
Usage: (reader-conditional? value)
代码语言:javascript
复制
Return true if the value is the data representation of a reader conditional

在Clojure版本1.7中添加

意识到了?功能

代码语言:javascript
复制
Usage: (realized? x)
代码语言:javascript
复制
Returns true if a value has been produced for a promise, delay, future or lazy sequence.

在Clojure版本1.3中添加

记录?功能

代码语言:javascript
复制
Usage: (record? x)
代码语言:javascript
复制
Returns true if x is a record

在Clojure版本1.6中添加

递归特殊形式

代码语言:javascript
复制
Usage: (recur exprs*)
代码语言:javascript
复制
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 http://clojure.org/special_forms#recur

在Clojure版本1.0中添加

还原函数

代码语言:javascript
复制
Usage: (reduce f coll)
       (reduce f val coll)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

约kv函数

代码语言:javascript
复制
Usage: (reduce-kv f init coll)
代码语言:javascript
复制
Reduces an associative collection. f should be a function of 3
arguments. Returns the result of applying f to init, the first key
and the first value in coll, then applying f to that result and the
2nd key and value, etc. If coll contains no entries, returns init
and f is not called. Note that reduce-kv is supported on vectors,
where the keys will be the ordinals.

在Clojure版本1.4中添加

约化函数

代码语言:javascript
复制
Usage: (reduced x)
代码语言:javascript
复制
Wraps x in a way such that a reduce will terminate with the value x

在Clojure版本1.5中添加

减少?功能

代码语言:javascript
复制
Usage: (reduced? x)
代码语言:javascript
复制
Returns true if x is the result of a call to reduced

在Clojure版本1.5中添加

约简函数

代码语言:javascript
复制
Usage: (reductions f coll)
       (reductions f init coll)
代码语言:javascript
复制
Returns a lazy seq of the intermediate values of the reduction (as
per reduce) of coll by f, starting with init.

在Clojure版本1.2中添加

复功

代码语言:javascript
复制
Usage: (ref x)
       (ref x & options)
代码语言:javascript
复制
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 become 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.

在Clojure版本1.0中添加

参考-历史-计数函数

代码语言:javascript
复制
Usage: (ref-history-count ref)
代码语言:javascript
复制
Returns the history count of a ref

在Clojure版本1.1中添加

参考文献

代码语言:javascript
复制
Usage: (ref-max-history ref)
       (ref-max-history ref n)
代码语言:javascript
复制
Gets the max-history of a ref, or sets it and returns the ref

在Clojure版本1.1中添加

参考-min-历史函数

代码语言:javascript
复制
Usage: (ref-min-history ref)
       (ref-min-history ref n)
代码语言:javascript
复制
Gets the min-history of a ref, or sets it and returns the ref

在Clojure版本1.1中添加

参考集函数

代码语言:javascript
复制
Usage: (ref-set ref val)
代码语言:javascript
复制
Must be called in a transaction. Sets the value of ref.
Returns val.

在Clojure版本1.0中添加

参考函数

代码语言:javascript
复制
Usage: (refer ns-sym & filters)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

参考-clojure宏

代码语言:javascript
复制
Usage: (refer-clojure & filters)
代码语言:javascript
复制
Same as (refer 'clojure.core <filters>)

在Clojure版本1.0中添加

重宏

代码语言:javascript
复制
Usage: (reify & opts+specs)
代码语言:javascript
复制
reify is a macro with the following structure:

(reify options* specs*)
 
 Currently there are no options.

 Each spec consists of the protocol or interface name followed by zero
 or more method bodies:

 protocol-or-interface-or-Object
 (methodName [args+] body)*

 Methods should be supplied for all methods of the desired
 protocol(s) and interface(s). You can also define overrides for
 methods of Object. Note that the first parameter must be supplied to
 correspond to the target object ('this' in Java parlance). Thus
 methods for interfaces will take one more argument than do the
 interface declarations.  Note also that recur calls to the method
 head should *not* pass the target object, it will be supplied
 automatically and can not be substituted.

 The return type can be indicated by a type hint on the method name,
 and arg types can be indicated by a type hint on arg names. If you
 leave out all hints, reify will try to match on same name/arity
 method in the protocol(s)/interface(s) - this is preferred. If you
 supply any hints at all, no inference is done, so all hints (or
 default of Object) must be correct, for both arguments and return
 type. If a method is overloaded in a protocol/interface, multiple
 independent method definitions must be supplied.  If overloaded with
 same arity in an interface you must specify complete hints to
 disambiguate - a missing hint implies Object.

 recur works to method heads The method bodies of reify are lexical
 closures, and can refer to the surrounding local scope:
 
 (str (let [f "foo"] 
      (reify Object 
        (toString [this] f))))
 == "foo"

 (seq (let [f "foo"] 
      (reify clojure.lang.Seqable 
        (seq [this] (seq f)))))
 == (\f \o \o))
 
 reify always implements clojure.lang.IObj and transfers meta
 data of the form to the created object.
 
 (meta ^{:k :v} (reify Object (toString [this] "foo")))
 == {:k :v}

在Clojure版本1.2中添加

释放-待定-发送功能

代码语言:javascript
复制
Usage: (release-pending-sends)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

再功能

代码语言:javascript
复制
Usage: (rem num div)
代码语言:javascript
复制
remainder of dividing numerator by denominator.

在Clojure版本1.0中添加

移除函数

代码语言:javascript
复制
Usage: (remove pred)
       (remove pred coll)
代码语言:javascript
复制
Returns a lazy sequence of the items in coll for which
(pred item) returns false. pred must be free of side-effects.
Returns a transducer when no collection is provided.

在Clojure版本1.0中添加

删除所有方法功能

代码语言:javascript
复制
Usage: (remove-all-methods multifn)
代码语言:javascript
复制
Removes all of the methods of multimethod.

在Clojure版本1.2中添加

删除方法函数

代码语言:javascript
复制
Usage: (remove-method multifn dispatch-val)
代码语言:javascript
复制
Removes the method of multimethod associated with dispatch-value.

在Clojure版本1.0中添加

移除

代码语言:javascript
复制
Usage: (remove-ns sym)
代码语言:javascript
复制
Removes the namespace named by the symbol. Use with caution.
Cannot be used to remove the clojure namespace.

在Clojure版本1.0中添加

移除-监视功能

代码语言:javascript
复制
Usage: (remove-watch reference key)
代码语言:javascript
复制
Removes a watch (set by add-watch) from a reference

在Clojure版本1.0中添加

重复功能

代码语言:javascript
复制
Usage: (repeat x)
       (repeat n x)
代码语言:javascript
复制
Returns a lazy (infinite!, or length n if supplied) sequence of xs.

在Clojure版本1.0中添加

重复函数

代码语言:javascript
复制
Usage: (repeatedly f)
       (repeatedly n f)
代码语言:javascript
复制
Takes a function of no args, presumably with side effects, and
returns an infinite (or length n if supplied) lazy sequence of calls
to it

在Clojure版本1.0中添加

替换函数

代码语言:javascript
复制
Usage: (replace smap)
       (replace smap coll)
代码语言:javascript
复制
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.  Returns a transducer when no collection
is provided.

在Clojure版本1.0中添加

复制函数

代码语言:javascript
复制
Usage: (replicate n x)
代码语言:javascript
复制
DEPRECATED: Use 'repeat' instead.
Returns a lazy seq of n xs.

在Clojure版本1.0中添加

自Clojure版本1.3以来就不再推荐了

要求功能

代码语言:javascript
复制
Usage: (require & args)
代码语言:javascript
复制
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 takes a symbol as its argument and makes that symbol an alias to the
  lib's namespace in the current namespace.
:refer takes a list of symbols to refer from the namespace or the :all
  keyword to bring in all public vars.

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]))

在Clojure版本1.0中添加

重置%21功能

代码语言:javascript
复制
Usage: (reset! atom newval)
代码语言:javascript
复制
Sets the value of atom to newval without regard for the
current value. Returns newval.

在Clojure版本1.0中添加

重置-元%21功能

代码语言:javascript
复制
Usage: (reset-meta! iref metadata-map)
代码语言:javascript
复制
Atomically resets the metadata for a namespace/var/ref/agent/atom

在Clojure版本1.0中添加

分解函数

代码语言:javascript
复制
Usage: (resolve sym)
       (resolve env sym)
代码语言:javascript
复制
same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)

在Clojure版本1.0中添加

REST函数

代码语言:javascript
复制
Usage: (rest coll)
代码语言:javascript
复制
Returns a possibly empty seq of the items after the first. Calls seq on its
argument.

在Clojure版本1.0中添加

重启代理函数

代码语言:javascript
复制
Usage: (restart-agent a new-state & options)
代码语言:javascript
复制
When an agent is failed, changes the agent state to new-state and
then un-fails the agent so that sends are allowed again.  If
a :clear-actions true option is given, any actions queued on the
agent that were being held while it was failed will be discarded,
otherwise those held actions will proceed.  The new-state must pass
the validator if any, or restart will throw an exception and the
agent will remain failed with its old state and error.  Watchers, if
any, will NOT be notified of the new state.  Throws an exception if
the agent is not failed.

在Clojure版本1.2中添加

结果集-seq函数

代码语言:javascript
复制
Usage: (resultset-seq rs)
代码语言:javascript
复制
Creates and returns a lazy sequence of structmaps corresponding to
the rows in the java.sql.ResultSet rs

在Clojure版本1.0中添加

逆函数

代码语言:javascript
复制
Usage: (reverse coll)
代码语言:javascript
复制
Returns a seq of the items in coll in reverse order. Not lazy.

在Clojure版本1.0中添加

可逆的?功能

代码语言:javascript
复制
Usage: (reversible? coll)
代码语言:javascript
复制
Returns true if coll implements Reversible

在Clojure版本1.0中添加

rseq函数

代码语言:javascript
复制
Usage: (rseq rev)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

rsubseq函数

代码语言:javascript
复制
Usage: (rsubseq sc test key)
       (rsubseq sc start-test start-key end-test end-key)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

运行%21功能

代码语言:javascript
复制
Usage: (run! proc coll)
代码语言:javascript
复制
Runs the supplied procedure (via reduce), for purposes of side
effects, on successive items in the collection. Returns nil

在Clojure版本1.7中添加

满足吗?功能

代码语言:javascript
复制
Usage: (satisfies? protocol x)
代码语言:javascript
复制
Returns true if x satisfies the protocol

在Clojure版本1.2中添加

二次函数

代码语言:javascript
复制
Usage: (second x)
代码语言:javascript
复制
Same as (first (next x))

在Clojure版本1.0中添加

选择键函数

代码语言:javascript
复制
Usage: (select-keys map keyseq)
代码语言:javascript
复制
Returns a map containing only those entries in map whose key is in keys

在Clojure版本1.0中添加

发送函数

代码语言:javascript
复制
Usage: (send a f & args)
代码语言:javascript
复制
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)

在Clojure版本1.0中添加

发送-关闭函数

代码语言:javascript
复制
Usage: (send-off a f & args)
代码语言:javascript
复制
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)

在Clojure版本1.0中添加

发送连接

代码语言:javascript
复制
Usage: (send-via executor a f & args)
代码语言:javascript
复制
Dispatch an action to an agent. Returns the agent immediately.
Subsequently, in a thread supplied by executor, the state of the agent
will be set to the value of:

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

在Clojure版本1.5中添加

SEQ函数

代码语言:javascript
复制
Usage: (seq coll)
代码语言:javascript
复制
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. Note that seqs cache values, thus seq
should not be used on any Iterable whose iterator repeatedly
returns the same mutable object.

在Clojure版本1.0中添加

SEQ?功能

代码语言:javascript
复制
Usage: (seq? x)
代码语言:javascript
复制
Return true if x implements ISeq

在Clojure版本1.0中添加

后继函数

代码语言:javascript
复制
Usage: (seque s)
       (seque n-or-q s)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

序列函数

代码语言:javascript
复制
Usage: (sequence coll)
       (sequence xform coll)
       (sequence xform coll & colls)
代码语言:javascript
复制
Coerces coll to a (possibly empty) sequence, if it is not already
one. Will not force a lazy seq. (sequence nil) yields (), When a
transducer is supplied, returns a lazy sequence of applications of
the transform to the items in coll(s), i.e. to the set of first
items of each coll, followed by the set of second
items in each coll, until any one of the colls is exhausted.  Any
remaining items in other colls are ignored. The transform should accept
number-of-colls arguments

在Clojure版本1.0中添加

顺序?功能

代码语言:javascript
复制
Usage: (sequential? coll)
代码语言:javascript
复制
Returns true if coll implements Sequential

在Clojure版本1.0中添加

集函数

代码语言:javascript
复制
Usage: (set coll)
代码语言:javascript
复制
Returns a set of the distinct elements of coll.

在Clojure版本1.0中添加

设置%21特殊形式

代码语言:javascript
复制
Usage: (set! var-symbol expr)
       (set! (. instance-expr instanceFieldName-symbol) expr)
       (set! (. Classname-symbol staticFieldName-symbol) expr)
代码语言:javascript
复制
Used to set thread-local-bound vars, Java object instance
fields, and Java class static fields.

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

在Clojure版本1.0中添加

设置代理-发送-执行器%21功能

代码语言:javascript
复制
Usage: (set-agent-send-executor! executor)
代码语言:javascript
复制
Sets the ExecutorService to be used by send

在Clojure版本1.5中添加

设置代理-发送-发送-执行器%21功能

代码语言:javascript
复制
Usage: (set-agent-send-off-executor! executor)
代码语言:javascript
复制
Sets the ExecutorService to be used by send-off

在Clojure版本1.5中添加

设置错误处理程序%21函数

代码语言:javascript
复制
Usage: (set-error-handler! a handler-fn)
代码语言:javascript
复制
Sets the error-handler of agent a to handler-fn.  If an action
being run by the agent throws an exception or doesn't pass the
validator fn, handler-fn will be called with two arguments: the
agent and the exception.

在Clojure版本1.2中添加

设置错误模式%21功能

代码语言:javascript
复制
Usage: (set-error-mode! a mode-keyword)
代码语言:javascript
复制
Sets the error-mode of agent a to mode-keyword, which must be
either :fail or :continue.  If an action being run by the agent
throws an exception or doesn't pass the validator fn, an
error-handler may be called (see set-error-handler!), after which,
if the mode is :continue, the agent will continue as if neither the
action that caused the error nor the error itself ever happened.

If the mode is :fail, the agent will become failed and will stop
accepting new 'send' and 'send-off' actions, and any previously
queued actions will be held until a 'restart-agent'.  Deref will
still work, returning the state of the agent before the error.

在Clojure版本1.2中添加

SET-验证器%21功能

代码语言:javascript
复制
Usage: (set-validator! iref validator-fn)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

准备好了吗?功能

代码语言:javascript
复制
Usage: (set? x)
代码语言:javascript
复制
Returns true if x implements IPersistentSet

在Clojure版本1.0中添加

短函数

代码语言:javascript
复制
Usage: (short x)
代码语言:javascript
复制
Coerce to short

在Clojure版本1.0中添加

短列函数

代码语言:javascript
复制
Usage: (short-array size-or-seq)
       (short-array size init-val-or-seq)
代码语言:javascript
复制
Creates an array of shorts

在Clojure版本1.1中添加

短路函数

代码语言:javascript
复制
Usage: (shorts xs)
代码语言:javascript
复制
Casts to shorts[]

在Clojure版本1.1中添加

洗牌函数

代码语言:javascript
复制
Usage: (shuffle coll)
代码语言:javascript
复制
Return a random permutation of coll

在Clojure版本1.2中添加

关机-代理功能

代码语言:javascript
复制
Usage: (shutdown-agents)
代码语言:javascript
复制
Initiates a shutdown of the thread pools that back the agent
system. Running actions will complete, but no new actions will be
accepted

在Clojure版本1.0中添加

浆函数

代码语言:javascript
复制
Usage: (slurp f & opts)
代码语言:javascript
复制
Opens a reader on f and reads all its contents, returning a string.
See clojure.java.io/reader for a complete list of supported arguments.

在Clojure版本1.0中添加

某些功能

代码语言:javascript
复制
Usage: (some pred coll)
代码语言:javascript
复制
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)

在Clojure版本1.0中添加

一些->宏

代码语言:javascript
复制
Usage: (some-> expr & forms)
代码语言:javascript
复制
When expr is not nil, threads it into the first form (via ->),
and when that result is not nil, through the next etc

在Clojure版本1.5中添加

一些->>宏

代码语言:javascript
复制
Usage: (some->> expr & forms)
代码语言:javascript
复制
When expr is not nil, threads it into the first form (via ->>),
and when that result is not nil, through the next etc

在Clojure版本1.5中添加

某些函数

代码语言:javascript
复制
Usage: (some-fn p)
       (some-fn p1 p2)
       (some-fn p1 p2 p3)
       (some-fn p1 p2 p3 & ps)
代码语言:javascript
复制
Takes a set of predicates and returns a function f that returns the first logical true value
returned by one of its composing predicates against any of its arguments, else it returns
logical false. Note that f is short-circuiting in that it will stop execution on the first
argument that triggers a logical true result against the original predicates.

在Clojure版本1.3中添加

一些?功能

代码语言:javascript
复制
Usage: (some? x)
代码语言:javascript
复制
Returns true if x is not nil, false otherwise.

在Clojure版本1.6中添加

排序函数

代码语言:javascript
复制
Usage: (sort coll)
       (sort comp coll)
代码语言:javascript
复制
Returns a sorted sequence of the items in coll. If no comparator is
supplied, uses compare.  comparator must implement
java.util.Comparator.  Guaranteed to be stable: equal elements will
not be reordered.  If coll is a Java array, it will be modified.  To
avoid this, sort a copy of the array.

在Clojure版本1.0中添加

排序函数

代码语言:javascript
复制
Usage: (sort-by keyfn coll)
       (sort-by keyfn comp coll)
代码语言:javascript
复制
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.  Guaranteed to be stable: equal elements will
not be reordered.  If coll is a Java array, it will be modified.  To
avoid this, sort a copy of the array.

在Clojure版本1.0中添加

排序映射函数

代码语言:javascript
复制
Usage: (sorted-map & keyvals)
代码语言:javascript
复制
keyval => key val
Returns a new sorted map with supplied mappings.  If any keys are
equal, they are handled as if by repeated uses of assoc.

在Clojure版本1.0中添加

排序映射函数

代码语言:javascript
复制
Usage: (sorted-map-by comparator & keyvals)
代码语言:javascript
复制
keyval => key val
Returns a new sorted map with supplied mappings, using the supplied
comparator.  If any keys are equal, they are handled as if by
repeated uses of assoc.

在Clojure版本1.0中添加

排序集函数

代码语言:javascript
复制
Usage: (sorted-set & keys)
代码语言:javascript
复制
Returns a new sorted set with supplied keys.  Any equal keys are
handled as if by repeated uses of conj.

在Clojure版本1.0中添加

排序-集-按函数

代码语言:javascript
复制
Usage: (sorted-set-by comparator & keys)
代码语言:javascript
复制
Returns a new sorted set with supplied keys, using the supplied
comparator.  Any equal keys are handled as if by repeated uses of
conj.

在Clojure版本1.1中添加

排序?功能

代码语言:javascript
复制
Usage: (sorted? coll)
代码语言:javascript
复制
Returns true if coll implements Sorted

在Clojure版本1.0中添加

特殊符号?功能

代码语言:javascript
复制
Usage: (special-symbol? s)
代码语言:javascript
复制
Returns true if s names a special form

在Clojure版本1.0中添加

痰功能

代码语言:javascript
复制
Usage: (spit f content & options)
代码语言:javascript
复制
Opposite of slurp.  Opens f with writer, writes content, then
closes f. Options passed to clojure.java.io/writer.

在Clojure版本1.2中添加

分裂-失能

代码语言:javascript
复制
Usage: (split-at n coll)
代码语言:javascript
复制
Returns a vector of [(take n coll) (drop n coll)]

在Clojure版本1.0中添加

分裂函数

代码语言:javascript
复制
Usage: (split-with pred coll)
代码语言:javascript
复制
Returns a vector of [(take-while pred coll) (drop-while pred coll)]

在Clojure版本1.0中添加

strfunction

代码语言:javascript
复制
Usage: (str)
       (str x)
       (str x & ys)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

弦乐?功能

代码语言:javascript
复制
Usage: (string? x)
代码语言:javascript
复制
Return true if x is a String

在Clojure版本1.0中添加

结构函数

代码语言:javascript
复制
Usage: (struct s & vals)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

结构映射

代码语言:javascript
复制
Usage: (struct-map s & inits)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

子函数

代码语言:javascript
复制
Usage: (subs s start)
       (subs s start end)
代码语言:javascript
复制
Returns the substring of s beginning at start inclusive, and ending
at end (defaults to length of string), exclusive.

在Clojure版本1.0中添加

代换函数

代码语言:javascript
复制
Usage: (subseq sc test key)
       (subseq sc start-test start-key end-test end-key)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

子向量函数

代码语言:javascript
复制
Usage: (subvec v start)
       (subvec v start end)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

超函数

代码语言:javascript
复制
Usage: (supers class)
代码语言:javascript
复制
Returns the immediate and indirect superclasses and interfaces of c, if any

在Clojure版本1.0中添加

交换%21功能

代码语言:javascript
复制
Usage: (swap! atom f)
       (swap! atom f x)
       (swap! atom f x y)
       (swap! atom f x y & args)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

符号功能

代码语言:javascript
复制
Usage: (symbol name)
       (symbol ns name)
代码语言:javascript
复制
Returns a Symbol with the given namespace and name.

在Clojure版本1.0中添加

符号?功能

代码语言:javascript
复制
Usage: (symbol? x)
代码语言:javascript
复制
Return true if x is a Symbol

在Clojure版本1.0中添加

同步宏

代码语言:javascript
复制
Usage: (sync flags-ignored-for-now & body)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

标记文字函数

代码语言:javascript
复制
Usage: (tagged-literal tag form)
代码语言:javascript
复制
Construct a data representation of a tagged literal from a
tag symbol and a form.

在Clojure版本1.7中添加

贴上标签-字面意思?功能

代码语言:javascript
复制
Usage: (tagged-literal? value)
代码语言:javascript
复制
Return true if the value is the data representation of a tagged literal

在Clojure版本1.7中添加

取函数

代码语言:javascript
复制
Usage: (take n)
       (take n coll)
代码语言:javascript
复制
Returns a lazy sequence of the first n items in coll, or all items if
there are fewer than n.  Returns a stateful transducer when
no collection is provided.

在Clojure版本1.0中添加

取后函数

代码语言:javascript
复制
Usage: (take-last n coll)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

取函数

代码语言:javascript
复制
Usage: (take-nth n)
       (take-nth n coll)
代码语言:javascript
复制
Returns a lazy seq of every nth item in coll.  Returns a stateful
transducer when no collection is provided.

在Clojure版本1.0中添加

兼任功能

代码语言:javascript
复制
Usage: (take-while pred)
       (take-while pred coll)
代码语言:javascript
复制
Returns a lazy sequence of successive items from coll while
(pred item) returns true. pred must be free of side-effects.
Returns a transducer when no collection is provided.

在Clojure版本1.0中添加

测试函数

代码语言:javascript
复制
Usage: (test v)
代码语言:javascript
复制
test [v] finds fn at key :test in var metadata and calls it,
presuming failure will throw exception

在Clojure版本1.0中添加

-nsfunction

代码语言:javascript
复制
Usage: (the-ns x)
代码语言:javascript
复制
If passed a namespace, returns it. Else, when passed a symbol,
returns the namespace named by it, throwing an exception if not
found.

在Clojure版本1.0中添加

线束?功能

代码语言:javascript
复制
Usage: (thread-bound? & vars)
代码语言:javascript
复制
Returns true if all of the vars provided as arguments have thread-local bindings.
Implies that set!'ing the provided vars will succeed.  Returns true if no vars are provided.

在Clojure版本1.2中添加

投掷特殊形式

代码语言:javascript
复制
Usage: (throw expr)
代码语言:javascript
复制
The expr is evaluated and thrown, therefore it should
yield an instance of some derivee of Throwable.

Please see http://clojure.org/special_forms#throw

在Clojure版本1.0中添加

时间线

代码语言:javascript
复制
Usage: (time expr)
代码语言:javascript
复制
Evaluates expr and prints the time it took.  Returns the value of
expr.

在Clojure版本1.0中添加

对列函数

代码语言:javascript
复制
Usage: (to-array coll)
代码语言:javascript
复制
Returns an array of Objects containing the contents of coll, which
can be any Collection.  Maps to java.util.Collection.toArray().

在Clojure版本1.0中添加

数组-2 dfunction

代码语言:javascript
复制
Usage: (to-array-2d coll)
代码语言:javascript
复制
Returns a (potentially-ragged) 2-dimensional array of Objects
containing the contents of coll, which can be any Collection of any
Collection.

在Clojure版本1.0中添加

蹦床功能

代码语言:javascript
复制
Usage: (trampoline f)
       (trampoline f & args)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

换能器功能

代码语言:javascript
复制
Usage: (transduce xform f coll)
       (transduce xform f init coll)
代码语言:javascript
复制
reduce with a transformation of f (xf). If init is not
supplied, (f) will be called to produce it. f should be a reducing
step function that accepts both 1 and 2 arguments, if it accepts
only 2 you can add the arity-1 with 'completing'. Returns the result
of applying (the transformed) xf to init and the first item in coll,
then applying xf to that result and the 2nd item, etc. If coll
contains no items, returns init and f is not called. Note that
certain transforms may inject or skip items.

在Clojure版本1.7中添加

瞬变函数

代码语言:javascript
复制
Usage: (transient coll)
代码语言:javascript
复制
Returns a new, transient version of the collection, in constant time.

在Clojure版本1.1中添加

树-seq函数

代码语言:javascript
复制
Usage: (tree-seq branch? children root)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

是真的吗?功能

代码语言:javascript
复制
Usage: (true? x)
代码语言:javascript
复制
Returns true if x is the value true, false otherwise.

在Clojure版本1.0中添加

梯级特殊形式

代码语言:javascript
复制
Usage: (try expr* catch-clause* finally-clause?)
代码语言:javascript
复制
catch-clause => (catch classname name expr*)
finally-clause => (finally expr*)

Catches and handles Java exceptions.

Please see http://clojure.org/special_forms#try

在Clojure版本1.0中添加

类型函数

代码语言:javascript
复制
Usage: (type x)
代码语言:javascript
复制
Returns the :type metadata of x, or its Class if none

在Clojure版本1.0中添加

未检查加法函数

代码语言:javascript
复制
Usage: (unchecked-add x y)
代码语言:javascript
复制
Returns the sum of x and y, both long.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查的附加函数

代码语言:javascript
复制
Usage: (unchecked-add-int x y)
代码语言:javascript
复制
Returns the sum of x and y, both int.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-字节函数

代码语言:javascript
复制
Usage: (unchecked-byte x)
代码语言:javascript
复制
Coerce to byte. Subject to rounding or truncation.

在Clojure版本1.3中添加

未检查字符

代码语言:javascript
复制
Usage: (unchecked-char x)
代码语言:javascript
复制
Coerce to char. Subject to rounding or truncation.

在Clojure版本1.3中添加

未检查-分解函数

代码语言:javascript
复制
Usage: (unchecked-dec x)
代码语言:javascript
复制
Returns a number one less than x, a long.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-Dec-int函数

代码语言:javascript
复制
Usage: (unchecked-dec-int x)
代码语言:javascript
复制
Returns a number one less than x, an int.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查除法函数

代码语言:javascript
复制
Usage: (unchecked-divide-int x y)
代码语言:javascript
复制
Returns the division of x by y, both int.
Note - uses a primitive operator subject to truncation.

在Clojure版本1.0中添加

未检查-双函数

代码语言:javascript
复制
Usage: (unchecked-double x)
代码语言:javascript
复制
Coerce to double. Subject to rounding.

在Clojure版本1.3中添加

未检查浮点函数

代码语言:javascript
复制
Usage: (unchecked-float x)
代码语言:javascript
复制
Coerce to float. Subject to rounding.

在Clojure版本1.3中添加

不加检查

代码语言:javascript
复制
Usage: (unchecked-inc x)
代码语言:javascript
复制
Returns a number one greater than x, a long.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-Inc-intfunction

代码语言:javascript
复制
Usage: (unchecked-inc-int x)
代码语言:javascript
复制
Returns a number one greater than x, an int.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查

代码语言:javascript
复制
Usage: (unchecked-int x)
代码语言:javascript
复制
Coerce to int. Subject to rounding or truncation.

在Clojure版本1.3中添加

未检查长函数

代码语言:javascript
复制
Usage: (unchecked-long x)
代码语言:javascript
复制
Coerce to long. Subject to rounding or truncation.

在Clojure版本1.3中添加

未检查-乘数函数

代码语言:javascript
复制
Usage: (unchecked-multiply x y)
代码语言:javascript
复制
Returns the product of x and y, both long.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-多-整函数

代码语言:javascript
复制
Usage: (unchecked-multiply-int x y)
代码语言:javascript
复制
Returns the product of x and y, both int.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-否定函数

代码语言:javascript
复制
Usage: (unchecked-negate x)
代码语言:javascript
复制
Returns the negation of x, a long.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-否定-整函数

代码语言:javascript
复制
Usage: (unchecked-negate-int x)
代码语言:javascript
复制
Returns the negation of x, an int.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查-余数-整函数

代码语言:javascript
复制
Usage: (unchecked-remainder-int x y)
代码语言:javascript
复制
Returns the remainder of division of x by y, both int.
Note - uses a primitive operator subject to truncation.

在Clojure版本1.0中添加

未检查短函数

代码语言:javascript
复制
Usage: (unchecked-short x)
代码语言:javascript
复制
Coerce to short. Subject to rounding or truncation.

在Clojure版本1.3中添加

未检查减法函数

代码语言:javascript
复制
Usage: (unchecked-subtract x y)
代码语言:javascript
复制
Returns the difference of x and y, both long.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

未检查减整函数

代码语言:javascript
复制
Usage: (unchecked-subtract-int x y)
代码语言:javascript
复制
Returns the difference of x and y, both int.
Note - uses a primitive operator subject to overflow.

在Clojure版本1.0中添加

潜函数

代码语言:javascript
复制
Usage: (underive tag parent)
       (underive h tag parent)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

非约化函数

代码语言:javascript
复制
Usage: (unreduced x)
代码语言:javascript
复制
If x is reduced?, returns (deref x), else returns x

在Clojure版本1.7中添加

无符号-位移位-右函数

代码语言:javascript
复制
Usage: (unsigned-bit-shift-right x n)
代码语言:javascript
复制
Bitwise shift right, without sign-extension.

在Clojure版本1.6中添加

更新函数

代码语言:javascript
复制
Usage: (update m k f)
       (update m k f x)
       (update m k f x y)
       (update m k f x y z)
       (update m k f x y z & more)
代码语言:javascript
复制
'Updates' a value in an associative structure, where k is a
key and f is a function that will take the old value
and any supplied args and return the new value, and returns a new
structure.  If the key does not exist, nil is passed as the old value.

在Clojure版本1.7中添加

更新-失效

代码语言:javascript
复制
Usage: (update-in m [k & ks] f & args)
代码语言:javascript
复制
'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.

在Clojure版本1.0中添加

更新-Proxyfunction

代码语言:javascript
复制
Usage: (update-proxy proxy mappings)
代码语言:javascript
复制
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.
Returns the proxy.

在Clojure版本1.0中添加

使用函数

代码语言:javascript
复制
Usage: (use & args)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

值函数

代码语言:javascript
复制
Usage: (val e)
代码语言:javascript
复制
Returns the value in the map entry.

在Clojure版本1.0中添加

阀函数

代码语言:javascript
复制
Usage: (vals map)
代码语言:javascript
复制
Returns a sequence of the map's values, in the same order as (seq map).

在Clojure版本1.0中添加

变特殊形式

代码语言:javascript
复制
Usage: (var symbol)
代码语言:javascript
复制
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 http://clojure.org/special_forms#var

在Clojure版本1.0中添加

var-getfunction

代码语言:javascript
复制
Usage: (var-get x)
代码语言:javascript
复制
Gets the value in the var object

在Clojure版本1.0中添加

变量集函数

代码语言:javascript
复制
Usage: (var-set x val)
代码语言:javascript
复制
Sets the value in the var object to val. The var must be
thread-locally bound.

在Clojure版本1.0中添加

瓦尔?功能

代码语言:javascript
复制
Usage: (var? v)
代码语言:javascript
复制
Returns true if v is of type clojure.lang.Var

在Clojure版本1.0中添加

变元功能

代码语言:javascript
复制
Usage: (vary-meta obj f & args)
代码语言:javascript
复制
Returns an object of the same type and value as obj, with
(apply f (meta obj) args) as its metadata.

在Clojure版本1.0中添加

向量函数

代码语言:javascript
复制
Usage: (vec coll)
代码语言:javascript
复制
Creates a new vector containing the contents of coll. Java arrays
will be aliased and should not be modified.

在Clojure版本1.0中添加

向量函数

代码语言:javascript
复制
Usage: (vector)
       (vector a)
       (vector a b)
       (vector a b c)
       (vector a b c d)
       (vector a b c d e)
       (vector a b c d e f)
       (vector a b c d e f & args)
代码语言:javascript
复制
Creates a new vector containing the args.

在Clojure版本1.0中添加

矢量转移

代码语言:javascript
复制
Usage: (vector-of t)
       (vector-of t & elements)
代码语言:javascript
复制
Creates a new vector of a single primitive type t, where t is one
of :int :long :float :double :byte :short :char or :boolean. The
resulting vector complies with the interface of vectors in general,
but stores the values unboxed internally.

Optionally takes one or more elements to populate the vector.

在Clojure版本1.2中添加

矢量?功能

代码语言:javascript
复制
Usage: (vector? x)
代码语言:javascript
复制
Return true if x implements IPersistentVector

在Clojure版本1.0中添加

挥发性百分之二十一功能

代码语言:javascript
复制
Usage: (volatile! val)
代码语言:javascript
复制
Creates and returns a Volatile with an initial value of val.

在Clojure版本1.7中添加

不稳定?功能

代码语言:javascript
复制
Usage: (volatile? x)
代码语言:javascript
复制
Returns true if x is a volatile.

在Clojure版本1.7中添加

VRET%21功能

代码语言:javascript
复制
Usage: (vreset! vol newval)
代码语言:javascript
复制
Sets the value of volatile to newval without regard for the
current value. Returns newval.

在Clojure版本1.7中添加

vswp%21宏

代码语言:javascript
复制
Usage: (vswap! vol f & args)
代码语言:javascript
复制
Non-atomically swaps the value of the volatile as if:
(apply f current-value-of-vol args). Returns the value that
was swapped in.

在Clojure版本1.7中添加

当宏

代码语言:javascript
复制
Usage: (when test & body)
代码语言:javascript
复制
Evaluates test. If logical true, evaluates body in an implicit do.

在Clojure版本1.0中添加

何时-第一宏

代码语言:javascript
复制
Usage: (when-first bindings & body)
代码语言:javascript
复制
bindings => x xs

Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once

在Clojure版本1.0中添加

时---

代码语言:javascript
复制
Usage: (when-let bindings & body)
代码语言:javascript
复制
bindings => binding-form test

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

在Clojure版本1.0中添加

当-不是宏

代码语言:javascript
复制
Usage: (when-not test & body)
代码语言:javascript
复制
Evaluates test. If logical false, evaluates body in an implicit do.

在Clojure版本1.0中添加

何时-

代码语言:javascript
复制
Usage: (when-some bindings & body)
代码语言:javascript
复制
bindings => binding-form test

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

在Clojure版本1.6中添加

同时

代码语言:javascript
复制
Usage: (while test & body)
代码语言:javascript
复制
Repeatedly executes body while test expression is true. Presumes
some side-effect will cause test to become false/nil. Returns nil

在Clojure版本1.0中添加

与-bindingsmacro

代码语言:javascript
复制
Usage: (with-bindings binding-map & body)
代码语言:javascript
复制
Takes a map of Var/value pairs. Installs for the given Vars the associated
values as thread-local bindings. Then executes body. Pops the installed
bindings after body was evaluated. Returns the value of body.

在Clojure版本1.1中添加

带-绑定%2A功能

代码语言:javascript
复制
Usage: (with-bindings* binding-map f & args)
代码语言:javascript
复制
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.

在Clojure版本1.1中添加

随?

代码语言:javascript
复制
Usage: (with-in-str s & body)
代码语言:javascript
复制
Evaluates body in a context in which *in* is bound to a fresh
StringReader initialized with the string s.

在Clojure版本1.0中添加

与-局部-varsmacro

代码语言:javascript
复制
Usage: (with-local-vars name-vals-vec & body)
代码语言:javascript
复制
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

在Clojure版本1.0中添加

有元功能

代码语言:javascript
复制
Usage: (with-meta obj m)
代码语言:javascript
复制
Returns an object of the same type and value as obj, with
map m as its metadata.

在Clojure版本1.0中添加

开宏

代码语言:javascript
复制
Usage: (with-open bindings & body)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

用-out-str宏

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

在Clojure版本1.0中添加

精确宏

代码语言:javascript
复制
Usage: (with-precision precision & exprs)
代码语言:javascript
复制
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.

在Clojure版本1.0中添加

与-redefsmacro

代码语言:javascript
复制
Usage: (with-redefs bindings & body)
代码语言:javascript
复制
binding => var-symbol temp-value-expr

Temporarily redefines Vars while executing the body.  The
temp-value-exprs will be evaluated and each resulting value will
replace in parallel the root value of its Var.  After the body is
executed, the root values of all the Vars will be set back to their
old values.  These temporary changes will be visible in all threads.
Useful for mocking out functions during testing.

在Clojure版本1.3中添加

与-redefs-fnfunction

代码语言:javascript
复制
Usage: (with-redefs-fn binding-map func)
代码语言:javascript
复制
Temporarily redefines Vars during a call to func.  Each val of
binding-map will replace the root value of its key which must be
a Var.  After func is called with no args, the root values of all
the Vars will be set back to their old values.  These temporary
changes will be visible in all threads.  Useful for mocking out
functions during testing.

在Clojure版本1.3中添加

xml-seqfunction

代码语言:javascript
复制
Usage: (xml-seq root)
代码语言:javascript
复制
A tree seq on the xml elements as per xml/parse

在Clojure版本1.0中添加

零?功能

代码语言:javascript
复制
Usage: (zero? x)
代码语言:javascript
复制
Returns true if num is zero, else false

在Clojure版本1.0中添加

zipmap函数

代码语言:javascript
复制
Usage: (zipmap keys vals)
代码语言:javascript
复制
Returns a map with the keys mapped to the corresponding vals.

在Clojure版本1.0中添加

clojure.core.protocol

协议

Coll还原协议

代码语言:javascript
复制
Protocol for collection types that can implement reduce faster than
first/next recursion. Called by clojure.core/reduce. Baseline
implementation defined in terms of Iterable.

已知实现:---Cat、cljure.lang.APersistentMap$KeySeq、clojure.lang.PersistentMap$ValSeq、clojure.lang.ASeq、clojure.lang.IReduceInit、clojure.lang.LazySeq、clojure.lang.PersistentVector、java.lang.Iterable、nil、Object。

Coll-还原函数

代码语言:javascript
复制
Usage: (coll-reduce coll f)
       (coll-reduce coll f val)

IKVReduceProtocol

代码语言:javascript
复制
Protocol for concrete associative types that can reduce themselves
via a function of key and val faster than first/next recursion over map
entries. Called by clojure.core/reduce-kv, and has same
semantics (just different arg order).

已知实现:clojure.lang.IKVReduce,clojure.lang.IPersistentMap,无

KV-还原函数

代码语言:javascript
复制
Usage: (kv-reduce amap f init)

国际减少协议

代码语言:javascript
复制
Protocol for concrete seq types that can reduce themselves
faster than first/next recursion. Called by clojure.core/reduce.

已知实现:核心.VecSeq、lang.lang.IhunkedSeq、clojure.lang.StringSeq、nil、Object

内约函数

代码语言:javascript
复制
Usage: (internal-reduce seq f start)

核心减速机

代码语言:javascript
复制
A library for reduction and parallel folding. Alpha and subject
to change.  Note that fold and its derivatives require Java 7+ or
Java 6 + jsr166y.jar for fork/join support. See Clojure's pom.xml for the
dependency info.

类型

牛型

字段:CNT左右

议定书:clojure.core.protocol/Coll Reduce,,,科勒福尔德

接口:clojure.lang.count,clojure.lang.seqable

公共变量和函数

->Catfunction

代码语言:javascript
复制
Usage: (->Cat cnt left right)
代码语言:javascript
复制
Positional factory function for class clojure.core.reducers.Cat.

附加%21功能

代码语言:javascript
复制
Usage: (append! acc x)
代码语言:javascript
复制
.adds x to acc and returns acc

在Clojure版本1.5中添加

猫函数

代码语言:javascript
复制
Usage: (cat)
       (cat ctor)
       (cat left right)
代码语言:javascript
复制
A high-performance combining fn that yields the catenation of the
reduced values. The result is reducible, foldable, seqable and
counted, providing the identity collections are reducible, seqable
and counted. The single argument version will build a combining fn
with the supplied identity constructor. Tests for identity
with (zero? (count x)). See also foldcat.

在Clojure版本1.5中添加

降函数

代码语言:javascript
复制
Usage: (drop n)
       (drop n coll)
代码语言:javascript
复制
Elides the first n values from the reduction of coll.

在Clojure版本1.5中添加

滤波函数

代码语言:javascript
复制
Usage: (filter pred)
       (filter pred coll)
代码语言:javascript
复制
Retains values in the reduction of coll for which (pred val)
returns logical true. Foldable.

在Clojure版本1.5中添加

平坦函数

代码语言:javascript
复制
Usage: (flatten)
       (flatten coll)
代码语言:javascript
复制
Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat foldable
collection.

在Clojure版本1.5中添加

折叠函数

代码语言:javascript
复制
Usage: (fold reducef coll)
       (fold combinef reducef coll)
       (fold n combinef reducef coll)
代码语言:javascript
复制
Reduces a collection using a (potentially parallel) reduce-combine
strategy. The collection is partitioned into groups of approximately
n (default 512), each of which is reduced with reducef (with a seed
value obtained by calling (combinef) with no arguments). The results
of these reductions are then reduced with combinef (default
reducef). combinef must be associative, and, when called with no
arguments, (combinef) must produce its identity element. These
operations may be performed in parallel, but the results will
preserve order.

在Clojure版本1.5中添加

折叠函数

代码语言:javascript
复制
Usage: (foldcat coll)
代码语言:javascript
复制
Equivalent to (fold cat append! coll)

在Clojure版本1.5中添加

折叠函数

代码语言:javascript
复制
Usage: (folder coll xf)
代码语言:javascript
复制
Given a foldable collection, and a transformation function xf,
returns a foldable collection, where any supplied reducing
fn will be transformed by xf. xf is a function of reducing fn to
reducing fn.

在Clojure版本1.5中添加

映射函数

代码语言:javascript
复制
Usage: (map f)
       (map f coll)
代码语言:javascript
复制
Applies f to every value in the reduction of coll. Foldable.

在Clojure版本1.5中添加

映射函数

代码语言:javascript
复制
Usage: (mapcat f)
       (mapcat f coll)
代码语言:javascript
复制
Applies f to every value in the reduction of coll, concatenating the result
colls of (f val). Foldable.

在Clojure版本1.5中添加

单重函数

代码语言:javascript
复制
Usage: (monoid op ctor)
代码语言:javascript
复制
Builds a combining fn out of the supplied operator and identity
constructor. op must be associative and ctor called with no args
must return an identity value for it.

在Clojure版本1.5中添加

还原函数

代码语言:javascript
复制
Usage: (reduce f coll)
       (reduce f init coll)
代码语言:javascript
复制
Like core/reduce except:
When init is not provided, (f) is used.
Maps are reduced with reduce-kv

约简函数

代码语言:javascript
复制
Usage: (reducer coll xf)
代码语言:javascript
复制
Given a reducible collection, and a transformation function xf,
returns a reducible collection, where any supplied reducing
fn will be transformed by xf. xf is a function of reducing fn to
reducing fn.

在Clojure版本1.5中添加

移除函数

代码语言:javascript
复制
Usage: (remove pred)
       (remove pred coll)
代码语言:javascript
复制
Removes values in the reduction of coll for which (pred val)
returns logical true. Foldable.

在Clojure版本1.5中添加

取函数

代码语言:javascript
复制
Usage: (take n)
       (take n coll)
代码语言:javascript
复制
Ends the reduction of coll after consuming n values.

在Clojure版本1.5中添加

take-while功能

代码语言:javascript
复制
Usage: (take-while pred)
       (take-while pred coll)
代码语言:javascript
复制
Ends the reduction of coll when (pred val) returns logical false.

在Clojure版本1.5中添加

clojure.core.server

代码语言:javascript
复制
Socket server support

公共变量和函数

复制函数

代码语言:javascript
复制
Usage: (repl)
代码语言:javascript
复制
REPL with predefined hooks for attachable socket server.

复幂函数

代码语言:javascript
复制
Usage: (repl-init)
代码语言:javascript
复制
Initialize repl in user namespace and make standard repl requires.

再读函数

代码语言:javascript
复制
Usage: (repl-read request-prompt request-exit)
代码语言:javascript
复制
Enhanced :read hook for repl supporting :repl/quit.

启动服务器功能

代码语言:javascript
复制
Usage: (start-server opts)
代码语言:javascript
复制
Start a socket server given the specified opts:
 :address Host or address, string, defaults to loopback address
 :port Port, integer, required
 :name Name, required
 :accept Namespaced symbol of the accept function to invoke, required
 :args Vector of args to pass to accept function
 :bind-err Bind *err* to socket out stream?, defaults to true
 :server-daemon Is server thread a daemon?, defaults to true
 :client-daemon Are client threads daemons?, defaults to true
Returns server socket.

启动服务函数

代码语言:javascript
复制
Usage: (start-servers system-props)
代码语言:javascript
复制
Start all servers specified in the system properties.

停止服务器函数

代码语言:javascript
复制
Usage: (stop-server)
       (stop-server name)
代码语言:javascript
复制
Stop server with name or use the server-name from *session* if none supplied.
Returns true if server stopped successfully, nil if not found, or throws if
there is an error closing the socket.

停止服务函数

代码语言:javascript
复制
Usage: (stop-servers)
代码语言:javascript
复制
Stop all servers ignores all errors, and returns nil.

扫码关注腾讯云开发者

领取腾讯云代金券