specter

Latest version: 1.1.3
Petrus Theron 2019-08-22T09:46:17.044100Z

Can Specter emit reductions over a lensed collection? E.g. (something-specter [ALL :amount (reducer +)] [{:amount 10.0M} {:amount 20.0M} ...]) => [{:amount 10.0M} {:amount 30.0M} ...]

Petrus Theron 2019-08-22T09:47:04.044400Z

E.g. w/o Specter:

(reductions
    (fn [[latest acc] [when amount]]
      [when (+ acc amount)])
    [0 0.0M]
    (zipmap (range 10) (range 10)))
=> ([0 0.0M] [0 0.0M] [7 7.0M] [1 8.0M] [4 12.0M] [6 18.0M] [3 21.0M] [2 23.0M] [9 32.0M] [5 37.0M] [8 45.0M])

lxsli 2019-08-22T11:55:04.044800Z

@petrus Could traversed be what you're after?

lxsli 2019-08-22T11:55:45.045100Z

Alternatively you might get mileage out of collect

lxsli 2019-08-22T11:56:07.045400Z

Not an expert myself so no promises