fix bug induced by change in api (pair fn instead of update fn)

This commit is contained in:
Christophe Grand 2015-09-03 20:51:37 +02:00
parent e576631ca4
commit 62e384ec43
2 changed files with 2 additions and 2 deletions

View file

@ -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.
```clj
=> (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

View file

@ -83,7 +83,7 @@
([acc] (clj/reduce (fn [acc krf] (krf acc)) acc (vals (persistent! @m))))
([acc 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))]
(when (reduced? acc)
(vswap! m assoc! k noprf))