Giter VIP home page Giter VIP logo

data.deque's Issues

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.

Conj'ing a deque onto a set causes ClassCastException

(require '[data.deque :as dq])
(conj [] (dq/deque 1))
;;=> [<top-(1)-bottom>]
(conj #{} (dq/deque 1))
;;=> Unhandled java.lang.ClassCastException
;;   data.deque.PersistentDeque cannot be cast to java.lang.Iterable
              core.clj: 5186  clojure.core/hash-ordered-coll
              core.clj:   -1  clojure.core/hash-ordered-coll
             deque.clj:   77  data.deque.PersistentDeque/hasheq
             Util.java:  177  clojure.lang.Util/dohasheq
             Util.java:  168  clojure.lang.Util/hasheq
PersistentHashMap.java:  120  clojure.lang.PersistentHashMap/hash
PersistentHashMap.java:  143  clojure.lang.PersistentHashMap/assoc
PersistentHashSet.java:   99  clojure.lang.PersistentHashSet/cons
PersistentHashSet.java:   17  clojure.lang.PersistentHashSet/cons
               RT.java:  673  clojure.lang.RT/conj
              core.clj:   85  clojure.core/conj
              core.clj:   82  clojure.core/conj

I encountered the issue also for type data.deque.PersistentDequeSeq, as I tried to extract the item using seq as a work-around.
I ended up using map to obtain a non-data.deque type so was wondering if this is intentional? Thanks!

 (conj #{} (map identity (dq/deque 1)))
;;=> #{(1)} 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.