0.9.4: add x/into-by-key, shorthand for (comp (x/by-key ..) (x/into ..))
This commit is contained in:
parent
81d0f0c171
commit
8f9b954a2b
3 changed files with 8 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ More transducers and reducing functions for Clojure(script)!
|
|||
1-item transducers generally only make sense in the context of a higher-order transducer.
|
||||
|
||||
* regular ones: `partition` (1 arg), `reductions`, `for`, `take-last`, `drop-last`, `window` and `window-by-time`
|
||||
* higher-order ones: `by-key`, `multiplex`, `transjuxt`, `partition` (2+ args)
|
||||
* higher-order ones: `by-key`, `into-by-key`, `multiplex`, `transjuxt`, `partition` (2+ args)
|
||||
* 1-item ones: `reduce`, `into`, `transjuxt`, `last`, `count`, `avg`, `sd`, `min`, `minimum`, `max`, `maximum`, `str`
|
||||
|
||||
*Reducing functions* (in `net.cgrand.xforms.rfs`): `min`, `minimum`, `max`, `maximum`, `str`, `str!`, `avg`, `sd`, `juxt` and `last`.
|
||||
|
|
@ -21,7 +21,7 @@ Transducing contexts: `transjuxt` (for performing several transductions in a sin
|
|||
Add this dependency to your project:
|
||||
|
||||
```clj
|
||||
[net.cgrand/xforms "0.9.2"]
|
||||
[net.cgrand/xforms "0.9.4"]
|
||||
```
|
||||
|
||||
```clj
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(defproject net.cgrand/xforms "0.9.3"
|
||||
(defproject net.cgrand/xforms "0.9.4"
|
||||
:description "Extra transducers for Clojure"
|
||||
:url "https://github.com/cgrand/xforms"
|
||||
:license {:name "Eclipse Public License"
|
||||
|
|
|
|||
|
|
@ -278,6 +278,11 @@
|
|||
acc)))
|
||||
([acc k v] (self acc #?(:clj (clojure.lang.MapEntry. k v) :cljs [k v])))))))))))
|
||||
|
||||
(defn into-by-key
|
||||
"A shorthand for the common case (comp (x/by-key ...) (x/into {}))."
|
||||
[coll & by-key-args]
|
||||
(comp (apply by-key by-key-args) (into coll)))
|
||||
|
||||
(macros/replace
|
||||
[#?(:cljs {(java.util.ArrayDeque. n) (Queue.)
|
||||
.add .enqueue
|
||||
|
|
|
|||
Loading…
Reference in a new issue