Fix example
wax failing on duplicate values
This commit is contained in:
parent
3ab242de11
commit
00fae8ede4
1 changed files with 11 additions and 7 deletions
18
README.md
18
README.md
|
|
@ -128,13 +128,17 @@ Padding is achieved as usual:
|
|||
|
||||
;; min of last 3 items
|
||||
=> (sequence
|
||||
(x/window 3
|
||||
(fn
|
||||
([] (sorted-set))
|
||||
([s] (first s))
|
||||
([s x] (conj s x)))
|
||||
disj)
|
||||
nums)
|
||||
(x/window 3
|
||||
(fn
|
||||
([] (sorted-map))
|
||||
([m] (key (first m)))
|
||||
([m x] (update m x (fnil inc 0))))
|
||||
(fn [m x]
|
||||
(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)
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue