This namespace contains various standard sequences, as well as utilities for working with strict and lazy sequences.
This namespace contains various standard sequences, as well as utilities for working with strict and lazy sequences.
(powers n)
(powers n x)
Returns an infinite sequence of x * n^i
, starting with i == 0
. x
defaults
to 1.
Returns an infinite sequence of `x * n^i`, starting with `i == 0`. `x` defaults to 1.
(pprint n xs)
Realizes, simplifies and pretty-prints n
elements from the supplied sequence
xs
.
Realizes, simplifies and pretty-prints `n` elements from the supplied sequence `xs`.
(separatev pred coll)
Returns a pair of vectors:
pred must be free of side-effects.
Returns a pair of vectors: - the first contains the items in coll for which (pred item) returns true - the second contains the items for which (pred item) returns false pred must be free of side-effects.
(seq-limit xs)
(seq-limit xs
{:keys [minterms maxterms tolerance convergence-fn]
:or {minterms 2
tolerance v/sqrt-machine-epsilon
convergence-fn (close-enuf? tolerance)}})
Accepts a sequence, iterates through it and returns a dictionary of this form:
{:converged? <boolean> :terms-checked <int> :result <sequence element>}
:converged?
is true if the sequence reached convergence by passing the tests
described below, false otherwise.
:terms-checked
will be equal to the number of items examined in the
sequence.
:result
holds the final item examined in the sequence.
:convergence-fn
user-supplied function of two successive elements in xs
that stops iteration and signals convergence if it returns true.
:minterms
seq-limit
won't return until at least this many terms from the
sequence have been processed.
:maxterms
seq-limit
will return (with :converged? false
) after
processing this many elements without passing any other checks.
:tolerance
A combination of relative and absolute tolerance. defaults to
sqrt(machine epsilon)
.
Accepts a sequence, iterates through it and returns a dictionary of this form: {:converged? <boolean> :terms-checked <int> :result <sequence element>} `:converged?` is true if the sequence reached convergence by passing the tests described below, false otherwise. `:terms-checked` will be equal to the number of items examined in the sequence. `:result` holds the final item examined in the sequence. ## Optional keyword args: `:convergence-fn` user-supplied function of two successive elements in `xs` that stops iteration and signals convergence if it returns true. `:minterms` `seq-limit` won't return until at least this many terms from the sequence have been processed. `:maxterms` `seq-limit` will return (with `:converged? false`) after processing this many elements without passing any other checks. `:tolerance` A combination of relative and absolute tolerance. defaults to `sqrt(machine epsilon)`.
(seq-print n xs)
Realizes, simplifies and prints n
elements from the supplied sequence xs
.
Realizes, simplifies and prints `n` elements from the supplied sequence `xs`.
(vector:generate n f)
Generates a new vector of length n
by applying the function f
to integers
in the range $[0,n)$.
Generates a new vector of length `n` by applying the function `f` to integers in the range $[0,n)$.
(zeno n)
(zeno n x)
Returns an infinite sequence of x / n^i
, starting with i == 0
. x
defaults
to 1.
Returns an infinite sequence of `x / n^i`, starting with `i == 0`. `x` defaults to 1.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close