parkour.reducers documentation

arg0

(arg0 x)(arg0 x y)(arg0 x y z)(arg0 x y z & more)
Accepts any number of arguments and returns the first.

arg1

(arg1 x y)(arg1 x y z)(arg1 x y z & more)
Accepts any number of arguments and returns the second.

concat

(concat & colls)
Reducers version of `concat`.

count

(count coll)
Like `count`, but implemented in terms of `fold`.

distinct

(distinct coll)
Remove adjacent duplicate values from `coll`.

distinct-by

(distinct-by f coll)
Remove adjacent duplicate values of `(f x)` for each `x` in `coll`.

ffilter

(ffilter pred coll)
Returns the first item in `coll` for which `(pred item)` is true.

first

(first coll)
Like `first`, but implemented in terms of `reduce`.

funcall

(funcall f)(funcall f x)(funcall f x y)(funcall f x y z)(funcall f x y z & more)
Call function `f` with additional arguments.

group-by+

(group-by+ f g coll)
Return a map of the values of applying `f` to each item in `coll` to vectors
of the associated results of applying `g` to each item in coll.

keep

Like `keep`, but implemented in terms of `reduce`

map-indexed

(map-indexed f coll)
Reducers version of `map-indexed`.

mjuxt

(mjuxt & fs)
Return a function which calls each function in `fs` on the
position-corresponding values in each argument sequence and returns a
vector of the results.

mpartial

(mpartial f)(mpartial f x)(mpartial f x y)(mpartial f x y & more)
Return a function which applies `f` to its first argument,
followed by `x`, `y`, etc., followed by any additional arguments.

nth0

(nth0 coll)
Like `first`, but more efficient for indexed collections.

nth1

(nth1 coll)
Like `second`, but more efficient for indexed collections.

nth2

(nth2 coll)
Third element from indexed collection `coll`.

reduce-by

(reduce-by keyfn f coll)(reduce-by keyfn f init coll)
Partition `coll` with `keyfn` as per `partition-by`, then reduce
each partition with `f` and optional initial value `init` as per
`r/reduce`.

reductions

(reductions f coll)(reductions f init coll)
Reducers version of `reductions`.

sample-reservoir

(sample-reservoir n coll)(sample-reservoir r n coll)
Take reservoir sample of size `n` from `coll`, optionally using `Random`
instance `r`.  Must reduce entirety of `coll` prior to returning results, which
will be in random order.  Entire sample will be realized in memory.