Liking cljdoc? Tell your friends :D

pangloss.transducers


appendclj

(append coll)

Append a set of raw data to the result of the transducer when the source data is completed. The data will not flow through any of the previous transducers in the chain, but will be processed by any subsquent ones.

Sort of like cat or concat

Append a set of raw data to the result of the transducer when the source data
is completed. The data will not flow through any of the previous transducers
in the chain, but will be processed by any subsquent ones.

Sort of like cat or concat
raw docstring

branchclj

(branch & xforms)

Allow a single chain of transducers to branch data out to be processed by multiple transducers, then merged back into a single one.

The results of each of the branching xforms are merged into the resulting output in round-robin fashion. If any of the xforms produces multiple results for a single input, they will be sequential in the output.

If an xform produces data when it is completed, that data will be included at the end of the result stream.

The data pipeline looks something like this:

(comp pre-xform (branch xform0 xform1 xform2) post-xform)

           ,--> xform0 >--.

pre-xform >------> xform1 >--->(round-robin merge)--> post-xform `--> xform2 >--'

Allow a single chain of transducers to branch data out to be processed by
multiple transducers, then merged back into a single one.

The results of each of the branching xforms are merged into the resulting
output in round-robin fashion. If any of the xforms produces multiple
results for a single input, they will be sequential in the output.

If an xform produces data when it is completed, that data will be included at
the end of the result stream.

The data pipeline looks something like this:

 (comp pre-xform
       (branch xform0 xform1 xform2)
       post-xform)

               ,--> xform0 >--.
 pre-xform >------> xform1 >--->(round-robin merge)--> post-xform
               `--> xform2 >--'
raw docstring

cond-branchclj

(cond-branch & pred-xform-pairs)

Will route data down the first path whose predicate is truthy. The results are merged.

Predicates are regular functions. They are called on each element that flows into this transducer until one of the predicates passes, causing the data to be routed down that predicate's xform.

Will route data down the first path whose predicate is truthy. The results are merged.

Predicates are regular functions. They are called on each element that flows into this
transducer until one of the predicates passes, causing the data to be routed down that
predicate's xform.
raw docstring

countedclj

(counted xform coll)

Return the count of elements in the result rather than the result itself.

Return the count of elements in the result rather than the result itself.
raw docstring

distinct-byclj

(distinct-by)
(distinct-by key)
(distinct-by f coll)

Removes duplicates based on the return value of key.

Removes duplicates based on the return value of key.
raw docstring

doprocessclj

(doprocess xform coll)

Like dorun for a transducer. Produces no intermediate sequence at all.

Like dorun for a transducer. Produces no intermediate sequence at all.
raw docstring

duplicates-byclj

(duplicates-by)
(duplicates-by key)
(duplicates-by f coll)

Return duplicated nodes based on the return value of key.

Empty result means no dups.

Return duplicated nodes based on the return value of key.

Empty result means no dups.
raw docstring

group-by-countclj

(group-by-count)
(group-by-count f)

Return a map of {count [all keys with that unique count]}

Return a map of {count [all keys with that unique count]}
raw docstring

group-countclj

(group-count)
(group-count f)

Return a map of {item count-equal-items} or {(f item) count-equal}.

Arity 1 is basically identical to frequencies.

Return a map of {item count-equal-items} or {(f item) count-equal}.

Arity 1 is basically identical to `frequencies`.
raw docstring

grouped-byclj

(grouped-by f & {:keys [extract on-value on-map keys? flat?] :or {keys? true}})

A transducer that acts like group-by but includes the result as a single result in the stream.

Options:

:extract fn (grouped-by f :extract extract) is like this library's (group-by-extract f extract coll).

:on-value fn apply a function to the final value (after extract is completed)

:on-map fn apply a function to the final map (after extract and on-value are completed)

:keys? false (grouped-by f :keys? false) is like (vals (group-by f coll)) after extract, on-value and on-map

:flat? false like :keys? false, but catenates each value into the result after extract, on-value and on-map

A transducer that acts like group-by but includes the result as a single result in the stream.

Options:

:extract fn
  (grouped-by f :extract extract) is like this library's (group-by-extract f extract coll).

:on-value fn
  apply a function to the final value (after extract is completed)

:on-map fn
  apply a function to the final map (after extract and on-value are completed)

:keys? false
  (grouped-by f :keys? false) is like (vals (group-by f coll))
  after extract, on-value and on-map

:flat? false
  like :keys? false, but catenates each value into the result
  after extract, on-value and on-map
raw docstring

lasts-byclj

(lasts-by)
(lasts-by f)
(lasts-by f coll)

A transducer that accomplishes the following but more efficiently (->> coll (group_by f) (map (fn [[k vals]] (last vals))))

A transducer that accomplishes the following but more efficiently
(->> coll
     (group_by f)
     (map (fn [[k vals]] (last vals))))
raw docstring

lookaheadclj

(lookahead xform)
(lookahead {:keys [min max]} xform)

Uses a nested transducer as the lookahead body

Uses a nested transducer as the lookahead body
raw docstring

map*clj

(map* xform)
(map* empty-coll xform)
(map* empty-coll item-seq xform)

Map over the elements in a sequence of sequences.

For instance in fermor (out-e*) produces a vector of edges for each node. This would let you work with those edges without flattening the vectors.

Args: xform: a transducer compatible with the sequence type ie (map ...) if each item is a sequence empty-coll: a function that produces the sequence given to into for each item item-seq: a function that coerces each item into the type of sequence you want

Map over the elements in a sequence of sequences.

For instance in fermor (out-e*) produces a vector of edges for each node. This
would let you work with those edges without flattening the vectors.

Args:
  xform: a transducer compatible with the sequence type ie (map ...) if each item is a sequence
  empty-coll: a function that produces the sequence given to into for each item
  item-seq: a function that coerces each item into the type of sequence you want
raw docstring

mergedclj

(merged xform coll)

If the xform produces only one or more maps, return them merged into a single map.

If the xform produces only one or more maps, return them merged into a single
map.
raw docstring

neg-lookaheadclj

(neg-lookahead xform)
(neg-lookahead {:keys [min max]} xform)

Ensure that the function does NOT produce a collection of at least one item.

Use the arity 2 version to specify that there must NOT be at least min and/or at most max items in the route. If min or max is nil that limit will not be enforced. The arity 2 version of neg-lookahead is not really recommended as it is a little bit confusing.

Ensure that the function does NOT produce a collection of at least one item.

Use the arity 2 version to specify that there must NOT be at least min
and/or at most max items in the route. If min or max is nil that limit will
not be enforced. The arity 2 version of neg-lookahead is not really recommended
as it is a little bit confusing.
raw docstring

rf-branchableclj

(rf-branchable rf)

Helper to adapt a reducing function to a branching transducer.

Don't pass the completing of the rf through because completing multiple times is invalid and this transducer will do that after its child xforms have been completed.

Helper to adapt a reducing function to a branching transducer.

Don't pass the completing of the rf through because completing multiple times
is invalid and this transducer will do that after its child xforms have been
completed.
raw docstring

(search xform coll)

Returns the first result

Returns the first result
raw docstring

sectionclj

(section xform)

Group the results of transforming each element into a collection per-element.

Not a transducer.

Group the results of transforming each element into a collection per-element.

Not a transducer.
raw docstring

section-mapclj

(section-map xform coll)

sortedclj

(sorted)

sorted-byclj

(sorted-by)
(sorted-by f)

sorted-group-by-countclj

(sorted-group-by-count)
(sorted-group-by-count f)

Return a map of {count [all keys with that unique count]}

Return a map of {count [all keys with that unique count]}
raw docstring

sorted-group-countclj

(sorted-group-count)
(sorted-group-count f)

Return a map of {item count-equal-items} or {(f item) count-equal}

Return a map of {item count-equal-items} or {(f item) count-equal}
raw docstring

when-duplicated-byclj

(when-duplicated-by)
(when-duplicated-by key)
(when-duplicated-by f coll)

Return only the first duplicated node based on the return value of key.

Nil result means no dups.

Return only the first duplicated node based on the return value of key.

Nil result means no dups.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close