cljs.core
*command-line-args*
A sequence of the supplied command line arguments, or nil if
none were supplied
*flush-on-newline*
When set to true, output will be flushed whenever a newline is printed.
Defaults to true.
*main-cli-fn*
When compiled for a command-line target, whatever function
*main-cli-fn* is set to will be called with the command-line
argv as arguments
*ns*
Var bound to the current namespace. Only used for bootstrapping.
*print-dup*
When set to logical true, objects will be printed in a way that preserves
their type when read in later.
Defaults to false.
*print-err-fn*
Each runtime environment provides a different way to print error output.
Whatever function *print-err-fn* is bound to will be passed any
Strings which should be printed.
*print-fn*
Each runtime environment provides a different way to print output.
Whatever function *print-fn* is bound to will be passed any
Strings which should be printed.
*print-fn-bodies*
*print-fns-bodies* controls whether functions print their source or
only their names.
*print-length*
*print-length* controls how many items of each collection the
printer will print. If it is bound to logical false, there is no
limit. Otherwise, it must be bound to an integer indicating the maximum
number of items of each collection to print. If a collection contains
more items, the printer will print items up to the limit followed by
'...' to represent the remaining items. The root binding is nil
indicating no limit.
*print-level*
*print-level* controls how many levels deep the printer will
print nested objects. If it is bound to logical false, there is no
limit. Otherwise, it must be bound to an integer indicating the maximum
level to print. Each argument to print is at level 0; if an argument is a
collection, its items are at level 1; and so on. If an object is a
collection and is at a level greater than or equal to the value bound to
*print-level*, the printer prints '#' to represent it. The root binding
is nil indicating no limit.
*print-meta*
If set to logical true, when printing an object, its metadata will also
be printed in a form that can be read back by the reader.
Defaults to false.
*print-namespace-maps*
*print-namespace-maps* controls whether the printer will print
namespace map literal syntax.
Defaults to false, but the REPL binds it to true.
*print-newline*
When set to logical false will drop newlines from printing calls.
This is to work around the implicit newlines emitted by standard JavaScript
console objects.
*print-readably*
When set to logical false, strings and characters will be printed with
non-alphanumeric characters converted to the appropriate escape sequences.
Defaults to true
(-add-watch this key f)
Adds a watcher function f to this. Keys must be unique per reference,
and can be used to remove the watch with -remove-watch.
(-assoc coll k v)
Returns a new collection of coll with a mapping from key k to
value v added to it.
(-compare x y)
Returns a negative number, zero, or a positive number when x is logically
'less than', 'equal to', or 'greater than' y.
(-conj coll o)
Returns a new collection of coll with o added to it. The new item
should be added to the most efficient place, e.g.
(conj [1 2 3 4] 5) => [1 2 3 4 5]
(conj '(2 3 4 5) 1) => '(1 2 3 4 5)
(-count coll)
Calculates the count of coll in constant time. Used by cljs.core/count.
(-dissoc coll k)
Part of the IMap protocol
Returns a new collection of coll without the mapping for key k.
(-empty coll)
Returns an empty collection of the same category as coll. Used
by cljs.core/empty.
(-find coll k)
Part of the IFind protocol
Returns the map entry for key, or nil if key not present.
(-first coll)
Part of the ISeq protocol
Returns the first item in the collection coll. Used by cljs.core/first.
(-kv-reduce coll f init)
Reduces an associative collection and returns the result. f should be
a function that takes three arguments.
(-next coll)
Part of the INext protocol
Returns a new collection of coll without the first item. In contrast to
rest, it should return nil if there are no more items, e.g.
(next []) => nil
(next nil) => nil
(-peek coll)
Returns the item from the top of the stack. Is used by cljs.core/peek.
(-pop coll)
Returns a new stack without the item on top of the stack. Is used
by cljs.core/pop.
(-realized? x)
Returns true if a value for x has been produced, false otherwise.
(-reduce coll f)
(-reduce coll f start)
f should be a function of 2 arguments. If start is not supplied,
returns the result of applying f to the first 2 items in coll, then
applying f to that result and the 3rd item, etc.
(-rest coll)
Part of the ISeq protocol
Returns a new collection of coll without the first item. It should
always return a seq, e.g.
(rest []) => ()
(rest nil) => ()
(-rseq coll)
Returns a seq of the items in coll in reversed order.
(-seq o)
Returns a seq of o, or nil if o is empty.
(-sorted-seq-from coll k ascending?)
Returns a sorted seq from coll in either ascending or descending order.
If ascending is true, the result should contain all items which are > or >=
than k. If ascending is false, the result should contain all items which
are < or <= than k, e.g.
(-sorted-seq-from (sorted-set 1 2 3 4 5) 3 true) => (3 4 5)
(-sorted-seq-from (sorted-set 1 2 3 4 5) 3 false) => (3 2 1)
(-vreset! o new-value)
Sets the value of volatile o to new-value without regard for the
current value. Returns new-value.
(/ x)
(/ x y)
(/ x y & more)
If no denominators are supplied, returns 1/numerator,
else returns numerator divided by all of the denominators.
(= x)
(= x y)
(= x y & more)
Equality. Returns true if x equals y, false if not. Compares
numbers and collections in a type-independent manner. Clojure's immutable data
structures define -equiv (and thus =) as a value, not an identity,
comparison.
ASeq
Marker protocol indicating an array sequence.
IAssociative
Protocol for adding associativity to collections.
IAtom
Marker protocol indicating an atom.
IChunk
Protocol for accessing the items of a chunk.
IChunkedNext
Protocol for accessing the chunks of a collection.
IChunkedSeq
Protocol for accessing a collection as sequential chunks.
ICounted
Protocol for adding the ability to count a collection in constant time.
IDeref
Protocol for adding dereference functionality to a reference.
IEquiv
Protocol for adding value comparison functionality to a type.
IFind
Protocol for implementing entry finding in collections.
IFn
Protocol for adding the ability to invoke an object as a function.
For example, a vector can also be used to look up a value:
([1 2 3 4] 1) => 2
IHash
Protocol for adding hashing functionality to a type.
IIndexed
Protocol for collections to provide indexed-based access to their items.
IIterable
Protocol for iterating over a collection.
IKVReduce
Protocol for associative types that can reduce themselves
via a function of key and val. Called by cljs.core/reduce-kv.
IList
Marker interface indicating a persistent list
ILookup
Protocol for looking up a value in a data structure.
IMap
Protocol for adding mapping functionality to collections.
IMeta
Protocol for accessing the metadata of an object.
INamed
Protocol for adding a name.
INext
Protocol for accessing the next items of a collection.
IPending
Protocol for types which can have a deferred realization. Currently only
implemented by Delay and LazySeq.
IPrintWithWriter
The old IPrintable protocol's implementation consisted of building a giant
list of strings to concatenate. This involved lots of concat calls,
intermediate vectors, and lazy-seqs, and was very slow in some older JS
engines. IPrintWithWriter implements printing via the IWriter protocol, so it
be implemented efficiently in terms of e.g. a StringBuffer append.
IRecord
Marker interface indicating a record object
IReduce
Protocol for seq types that can reduce themselves.
Called by cljs.core/reduce.
IReset
Protocol for adding resetting functionality.
ISeq
Protocol for collections to provide access to their items as sequences.
ISeqable
Protocol for adding the ability to a type to be transformed into a sequence.
ISequential
Marker interface indicating a persistent collection of sequential items
ISet
Protocol for adding set functionality to a collection.
ISorted
Protocol for a collection which can represent their items
in a sorted manner.
IStack
Protocol for collections to provide access to their items as stacks. The top
of the stack should be accessed in the most efficient way for the different
data structures.
ISwap
Protocol for adding swapping functionality.
ITransientMap
Protocol for adding mapping functionality to transient collections.
ITransientSet
Protocol for adding set functionality to a transient collection.
ITransientVector
Protocol for adding vector functionality to transient collections.
IVector
Protocol for adding vector functionality to collections.
IVolatile
Protocol for adding volatile functionality.
IWatchable
Protocol for types that can be watched. Currently only implemented by Atom.
IWithMeta
Protocol for adding metadata to an object.
IWriter
Protocol for writing. Currently only implemented by StringBufferWriter.
(aclone arr)
Returns a javascript array, cloned from the passed in array
(alength array)
Returns the length of the array. Works on arrays of all types.
(any? x)
Returns true if given any argument.
(array? x)
Returns true if x is a JavaScript array.
(assoc coll k v)
(assoc coll k v & kvs)
assoc[iate]. When applied to a map, returns a new map of the
same (hashed/sorted) type, that contains the mapping of key(s) to
val(s). When applied to a vector, returns a new vector that
contains val at index.
(assoc-in m [k & ks] v)
Associates a value in a nested associative structure, where ks is a
sequence of keys and v is the new value and returns a new nested structure.
If any levels do not exist, hash-maps will be created.
(atom x)
(atom x & {:keys [meta validator]})
Creates and returns an Atom with an initial value of x and zero or
more options (in any order):
:meta metadata-map
:validator validate-fn
If metadata-map is supplied, it will be come the metadata on the
atom. validate-fn must be nil or a side-effect-free fn of one
argument, which will be passed the intended new state on any state
change. If the new state is unacceptable, the validate-fn should
return false or throw an Error. If either of these error conditions
occur, then the value of the atom will not change.
(bounded-count n coll)
If coll is counted? returns its count, else will count at most the first n
elements of coll using its seq
(char? x)
Returns true if x is a JavaScript string of length one.
(clone value)
Clone the supplied value which must implement ICloneable.
(coll? x)
Returns true if x satisfies ICollection
(compare x y)
Comparator. Returns a negative number, zero, or a positive number
when x is logically 'less than', 'equal to', or 'greater than'
y. Uses IComparable if available and google.array.defaultCompare for objects
of the same type and special-cases nil to be less than any other object.
(compare-and-set! a oldval newval)
Atomically sets the value of atom to newval if and only if the
current value of the atom is equal to oldval. Returns true if
set happened, else false.
(complement f)
Takes a fn f and returns a fn that takes the same arguments as f,
has the same effects, if any, and returns the opposite truth value.
(completing f)
(completing f cf)
Takes a reducing function f of 2 args and returns a fn suitable for
transduce by adding an arity-1 signature that calls cf (default -
identity) on the result argument.
(conj)
(conj coll)
(conj coll x)
(conj coll x & xs)
conj[oin]. Returns a new collection with the xs
'added'. (conj nil item) returns (item). The 'addition' may
happen at different 'places' depending on the concrete type.
Example
Add a name to a vector
(conj ["Alice" "Bob"] "Charlie")
Add a key-val pair to a hash map
(conj {:name "Alice"} [:age 30])
(cons x coll)
Returns a new seq where x is the first element and coll is the rest.
(constantly x)
Returns a function that takes any number of arguments and returns x.
(contains? coll v)
Returns true if key is present in the given collection, otherwise
returns false. Note that for numerically indexed collections like
vectors and arrays, this tests if the numeric key is within the
range of indexes. 'contains?' operates constant or logarithmic time;
it will not perform a linear search for a value. See also 'some'.
(count coll)
Returns the number of items in the collection. (count nil) returns
0. Also works on strings, arrays, and Maps
(counted? x)
Returns true if coll implements count in constant time
(cycle coll)
Returns a lazy (infinite!) sequence of repetitions of the items in coll.
(dec x)
Returns a number one less than num.
(deref o)
Also reader macro: @var/@atom/@delay. Returns the
most-recently-committed value of ref. When applied to a var
or atom, returns its current state. When applied to a delay, forces
it if not already forced. See also - realized?.
(double? x)
Returns true for JavaScript numbers, false otherwise.
(drop n)
(drop n coll)
Returns a lazy sequence of all but the first n items in coll.
Returns a stateful transducer when no collection is provided.
(drop-while pred)
(drop-while pred coll)
Returns a lazy sequence of the items in coll starting from the
first item for which (pred item) returns logical false. Returns a
stateful transducer when no collection is provided.
Example
(do
["Remove all non-vowel characters up to the first vowel"]
(drop-while (complement #{\a \e \i \o \u}) "clojure"))
(empty coll)
Returns an empty collection of the same category as coll, or nil
(empty? coll)
Returns true if coll has no items - same as (not (seq coll)).
Please use the idiom (seq x) rather than (not (empty? x))
(equiv-map x y)
Test map equivalence. Returns true if x equals y, otherwise returns false.
(even? n)
Returns true if n is even, throws an exception if n is not an integer
(every-pred p)
(every-pred p1 p2)
(every-pred p1 p2 p3)
(every-pred p1 p2 p3 & ps)
Takes a set of predicates and returns a function f that returns true if all of its
composing predicates return a logical true value against all of its arguments, else it returns
false. Note that f is short-circuiting in that it will stop execution on the first
argument that triggers a logical false result against the original predicates.
(every? pred coll)
Returns true if (pred x) is logical true for every x in coll, else
false.
(false? x)
Returns true if x is the value false, false otherwise.
(filter pred)
(filter pred coll)
Returns a lazy sequence of the items in coll for which
(pred item) returns true. pred must be free of side-effects.
Returns a transducer when no collection is provided.
Example
(do
["Exclude languages with single character names"]
(filter
(fn* [p1__18668#] (> (count p1__18668#) 1))
["Java" "Lisp" "Fortran" "C" "D" "C++"]))
(filterv pred coll)
Returns a vector of the items in coll for which
(pred item) returns true. pred must be free of side-effects.
(find coll k)
Returns the map entry for key, or nil if key not present.
(first coll)
Returns the first item in the collection. Calls seq on its
argument. If coll is nil, returns nil.
(flatten x)
Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat sequence.
(flatten nil) returns nil.
(float? x)
Returns true for JavaScript numbers, false otherwise.
(fn? f)
Return true if f is a JavaScript function or satisfies the Fn protocol.
(fnil f x)
(fnil f x y)
(fnil f x y z)
Takes a function f, and returns a function that calls f, replacing
a nil first argument to f with the supplied value x. Higher arity
versions can replace arguments in the second and third
positions (y, z). Note that the function f can take any number of
arguments, not just the one(s) being nil-patched.
(get-in m ks)
(get-in m ks not-found)
Returns the value in a nested associative structure,
where ks is a sequence of keys. Returns nil if the key is not present,
or the not-found value if supplied.
(hash o)
Returns the hash code of its argument. Note this is the hash code
consistent with =.
(hash-ordered-coll coll)
Returns the hash code, consistent with =, for an external ordered
collection implementing Iterable.
See http://clojure.org/data_structures#hash for full algorithms.
(hash-unordered-coll coll)
Returns the hash code, consistent with =, for an external unordered
collection implementing Iterable. For maps, the iterator should
return map entries whose hash is computed as
(hash-ordered-coll [k v]).
See http://clojure.org/data_structures#hash for full algorithms.
(ifn? f)
Returns true if f returns true for fn? or satisfies IFn.
(inc x)
Returns a number one greater than num.
(indexed? x)
Returns true if coll implements nth in constant time
(inst-ms inst)
Return the number of milliseconds since January 1, 1970, 00:00:00 GMT
(instance? c x)
Evaluates x and tests if it is an instance of the type
c. Returns true or false
(int x)
Coerce to int by stripping decimal places.
(int? x)
Return true if x satisfies integer? or is an instance of goog.math.Integer
or goog.math.Long.
(integer? n)
Returns true if n is a JavaScript number with no decimal part.
(iterate f x)
Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects
(js-invoke obj s & args)
Invoke JavaScript object method via string. Needed when the
string is not a valid unquoted property name.
(js-mod n d)
Modulus of num and div with original javascript behavior. i.e. bug for negative numbers
(keep f)
(keep f coll)
Returns a lazy sequence of the non-nil results of (f item). Note,
this means false return values will be included. f must be free of
side-effects. Returns a transducer when no collection is provided.
(keep-indexed f)
(keep-indexed f coll)
Returns a lazy sequence of the non-nil results of (f index item). Note,
this means false return values will be included. f must be free of
side-effects. Returns a stateful transducer when no collection is
provided.
(last s)
Return the last item in coll, in linear time
(long x)
Coerce to long by stripping decimal places. Identical to `int'.
(make-array size)
(make-array type size)
(make-array type size & more-sizes)
Construct a JavaScript array of the specified dimensions. Accepts ignored
type argument for compatibility with Clojure. Note that there is no efficient
way to allocate multi-dimensional arrays in JavaScript; as such, this function
will run in polynomial time when called with 3 or more arguments.
(map f)
(map f coll)
(map f c1 c2)
(map f c1 c2 c3)
(map f c1 c2 c3 & colls)
Returns a lazy sequence consisting of the result of applying f to
the set of first items of each coll, followed by applying f to the
set of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments. Returns a transducer when
no collection is provided.
(map-indexed f)
(map-indexed f coll)
Returns a lazy sequence consisting of the result of applying f to 0
and the first item of coll, followed by applying f to 1 and the second
item in coll, etc, until coll is exhausted. Thus function f should
accept 2 arguments, index and item. Returns a stateful transducer when
no collection is provided.
(mapcat f)
(mapcat f & colls)
Returns the result of applying concat to the result of applying map
to f and colls. Thus function f should return a collection. Returns
a transducer when no collections are provided
(mapv f coll)
(mapv f c1 c2)
(mapv f c1 c2 c3)
(mapv f c1 c2 c3 & colls)
Returns a vector consisting of the result of applying f to the
set of first items of each coll, followed by applying f to the set
of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments.
merge-with
Example
(do
["Combine all map values that have the same key"]
(merge-with
concat
{:rubble ["Barney"], :flintstone ["Fred"]}
{:rubble ["Betty"], :flintstone ["Wilma"]}
{:rubble ["Bam-Bam"], :flintstone ["Pebbles"]}))
(meta o)
Returns the metadata of obj, returns nil if there is no metadata.
(mix-collection-hash hash-basis count)
Mix final collection hash for ordered or unordered collections.
hash-basis is the combined collection hash, count is the number
of elements included in the basis. Note this is the hash code
consistent with =, different from .hashCode.
See http://clojure.org/data_structures#hash for full algorithms.
(mod n d)
Modulus of num and div. Truncates toward negative infinity.
(namespace x)
Returns the namespace String of a symbol or keyword, or nil if not present.
(nat-int? x)
Return true if x satisfies int? and is a natural integer value.
(neg-int? x)
Return true if x satisfies int? and is negative.
(neg? x)
Returns true if num is less than zero, else false
(next coll)
Returns a seq of the items after the first. Calls seq on its
argument. If there are no more items, returns nil
(nil? x)
Returns true if x is nil, false otherwise.
(not x)
Returns true if x is logical false, false otherwise.
(nth coll n)
(nth coll n not-found)
Returns the value at the index. get returns nil if index out of
bounds, nth throws an exception unless not-found is supplied. nth
also works for strings, arrays, regex Matchers and Lists, and,
in O(n) time, for sequences.
(odd? n)
Returns true if n is odd, throws an exception if n is not an integer
(partition n coll)
(partition n step coll)
(partition n step pad coll)
Returns a lazy sequence of lists of n items each, at offsets step
apart. If step is not supplied, defaults to n, i.e. the partitions
do not overlap. If a pad collection is supplied, use its elements as
necessary to complete last partition up to n items. In case there are
not enough padding elements, return a partition with less than n items.
(peek coll)
For a list or queue, same as first, for a vector, same as, but much
more efficient than, last. If the collection is empty, returns nil.
(persistent! tcoll)
Returns a new, persistent version of the transient collection, in
constant time. The transient collection cannot be used after this
call, any such use will throw an exception.
(pop coll)
For a list or queue, returns a new list/queue without the first
item, for a vector, returns a new vector without the last item.
Note - not the same as next/butlast.
(pop! tcoll)
Removes the last item from a transient vector. If
the collection is empty, throws an exception. Returns tcoll
(pos-int? x)
Return true if x satisfies int? and is positive.
(pos? x)
Returns true if num is greater than zero, else false
(pr-str* obj)
Support so that collections can implement toString without
loading all the printing machinery.
(quot n d)
quot[ient] of dividing numerator by denominator.
(reduce f coll)
(reduce f val coll)
f should be a function of 2 arguments. If val is not supplied,
returns the result of applying f to the first 2 items in coll, then
applying f to that result and the 3rd item, etc. If coll contains no
items, f must accept no arguments as well, and reduce returns the
result of calling f with no arguments. If coll has only 1 item, it
is returned and f is not called. If val is supplied, returns the
result of applying f to val and the first item in coll, then
applying f to that result and the 2nd item, etc. If coll contains no
items, returns val and f is not called.
(reduce-kv f init coll)
Reduces an associative collection. f should be a function of 3
arguments. Returns the result of applying f to init, the first key
and the first value in coll, then applying f to that result and the
2nd key and value, etc. If coll contains no entries, returns init
and f is not called. Note that reduce-kv is supported on vectors,
where the keys will be the ordinals.
(reduced x)
Wraps x in a way such that a reduce will terminate with the value x
(reduced? r)
Returns true if x is the result of a call to reduced
(rem n d)
remainder of dividing numerator by denominator.
(remove pred)
(remove pred coll)
Returns a lazy sequence of the items in coll for which
(pred item) returns false. pred must be free of side-effects.
Returns a transducer when no collection is provided.
(repeatedly f)
(repeatedly n f)
Takes a function of no args, presumably with side effects, and
returns an infinite (or length n if supplied) lazy sequence of calls
to it
(replicate n x)
DEPRECATED: Use 'repeat' instead.
Returns a lazy seq of n xs.
(reset! a new-value)
Sets the value of atom to newval without regard for the
current value. Returns new-value.
(reset-vals! a new-value)
Sets the value of atom to newval. Returns [old new], the value of the
atom before and after the reset.
(rest coll)
Returns a possibly empty seq of the items after the first. Calls seq on its
argument.
(reverse coll)
Returns a seq of the items in coll in reverse order. Not lazy.
(rseq rev)
Returns, in constant time, a seq of the items in rev (which
can be a vector or sorted-map), in reverse order. If rev is empty returns nil
(seq coll)
Returns a seq on the collection. If the collection is
empty, returns nil. (seq nil) returns nil. seq also works on
Strings.
(seqable? s)
Return true if the seq function is supported for s
(sequence coll)
(sequence xform coll)
(sequence xform coll & colls)
Coerces coll to a (possibly empty) sequence, if it is not already
one. Will not force a lazy seq. (sequence nil) yields (), When a
transducer is supplied, returns a lazy sequence of applications of
the transform to the items in coll(s), i.e. to the set of first
items of each coll, followed by the set of second
items in each coll, until any one of the colls is exhausted. Any
remaining items in other colls are ignored. The transform should accept
number-of-colls arguments
(set-validator! iref val)
Sets the validator-fn for an atom. validator-fn must be nil or a
side-effect-free fn of one argument, which will be passed the intended
new state on any state change. If the new state is unacceptable, the
validator-fn should return false or throw an Error. If the current state
is not acceptable to the new validator, an Error will be thrown and the
validator will not be changed.
(set? x)
Returns true if x satisfies ISet
(some pred coll)
Returns the first logical true value of (pred x) for any x in coll,
else nil. One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)
(some-fn p)
(some-fn p1 p2)
(some-fn p1 p2 p3)
(some-fn p1 p2 p3 & ps)
Takes a set of predicates and returns a function f that returns the first logical true value
returned by one of its composing predicates against any of its arguments, else it returns
logical false. Note that f is short-circuiting in that it will stop execution on the first
argument that triggers a logical true result against the original predicates.
(some? x)
Returns true if x is not nil, false otherwise.
(sort coll)
(sort comp coll)
Returns a sorted sequence of the items in coll. Comp can be
boolean-valued comparison function, or a -/0/+ valued comparator.
Comp defaults to compare.
(sort-by keyfn coll)
(sort-by keyfn comp coll)
Returns a sorted sequence of the items in coll, where the sort
order is determined by comparing (keyfn item). Comp can be
boolean-valued comparison funcion, or a -/0/+ valued comparator.
Comp defaults to compare.
Example
Sort using a specific keyword
(sort-by
:year
<
[{:name "Lisp", :year 1959}
{:name "Fortran", :year 1957}
{:name "Smalltalk", :year 1972}])
Sort numbers lexicographically
(sort-by str [5 18 83 23 40])
(subvec v start)
(subvec v start end)
Returns a persistent vector of the items in vector from
start (inclusive) to end (exclusive). If end is not supplied,
defaults to (count vector). This operation is O(1) and very fast, as
the resulting vector shares structure with the original and no
trimming is done.
(system-time)
Returns highest resolution time offered by host in milliseconds.
(take n)
(take n coll)
Returns a lazy sequence of the first n items in coll, or all items if
there are fewer than n. Returns a stateful transducer when
no collection is provided.
(take-last n coll)
Returns a seq of the last n items in coll. Depending on the type
of coll may be no better than linear time. For vectors, see also subvec.
take-while
Example
(do
["Get all the negative numbers up to the first non-negative"]
(take-while neg? [-2 -1 0 -1 -2 3]))
(to-array-2d coll)
Returns a (potentially-ragged) 2-dimensional array
containing the contents of coll.
(transduce xform f coll)
(transduce xform f init coll)
reduce with a transformation of f (xf). If init is not
supplied, (f) will be called to produce it. f should be a reducing
step function that accepts both 1 and 2 arguments, if it accepts
only 2 you can add the arity-1 with 'completing'. Returns the result
of applying (the transformed) xf to init and the first item in coll,
then applying xf to that result and the 2nd item, etc. If coll
contains no items, returns init and f is not called. Note that
certain transforms may inject or skip items.
(transient coll)
Returns a new, transient version of the collection, in constant time.
(tree-seq branch? children root)
Returns a lazy sequence of the nodes in a tree, via a depth-first walk.
branch? must be a fn of one arg that returns true if passed a node
that can have children (but may not). children must be a fn of one
arg that returns a sequence of the children. Will only be called on
nodes for which branch? returns true. Root is the root node of the
tree.
(true? x)
Returns true if x is the value true, false otherwise.
(undefined? x)
Returns true if x identical to the JavaScript undefined value.
(var? v)
Returns true if v is of type cljs.core.Var
(vec coll)
Creates a new vector containing the contents of coll. JavaScript arrays
will be aliased and should not be modified.
(volatile! val)
Creates and returns a Volatile with an initial value of val.
(vreset! vol newval)
Sets the value of volatile to newval without regard for the
current value. Returns newval.
(with-meta o meta)
Returns an object of the same type and value as obj, with
map m as its metadata.
(zero? x)
Returns true if num is zero, else false