PersistentQueue
(PersistentQueue. meta count front rear __hash)
(deftype PersistentQueue [meta count front rear ^:mutable __hash]
Object
(toString [coll]
(pr-str* coll))
(equiv [this other]
(-equiv this other))
(indexOf [coll x]
(-indexOf coll x 0))
(indexOf [coll x start]
(-indexOf coll x start))
(lastIndexOf [coll x]
(-lastIndexOf coll x (count coll)))
(lastIndexOf [coll x start]
(-lastIndexOf coll x start))
ICloneable
(-clone [coll] (PersistentQueue. meta count front rear __hash))
IIterable
(-iterator [coll]
(PersistentQueueIter. front (-iterator rear)))
IWithMeta
(-with-meta [coll new-meta]
(if (identical? new-meta meta)
coll
(PersistentQueue. new-meta count front rear __hash)))
IMeta
(-meta [coll] meta)
ISeq
(-first [coll] (first front))
(-rest [coll] (rest (seq coll)))
IStack
(-peek [coll] (first front))
(-pop [coll]
(if front
(if-let [f1 (next front)]
(PersistentQueue. meta (dec count) f1 rear nil)
(PersistentQueue. meta (dec count) (seq rear) [] nil))
coll))
ICollection
(-conj [coll o]
(if front
(PersistentQueue. meta (inc count) front (conj (or rear []) o) nil)
(PersistentQueue. meta (inc count) (conj front o) [] nil)))
IEmptyableCollection
(-empty [coll] (-with-meta (.-EMPTY PersistentQueue) meta))
ISequential
IEquiv
(-equiv [coll other] (equiv-sequential coll other))
IHash
(-hash [coll] (caching-hash coll hash-ordered-coll __hash))
ISeqable
(-seq [coll]
(let [rear (seq rear)]
(if (or front rear)
(PersistentQueueSeq. nil front (seq rear) nil))))
ICounted
(-count [coll] count))