Fix example

wax failing on duplicate values
This commit is contained in:
Christophe Grand 2019-02-28 15:30:20 +01:00
parent 3ab242de11
commit 00fae8ede4

View file

@ -128,13 +128,17 @@ Padding is achieved as usual:
;; min of last 3 items ;; min of last 3 items
=> (sequence => (sequence
(x/window 3 (x/window 3
(fn (fn
([] (sorted-set)) ([] (sorted-map))
([s] (first s)) ([m] (key (first m)))
([s x] (conj s x))) ([m x] (update m x (fnil inc 0))))
disj) (fn [m x]
nums) (let [n (dec (m x))]
(if (zero? n)
(dissoc m x)
(assoc m x (dec n))))))
nums)
(11 8 8 8 6 6 6 10) (11 8 8 8 6 6 6 10)
``` ```