Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with adding and removing nil #3

Open
DrSplinter opened this issue Dec 6, 2021 · 3 comments
Open

Bug with adding and removing nil #3

DrSplinter opened this issue Dec 6, 2021 · 3 comments

Comments

@DrSplinter
Copy link

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.

@namenu
Copy link
Owner

namenu commented Dec 7, 2021

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.

@DrSplinter
Copy link
Author

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?)

@namenu
Copy link
Owner

namenu commented Dec 8, 2021

No, it's an obvious bug of data.deque so let's keep this open. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants