data.deque
data.deque copied to clipboard
Bug with adding and removing `nil`
There is a problem with the following:
(require '[data.deque :as dq])
(assert (= (list 2 nil)
(-> (dq/deque)
(dq/add-first nil)
(dq/add-first nil)
(dq/add-first 2)
dq/remove-last
seq)))
Interesting is the fact that if we add-last and then remove-first it works correctly.
When removing an element, the finger tree may shrink by checking returning nil.
It seems nils in the example is causing the wrong behavior.
(In general, inserting nil into a collection is not recommended.)
I'll make a PR not to use nil as a marker. Thanks.
Oh, OK then. I'll use some keyword like :clojure.spec.alpha/invalid keyword used in spec :-)
Thank you too
(should I close this Issue?)
No, it's an obvious bug of data.deque so let's keep this open. 😃