If no ys are supplied, returns the negation of x, else subtracts
the ys from x and returns the result. Does not auto-promote
ints, will overflow. See also: -'
second item in the first form, making a list of it if it is not a
list already. If there are more forms, inserts the first form as the
second item in second form, etc.
- source
+ source
@@ -1511,7 +1511,7 @@
->>
last item in the first form, making a list of it if it is not a
list already. If there are more forms, inserts the first form as the
last item in second form, etc.
- source
+ source
@@ -1524,7 +1524,7 @@
/
If no denominators are supplied, returns 1/numerator,
else returns numerator divided by all of the denominators.
numbers and collections in a type-independent manner. Immutable data
structures define = as a value, not an identity,
comparison.
- source
+ sourceshow types
@@ -1590,7 +1590,7 @@
==
Returns non-nil if nums all have the equivalent
value (type-independent), otherwise false
Throws an exception if val is nil.
Blocks if ch is full (no buffer space is available).
Returns true unless ch is already closed.
- source
+ sourceshow types
@@ -1629,7 +1629,7 @@
>=
Returns non-nil if nums are in monotonically non-increasing order,
otherwise false.
namespace. Arguments are two symbols: the alias to be used, and
the symbolic name of the target namespace. Use :as in the ns macro in preference
to calling this directly.
- source
+ sourceshow types
returns logical false (nil or false), and returns that value and
doesn't evaluate any of the other expressions, otherwise it returns
the value of the last expr. (and) returns true.
- source
+ source
Binds name to expr, evaluates the first form in the lexical context
of that binding, then binds name to that result, repeating for each
successive form, returning the result of the last form.
same (hashed/sorted) type, that contains the mapping of key(s) to
val(s). When applied to a vector, returns a new vector that
contains val at index. Note - index must be <= (count vector).
- source
+ source
@@ -1766,7 +1766,7 @@
assoc-in
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.
re-establishes the bindings that existed before. The new bindings
are made in parallel (unlike let); all init-exprs are evaluated
before the vars are bound to their new values.
- source
+ source
@@ -1849,7 +1849,7 @@
bit-and
(bit-and x y & more)^Int (bit-and ^Int x ^Int y & more)
Returns true if all of the vars provided as arguments have any bound value.
Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided.
default expression can follow the clauses, and its value will be
returned if no clause matches. If no default expression is provided
and no clause matches, an exception is thrown.
- source
+ source
@@ -2047,7 +2047,7 @@
cast
(cast t x)(cast ^Type t x)
Throws an error if x is not of a type t, else returns x.
Logically closing happens after all puts have been delivered. Therefore, any
blocked puts will remain blocked until a taker releases them.
- source
+ sourceshow types
of those fns. The returned fn takes a variable number of args,
applies the rightmost of fns to the args, the next
fn (right-to-left) to the result, etc.
- source
+ sourceshow types
@@ -2165,7 +2165,7 @@
compare
when x is logically 'less than', 'equal to', or 'greater than'
y. Works for nil, and compares numbers and collections in a type-independent manner. x
must implement Comparable
- source
+ sourceshow types
@@ -2176,7 +2176,7 @@
complement
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.
time. If a test returns logical true, cond evaluates and returns
the value of the corresponding expr and doesn't evaluate any of the
other tests or exprs. (cond) returns nil.
- source
+ source
@@ -2215,7 +2215,7 @@
cond->
through each form for which the corresponding test
expression is true. Note that, unlike cond branching, cond-> threading does
not short circuit after the first true test expression.
- source
+ source
@@ -2228,7 +2228,7 @@
cond->>
through each form for which the corresponding test expression
is true. Note that, unlike cond branching, cond->> threading does not short circuit
after the first true test expression.
- source
+ source
@@ -2255,7 +2255,7 @@
condp
and its value will be returned if no clause matches. If no default
expression is provided and no clause matches, an
exception is thrown.
- source
+ source
@@ -2268,7 +2268,7 @@
conj
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.
vectors, this tests if the numeric key is within the
range of indexes. 'contains?' operates constant or logarithmic time;
it will not perform a linear search for a value. See also 'some'.
- source
+ sourceshow types
@@ -2314,7 +2314,7 @@
count
Returns the number of items in the collection. (count nil) returns
0. Also works on strings
Multimethods expect the value of the hierarchy option to be supplied as
a reference type e.g. a var (i.e. via the Var-quote dispatch macro #'
or the var special form).
- source
+ source
@@ -2456,7 +2456,7 @@
defn
name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
to the var metadata. prepost-map defines a map with optional keys
:pre and :post that contain collections of pre or post conditions.
- source
+ source
invoke the body only the first time it is forced (with force or deref/@), and
will cache the result and return it on all subsequent force
calls. See also - realized?
- source
+ source
Also reader macro: @var/@atom/@delay. When applied to a var or atom,
returns its current state. When applied to a delay, forces
it if not already forced.
be used to force any effects. Walks through the successive nexts of
the seq, retains the head and returns it, thus causing the entire
seq to reside in memory at one time.
- source
+ sourceshow types
@@ -2601,7 +2601,7 @@
dorun
element in the seq do not occur until the seq is consumed. dorun can
be used to force any effects. Walks through the successive nexts of
the seq, does not retain the head and returns nil.
- source
+ sourceshow types
@@ -2613,7 +2613,7 @@
doseq
Repeatedly executes body (presumably for side-effects) with
bindings and filtering as provided by "for". Does not retain
the head of the sequence. Returns nil.
Repeatedly executes body (presumably for side-effects) with name
bound to integers from 0 through n-1.
- source
+ source
@@ -2638,7 +2638,7 @@
doto
Evaluates x then calls all of the methods and functions with the
value of x supplied at the front of the given arguments. The forms
are evaluated in order. Returns x.
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.
- source
+ sourceshow types
@@ -2758,7 +2758,7 @@
every?
Returns true if (pred x) is logical true for every x in coll, else
false.
Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat sequence.
(flatten nil) returns an empty sequence.
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.
- source
+ sourceshow types
@@ -3000,7 +3000,7 @@
for
:while test, :when test.
(take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))
- source
+ source
@@ -3010,7 +3010,7 @@
force
(force x)
If x is a Delay, returns the (possibly cached) value of its expression, else returns x
Returns a new symbol with a unique name. If a prefix string is
supplied, the name is prefix# where # is some unique number. If
prefix is not supplied, the prefix is 'G__'.
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.
So using goroutines only makes sense if you do I/O (specifically, calling the above functions)
inside them. Also, note that a goroutine may never have a chance to run if the root goroutine
(or another goroutine) doesn't do any I/O or channel operations (<! or >!).
- source
+ source
@@ -3113,7 +3113,7 @@
group-by
Returns a map of the elements of coll keyed by the result of
f on each element. The value at each key will be a vector of the
corresponding elements, in the order they appeared in coll.
ns (which can be a symbol or a namespace), setting its root binding
to val if supplied. The namespace must exist. The var will adopt any
metadata from the name symbol. Returns the var.
- source
+ sourceshow types
@@ -3337,7 +3337,7 @@
interpose
Returns a lazy seq of the elements of coll separated by sep.
Returns a stateful transducer when no collection is provided.
returns a vector containing the result of applying each fn to the
args (left-to-right).
((juxt a b c) x) => [(a x) (b x) (c x)]
- source
+ sourceshow types
@@ -3397,7 +3397,7 @@
keep
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 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.
a Seqable object that will invoke the body only the first time seq
is called, and will cache the result and return it on all subsequent
seq calls. See also - realized?
- source
+ source
@@ -3502,7 +3502,7 @@
let
Evaluates the exprs in a lexical context in which the symbols in
the binding-forms are bound to their respective init-exprs or parts
therein.
- source
+ source
@@ -3516,7 +3516,7 @@
letfn
Takes a vector of function specs and a body, and generates a set of
bindings of functions to their names. All of the names are available
in all of the definitions of the functions, as well as the body.
- source
+ source
@@ -3527,7 +3527,7 @@
line-seq
Returns the lines of text from rdr as a lazy sequence of strings.
rdr must be File or BufferedReader.
Evaluates the exprs in a lexical context in which the symbols in
the binding-forms are bound to their respective init-exprs or parts
therein. Acts as a recur target.
Repeatedly calls macroexpand-1 on form until it no longer
represents a macro form, then returns it. Note neither
macroexpand-1 nor macroexpand expand macros in subforms.
of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments.
- source
+ sourceshow types
@@ -3668,7 +3668,7 @@
map-indexed
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.
- source
+ sourceshow types
of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments.
- source
+ sourceshow types
@@ -3718,7 +3718,7 @@
max
(max x y & more)^Number (max ^Number x ^Number y & more)
memoized version of the function keeps a cache of the mapping from arguments
to results and, when calls with the same arguments are repeated often, has
higher performance at the expense of higher memory use.
- source
+ sourceshow types
@@ -3755,7 +3755,7 @@
merge
Returns a map that consists of the rest of the maps conj-ed onto
the first. If a key occurs in more than one map, the mapping from
the latter (left-to-right) will be the mapping in the result.
the first. If a key occurs in more than one map, the mapping(s)
from the latter (left-to-right) will be combined with the mapping in
the result by calling (f val-in-result val-in-latter).
- source
+ sourceshow types
@@ -3778,7 +3778,7 @@
meta
(meta obj)
Returns the metadata of obj, returns nil if there is no metadata.
namespace (unless found in the environment), else nil. Note that
if the symbol is fully qualified, the var/Type to which it resolves
need not be present in the namespace.
- source
+ sourceshow types
@@ -4091,7 +4091,7 @@
ns-sources
value is the URL of the resource. Only http:// and https:// are
currently supported; everything else is treated as a local
pathname. HTTP URLs are cached in $HOME/.jokerd/deps/.
- source
+ sourceshow types
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, in O(n) time, for strings and sequences.
returns a logical true value, or returns that value and doesn't
evaluate any of the other expressions, otherwise it returns the
value of the last expression. (or) returns nil.
- source
+ source
@@ -4215,7 +4215,7 @@
partial
Takes a function f and fewer than the normal arguments to f, and
returns a fn that takes a variable number of additional args. When
called, the returned function calls f with args + additional args.
do not overlap. If a pad collection is supplied, use its elements as
necessary to complete last partition upto n items. In case there are
not enough padding elements, return a partition with less than n items.
- source
+ sourceshow types
@@ -4243,7 +4243,7 @@
partition-all
Returns a lazy sequence of lists like partition, but may include
partitions with fewer than n items at the end.
item, for a vector, returns a new vector without the last item. If
the collection is empty, throws an exception. Note - not the same
as next/butlast.
- source
+ sourceshow types
@@ -4288,7 +4288,7 @@
pos-int?
(pos-int? x)^Boolean (pos-int? x)
Return true if x is a positive fixed precision integer
of *out*. Prints the object(s), separated by spaces if there is
more than one. By default, pr and prn print in a way that objects
can be read by the reader
- source
+ source
(exclusive), by step, where start defaults to 0, step to 1, and end to
infinity. When step is equal to 0, returns an infinite sequence of
start. When start is equal to end, returns empty list.
- source
+ sourceshow types
result of applying f to val and the first item in coll, then
applying f to that result and the 2nd item, etc. If coll contains no
items, returns val and f is not called.
- source
+ sourceshow types
@@ -4699,7 +4699,7 @@
reduce-kv
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.
- source
+ sourceshow types
@@ -4711,7 +4711,7 @@
reductions
Returns a lazy seq of the intermediate values of the reduction (as
per reduce) of coll by f, starting with init.
select a subset, via inclusion or exclusion, or to provide a mapping
to a symbol different from the var's name, in order to prevent
clashes. Use :use in the ns macro in preference to calling this directly.
- source
+ sourceshow types
Given a map of replacement pairs and a vector/collection, returns a
vector/seq with any elements = a key in smap replaced with the
corresponding val in smap.
Opens file f and reads all its contents, returning a string.
f can be a string (filename) or a reader object like *in* or
the one returned by joker.os/open.
else nil. One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)
- source
+ sourceshow types
@@ -5177,7 +5177,7 @@
some->
When expr is not nil, threads it into the first form (via ->),
and when that result is not nil, through the next etc.
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.
- source
+ sourceshow types
Returns a sorted sequence of the items in coll, where the sort
order is determined by comparing (keyfn item). If no comparator is
supplied, uses compare.
With no args, returns the empty string. With one arg x, returns
string representation of x. (str nil) returns the empty string. With more than
one arg, returns the concatenation of the str values of the args.
defaults to (count vector). This operation is O(1) and very fast, as
the resulting vector shares structure with the original and no
trimming is done.
- source
+ sourceshow types
@@ -5343,7 +5343,7 @@
swap!
Atomically swaps the value of atom to be:
(apply f current-value-of-atom args).
Returns the value that was swapped in.
(apply f current-value-of-atom args). Note that f may be called
multiple times, and thus should be free of side effects.
Returns [old new], the value of the atom before and after the swap.
- source
+ sourceshow types
@@ -5367,7 +5367,7 @@
symbol
(symbol ns name)^Symbol (symbol ns name)
Returns a Symbol with the given namespace and name.
returns that non-fn value. Note that if you want to return a fn as a
final value, you must wrap it in some data structure and unpack it
after trampoline returns.
- source
+ sourceshow types
@@ -5485,7 +5485,7 @@
tree-seq
arg that returns a sequence of the children. Will only be called on
nodes for which branch? returns true. Root is the root node of the
tree.
- source
+ sourceshow types
@@ -5495,7 +5495,7 @@
true?
(true? x)
Returns true if x is the value true, false otherwise.
key and f is a function that will take the old value
and any supplied args and return the new value, and returns a new
structure. If the key does not exist, nil is passed as the old value.
- source
+ sourceshow types
@@ -5546,7 +5546,7 @@
update-in
and any supplied args and return the new value, and returns a new
nested structure. If any levels do not exist, hash-maps will be
created.
- source
+ sourceshow types
@@ -5562,7 +5562,7 @@
use
'use accepts additional options in libspecs: :exclude, :only, :rename.
The arguments and semantics for :exclude, :only, and :rename are the same
as those documented for joker.core/refer.
- source
+ sourceshow types
Takes a map of Var/value pairs. Sets the vars to the corresponding values.
Then executes body. Resets the vars back to the original
values after body was evaluated. Returns the value of body.
Takes a map of Var/value pairs. Sets the vars to the corresponding values.
Then calls f with the supplied arguments. Resets the vars back to the original
values after f returned. Returns whatever f returns.
- Constants are variables with :const true in their metadata. Joker currently does not recognize them as
- special; as such, it allows redefining them or their values.
+ Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.