fix bug induced by change in api (pair fn instead of update fn)
This commit is contained in:
parent
e576631ca4
commit
62e384ec43
2 changed files with 2 additions and 2 deletions
|
|
@ -44,7 +44,7 @@ Add this dependency to your project:
|
||||||
`avg` is a reducing fn to compute the arithmetic mean. `juxt` is used to compute several reducing fns at once.
|
`avg` is a reducing fn to compute the arithmetic mean. `juxt` is used to compute several reducing fns at once.
|
||||||
```clj
|
```clj
|
||||||
=> (into {} (x/by-key odd? (x/reduce (x/juxt + x/avg))) (range 256))
|
=> (into {} (x/by-key odd? (x/reduce (x/juxt + x/avg))) (range 256))
|
||||||
{0 [16256 127], 1 [16384 128]}
|
{false [16256 127], true [16384 128]}
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
([acc] (clj/reduce (fn [acc krf] (krf acc)) acc (vals (persistent! @m))))
|
([acc] (clj/reduce (fn [acc krf] (krf acc)) acc (vals (persistent! @m))))
|
||||||
([acc x]
|
([acc x]
|
||||||
(let [k (kfn x)
|
(let [k (kfn x)
|
||||||
krf (or (get @m k) (doto (xform (make-rf x)) (->> (vswap! m assoc! k))))
|
krf (or (get @m k) (doto (xform (make-rf k)) (->> (vswap! m assoc! k))))
|
||||||
acc (krf acc (vfn x))]
|
acc (krf acc (vfn x))]
|
||||||
(when (reduced? acc)
|
(when (reduced? acc)
|
||||||
(vswap! m assoc! k noprf))
|
(vswap! m assoc! k noprf))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue