3 ms·
I wonder if update-in or merge-with would be more efficient. Another thing to consider is if you want to get fancy (persistent! (reduce #(update-in %1 [%2] (fn
by runevault 16y ago
I wonder if update-in or merge-with would be more efficient.
Another thing to consider is if you want to get fancy
(persistent! (reduce #(update-in %1 [%2] (fnil inc 0)) (transient {}) "abcdaabccc"))
Still no REPL but this should work and take advantage of transients if you're doing it against a bigger dataset (which I assume you care about since you also worried about laziness)
- deleted 16y ago[deleted]