All notable changes to this project are documented here. The format follows Keep a Changelog, and the project uses Semantic Versioning.
clojure.core function has
one: partition-all, partition-by, take, drop, take-nth, take-while,
drop-while, interpose, remove, map, filter, mapcat, keep,
map-indexed, keep-indexed, replace. (c/map f) returns the same
transducer as (clojure.core/map f).sequence: (sequence coll), (sequence coll xform),
(sequence coll xform & colls).transduce: (transduce coll xform f), (transduce coll xform f init).
With these, a transducer pipeline threads with ->:
(-> (range 10) (c/transduce (comp (c/map inc) (c/filter even?)) + 0))
returns 30.eduction: (eduction coll & xforms), the transducers following the
collection. (-> (range 10) (c/eduction (c/map inc) (c/filter even?)) vec)
returns [2 4 6 8 10].clojure.core's docstring; a docstring
is now the coll-first note followed by clojure.core's docstring verbatim.(c/map [1 2 3]) is now a legal call to the transducer arity (it returns a
transducer that uses the vector as its function) instead of an arity error.
clj-kondo, with the shipped config, no longer reports it; it still reports
wrong-arity calls such as (c/partition [1 2 3]).clojure.core expects
it, not only last (internal; no consumer-visible change beyond eduction).First release, published as io.github.durantschoon/consistent-lib.
consistent-lib.core: 34 collection-first wrappers for clojure.core sequence
functions. Each one behaves exactly like the clojure.core function of the same
name, with the primary collection moved to argument 1 (any further collections
stay after the function, in core's order):
partition, partition-all, partition-by,
split-at, split-with, group-by;take, drop, take-nth, take-while, drop-while,
take-last, drop-last;map, mapv, map-indexed, mapcat, filter, filterv,
remove, keep, keep-indexed, replace, sort, sort-by, interpose;reduce, reductions, reduce-kv, run!;some, every?, not-every?, not-any?.clojure.core does not already take its
primary collection first, so concat, interleave and subvec are not
wrapped.(map coll f c2 c3 & colls), (mapcat coll f & colls).clojure.core docstring verbatim; its :arglists show the collection-first
order.consistent-lib.core is .cljc and delegates to
cljs.core in ClojureScript.clj-kondo.exports/io.github.durantschoon/consistent-lib), with a hook that
gives consumers arity checking on wrapper calls.(map f)); use clojure.core directly for
transducers. The affected wrappers say so in their docstrings.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |