Commits

Meikel Brandmeyer committed d132a59

Made LazyMapSeq extend clojure.lang.ASeq

  • Participants
  • Parent commits 67a7fb7

Comments (0)

Files changed (1)

src/de/kotka/lazymap/LazyMapSeq.clj

   (:gen-class
      :init         init
      :state        theSeq
-     :implements   [clojure.lang.ISeq clojure.lang.Sequential]
-     :constructors {[clojure.lang.ISeq] []})
-  (:import
-     (clojure.lang Cons)))
+     :extends      clojure.lang.ASeq
+     :constructors {[clojure.lang.ISeq] []
+                    [clojure.lang.ISeq clojure.lang.IPersistentMap]
+                    [clojure.lang.IPersistentMap]}))
 
-(defn- -init [theSeq] [[] theSeq])
+(defn- -init
+  ([theSeq]         [[] theSeq])
+  ([theSeq theMeta] [[theMeta] theSeq]))
 
-; ISeq
 (defn- -first
   [#^de.kotka.lazymap.LazyMapSeq this]
   (let [first-val (first (.theSeq this))]
     (de.kotka.lazymap.LazyMapEntry. (key first-val) (val first-val))))
 
-(defn- -more
-  [#^de.kotka.lazymap.LazyMapSeq this]
-  (if-let [inner-rest (next (.theSeq this))]
-    (de.kotka.lazymap.LazyMapSeq. inner-rest)
-    clojure.lang.PersistentList/EMPTY))
-
 (defn- -next
   [#^de.kotka.lazymap.LazyMapSeq this]
   (when-let [inner-rest (next (.theSeq this))]
     (de.kotka.lazymap.LazyMapSeq. inner-rest)))
-
-(defn- -cons
-  [#^de.kotka.lazymap.LazyMapSeq this other]
-  (Cons. other this))
-
-; IPersistentCollection
-(defn- -count
-  [#^de.kotka.lazymap.LazyMapSeq this]
-  (-> this .theSeq count))
-
-(def #^{:private true} -seq identity)
-
-(defn- -empty [_] nil)