diff --git a/public/docs.json b/public/docs.json index a8be1ea..16e0a1c 100644 --- a/public/docs.json +++ b/public/docs.json @@ -1 +1 @@ -{"cljs.core/*":{"full-name":"cljs.core/*","signature":["[]","[x]","[x y]","[x y & more]"],"description-html":"
Returns the product of nums.
\n(*)
returns 1.
Returns the sum of nums.
\n(+)
returns 0.
If no y
s are supplied, returns the negation of x
, else subtracts the y
s\nfrom x
and returns the result.
The thread-first macro "threads" an expression through several forms as the\nsecond item in a list.
\nInserts x
as the second item in the first form, making a list of it if it is\nnot a list already. If there are more forms, inserts the first form as the\nsecond item in second form, etc.
Code | \nExpands To |
---|---|
\n(-> x\n (a b c)\n d\n (x y z)) | \n \n(x (d (a x b c)) y z) |
The thread-last macro "threads" an expression through several forms as the last\nitem in a list.
\nInserts x
as the last item in the first form, making a list of it if it is not\na list already. If there are more forms, inserts the first form as the last item\nin second form, etc.
Code | \nExpands To |
---|---|
\n(->> x\n (a b c)\n d\n (x y z)) | \n \n(x y z (d (a b c x))) |
If no denominators are supplied, returns 1/numerator, else returns numerator\ndivided by all of the denominators.
\n","related":["cljs.core/*","cljs.core/quot"]},"cljs.core/<":{"full-name":"cljs.core/<","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is greater than the previous\none, false otherwise.
\n","related":["cljs.core/<="]},"cljs.core/<=":{"full-name":"cljs.core/<=","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is greater than or equal to the\nprevious one, false otherwise.
\n","related":["cljs.core/<"]},"cljs.core/=":{"full-name":"cljs.core/=","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if the value of x
equals the value of y
, false otherwise.
=
is a value comparison, not an identity comparison.
All collections can be tested for value, regardless of "depth".
\n","related":["cljs.core/==","cljs.core/not=","cljs.core/identical?"]},"cljs.core/==":{"full-name":"cljs.core/==","signature":["[x]","[x y]","[x y & more]"],"description-html":"This is an equality check for numbers of different types that was carried over from Clojure,\nto allow compatibility when converting code to ClojureScript.
\nSince there is only a single number type in JavaScript, 64-bit floating point, there is no\nreason to use the ==
operator in ClojureScript.
Behavior on non-number arguments is undefined.
\n","related":["cljs.core/=","cljs.core/identical?"]},"cljs.core/>":{"full-name":"cljs.core/>","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is less than the previous\none, false otherwise.
\n","related":["cljs.core/>="]},"cljs.core/>=":{"full-name":"cljs.core/>=","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is less than or equal to the\nprevious one, false otherwise.
\n","related":["cljs.core/>"]},"cljs.core/aclone":{"full-name":"cljs.core/aclone","signature":["[arr]"],"description-html":"Creates a clone of the given JavaScript array arr
. The result is a new\nJavaScript array, which is a shallow copy, not a deep copy.
Adds a watch function f
to atom a
that will execute when the value of a
\nchanges.
The watch function takes 4 arguments: a key, the atom, its old state, and its\nnew state.
\nkey
should be a keyword and can be used with remove-watch
to remove the\nwatch function.
Returns the value at index i
from JavaScript arrays and objects.
Can be used to retrieve nested properties with the additional idxs
arguments.
Evaluates arguments one at a time from left to right. If an argument returns\nlogical false (nil or false), and
returns that value and doesn't evaluate any\nof the other arguments, otherwise it returns the value of the last argument.
(and)
returns true.
Applies function f
to the argument list formed by prepending intervening\narguments to args
.
Creates a JavaScript array containing args
.
The tagged literal #js [1 2 3]
is equivalent to (array 1 2 3)
Returns a new array map (a map implemented with arrays) with the supplied mappings.
\nkeyvals
must be an even number of forms.
Returns true if x
is a JavaScript array, false otherwise.
Binds name
to expr
, evaluates the first form in the lexical context of that\nbinding, then binds name
to that result, repeating for each successive form,\nreturning the result of the last form.
Useful for when you want a threading macro to use different "places" at each\nform.
\n","related":["cljs.core/->","cljs.core/->>","cljs.core/cond->","cljs.core/cond->>","cljs.core/some->","cljs.core/some->>"],"type":"macro"},"cljs.core/aset":{"full-name":"cljs.core/aset","signature":["[array i val]","[array idx idx2 & idxv]"],"description-html":"Sets val
at index i
in JavaScript arrays and objects.
Can be used to set nested properties with the additional idxs
arguments.
assoc(iate)
\nWhen applied to a map, returns a new map that contains the mapping of key(s) to\nval(s).
\nHas no effect on the map type (hashed/sorted).
\nWhen applied to a vector, returns a new vector that contains value v
at index\nk
.
Associates a value in a nested associative structure, where ks
is a sequence\nof keys and v
is the new value. Returns a new nested structure.
If any levels do not exist, hash-maps will be created.
\n","related":["cljs.core/assoc","cljs.core/update-in","cljs.core/dissoc-in","cljs.core/get-in"]},"cljs.core/associative?":{"full-name":"cljs.core/associative?","signature":["[coll]"],"description-html":"Returns true if coll
implements the IAssociative
protocol, false otherwise.
Maps and vectors are associative.
\n"},"cljs.core/atom":{"full-name":"cljs.core/atom","signature":["[x]","[x opts]"],"description-html":"Creates and returns an atom with an initial value of x
.
opts
is an optional map with optional keys :meta
and :validator
.
:meta
should be a metadata-map for the atom.
:validator
should be a validator function for the atom. See set-validator!
\nfor more information.
Bitwise "and". Same as x & y
in JavaScript.
Bitwise "and" x
with bitwise "not" y
. Same as x & ~y
in JavaScript.
Clear bit at index n
. Same as x & ~(1 << y)
in JavaScript.
Flip bit at index n
Bitwise complement
\n"},"cljs.core/bit-or":{"full-name":"cljs.core/bit-or","signature":["[x y]"],"description-html":"Bitwise or
\n","related":["cljs.core/bit-and","cljs.core/bit-xor"]},"cljs.core/bit-set":{"full-name":"cljs.core/bit-set","signature":["[x n]"],"description-html":"Set bit at index n
Bitwise shift left
\n","related":["cljs.core/bit-shift-right"]},"cljs.core/bit-shift-right":{"full-name":"cljs.core/bit-shift-right","signature":["[x n]"],"description-html":"Bitwise shift right
\n","related":["cljs.core/bit-shift-left","cljs.core/unsigned-bit-shift-right"]},"cljs.core/bit-test":{"full-name":"cljs.core/bit-test","signature":["[x n]"],"description-html":"Test bit at index n
Bitwise exclusive or
\n","related":["cljs.core/bit-and","cljs.core/bit-or"]},"cljs.core/butlast":{"full-name":"cljs.core/butlast","signature":["[s]"],"description-html":"Returns a sequence of all but the last item in s
.
butlast
runs in linear time.
Takes an expression and a set of clauses. Each clause can take the form of\neither:
\ntest-constant result-expr
(test-constant1 ... test-constantN) result-expr
The test-constants are not evaluated. They must be compile-time literals, and\nneed not be quoted. If the expression is equal to a test-constant, the\ncorresponding result-expr
is returned. A single default expression can follow\nthe clauses, and its value will be returned if no clause matches. If no default\nexpression is provided and no clause matches, an Error is thrown.
Unlike cond
and condp
, case
does a constant-time dispatch, the clauses are\nnot considered sequentially. All manner of constant expressions are acceptable\nin case
, including numbers, strings, symbols, keywords, and ClojureScript\ncomposites thereof. Note that since lists are used to group multiple constants\nthat map to the same expression, a vector can be used to match a list if needed.\nThe test-constants need not be all of the same type.
catch
should be used inside of a try
expression.
exception-type
should be the type of exception thrown (usually js/Error
or\njs/Object
). When there is a match, the thrown exception will be bound to\nname
inside of expr*
and expr*
will be evaluated and returned as the value\nof the try
expression.
Coerce to char
\n"},"cljs.core/clj->js":{"full-name":"cljs.core/clj->js","signature":["[x]"],"description-html":"Recursively transforms ClojureScript values to JavaScript.
\nClojureScript | \n\n | JavaScript | \n\n |
---|---|---|---|
Set | \n#{} | \nArray | \n[] | \n
Vector | \n[] | \nArray | \n[] | \n
List | \n() | \nArray | \n[] | \n
Keyword | \n:foo | \nString | \n"foo" | \n
Symbol | \nbar | \nString | \n"bar" | \n
Map | \n{} | \nObject | \n{} | \n
Returns true if x
is a collection, false otherwise.
Lists, maps, sets, and vectors are collections.
\n","related":["cljs.core/seq?","cljs.core/list?","cljs.core/sequential?"]},"cljs.core/comp":{"full-name":"cljs.core/comp","signature":["[]","[f]","[f g]","[f g h]","[f1 f2 f3 & fs]"],"description-html":"Takes a set of functions (fn
s) and returns a function that is the composition\nof those functions.
The returned function takes a variable number of arguments, applies the\nrightmost of fn
s to the arguments, the next fn
(right-to-left) to the\nresult, etc.
((comp a b c) x y)
=> (a (b (c x y)))
Comparator.
\nReturns a negative number, zero, or a positive number when x
is logically\n"less than", "equal to", or "greater than" y
.
Uses IComparable
if available and google.array.defaultCompare
for objects of\nthe same type. nil is treated as a special case and is always less than any\nother object.
Atomically sets the value of atom a
to newval
if and only if the current\nvalue of the atom is identical to oldval
.
Returns true if set happened, false otherwise.
\n","related":["cljs.core/atom","cljs.core/reset!","cljs.core/swap!"]},"cljs.core/complement":{"full-name":"cljs.core/complement","signature":["[f]"],"description-html":"Takes a function f
and returns a function that takes the same arguments as\nf
, has the same effects, if any, and returns the opposite truth value.
Returns a lazy sequence representing the concatenation of the elements in the\nsupplied collections.
\n","related":["cljs.core/conj","cljs.core/into"]},"cljs.core/cond":{"full-name":"cljs.core/cond","signature":["[& clauses]"],"description-html":"clauses
must be an even number of forms, ie: (cond t1 e1, t2 e2, t3 e3)
.\nEach test t
is evaluated one at a time. If a test returns logical true, cond
\nevaluates and returns the corresponding expression e
and does not evaluate any\nof the other tests or expressions.
It is idiomatic to provide a default case as the last test pair using the\nkeyword :else
(a keyword always evaluates to logical true).
(cond)
returns nil.
Takes an expression and a set of test/form pairs. Threads expr
(via ->
)\nthrough each form for which the corresponding test expression is true.
Note that, unlike cond
branching, cond->
threading does not short circuit\nafter the first true test expression.
Takes an expression and a set of test/form pairs. Threads expr
(via ->>
)\nthrough each form for which the corresponding test expression is true.
Note that, unlike cond
branching, cond->>
threading does not short circuit\nafter the first true test expression.
Takes a binary predicate, an expression, and a set of clauses. There are two\nkinds of clauses:
\nBinary clause: test-expr
result-expr
Ternary clause: test-expr
:>>
result-fn
\n(Note: :>>
is an ordinary keyword)
For each clause, (pred test-expr expr)
is evaluated. If it returns logical\ntrue, the clause is a match.
If a binary clause matches, its result-expr
is returned.
If a ternary clause matches, its result-fn
is called with the result of the\npredicate and returned by condp
. result-fn
should take one argument.
A single default expression can follow the clauses, and its value will be\nreturned if no clause matches.
\nIf no default expression is provided and no clause matches, an Error is thrown.
\n","related":["cljs.core/cond","cljs.core/if"],"type":"macro"},"cljs.core/conj":{"full-name":"cljs.core/conj","signature":["[]","[coll]","[coll x]","[coll x & xs]"],"description-html":"conj(oin)
\nReturns a new collection with the x
s "added" to coll
.
conj
adds items to the end of a vector, the beginning of a list, and into a\nset.
conj
works with maps by merging and also supports vector pairs with two\nelements.
Multiple x
s are added in order, as if called one at a time.
(conj nil item)
returns (item)
.
Returns a new sequence where x
is the first element and coll
is the rest.
Returns a function that takes any number of arguments and always returns x
.
Returns true if k
is present in coll
, otherwise returns false.
Note that for numerically indexed collections like vectors and arrays, this\ntests if the numeric key is within the range of indexes.
\ncontains?
operates in constant or logarithmic time; it will not perform a\nlinear search for a value.
Returns the number of items in x
.
count
works on arrays, lists, maps, sets, strings, and vectors.
(count nil)
returns 0.
Returns true if x
executes count
in constant time, false otherwise.
Lists, maps, sets, strings, and vectors can be counted in constant time.
\n"},"cljs.core/cycle":{"full-name":"cljs.core/cycle","signature":["[coll]"],"description-html":"Returns an infinite lazy sequence of repetitions of the items in coll
.
Returns a number one less than x
.
Uses def
to establish symbols of names
with no bindings.
Useful for making forward declarations.
\n","related":["cljs.core/def"],"type":"macro"},"cljs.core/def":{"full-name":"cljs.core/def","signature":["[symbol]","[symbol init]","[symbol doc-string init]"],"description-html":"Creates a global variable with the name of symbol
and a namespace of the\ncurrent namespace.
If init
is supplied, it is evaluated and the result is assigned to symbol
.
doc-string
is an optional documentation string.
def
is one of ClojureScript's special forms\nand is used by many macros to define common elements (ie: defn
, defmacro
,\netc).
Defines a function.
\ndoc-string?
is an optional documentation string.
attr-map?
is an optional map of metadata to\nattach to the global variable name.
prepost-map?
is an optional map with optional keys :pre
and :post
that\ncontain collections of pre or post conditions\nfor the function.
Code | \nExpands To |
---|---|
\n(defn foo [a b c]\n (* a b c)) | \n \n(def foo\n (fn [a b c]\n (* a b c))) |
Same as defn
, but adds {:private true}
metadata to the definition.
Note: :private
metadata is not currently enforced by the ClojureScript\ncompiler.
Returns the current value of atom x
.
The @
reader macro is often used instead of deref
. @foo
is the same thing\nas (deref foo)
.
disj(oin). Returns a new set of the same (hashed/sorted) type, that does not\ncontain key(s).
\n","related":["cljs.core/dissoc","cljs.core/disj!","clojure.set/difference"]},"cljs.core/dissoc":{"full-name":"cljs.core/dissoc","signature":["[coll]","[coll k]","[coll k & ks]"],"description-html":"dissoc(iate)
\nReturns a new map that does not contain a mapping for key(s).
\nHas no effect on the map type (hashed/sorted).
\n","related":["cljs.core/assoc","cljs.core/dissoc-in","cljs.core/disj","cljs.core/select-keys"]},"cljs.core/distinct":{"full-name":"cljs.core/distinct","signature":["[coll]"],"description-html":"Returns a lazy sequence of the elements of coll
with duplicates removed.
Returns true if no two of the arguments are =
Forces evaluation of a lazy sequence. Often used to see the effects of a\nsequence produced via functions that have side effects.
\ndoall
walks through the successive next
s of the sequence, returning the head\nand causing the entire sequence to reside in memory at one time.
Forces evaluation of a lazy sequence. Often used to see the effects of a\nsequence produced via functions that have side effects.
\ndorun
walks through the successive next
s of the sequence and returns nil.
Repeatedly executes body
(presumably for side-effects) with bindings and\nfiltering as provided by for
. Does not retain the head of the sequence.
Returns nil.
\n","related":["cljs.core/doall","cljs.core/dorun","cljs.core/for","cljs.core/dotimes"],"type":"macro"},"cljs.core/dotimes":{"full-name":"cljs.core/dotimes","signature":["[[name n] & body]"],"description-html":"Repeatedly executes body
(presumably for side-effects) with name
bound to\nintegers from 0
through n-1
.
Returns a lazy sequence of all but the first n
items in coll
.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/take","cljs.core/drop-last","cljs.core/drop-while","cljs.core/nthnext","cljs.core/nthrest"]},"cljs.core/drop-last":{"full-name":"cljs.core/drop-last","signature":["[s]","[n s]"],"description-html":"Return a lazy sequence of all but the last n
items in s
.
n
defaults to 1.
Returns a lazy sequence of the items in coll
starting from the first item for\nwhich (pred item)
returns logical false.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/take-while","cljs.core/split-with"]},"cljs.core/empty":{"full-name":"cljs.core/empty","signature":["[coll]"],"description-html":"Returns an empty collection of the same category as coll
.
Returns nil if coll
is nil.
Returns true if coll
has no items - same as (not (seq coll))
.
Please use the idiom (seq x)
rather than (not (empty? x))
.
Returns true if n
is an even number.
Throws an exception if n
is not an integer.
Takes a set of predicate functions and returns a function f
that returns true\nif all of its composing predicates return a logical true value against all of\nits arguments, else it returns false.
Note that f
is short-circuiting in that it will stop execution on the first\nargument that triggers a logical false result against the original predicates.
Returns true if (pred x)
is logical true for every x
in coll
, else false.
Returns true if x
is the value false, false otherwise.
Same as (first (first coll))
.
Returns a lazy sequence of the non-nil results of (f item)
. Note, this means\nfalse return values will be included.
f
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/remove","cljs.core/keep"]},"cljs.core/filterv":{"full-name":"cljs.core/filterv","signature":["[pred coll]"],"description-html":"Returns a vector of the items in coll
for which (pred item)
returns true.
pred
must be free of side-effects.
finally
should be the last form inside of a try
expression. It is optional.
finally
clauses are always evaluated for their side effects whether there was\nan error or not, but they are never the return value of a try
expression.
Returns the map entry for key k
, or nil if k
is not found.
Returns the first item in coll
and calls seq
on its argument.
Returns nil when coll
is nil.
Takes any nested combination of sequential things (lists, vectors, etc.) and\nreturns their contents as a single, flat sequence.
\n(flatten nil)
returns nil.
Defines a function.
\nname?
is an optional name of the function to be used inside body
. This is\nuseful for recursive calls. Note that name?
in fn
is not the same as the\nname
argument to defn
, which defines a global symbol for the function.
params*
are the arguments to the function and a binding form for the symbols\nthat the arguments will take inside the body of the function. Functions can have\narity of 0-20 and there is no runtime enforcement of arity when calling a\nfunction (just like in JavaScript).
prepost-map?
is an optional map with optional keys :pre
and :post
that\ncontain collections of pre or post conditions\nfor the function.
body
is a series of expressions that execute when the function is called. The\narguments to the function are mapped to symbols in params*
and are available\nin body
. The value of the last expression in body
is the return value of\ncalling the function.
Returns true if f
is a function, false otherwise.
Same as (first (next coll))
Takes a function f
, and returns a function that calls f
, replacing a nil\nfirst argument to f
with the supplied value x
. Higher arity versions can\nreplace 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)\nbeing nil-patched.
List comprehension.
\nTakes a vector of one or more binding-form/collection-expr pairs, each followed\nby zero or more modifiers, and yields a lazy sequence of evaluations of expr.
\nCollections are iterated in a nested fashion, rightmost fastest, and nested\ncoll-exprs can refer to bindings created in prior binding-forms. Supported\nmodifiers are: :let [binding-form expr ...]
, :while test
, :when test
.
Returns a map from distinct items in coll
to the number of times they appear.
(frequencies [:a :a :b])
=> {:a 2, :b 1}
Returns the value mapped to key k
.
Returns not-found
or nil if k
is not present in o
.
Returns the value in a nested associative structure, where ks
is a sequence of\nkeys.
Returns nil if the key is not found, or not-found
if supplied.
Returns the validator function for atom a
.
Returns a map of the elements of coll
keyed by the result of running f
on\neach element.
The value at each key will be a vector of the corresponding elements in the\norder they appeared in coll
.
Returns a new hash map with supplied mappings.
\nkeyvals
must be an even number of forms.
Returns a new hash set with supplied keys
.
Any equal keys are handled as if by repeated uses of conj
.
Returns true if x
and y
are the same object, false otherwise.
Returns its argument.
\n","related":["cljs.core/nil?"]},"cljs.core/if":{"full-name":"cljs.core/if","signature":["[test then else?]"],"description-html":"If test
is not false or nil, then
is evaluated and returned. Otherwise,\nelse?
is evaluated and returned. else?
defaults to nil if not provided.
if
is one of ClojureScript's special forms\nand is a fundamental building block of the language. All other conditionals in\nClojureScript are based on if
s notion of truthiness (ie: anything other than\nfalse or nil).
When test
is logical true, evaluates then
with the value of test
bound to\nx
. Otherwise, evaluates else
with no bindings.
else
defaults to nil.
If test
is false or nil, evaluates and returns then
. Otherwise, evaluates\nand returns else
. else
defaults to nil if not provided.
If test
is not nil, evaluates then
with x
bound to the value of test
. If\nnot, yields else
.
Returns true if f
implements the IFn
protocol, false otherwise.
Functions, keywords, map, sets, and vectors can be called as functions.
\n","related":["cljs.core/fn?"]},"cljs.core/inc":{"full-name":"cljs.core/inc","signature":["[x]"],"description-html":"Returns a number one greater than x
.
Returns true if o
is an instance of type t
, false otherwise.
Coerces x
to an integer by stripping decimal places.
Returns true if n
is an integer, false otherwise.
Returns a lazy seq of the first item in each collection, then the second items,\nthen the third, etc.
\n","related":["cljs.core/interpose","cljs.core/zipmap"]},"cljs.core/interpose":{"full-name":"cljs.core/interpose","signature":["[sep coll]"],"description-html":"Returns a lazy seq of the elements of coll
separated by sep
.
Returns a new collection consisting of to
with all of the items of from
\n"added" using conj
.
A transducer may be supplied as xform
.
Returns a new JavaScript array from the elements of aseq
.
Returns a lazy sequence of x
, (f x)
, (f (f x))
etc.
f
must be free of side-effects.
Recursively transforms JavaScript arrays into ClojureScript vectors, and\nJavaScript objects into ClojureScript maps.
\nPass options :keywordize-keys true
to recursively convert object property\nnames from strings to keywords.
(js->clj js-data :keywordize-keys true)
Note that js->clj
is not optimized for speed and the transit.cljs library is\nrecommended when parsing large amounts of JSON data.
Deletes property key
in JavaScript object obj
.
Uses the JavaScript delete
operator.
Returns a new JavaScript object using the supplied mappings.
\nkeyvals
must be an even number of forms.
Takes a set of functions and returns a function that is the juxtaposition of\nthose functions.
\nThe returned function takes a variable number of arguments, and returns a vector\ncontaining the result of applying each function to the arguments (left-to-\nright).
\n((juxt a b c) x)
=> [(a x) (b x) (c x)]
Returns a lazy sequence of the non-nil results of (f item)
. Note, this means\nfalse return values will be included.
f
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/keep-indexed","cljs.core/map","cljs.core/filter"]},"cljs.core/keep-indexed":{"full-name":"cljs.core/keep-indexed","signature":["[f]","[f coll]"],"description-html":"Returns a lazy sequence of the non-nil results of (f index item)
. Note, this\nmeans false return values will be included.
`f must be free of side-effects.
\nReturns a stateful transducer when no collection is provided.
\n","related":["cljs.core/map-indexed","cljs.core/keep"]},"cljs.core/key":{"full-name":"cljs.core/key","signature":["[map-entry]"],"description-html":"Returns the key of the map entry.
\n","related":["cljs.core/keys"]},"cljs.core/keys":{"full-name":"cljs.core/keys","signature":["[hash-map]"],"description-html":"Returns a sequence of the keys in hash-map
.
Returns the last item in coll
in linear time.
peek
is much faster than last
for a vector.
Expands to code which yields a lazy sequence of the concatenation of the\nsupplied collections. Each collections expression is not evaluated until it is\nneeded.
\nCode | \nExpands To |
---|---|
(lazy-cat x y z) \n | \n(concat (lazy-seq x)\n (lazy-seq y)\n (lazy-seq z)) |
Returns a new lazy sequence.
\n","related":["cljs.core/lazy-cat","cljs.core/realized?","cljs.core/doall","cljs.core/iterate"]},"cljs.core/let":{"full-name":"cljs.core/let","signature":["[bindings & body]"],"description-html":"Binds expressions to symbols and makes those symbols available only within\nbody
.
bindings
should be a vector with an even number of forms, ie: [a1 b1, a2 b2,\na3 b3]
. The first item in a pair (the a
s) should be a symbol that is assigned\nthe evaluation of the second item (the b
s). These symbols (the a
s) are then\navailable within body
(and not outside of body
).
Another way to think about this is that the binding symbols in let
are like\nlocal def
s that are only available within let
's scope.
In addition to direct symbol binding, let
supports a destructuring syntax to\n"break apart" collections into multiple symbols. This destructuring syntax is\nlike it's own mini-language and allows for succinct code.
let
is one of ClojureScript's special forms and is a fundamental building\nblock of the language. Many macros rely on let
s binding syntax and scope\nrules.
Takes a vector of function definitions fnspecs
and binds the functions to\ntheir names. All of the names are available in all of the definitions of the\nfunctions as well as body
.
fnspecs
must be a vector with an even number of forms. See let
.
letfn
is one of ClojureScript's special forms.
Creates a new list containing items
.
Creates a new list containing the items prepended to the rest, the last of which\nwill be treated as a sequence.
\n","related":["cljs.core/list"]},"cljs.core/list?":{"full-name":"cljs.core/list?","signature":["[x]"],"description-html":"Returns true if x
is a list, false otherwise.
Creates an empty JavaScript array of size size
.
Returns a lazy sequence of applying function f
to every element of coll
.
When more than one collection is provided, returns a lazy sequence consisting of\nthe result of applying f
to the set of first items of each c
, followed by\napplying f
to the set of second items in each c
, until any one of the c
s\nis exhausted. Any remaining items in other c
s are ignored. Function f
should\naccept number-of-c
s arguments.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/map-indexed","cljs.core/pmap","cljs.core/amap","cljs.core/mapcat","cljs.core/keep","cljs.core/juxt"]},"cljs.core/map-indexed":{"full-name":"cljs.core/map-indexed","signature":["[f coll]"],"description-html":"Returns a lazy sequence consisting of the result of applying f
to 0 and the\nfirst item of coll
, followed by applying f
to 1 and the second item in\ncoll
, etc, until coll
is exhausted.
Function f
should accept 2 arguments, index and item.
Returns true if x
is a map, false otherwise.
Returns the result of applying concat
to the result of applying map
to f
\nand colls
.
Function f
should return a collection.
Returns a transducer when no collections are provided.
\n","related":["cljs.core/map","cljs.core/concat"]},"cljs.core/mapv":{"full-name":"cljs.core/mapv","signature":["[f coll]","[f c1 c2]","[f c1 c2 c3]","[f c1 c2 c3 & colls]"],"description-html":"Returns a vector consisting of the result of applying f
to the set of first\nitems of each coll, followed by applying f
to the set of second items in each\ncoll, until any one of the colls is exhausted. Any remaining items in other\ncolls are ignored.
Function f
should accept number-of-colls arguments.
Returns the greatest number argument.
\n","related":["cljs.core/min","cljs.core/max-key"]},"cljs.core/max-key":{"full-name":"cljs.core/max-key","signature":["[k x]","[k x y]","[k x y & more]"],"description-html":"Returns the x
for which (k x)
is greatest.
(k x)
should return a number.
Returns a memoized version of a referentially transparent function.
\nA memoized version of a function keeps a cache of the mappings from arguments to\nresults in memory. When calls with the same arguments are repeated often, a\nmemoized function has higher performance at the expense of higher memory usage.
\n"},"cljs.core/merge":{"full-name":"cljs.core/merge","signature":["[& maps]"],"description-html":"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 rightmost map will\n"win".
\n","related":["cljs.core/merge-with","cljs.core/hash-map"]},"cljs.core/merge-with":{"full-name":"cljs.core/merge-with","signature":["[f & maps]"],"description-html":"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-\nright) will be combined with the mapping in the result by calling (f val-in-\nresult val-in-latter)
.
Returns the least number argument.
\n","related":["cljs.core/max","cljs.core/min-key"]},"cljs.core/min-key":{"full-name":"cljs.core/min-key","signature":["[k x]","[k x y]","[k x y & more]"],"description-html":"Returns the x
for which (k x)
is least.
(k x)
should return a number.
Returns the modulus of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Truncates toward negative infinity.
\n","related":["cljs.core/rem"]},"cljs.core/name":{"full-name":"cljs.core/name","signature":["[x]"],"description-html":"Returns a string value of a keyword, string, or symbol.
\n(name :foo)
=> "foo"
(name "foo")
=> "foo"
(name 'foo)
=> "foo"
Returns true if n
is less than 0, false otherwise.
Returns a sequence of the items after the first and calls seq
on its argument.
Returns nil if coll
is empty.
Same as (next (first coll))
.
Returns true if x
is nil, false otherwise.
Same as (next (next coll))
.
Returns true if x
is logical false, false otherwise.
Returns false if (pred x)
is logical true for any x
in coll
, else true.
Returns nil if coll
is empty, else returns coll
.
Returns false if (pred x)
is logical true for every x
in coll
, else true.
Returns the opposite of =
.
Same as (not (= x y))
Sets the namespace of the file.
\nns
must be the first form in a .cljs
file and there can only be one ns
\ndeclaration per file. Namespaces must match the file name of their respective\n.cljs
files, with the exception that dashes in namespaces become underscores\nin filenames. Thus, (ns foo.bar-biz.baz)
should be the first form in file\nfoo/bar_biz/baz.cljs
.
references
can be zero or more forms used to import other namespaces, symbols,\nand libraries into the current namespace.
Returns the value at index n
or not-found
if the index is out of bounds.
nth
will throw an exception if n
is out of bounds and not-found
is not\nsupplied.
nth
works for Strings, Arrays, Regex Matchers, Lists, and Sequences. For\nSequences, nth
takes O(n) time.
Returns the n
th next
of coll
.
Returns (seq coll)
when n
is 0.
Returns the nth
rest of coll
.
Returns coll
when n
is 0.
Returns true if n
is a number, false otherwise.
Returns true if x
is a JavaScript object, false otherwise.
Returns true if n
is an odd number.
Throws an exception if n
is not an integer.
Evaluates arguments one at a time from left to right. If an argument returns\nlogical true, or
returns that value and doesn't evaluate any of the other\narguments, otherwise it returns the value of the last argument.
(or)
returns nil.
Takes a function f
and fewer than the normal arguments to f
. Returns a\nfunction that takes a variable number of additional arguments. When called, the\nreturned function calls f
with the original arguments plus the additional\narguments.
((partial f a b) c d)
=> (f a b c d)
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, its elements will be used as necessary to\ncomplete the last partition up to n
items.
Returns a partition with less than n
items if there are not enough padding\nelements.
Returns a lazy sequence of lists like partition
, but may include partitions\nwith fewer than n
items at the end.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/partition","cljs.core/partition-by"]},"cljs.core/partition-by":{"full-name":"cljs.core/partition-by","signature":["[f]","[f coll]"],"description-html":"Applies f
to each value in coll
, splitting it each time f
returns a new\nvalue. Returns a lazy sequence of partitions.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/partition","cljs.core/partition-all","cljs.core/group-by"]},"cljs.core/peek":{"full-name":"cljs.core/peek","signature":["[coll]"],"description-html":"Returns the first element of a list; same as first
.
Returns the last element of a vector, and much more efficient than using last
.
Returns nil if coll
is empty.
For a list, returns a new list without the first item.
\nFor a vector, returns a new vector without the last item.
\n","related":["cljs.core/peek","cljs.core/rest","cljs.core/conj"]},"cljs.core/pos?":{"full-name":"cljs.core/pos?","signature":["[n]"],"description-html":"Returns true if n
is greater than 0, false otherwise.
Returns the quotient of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Returns a random floating point number between 0 inclusive and n
exclusive.
n
defaults to 1.
Returns a random integer between 0 inclusive and n
exclusive.
Returns a random element from a sequential collection coll
.
Has the same performance characteristics as nth
.
Returns a lazy sequence of nums from start
(inclusive) to end
(exclusive),\nby step
, where start
defaults to 0, step
to 1, and end
to infinity.
Returns the first regex match, if any, of s
to re
, using re.exec(s)
.
Returns a vector, containing first the matching substring, then any capturing\ngroups if the regular expression contains capturing groups.
\n"},"cljs.core/re-matches":{"full-name":"cljs.core/re-matches","signature":["[re s]"],"description-html":"Returns the result of (re-find re s)
if re
fully matches s
.
Returns an instance of RegExp which has compiled the provided string.
\n"},"cljs.core/re-seq":{"full-name":"cljs.core/re-seq","signature":["[re s]"],"description-html":"Returns a lazy sequence of successive matches of regex re
in string s
.
Returns true if a value has been produced for a lazy sequence.
\n","related":["cljs.core/lazy-seq"]},"cljs.core/reduce":{"full-name":"cljs.core/reduce","signature":["[f coll]","[f val coll]"],"description-html":"f
should be a function of 2 arguments. If val
is not supplied, returns the\nresult of applying f
to the first 2 items in coll
, then applying f
to that\nresult and the 3rd item, etc.
If coll
contains no items, f
must accept no arguments as well, and reduce
\nreturns 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\nitem 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.
Reduces an associative collection.
\nf
should be a function of 3 arguments. Returns the result of applying f
to\ninit
, the first key and the first value in coll
, then applying f
to that\nresult 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\nordinals.
Returns a lazy sequence of the intermediate values of the reduction (as per\nreduce
) of coll
by f
, starting with init
.
Returns the remainder of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Returns a lazy sequence of the items in coll
for which (pred item)
returns\nfalse.
pred
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/filter"]},"cljs.core/remove-watch":{"full-name":"cljs.core/remove-watch","signature":["[a key]"],"description-html":"Removes a watch function identified by key
from atom a
. The function must\nhave originally been set by add-watch
.
Returns a lazy sequence of x
s.
The length of the sequence is infinite, or n
if provided.
Takes a function f
of no args, presumably with side effects, and returns an\ninfinite (or length n
if supplied) lazy sequence of calls to it.
Given a map of replacement pairs smap
and a vector/collection coll
, returns\na vector/seq with any elements =
to a key in smap
replaced with the\ncorresponding val in smap
.
Returns a transducer when coll
is not provided.
Sets the value of atom a
to new-value
without regard for the current value.
Returns new-value
.
Returns a possibly empty sequence of the items after the first item.
\nCalls seq
on its argument.
Returns a sequence of the items in coll
in reverse order. Not lazy.
Returns true if coll
implements the IReversible
protocol, false otherwise.
Vectors, sorted maps, and sorted sets implement IReversible
.
Returns a sequence of the items in coll
in reverse order in constant time.
Returns nil if coll
is empty.
coll
must be a vector or a sorted-map.
sc
must be a sorted collection.
test
, start-test
, end-test
must be <
, <=
, >
or >=
.
Returns a reverse sequence of those entries with keys ek
for which\n(test (.. sc comparator (compare ek key)) 0)
is true.
Returns the second item in coll
.
Same as (first (next coll))
Returns a map containing only those entries in map
whose key is in keys
.
Returns a sequence on the collection. If the collection is empty, returns nil.
\n(seq nil)
returns nil.
seq
also works on strings.
Returns true if x
is a sequence, false otherwise.
All collections can be converted into a sequence using seq
.
Returns true if coll
implements the ISequential
protocol, false otherwise.
Lists and vectors are sequential.
\n","related":["cljs.core/seq?","cljs.core/coll?"]},"cljs.core/set":{"full-name":"cljs.core/set","signature":["[coll]"],"description-html":"Returns a set of the distinct elements of coll
.
Sets js-var
to val
using the JavaScript =
operator.
Sets a validator function for atom a
.
fn
must be nil or a side-effect-free function of one argument, which will be\npassed the intended new state on any state change. fn
should return false or\nthrow an Error if the new state is unacceptable.
If the current value of a
is unacceptable to fn
when set-validator!
is\ncalled, an Error will be thrown and the validator will not be set.
(set-validator! my-atom nil)
will remove the validator from my-atom
.
Returns true if x
is a set, false otherwise.
Returns a random permutation of coll
.
Returns the first logical true value of (pred x)
for any x
in coll
, else\nnil.
A common idiom is to use a set as pred, for example this will return :fred
if\n:fred
is in the sequence, otherwise nil: (some #{:fred} coll)
When expr
is not nil, threads it into the first form (via ->
), and when that\nresult is not nil, through the next, etc.
When expr
is not nil, threads it into the first form (via ->>
), and when\nthat result is not nil, through the next, etc.
Takes a set of predicate functions and returns a function f
that returns the\nfirst logical true value returned by one of its composing predicates against any\nof its arguments, else it returns logical false.
Note that f
is short-circuiting in that it will stop execution on the first\nargument that triggers a logical true result against the original predicates.
Returns true if x
is not nil, false otherwise.
Returns a sorted sequence of the items in coll
.
comp
can be a boolean-valued comparison funcion, or a -/0/+ valued comparator.
comp
defaults to compare
.
Returns a sorted sequence of the items in coll
, where the sort order is\ndetermined by comparing (keyfn item)
.
comp
can be boolean-valued comparison function, or a -/0/+ valued comparator.
comp
defaults to compare
.
Returns a new sorted map with supplied mappings.
\nkeyvals
must be an even number of forms.
Returns a new sorted map with supplied mappings, using the supplied comparator\nfunction.
\nkeyvals
must be an even number of forms.
Returns a new sorted set with supplied keys
.
Returns a new sorted set with supplied keys
, using the supplied comparator
.
Returns true if coll
implements the ISorted
protocol, false otherwise.
Sorted maps and sorted sets implement ISorted
.
Returns a vector of [(take n coll) (drop n coll)]
.
Returns a vector of [(take-while pred coll) (drop-while pred coll)]
(str)
and (str nil)
return the empty string.
(str x)
returns x.toString()
.
With more than one argument, returns the concatenation of the str
values of\nthe arguments.
Returns true if x
is a string, false otherwise.
Returns the substring of s
beginning at start
inclusive, and ending at end
\nexclusive.
end
defaults to the length of the string.
sc
must be a sorted collection.
test
, start-test
, end-test
must be <
, <=
, >
or >=
.
Returns a sequence of those entries with keys ek
for which\n(test (.. sc comparator (compare ek key)) 0)
is true.
Returns a persistent vector of the items in v
from start
inclusive to end
\nexclusive.
If end
is not supplied, defaults to (count v)
.
This operation is O(1) and very fast, as the resulting vector shares structure\nwith the original and no trimming is done.
\n","related":["cljs.core/vector","cljs.core/vector?"]},"cljs.core/swap!":{"full-name":"cljs.core/swap!","signature":["[a f]","[a f x]","[a f x y]","[a f x y & more]"],"description-html":"Atomically swaps the value of atom to be: (apply f current-value-of-atom\nargs)
Note that f
may be called multiple times, and thus should be free of side\neffects.
Returns the value that was swapped in.
\n","related":["cljs.core/atom","cljs.core/reset!"]},"cljs.core/take":{"full-name":"cljs.core/take","signature":["[n]","[n coll]"],"description-html":"Returns a lazy sequence of the first n
items in coll
. Returns all the items\nif there are fewer than n
.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/drop","cljs.core/take-while","cljs.core/take-last","cljs.core/take-nth"]},"cljs.core/take-last":{"full-name":"cljs.core/take-last","signature":["[n coll]"],"description-html":"Returns a sequence of the last n
items in coll
.
Depending on the type of collection, take-last
may be no faster than linear\ntime. For vectors, please use subvec
.
Returns a lazy seq of every n
th item in coll
.
Returns a stateful transducer when no collection is provided.
\n"},"cljs.core/take-while":{"full-name":"cljs.core/take-while","signature":["[pred]","[pred coll]"],"description-html":"Returns a lazy sequence of successive items from coll
while (pred item)
\nreturns true. pred
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/drop-while","cljs.core/split-with"]},"cljs.core/throw":{"full-name":"cljs.core/throw","signature":["[expr]"],"description-html":"expr
is evaluated and thrown, hopefully to be caught by a try
expression.
(throw (js/Error. "Oops!"))
Returns a (potentially-ragged) 2-dimensional JavaScript array containing the\ncontents of coll
.
Returns a lazy sequence of the nodes in a tree, via a depth-first walk.
\nbranch?
must be a function of one argument that returns true if passed a node\nthat can have children (but may not).
children
must be a function of one argument that returns a sequence of the\nchildren. children
will only be called on nodes for which branch?
returns\ntrue.
root
is the root node of the tree.
Returns true if x
is the value true, false otherwise.
The expressions (expr*
) are evaluated and, if no exceptions occur, the value\nof the last is returned.
If an exception occurs and catch clauses (catch-clause*
) are provided, each is\nexamined in turn and the first for which the thrown exception is an instance of\nthe named class is considered a matching catch clause. If there is a matching\ncatch clause, its expressions are evaluated in a context in which name is bound\nto the thrown exception, and the value of the last is the return value of the\nfunction.
If there is no matching catch clause, the exception propagates out of the\nfunction. Before returning, normally or abnormally, any finally-clause?
\nexpressions will be evaluated for their side effects.
try
is one of ClojureScript's special forms.
Bitwise shift right with zero fill
\n","related":["cljs.core/bit-shift-right"]},"cljs.core/update-in":{"full-name":"cljs.core/update-in","signature":["[m [k & ks] f]","[m [k & ks] f a]","[m [k & ks] f a b]","[m [k & ks] f a b c]","[m [k & ks] f a b c & args]"],"description-html":""Updates" a value in a nested associative structure, where ks
is a sequence of\nkeys and f
is a function that will take the old value and any supplied\narguments and return the new value. Returns a new nested structure.
If any levels do not exist, hash-maps will be created.
\n","related":["cljs.core/assoc-in","cljs.core/get-in"]},"cljs.core/val":{"full-name":"cljs.core/val","signature":["[map-entry]"],"description-html":"Returns the value in the map entry.
\n","related":["cljs.core/vals"]},"cljs.core/vals":{"full-name":"cljs.core/vals","signature":["[hash-map]"],"description-html":"Returns a sequence of the values in hash-map
.
Creates a new vector containing the contents of coll
Creates a new vector containing args
.
Returns true if x
is a vector, false otherwise.
Evaluates test
. If logical true, evaluates body
in an implicit do
.
when
is often used instead of if
for conditions that do not have an "else".
With bindings
as x
, xs
, roughly the same as (when (seq xs) (let [x (first\nxs)] body))
but xs
is evaluated only once.
When test
is logical true, evaluates body
with the value of test
bound to\nx
.
Evaluates test
. If logical false, evaluates body
in an implicit do
.
When test
is not nil, evaluates body
with x
bound to the value of test
.
Repeatedly executes body
while test
expression is true. Presumes some\nside-effect will cause test
to become false or nil.
Returns nil.
\n","related":["cljs.core/loop"],"type":"macro"},"cljs.core/zero?":{"full-name":"cljs.core/zero?","signature":["[n]"],"description-html":"Returns true if n
is 0, false otherwise.
Returns a map with keys
mapped to corresponding vals
.
user=> (zipmap [:a :b :c :d] [1 2 3 4])\n{:a 1, :b 2, :c 3, :d 4}","related":["cljs.core/interleave"]},"clojure.set/difference":{"full-name":"clojure.set/difference","signature":["[s1]","[s1 s2]","[s1 s2 & sets]"],"description-html":"
Return a set that is the first set without elements of the remaining sets.
\n","related":["clojure.set/union","clojure.set/intersection","clojure.set/superset?","clojure.set/project"]},"clojure.set/intersection":{"full-name":"clojure.set/intersection","signature":["[s1]","[s1 s2]","[s1 s2 & sets]"],"description-html":"Return a set that is the intersection of the input sets.
\n","related":["clojure.set/union","clojure.set/difference","clojure.set/superset?","clojure.set/project"]},"clojure.set/select":{"full-name":"clojure.set/select","signature":["[pred xset]"],"description-html":"Returns a set of the elements for which pred
is true.
Returns true if a
is a subset of b
, false otherwise.
In other words, returns true if all the elements of a
can be found in b
.
Returns true if a
is a superset of b
, false otherwise.
In other words, returns true if a
contains all the elements of b
.
Return a set that is the union of the input sets.
\n","related":["clojure.set/intersection","clojure.set/difference","clojure.set/superset?"]},"clojure.string/blank?":{"full-name":"clojure.string/blank?","signature":["[s]"],"description-html":"True if s
is nil, empty, or contains only whitespace.
Converts first character of the string to upper-case, all other characters to\nlower-case.
\n"},"clojure.string/escape":{"full-name":"clojure.string/escape","signature":["[s cmap]"],"description-html":"Return a new string, using cmap
to escape each character ch
from s
as follows:
If (cmap ch)
is nil, append ch to the new string.
If (cmap ch)
is non-nil, append (str (cmap ch))
instead.
Returns a string of all elements in coll
, as returned by (seq coll)
,\nseparated by an optional separator.
Converts string to all lower-case.
\n"},"clojure.string/replace":{"full-name":"clojure.string/replace","signature":["[s match replacement]"],"description-html":"Replaces all instance of match
with replacement
in s
.
The options for match / replacement are:
\nmatch | \nreplacement | \n
---|---|
string | \nstring | \n
regex | \nstring | \n
regex | \nfunction | \n
Replaces the first instance of match
with replacement
in s
.
The options for match / replacement are:
\nmatch | \nreplacement | \n
---|---|
string | \nstring | \n
regex | \nstring | \n
regex | \nfunction | \n
Returns s
with its characters reversed.
Splits string on a regular expression. Optional argument limit is the maximum\nnumber of splits. Not lazy. Returns vector of the splits.
\n","related":["cljs.core/subs","clojure.string/replace","clojure.string/split-lines"]},"clojure.string/split-lines":{"full-name":"clojure.string/split-lines","signature":["[s]"],"description-html":"Splits s
on \\n
or \\r\\n
.
Removes whitespace from both ends of string.
\n"},"clojure.string/trim-newline":{"full-name":"clojure.string/trim-newline","signature":["[s]"],"description-html":"Removes all trailing newline \\n
or return \\r
characters from string.
Similar to Perl's chomp.
\n"},"clojure.string/triml":{"full-name":"clojure.string/triml","signature":["[s]"],"description-html":"Removes whitespace from the left side of string.
\n"},"clojure.string/trimr":{"full-name":"clojure.string/trimr","signature":["[s]"],"description-html":"Removes whitespace from the right side of string.
\n"},"clojure.string/upper-case":{"full-name":"clojure.string/upper-case","signature":["[s]"],"description-html":"Converts string to all upper-case.
\n"}} \ No newline at end of file +{"cljs.core/*":{"full-name":"cljs.core/*","signature":["[]","[x]","[x y]","[x y & more]"],"description-html":"Returns the product of nums.
\n(*)
returns 1.
Returns the sum of nums.
\n(+)
returns 0.
If no y
s are supplied, returns the negation of x
, else subtracts the y
s\nfrom x
and returns the result.
The thread-first macro "threads" an expression through several forms as the\nsecond item in a list.
\nInserts x
as the second item in the first form, making a list of it if it is\nnot a list already. If there are more forms, inserts the first form as the\nsecond item in second form, etc.
Code | \nExpands To |
---|---|
\n(-> x\n (a b c)\n d\n (x y z)) | \n \n(x (d (a x b c)) y z) |
The thread-last macro "threads" an expression through several forms as the last\nitem in a list.
\nInserts x
as the last item in the first form, making a list of it if it is not\na list already. If there are more forms, inserts the first form as the last item\nin second form, etc.
Code | \nExpands To |
---|---|
\n(->> x\n (a b c)\n d\n (x y z)) | \n \n(x y z (d (a b c x))) |
If no denominators are supplied, returns 1/numerator, else returns numerator\ndivided by all of the denominators.
\n","related":["cljs.core/*","cljs.core/quot"]},"cljs.core/<":{"full-name":"cljs.core/<","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is greater than the previous\none, false otherwise.
\n","related":["cljs.core/<="]},"cljs.core/<=":{"full-name":"cljs.core/<=","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is greater than or equal to the\nprevious one, false otherwise.
\n","related":["cljs.core/<"]},"cljs.core/=":{"full-name":"cljs.core/=","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if the value of x
equals the value of y
, false otherwise.
=
is a value comparison, not an identity comparison.
All collections can be tested for value, regardless of "depth".
\n","related":["cljs.core/==","cljs.core/not=","cljs.core/identical?"]},"cljs.core/==":{"full-name":"cljs.core/==","signature":["[x]","[x y]","[x y & more]"],"description-html":"This is an equality check for numbers of different types that was carried over from Clojure,\nto allow compatibility when converting code to ClojureScript.
\nSince there is only a single number type in JavaScript, 64-bit floating point, there is no\nreason to use the ==
operator in ClojureScript.
Behavior on non-number arguments is undefined.
\n","related":["cljs.core/=","cljs.core/identical?"]},"cljs.core/>":{"full-name":"cljs.core/>","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is less than the previous\none, false otherwise.
\n","related":["cljs.core/>="]},"cljs.core/>=":{"full-name":"cljs.core/>=","signature":["[x]","[x y]","[x y & more]"],"description-html":"Returns true if each successive number argument is less than or equal to the\nprevious one, false otherwise.
\n","related":["cljs.core/>"]},"cljs.core/aclone":{"full-name":"cljs.core/aclone","signature":["[arr]"],"description-html":"Creates a clone of the given JavaScript array arr
. The result is a new\nJavaScript array, which is a shallow copy, not a deep copy.
Adds a watch function f
to atom a
that will execute when the value of a
\nchanges.
The watch function takes 4 arguments: a key, the atom, its old state, and its\nnew state.
\nkey
should be a keyword and can be used with remove-watch
to remove the\nwatch function.
Evaluates arguments one at a time from left to right. If an argument returns\nlogical false (nil or false), and
returns that value and doesn't evaluate any\nof the other arguments, otherwise it returns the value of the last argument.
(and)
returns true.
Applies function f
to the argument list formed by prepending intervening\narguments to args
.
Creates a JavaScript array containing args
.
The tagged literal #js [1 2 3]
is equivalent to (array 1 2 3)
Returns a new array map (a map implemented with arrays) with the supplied mappings.
\nkeyvals
must be an even number of forms.
Returns true if x
is a JavaScript array, false otherwise.
Binds name
to expr
, evaluates the first form in the lexical context of that\nbinding, then binds name
to that result, repeating for each successive form,\nreturning the result of the last form.
Useful for when you want a threading macro to use different "places" at each\nform.
\n","related":["cljs.core/->","cljs.core/->>","cljs.core/cond->","cljs.core/cond->>","cljs.core/some->","cljs.core/some->>"],"type":"macro"},"cljs.core/assoc":{"full-name":"cljs.core/assoc","signature":["[coll k v]","[coll k v & kvs]"],"description-html":"assoc(iate)
\nWhen applied to a map, returns a new map that contains the mapping of key(s) to\nval(s).
\nHas no effect on the map type (hashed/sorted).
\nWhen applied to a vector, returns a new vector that contains value v
at index\nk
.
Associates a value in a nested associative structure, where ks
is a sequence\nof keys and v
is the new value. Returns a new nested structure.
If any levels do not exist, hash-maps will be created.
\n","related":["cljs.core/assoc","cljs.core/update-in","cljs.core/dissoc-in","cljs.core/get-in"]},"cljs.core/associative?":{"full-name":"cljs.core/associative?","signature":["[coll]"],"description-html":"Returns true if coll
implements the IAssociative
protocol, false otherwise.
Maps and vectors are associative.
\n"},"cljs.core/atom":{"full-name":"cljs.core/atom","signature":["[x]","[x opts]"],"description-html":"Creates and returns an atom with an initial value of x
.
opts
is an optional map with optional keys :meta
and :validator
.
:meta
should be a metadata-map for the atom.
:validator
should be a validator function for the atom. See set-validator!
\nfor more information.
Bitwise "and". Same as x & y
in JavaScript.
Bitwise "and" x
with bitwise "not" y
. Same as x & ~y
in JavaScript.
Clear bit at index n
. Same as x & ~(1 << y)
in JavaScript.
Flip bit at index n
Bitwise complement
\n"},"cljs.core/bit-or":{"full-name":"cljs.core/bit-or","signature":["[x y]"],"description-html":"Bitwise or
\n","related":["cljs.core/bit-and","cljs.core/bit-xor"]},"cljs.core/bit-set":{"full-name":"cljs.core/bit-set","signature":["[x n]"],"description-html":"Set bit at index n
Bitwise shift left
\n","related":["cljs.core/bit-shift-right"]},"cljs.core/bit-shift-right":{"full-name":"cljs.core/bit-shift-right","signature":["[x n]"],"description-html":"Bitwise shift right
\n","related":["cljs.core/bit-shift-left","cljs.core/unsigned-bit-shift-right"]},"cljs.core/bit-test":{"full-name":"cljs.core/bit-test","signature":["[x n]"],"description-html":"Test bit at index n
Bitwise exclusive or
\n","related":["cljs.core/bit-and","cljs.core/bit-or"]},"cljs.core/butlast":{"full-name":"cljs.core/butlast","signature":["[s]"],"description-html":"Returns a sequence of all but the last item in s
.
butlast
runs in linear time.
Takes an expression and a set of clauses. Each clause can take the form of\neither:
\ntest-constant result-expr
(test-constant1 ... test-constantN) result-expr
The test-constants are not evaluated. They must be compile-time literals, and\nneed not be quoted. If the expression is equal to a test-constant, the\ncorresponding result-expr
is returned. A single default expression can follow\nthe clauses, and its value will be returned if no clause matches. If no default\nexpression is provided and no clause matches, an Error is thrown.
Unlike cond
and condp
, case
does a constant-time dispatch, the clauses are\nnot considered sequentially. All manner of constant expressions are acceptable\nin case
, including numbers, strings, symbols, keywords, and ClojureScript\ncomposites thereof. Note that since lists are used to group multiple constants\nthat map to the same expression, a vector can be used to match a list if needed.\nThe test-constants need not be all of the same type.
catch
should be used inside of a try
expression.
exception-type
should be the type of exception thrown (usually js/Error
or\njs/Object
). When there is a match, the thrown exception will be bound to\nname
inside of expr*
and expr*
will be evaluated and returned as the value\nof the try
expression.
Coerce to char
\n"},"cljs.core/clj->js":{"full-name":"cljs.core/clj->js","signature":["[x]"],"description-html":"Recursively transforms ClojureScript values to JavaScript.
\nClojureScript | \n\n | JavaScript | \n\n |
---|---|---|---|
Set | \n#{} | \nArray | \n[] | \n
Vector | \n[] | \nArray | \n[] | \n
List | \n() | \nArray | \n[] | \n
Keyword | \n:foo | \nString | \n"foo" | \n
Symbol | \nbar | \nString | \n"bar" | \n
Map | \n{} | \nObject | \n{} | \n
Returns true if x
is a collection, false otherwise.
Lists, maps, sets, and vectors are collections.
\n","related":["cljs.core/seq?","cljs.core/list?","cljs.core/sequential?"]},"cljs.core/comp":{"full-name":"cljs.core/comp","signature":["[]","[f]","[f g]","[f g h]","[f1 f2 f3 & fs]"],"description-html":"Takes a set of functions (fn
s) and returns a function that is the composition\nof those functions.
The returned function takes a variable number of arguments, applies the\nrightmost of fn
s to the arguments, the next fn
(right-to-left) to the\nresult, etc.
((comp a b c) x y)
=> (a (b (c x y)))
Comparator.
\nReturns a negative number, zero, or a positive number when x
is logically\n"less than", "equal to", or "greater than" y
.
Uses IComparable
if available and google.array.defaultCompare
for objects of\nthe same type. nil is treated as a special case and is always less than any\nother object.
Atomically sets the value of atom a
to newval
if and only if the current\nvalue of the atom is identical to oldval
.
Returns true if set happened, false otherwise.
\n","related":["cljs.core/atom","cljs.core/reset!","cljs.core/swap!"]},"cljs.core/complement":{"full-name":"cljs.core/complement","signature":["[f]"],"description-html":"Takes a function f
and returns a function that takes the same arguments as\nf
, has the same effects, if any, and returns the opposite truth value.
Returns a lazy sequence representing the concatenation of the elements in the\nsupplied collections.
\n","related":["cljs.core/conj","cljs.core/into"]},"cljs.core/cond":{"full-name":"cljs.core/cond","signature":["[& clauses]"],"description-html":"clauses
must be an even number of forms, ie: (cond t1 e1, t2 e2, t3 e3)
.\nEach test t
is evaluated one at a time. If a test returns logical true, cond
\nevaluates and returns the corresponding expression e
and does not evaluate any\nof the other tests or expressions.
It is idiomatic to provide a default case as the last test pair using the\nkeyword :else
(a keyword always evaluates to logical true).
(cond)
returns nil.
Takes an expression and a set of test/form pairs. Threads expr
(via ->
)\nthrough each form for which the corresponding test expression is true.
Note that, unlike cond
branching, cond->
threading does not short circuit\nafter the first true test expression.
Takes an expression and a set of test/form pairs. Threads expr
(via ->>
)\nthrough each form for which the corresponding test expression is true.
Note that, unlike cond
branching, cond->>
threading does not short circuit\nafter the first true test expression.
Takes a binary predicate, an expression, and a set of clauses. There are two\nkinds of clauses:
\nBinary clause: test-expr
result-expr
Ternary clause: test-expr
:>>
result-fn
\n(Note: :>>
is an ordinary keyword)
For each clause, (pred test-expr expr)
is evaluated. If it returns logical\ntrue, the clause is a match.
If a binary clause matches, its result-expr
is returned.
If a ternary clause matches, its result-fn
is called with the result of the\npredicate and returned by condp
. result-fn
should take one argument.
A single default expression can follow the clauses, and its value will be\nreturned if no clause matches.
\nIf no default expression is provided and no clause matches, an Error is thrown.
\n","related":["cljs.core/cond","cljs.core/if"],"type":"macro"},"cljs.core/conj":{"full-name":"cljs.core/conj","signature":["[]","[coll]","[coll x]","[coll x & xs]"],"description-html":"conj(oin)
\nReturns a new collection with the x
s "added" to coll
.
conj
adds items to the end of a vector, the beginning of a list, and into a\nset.
conj
works with maps by merging and also supports vector pairs with two\nelements.
Multiple x
s are added in order, as if called one at a time.
(conj nil item)
returns (item)
.
Returns a new sequence where x
is the first element and coll
is the rest.
Returns a function that takes any number of arguments and always returns x
.
Returns true if k
is present in coll
, otherwise returns false.
Note that for numerically indexed collections like vectors and arrays, this\ntests if the numeric key is within the range of indexes.
\ncontains?
operates in constant or logarithmic time; it will not perform a\nlinear search for a value.
Returns the number of items in x
.
count
works on arrays, lists, maps, sets, strings, and vectors.
(count nil)
returns 0.
Returns true if x
executes count
in constant time, false otherwise.
Lists, maps, sets, strings, and vectors can be counted in constant time.
\n"},"cljs.core/cycle":{"full-name":"cljs.core/cycle","signature":["[coll]"],"description-html":"Returns an infinite lazy sequence of repetitions of the items in coll
.
Returns a number one less than x
.
Uses def
to establish symbols of names
with no bindings.
Useful for making forward declarations.
\n","related":["cljs.core/def"],"type":"macro"},"cljs.core/def":{"full-name":"cljs.core/def","signature":["[symbol]","[symbol init?]","[symbol doc-string? init?]"],"description-html":"Creates a global variable with the name of symbol
and a namespace of the\ncurrent namespace.
If init
is supplied, it is evaluated and the result is assigned to symbol
, otherwise symbol
is nil
.
doc-string
is an optional documentation string.
def
is one of ClojureScript's special forms\nand is used by many macros to define common elements (ie: defn
, defmacro
,\netc).
Defines a function.
\ndoc-string?
is an optional documentation string.
attr-map?
is an optional map of metadata to\nattach to the global variable name.
prepost-map?
is an optional map with optional keys :pre
and :post
that\ncontain collections of pre or post conditions\nfor the function.
Code | \nExpands To |
---|---|
\n(defn foo [a b c]\n (* a b c)) | \n \n(def foo\n (fn [a b c]\n (* a b c))) |
Same as defn
, but adds {:private true}
metadata to the definition.
Note: :private
metadata is not currently enforced by the ClojureScript\ncompiler.
Returns the current value of atom x
.
The @
reader macro is often used instead of deref
. @foo
is the same thing\nas (deref foo)
.
disj(oin). Returns a new set of the same (hashed/sorted) type, that does not\ncontain key(s).
\n","related":["cljs.core/dissoc","cljs.core/disj!","clojure.set/difference"]},"cljs.core/dissoc":{"full-name":"cljs.core/dissoc","signature":["[coll]","[coll k]","[coll k & ks]"],"description-html":"dissoc(iate)
\nReturns a new map that does not contain a mapping for key(s).
\nHas no effect on the map type (hashed/sorted).
\n","related":["cljs.core/assoc","cljs.core/dissoc-in","cljs.core/disj","cljs.core/select-keys"]},"cljs.core/distinct":{"full-name":"cljs.core/distinct","signature":["[coll]"],"description-html":"Returns a lazy sequence of the elements of coll
with duplicates removed.
Returns true if no two of the arguments are =
Forces evaluation of a lazy sequence. Often used to see the effects of a\nsequence produced via functions that have side effects.
\ndoall
walks through the successive next
s of the sequence, returning the head\nand causing the entire sequence to reside in memory at one time.
Forces evaluation of a lazy sequence. Often used to see the effects of a\nsequence produced via functions that have side effects.
\ndorun
walks through the successive next
s of the sequence and returns nil.
Repeatedly executes body
(presumably for side-effects) with bindings and\nfiltering as provided by for
. Does not retain the head of the sequence.
Returns nil.
\n","related":["cljs.core/doall","cljs.core/dorun","cljs.core/for","cljs.core/dotimes"],"type":"macro"},"cljs.core/dotimes":{"full-name":"cljs.core/dotimes","signature":["[[name n] & body]"],"description-html":"Repeatedly executes body
(presumably for side-effects) with name
bound to\nintegers from 0
through n-1
.
Returns a lazy sequence of all but the first n
items in coll
.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/take","cljs.core/drop-last","cljs.core/drop-while","cljs.core/nthnext","cljs.core/nthrest"]},"cljs.core/drop-last":{"full-name":"cljs.core/drop-last","signature":["[s]","[n s]"],"description-html":"Return a lazy sequence of all but the last n
items in s
.
n
defaults to 1.
Returns a lazy sequence of the items in coll
starting from the first item for\nwhich (pred item)
returns logical false.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/take-while","cljs.core/split-with"]},"cljs.core/empty":{"full-name":"cljs.core/empty","signature":["[coll]"],"description-html":"Returns an empty collection of the same category as coll
.
Returns nil if coll
is nil.
Returns true if coll
has no items - same as (not (seq coll))
.
Please use the idiom (seq x)
rather than (not (empty? x))
.
Returns true if n
is an even number.
Throws an exception if n
is not an integer.
Takes a set of predicate functions and returns a function f
that returns true\nif all of its composing predicates return a logical true value against all of\nits arguments, else it returns false.
Note that f
is short-circuiting in that it will stop execution on the first\nargument that triggers a logical false result against the original predicates.
Returns true if (pred x)
is logical true for every x
in coll
, else false.
Returns true if x
is the value false, false otherwise.
Same as (first (first coll))
.
Returns a lazy sequence of the non-nil results of (f item)
. Note, this means\nfalse return values will be included.
f
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/remove","cljs.core/keep"]},"cljs.core/filterv":{"full-name":"cljs.core/filterv","signature":["[pred coll]"],"description-html":"Returns a vector of the items in coll
for which (pred item)
returns true.
pred
must be free of side-effects.
finally
should be the last form inside of a try
expression. It is optional.
finally
clauses are always evaluated for their side effects whether there was\nan error or not, but they are never the return value of a try
expression.
Returns the map entry for key k
, or nil if k
is not found.
Returns the first item in coll
and calls seq
on its argument.
Returns nil when coll
is nil.
Takes any nested combination of sequential things (lists, vectors, etc.) and\nreturns their contents as a single, flat sequence.
\n(flatten nil)
returns nil.
Defines a function.
\nname?
is an optional name of the function to be used inside body
. This is\nuseful for recursive calls. Note that name?
in fn
is not the same as the\nname
argument to defn
, which defines a global symbol for the function.
params*
are the arguments to the function and a binding form for the symbols\nthat the arguments will take inside the body of the function. Functions can have\narity of 0-20 and there is no runtime enforcement of arity when calling a\nfunction (just like in JavaScript).
prepost-map?
is an optional map with optional keys :pre
and :post
that\ncontain collections of pre or post conditions\nfor the function.
body
is a series of expressions that execute when the function is called. The\narguments to the function are mapped to symbols in params*
and are available\nin body
. The value of the last expression in body
is the return value of\ncalling the function.
Returns true if f
is a function, false otherwise.
Same as (first (next coll))
Takes a function f
, and returns a function that calls f
, replacing a nil\nfirst argument to f
with the supplied value x
. Higher arity versions can\nreplace 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)\nbeing nil-patched.
List comprehension.
\nTakes a vector of one or more binding-form/collection-expr pairs, each followed\nby zero or more modifiers, and yields a lazy sequence of evaluations of expr.
\nCollections are iterated in a nested fashion, rightmost fastest, and nested\ncoll-exprs can refer to bindings created in prior binding-forms. Supported\nmodifiers are: :let [binding-form expr ...]
, :while test
, :when test
.
Returns a map from distinct items in coll
to the number of times they appear.
(frequencies [:a :a :b])
=> {:a 2, :b 1}
Returns the value mapped to key k
.
Returns not-found
or nil if k
is not present in o
.
Returns the value in a nested associative structure, where ks
is a sequence of\nkeys.
Returns nil if the key is not found, or not-found
if supplied.
Returns the validator function for atom a
.
Returns a map of the elements of coll
keyed by the result of running f
on\neach element.
The value at each key will be a vector of the corresponding elements in the\norder they appeared in coll
.
Returns a new hash map with supplied mappings.
\nkeyvals
must be an even number of forms.
Returns a new hash set with supplied keys
.
Any equal keys are handled as if by repeated uses of conj
.
Returns true if x
and y
are the same object, false otherwise.
Returns its argument.
\n","related":["cljs.core/nil?"]},"cljs.core/if":{"full-name":"cljs.core/if","signature":["[test then else?]"],"description-html":"If test
is not false or nil, then
is evaluated and returned. Otherwise,\nelse?
is evaluated and returned. else?
defaults to nil if not provided.
if
is one of ClojureScript's special forms\nand is a fundamental building block of the language. All other conditionals in\nClojureScript are based on if
s notion of truthiness (ie: anything other than\nfalse or nil).
When test
is logical true, evaluates then
with the value of test
bound to\nx
. Otherwise, evaluates else
with no bindings.
else
defaults to nil.
If test
is false or nil, evaluates and returns then
. Otherwise, evaluates\nand returns else
. else
defaults to nil if not provided.
If test
is not nil, evaluates then
with x
bound to the value of test
. If\nnot, yields else
.
Returns true if f
implements the IFn
protocol, false otherwise.
Functions, keywords, map, sets, and vectors can be called as functions.
\n","related":["cljs.core/fn?"]},"cljs.core/inc":{"full-name":"cljs.core/inc","signature":["[x]"],"description-html":"Returns a number one greater than x
.
Returns true if o
is an instance of type t
, false otherwise.
Coerces x
to an integer by stripping decimal places.
Returns true if n
is an integer, false otherwise.
Returns a lazy seq of the first item in each collection, then the second items,\nthen the third, etc.
\n","related":["cljs.core/interpose","cljs.core/zipmap"]},"cljs.core/interpose":{"full-name":"cljs.core/interpose","signature":["[sep coll]"],"description-html":"Returns a lazy seq of the elements of coll
separated by sep
.
Returns a new collection consisting of to
with all of the items of from
\n"added" using conj
.
A transducer may be supplied as xform
.
Returns a new JavaScript array from the elements of aseq
.
Returns a lazy sequence of x
, (f x)
, (f (f x))
etc.
f
must be free of side-effects.
Recursively transforms JavaScript arrays into ClojureScript vectors, and\nJavaScript objects into ClojureScript maps.
\nPass options :keywordize-keys true
to recursively convert object property\nnames from strings to keywords.
(js->clj js-data :keywordize-keys true)
Note that js->clj
is not optimized for speed and the transit.cljs library is\nrecommended when parsing large amounts of JSON data.
Deletes property key
in JavaScript object obj
.
Uses the JavaScript delete
operator.
Returns a new JavaScript object using the supplied mappings.
\nkeyvals
must be an even number of forms.
Takes a set of functions and returns a function that is the juxtaposition of\nthose functions.
\nThe returned function takes a variable number of arguments, and returns a vector\ncontaining the result of applying each function to the arguments (left-to-\nright).
\n((juxt a b c) x)
=> [(a x) (b x) (c x)]
Returns a lazy sequence of the non-nil results of (f item)
. Note, this means\nfalse return values will be included.
f
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/keep-indexed","cljs.core/map","cljs.core/filter"]},"cljs.core/keep-indexed":{"full-name":"cljs.core/keep-indexed","signature":["[f]","[f coll]"],"description-html":"Returns a lazy sequence of the non-nil results of (f index item)
. Note, this\nmeans false return values will be included.
`f must be free of side-effects.
\nReturns a stateful transducer when no collection is provided.
\n","related":["cljs.core/map-indexed","cljs.core/keep"]},"cljs.core/key":{"full-name":"cljs.core/key","signature":["[map-entry]"],"description-html":"Returns the key of the map entry.
\n","related":["cljs.core/keys"]},"cljs.core/keys":{"full-name":"cljs.core/keys","signature":["[hash-map]"],"description-html":"Returns a sequence of the keys in hash-map
.
Returns the last item in coll
in linear time.
peek
is much faster than last
for a vector.
Expands to code which yields a lazy sequence of the concatenation of the\nsupplied collections. Each collections expression is not evaluated until it is\nneeded.
\nCode | \nExpands To |
---|---|
(lazy-cat x y z) \n | \n(concat (lazy-seq x)\n (lazy-seq y)\n (lazy-seq z)) |
Returns a new lazy sequence.
\n","related":["cljs.core/lazy-cat","cljs.core/realized?","cljs.core/doall","cljs.core/iterate"]},"cljs.core/let":{"full-name":"cljs.core/let","signature":["[bindings & body]"],"description-html":"Binds expressions to symbols and makes those symbols available only within\nbody
.
bindings
should be a vector with an even number of forms, ie: [a1 b1, a2 b2,\na3 b3]
. The first item in a pair (the a
s) should be a symbol that is assigned\nthe evaluation of the second item (the b
s). These symbols (the a
s) are then\navailable within body
(and not outside of body
).
Another way to think about this is that the binding symbols in let
are like\nlocal def
s that are only available within let
's scope.
In addition to direct symbol binding, let
supports a destructuring syntax to\n"break apart" collections into multiple symbols. This destructuring syntax is\nlike it's own mini-language and allows for succinct code.
let
is one of ClojureScript's special forms and is a fundamental building\nblock of the language. Many macros rely on let
s binding syntax and scope\nrules.
Takes a vector of function definitions fnspecs
and binds the functions to\ntheir names. All of the names are available in all of the definitions of the\nfunctions as well as body
.
fnspecs
must be a vector with an even number of forms. See let
.
letfn
is one of ClojureScript's special forms.
Creates a new list containing items
.
Creates a new list containing the items prepended to the rest, the last of which\nwill be treated as a sequence.
\n","related":["cljs.core/list"]},"cljs.core/list?":{"full-name":"cljs.core/list?","signature":["[x]"],"description-html":"Returns true if x
is a list, false otherwise.
Creates an empty JavaScript array of size size
.
Returns a lazy sequence of applying function f
to every element of coll
.
When more than one collection is provided, returns a lazy sequence consisting of\nthe result of applying f
to the set of first items of each c
, followed by\napplying f
to the set of second items in each c
, until any one of the c
s\nis exhausted. Any remaining items in other c
s are ignored. Function f
should\naccept number-of-c
s arguments.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/map-indexed","cljs.core/pmap","cljs.core/amap","cljs.core/mapcat","cljs.core/keep","cljs.core/juxt"]},"cljs.core/map-indexed":{"full-name":"cljs.core/map-indexed","signature":["[f coll]"],"description-html":"Returns a lazy sequence consisting of the result of applying f
to 0 and the\nfirst item of coll
, followed by applying f
to 1 and the second item in\ncoll
, etc, until coll
is exhausted.
Function f
should accept 2 arguments, index and item.
Returns true if x
is a map, false otherwise.
Returns the result of applying concat
to the result of applying map
to f
\nand colls
.
Function f
should return a collection.
Returns a transducer when no collections are provided.
\n","related":["cljs.core/map","cljs.core/concat"]},"cljs.core/mapv":{"full-name":"cljs.core/mapv","signature":["[f coll]","[f c1 c2]","[f c1 c2 c3]","[f c1 c2 c3 & colls]"],"description-html":"Returns a vector consisting of the result of applying f
to the set of first\nitems of each coll, followed by applying f
to the set of second items in each\ncoll, until any one of the colls is exhausted. Any remaining items in other\ncolls are ignored.
Function f
should accept number-of-colls arguments.
Returns the greatest number argument.
\n","related":["cljs.core/min","cljs.core/max-key"]},"cljs.core/max-key":{"full-name":"cljs.core/max-key","signature":["[k x]","[k x y]","[k x y & more]"],"description-html":"Returns the x
for which (k x)
is greatest.
(k x)
should return a number.
Returns a memoized version of a referentially transparent function.
\nA memoized version of a function keeps a cache of the mappings from arguments to\nresults in memory. When calls with the same arguments are repeated often, a\nmemoized function has higher performance at the expense of higher memory usage.
\n"},"cljs.core/merge":{"full-name":"cljs.core/merge","signature":["[& maps]"],"description-html":"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 rightmost map will\n"win".
\n","related":["cljs.core/merge-with","cljs.core/hash-map"]},"cljs.core/merge-with":{"full-name":"cljs.core/merge-with","signature":["[f & maps]"],"description-html":"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-\nright) will be combined with the mapping in the result by calling (f val-in-\nresult val-in-latter)
.
Returns the least number argument.
\n","related":["cljs.core/max","cljs.core/min-key"]},"cljs.core/min-key":{"full-name":"cljs.core/min-key","signature":["[k x]","[k x y]","[k x y & more]"],"description-html":"Returns the x
for which (k x)
is least.
(k x)
should return a number.
Returns the modulus of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Truncates toward negative infinity.
\n","related":["cljs.core/rem"]},"cljs.core/name":{"full-name":"cljs.core/name","signature":["[x]"],"description-html":"Returns a string value of a keyword, string, or symbol.
\n(name :foo)
=> "foo"
(name "foo")
=> "foo"
(name 'foo)
=> "foo"
Returns true if n
is less than 0, false otherwise.
Returns a sequence of the items after the first and calls seq
on its argument.
Returns nil if coll
is empty.
Same as (next (first coll))
.
Returns true if x
is nil, false otherwise.
Same as (next (next coll))
.
Returns true if x
is logical false, false otherwise.
Returns false if (pred x)
is logical true for any x
in coll
, else true.
Returns nil if coll
is empty, else returns coll
.
Returns false if (pred x)
is logical true for every x
in coll
, else true.
Returns the opposite of =
.
Same as (not (= x y))
Sets the namespace of the file.
\nns
must be the first form in a .cljs
file and there can only be one ns
\ndeclaration per file. Namespaces must match the file name of their respective\n.cljs
files, with the exception that dashes in namespaces become underscores\nin filenames. Thus, (ns foo.bar-biz.baz)
should be the first form in file\nfoo/bar_biz/baz.cljs
.
references
can be zero or more forms used to import other namespaces, symbols,\nand libraries into the current namespace.
Returns the value at index n
or not-found
if the index is out of bounds.
nth
will throw an exception if n
is out of bounds and not-found
is not\nsupplied.
nth
works for Strings, Arrays, Regex Matchers, Lists, and Sequences. For\nSequences, nth
takes O(n) time.
Returns the n
th next
of coll
.
Returns (seq coll)
when n
is 0.
Returns the nth
rest of coll
.
Returns coll
when n
is 0.
Returns true if n
is a number, false otherwise.
Returns true if x
is a JavaScript object, false otherwise.
Returns true if n
is an odd number.
Throws an exception if n
is not an integer.
Evaluates arguments one at a time from left to right. If an argument returns\nlogical true, or
returns that value and doesn't evaluate any of the other\narguments, otherwise it returns the value of the last argument.
(or)
returns nil.
Takes a function f
and fewer than the normal arguments to f
. Returns a\nfunction that takes a variable number of additional arguments. When called, the\nreturned function calls f
with the original arguments plus the additional\narguments.
((partial f a b) c d)
=> (f a b c d)
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, its elements will be used as necessary to\ncomplete the last partition up to n
items.
Returns a partition with less than n
items if there are not enough padding\nelements.
Returns a lazy sequence of lists like partition
, but may include partitions\nwith fewer than n
items at the end.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/partition","cljs.core/partition-by"]},"cljs.core/partition-by":{"full-name":"cljs.core/partition-by","signature":["[f]","[f coll]"],"description-html":"Applies f
to each value in coll
, splitting it each time f
returns a new\nvalue. Returns a lazy sequence of partitions.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/partition","cljs.core/partition-all","cljs.core/group-by"]},"cljs.core/peek":{"full-name":"cljs.core/peek","signature":["[coll]"],"description-html":"Returns the first element of a list; same as first
.
Returns the last element of a vector, and much more efficient than using last
.
Returns nil if coll
is empty.
For a list, returns a new list without the first item.
\nFor a vector, returns a new vector without the last item.
\n","related":["cljs.core/peek","cljs.core/rest","cljs.core/conj"]},"cljs.core/pos?":{"full-name":"cljs.core/pos?","signature":["[n]"],"description-html":"Returns true if n
is greater than 0, false otherwise.
Returns the quotient of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Returns a random floating point number between 0 inclusive and n
exclusive.
n
defaults to 1.
Returns a random integer between 0 inclusive and n
exclusive.
Returns a random element from a sequential collection coll
.
Has the same performance characteristics as nth
.
Returns a lazy sequence of nums from start
(inclusive) to end
(exclusive),\nby step
, where start
defaults to 0, step
to 1, and end
to infinity.
Returns the first regex match, if any, of s
to re
, using re.exec(s)
.
Returns a vector, containing first the matching substring, then any capturing\ngroups if the regular expression contains capturing groups.
\n"},"cljs.core/re-matches":{"full-name":"cljs.core/re-matches","signature":["[re s]"],"description-html":"Returns the result of (re-find re s)
if re
fully matches s
.
Returns an instance of RegExp which has compiled the provided string.
\n"},"cljs.core/re-seq":{"full-name":"cljs.core/re-seq","signature":["[re s]"],"description-html":"Returns a lazy sequence of successive matches of regex re
in string s
.
Returns true if a value has been produced for a lazy sequence.
\n","related":["cljs.core/lazy-seq"]},"cljs.core/reduce":{"full-name":"cljs.core/reduce","signature":["[f coll]","[f val coll]"],"description-html":"f
should be a function of 2 arguments. If val
is not supplied, returns the\nresult of applying f
to the first 2 items in coll
, then applying f
to that\nresult and the 3rd item, etc.
If coll
contains no items, f
must accept no arguments as well, and reduce
\nreturns 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\nitem 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.
Reduces an associative collection.
\nf
should be a function of 3 arguments. Returns the result of applying f
to\ninit
, the first key and the first value in coll
, then applying f
to that\nresult 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\nordinals.
Returns a lazy sequence of the intermediate values of the reduction (as per\nreduce
) of coll
by f
, starting with init
.
Returns the remainder of dividing numerator n
by denominator d
.
Returns NaN
when d
is 0 (divide by 0 error).
Returns a lazy sequence of the items in coll
for which (pred item)
returns\nfalse.
pred
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/filter"]},"cljs.core/remove-watch":{"full-name":"cljs.core/remove-watch","signature":["[a key]"],"description-html":"Removes a watch function identified by key
from atom a
. The function must\nhave originally been set by add-watch
.
Returns a lazy sequence of x
s.
The length of the sequence is infinite, or n
if provided.
Takes a function f
of no args, presumably with side effects, and returns an\ninfinite (or length n
if supplied) lazy sequence of calls to it.
Given a map of replacement pairs smap
and a vector/collection coll
, returns\na vector/seq with any elements =
to a key in smap
replaced with the\ncorresponding val in smap
.
Returns a transducer when coll
is not provided.
Sets the value of atom a
to new-value
without regard for the current value.
Returns new-value
.
Returns a possibly empty sequence of the items after the first item.
\nCalls seq
on its argument.
Returns a sequence of the items in coll
in reverse order. Not lazy.
Returns true if coll
implements the IReversible
protocol, false otherwise.
Vectors, sorted maps, and sorted sets implement IReversible
.
Returns a sequence of the items in coll
in reverse order in constant time.
Returns nil if coll
is empty.
coll
must be a vector or a sorted-map.
sc
must be a sorted collection.
test
, start-test
, end-test
must be <
, <=
, >
or >=
.
Returns a reverse sequence of those entries with keys ek
for which\n(test (.. sc comparator (compare ek key)) 0)
is true.
Returns the second item in coll
.
Same as (first (next coll))
Returns a map containing only those entries in map
whose key is in keys
.
Returns a sequence on the collection. If the collection is empty, returns nil.
\n(seq nil)
returns nil.
seq
also works on strings.
Returns true if x
is a sequence, false otherwise.
All collections can be converted into a sequence using seq
.
Returns true if coll
implements the ISequential
protocol, false otherwise.
Lists and vectors are sequential.
\n","related":["cljs.core/seq?","cljs.core/coll?"]},"cljs.core/set":{"full-name":"cljs.core/set","signature":["[coll]"],"description-html":"Returns a set of the distinct elements of coll
.
Sets js-var
to val
using the JavaScript =
operator.
Sets a validator function for atom a
.
fn
must be nil or a side-effect-free function of one argument, which will be\npassed the intended new state on any state change. fn
should return false or\nthrow an Error if the new state is unacceptable.
If the current value of a
is unacceptable to fn
when set-validator!
is\ncalled, an Error will be thrown and the validator will not be set.
(set-validator! my-atom nil)
will remove the validator from my-atom
.
Returns true if x
is a set, false otherwise.
Returns a random permutation of coll
.
Returns the first logical true value of (pred x)
for any x
in coll
, else\nnil.
A common idiom is to use a set as pred, for example this will return :fred
if\n:fred
is in the sequence, otherwise nil: (some #{:fred} coll)
When expr
is not nil, threads it into the first form (via ->
), and when that\nresult is not nil, through the next, etc.
When expr
is not nil, threads it into the first form (via ->>
), and when\nthat result is not nil, through the next, etc.
Takes a set of predicate functions and returns a function f
that returns the\nfirst logical true value returned by one of its composing predicates against any\nof its arguments, else it returns logical false.
Note that f
is short-circuiting in that it will stop execution on the first\nargument that triggers a logical true result against the original predicates.
Returns true if x
is not nil, false otherwise.
Returns a sorted sequence of the items in coll
.
comp
can be a boolean-valued comparison funcion, or a -/0/+ valued comparator.
comp
defaults to compare
.
Returns a sorted sequence of the items in coll
, where the sort order is\ndetermined by comparing (keyfn item)
.
comp
can be boolean-valued comparison function, or a -/0/+ valued comparator.
comp
defaults to compare
.
Returns a new sorted map with supplied mappings.
\nkeyvals
must be an even number of forms.
Returns a new sorted map with supplied mappings, using the supplied comparator\nfunction.
\nkeyvals
must be an even number of forms.
Returns a new sorted set with supplied keys
.
Returns a new sorted set with supplied keys
, using the supplied comparator
.
Returns true if coll
implements the ISorted
protocol, false otherwise.
Sorted maps and sorted sets implement ISorted
.
Returns a vector of [(take n coll) (drop n coll)]
.
Returns a vector of [(take-while pred coll) (drop-while pred coll)]
(str)
and (str nil)
return the empty string.
(str x)
returns x.toString()
.
With more than one argument, returns the concatenation of the str
values of\nthe arguments.
Returns true if x
is a string, false otherwise.
Returns the substring of s
beginning at start
inclusive, and ending at end
\nexclusive.
end
defaults to the length of the string.
sc
must be a sorted collection.
test
, start-test
, end-test
must be <
, <=
, >
or >=
.
Returns a sequence of those entries with keys ek
for which\n(test (.. sc comparator (compare ek key)) 0)
is true.
Returns a persistent vector of the items in v
from start
inclusive to end
\nexclusive.
If end
is not supplied, defaults to (count v)
.
This operation is O(1) and very fast, as the resulting vector shares structure\nwith the original and no trimming is done.
\n","related":["cljs.core/vector","cljs.core/vector?"]},"cljs.core/swap!":{"full-name":"cljs.core/swap!","signature":["[a f]","[a f x]","[a f x y]","[a f x y & more]"],"description-html":"Atomically swaps the value of atom to be: (apply f current-value-of-atom\nargs)
Note that f
may be called multiple times, and thus should be free of side\neffects.
Returns the value that was swapped in.
\n","related":["cljs.core/atom","cljs.core/reset!"]},"cljs.core/take":{"full-name":"cljs.core/take","signature":["[n]","[n coll]"],"description-html":"Returns a lazy sequence of the first n
items in coll
. Returns all the items\nif there are fewer than n
.
Returns a stateful transducer when no collection is provided.
\n","related":["cljs.core/drop","cljs.core/take-while","cljs.core/take-last","cljs.core/take-nth"]},"cljs.core/take-last":{"full-name":"cljs.core/take-last","signature":["[n coll]"],"description-html":"Returns a sequence of the last n
items in coll
.
Depending on the type of collection, take-last
may be no faster than linear\ntime. For vectors, please use subvec
.
Returns a lazy seq of every n
th item in coll
.
Returns a stateful transducer when no collection is provided.
\n"},"cljs.core/take-while":{"full-name":"cljs.core/take-while","signature":["[pred]","[pred coll]"],"description-html":"Returns a lazy sequence of successive items from coll
while (pred item)
\nreturns true. pred
must be free of side-effects.
Returns a transducer when no collection is provided.
\n","related":["cljs.core/drop-while","cljs.core/split-with"]},"cljs.core/throw":{"full-name":"cljs.core/throw","signature":["[expr]"],"description-html":"expr
is evaluated and thrown, hopefully to be caught by a try
expression.
(throw (js/Error. "Oops!"))
Returns a (potentially-ragged) 2-dimensional JavaScript array containing the\ncontents of coll
.
Returns a lazy sequence of the nodes in a tree, via a depth-first walk.
\nbranch?
must be a function of one argument that returns true if passed a node\nthat can have children (but may not).
children
must be a function of one argument that returns a sequence of the\nchildren. children
will only be called on nodes for which branch?
returns\ntrue.
root
is the root node of the tree.
Returns true if x
is the value true, false otherwise.
The expressions (expr*
) are evaluated and, if no exceptions occur, the value\nof the last is returned.
If an exception occurs and catch clauses (catch-clause*
) are provided, each is\nexamined in turn and the first for which the thrown exception is an instance of\nthe named class is considered a matching catch clause. If there is a matching\ncatch clause, its expressions are evaluated in a context in which name is bound\nto the thrown exception, and the value of the last is the return value of the\nfunction.
If there is no matching catch clause, the exception propagates out of the\nfunction. Before returning, normally or abnormally, any finally-clause?
\nexpressions will be evaluated for their side effects.
try
is one of ClojureScript's special forms.
Bitwise shift right with zero fill
\n","related":["cljs.core/bit-shift-right"]},"cljs.core/update-in":{"full-name":"cljs.core/update-in","signature":["[m [k & ks] f]","[m [k & ks] f a]","[m [k & ks] f a b]","[m [k & ks] f a b c]","[m [k & ks] f a b c & args]"],"description-html":""Updates" a value in a nested associative structure, where ks
is a sequence of\nkeys and f
is a function that will take the old value and any supplied\narguments and return the new value. Returns a new nested structure.
If any levels do not exist, hash-maps will be created.
\n","related":["cljs.core/assoc-in","cljs.core/get-in"]},"cljs.core/val":{"full-name":"cljs.core/val","signature":["[map-entry]"],"description-html":"Returns the value in the map entry.
\n","related":["cljs.core/vals"]},"cljs.core/vals":{"full-name":"cljs.core/vals","signature":["[hash-map]"],"description-html":"Returns a sequence of the values in hash-map
.
Creates a new vector containing the contents of coll
Creates a new vector containing args
.
Returns true if x
is a vector, false otherwise.
Evaluates test
. If logical true, evaluates body
in an implicit do
.
when
is often used instead of if
for conditions that do not have an "else".
With bindings
as x
, xs
, roughly the same as (when (seq xs) (let [x (first\nxs)] body))
but xs
is evaluated only once.
When test
is logical true, evaluates body
with the value of test
bound to\nx
.
Evaluates test
. If logical false, evaluates body
in an implicit do
.
When test
is not nil, evaluates body
with x
bound to the value of test
.
Repeatedly executes body
while test
expression is true. Presumes some\nside-effect will cause test
to become false or nil.
Returns nil.
\n","related":["cljs.core/loop"],"type":"macro"},"cljs.core/zero?":{"full-name":"cljs.core/zero?","signature":["[n]"],"description-html":"Returns true if n
is 0, false otherwise.
Returns a map with keys
mapped to corresponding vals
.
user=> (zipmap [:a :b :c :d] [1 2 3 4])\n{:a 1, :b 2, :c 3, :d 4}","related":["cljs.core/interleave"]},"clojure.set/difference":{"full-name":"clojure.set/difference","signature":["[s1]","[s1 s2]","[s1 s2 & sets]"],"description-html":"
Return a set that is the first set without elements of the remaining sets.
\n","related":["clojure.set/union","clojure.set/intersection","clojure.set/superset?","clojure.set/project"]},"clojure.set/intersection":{"full-name":"clojure.set/intersection","signature":["[s1]","[s1 s2]","[s1 s2 & sets]"],"description-html":"Return a set that is the intersection of the input sets.
\n","related":["clojure.set/union","clojure.set/difference","clojure.set/superset?","clojure.set/project"]},"clojure.set/select":{"full-name":"clojure.set/select","signature":["[pred xset]"],"description-html":"Returns a set of the elements for which pred
is true.
Returns true if a
is a subset of b
, false otherwise.
In other words, returns true if all the elements of a
can be found in b
.
Returns true if a
is a superset of b
, false otherwise.
In other words, returns true if a
contains all the elements of b
.
Return a set that is the union of the input sets.
\n","related":["clojure.set/intersection","clojure.set/difference","clojure.set/superset?"]},"clojure.string/blank?":{"full-name":"clojure.string/blank?","signature":["[s]"],"description-html":"True if s
is nil, empty, or contains only whitespace.
Converts first character of the string to upper-case, all other characters to\nlower-case.
\n"},"clojure.string/escape":{"full-name":"clojure.string/escape","signature":["[s cmap]"],"description-html":"Return a new string, using cmap
to escape each character ch
from s
as follows:
If (cmap ch)
is nil, append ch to the new string.
If (cmap ch)
is non-nil, append (str (cmap ch))
instead.
Returns a string of all elements in coll
, as returned by (seq coll)
,\nseparated by an optional separator.
Converts string to all lower-case.
\n"},"clojure.string/replace":{"full-name":"clojure.string/replace","signature":["[s match replacement]"],"description-html":"Replaces all instance of match
with replacement
in s
.
The options for match / replacement are:
\nmatch | \nreplacement | \n
---|---|
string | \nstring | \n
regex | \nstring | \n
regex | \nfunction | \n
Replaces the first instance of match
with replacement
in s
.
The options for match / replacement are:
\nmatch | \nreplacement | \n
---|---|
string | \nstring | \n
regex | \nstring | \n
regex | \nfunction | \n
Returns s
with its characters reversed.
Splits string on a regular expression. Optional argument limit is the maximum\nnumber of splits. Not lazy. Returns vector of the splits.
\n","related":["cljs.core/subs","clojure.string/replace","clojure.string/split-lines"]},"clojure.string/split-lines":{"full-name":"clojure.string/split-lines","signature":["[s]"],"description-html":"Splits s
on \\n
or \\r\\n
.
Removes whitespace from both ends of string.
\n"},"clojure.string/trim-newline":{"full-name":"clojure.string/trim-newline","signature":["[s]"],"description-html":"Removes all trailing newline \\n
or return \\r
characters from string.
Similar to Perl's chomp.
\n"},"clojure.string/triml":{"full-name":"clojure.string/triml","signature":["[s]"],"description-html":"Removes whitespace from the left side of string.
\n"},"clojure.string/trimr":{"full-name":"clojure.string/trimr","signature":["[s]"],"description-html":"Removes whitespace from the right side of string.
\n"},"clojure.string/upper-case":{"full-name":"clojure.string/upper-case","signature":["[s]"],"description-html":"Converts string to all upper-case.
\n"}} \ No newline at end of file