LazySeq
(LazySeq. meta fn s __hash)
(deftype LazySeq [meta ^:mutable fn ^:mutable s ^:mutable __hash]
Object
(toString [coll]
(pr-str* coll))
(equiv [this other]
(-equiv this other))
(sval [coll]
(if (nil? fn)
s
(do
(set! s (fn))
(set! fn nil)
s)))
(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))
IPending
(-realized? [coll]
(not fn))
IWithMeta
(-with-meta [coll new-meta]
(if (identical? new-meta meta)
coll
(LazySeq. new-meta #(-seq coll) nil __hash)))
IMeta
(-meta [coll] meta)
ISeq
(-first [coll]
(-seq coll)
(when-not (nil? s)
(first s)))
(-rest [coll]
(-seq coll)
(if-not (nil? s)
(rest s)
()))
INext
(-next [coll]
(-seq coll)
(when-not (nil? s)
(next s)))
ICollection
(-conj [coll o] (cons o coll))
IEmptyableCollection
(-empty [coll] (-with-meta (.-EMPTY List) meta))
ISequential
IEquiv
(-equiv [coll other] (equiv-sequential coll other))
IHash
(-hash [coll] (caching-hash coll hash-ordered-coll __hash))
ISeqable
(-seq [coll]
(.sval coll)
(when-not (nil? s)
(loop [ls s]
(if (instance? LazySeq ls)
(recur (.sval ls))
(do (set! s ls)
(seq s))))))
IReduce
(-reduce [coll f] (seq-reduce f coll))
(-reduce [coll f start] (seq-reduce f start coll)))