Removal of redundant code.

This commit is contained in:
Simon Brooke 2019-08-16 17:03:17 +01:00
parent dfe4333dfa
commit 3f4e873e74

View file

@ -14,19 +14,13 @@
;; next and more must return ISeq: ;; next and more must return ISeq:
;; https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java ;; https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java
(more [this] (if (more [this] (if
(seq? this) (seq? (.CDR this))
(if
(= (.CDR this) NIL)
clojure.lang.PersistentList/EMPTY clojure.lang.PersistentList/EMPTY
(.CDR this)) (.CDR this)))
NIL))
(next [this] (if (next [this] (if
(seq? this) (seq? (.CDR this))
(if
(= (.CDR this) NIL)
nil ;; next returns nil when empty nil ;; next returns nil when empty
(.CDR this)) (.CDR this)))
NIL))
clojure.lang.Seqable clojure.lang.Seqable
(seq [this] this) (seq [this] this)
@ -37,12 +31,9 @@
clojure.lang.IPersistentCollection clojure.lang.IPersistentCollection
(count [this] (if (count [this] (if
(seq? this) (seq? (.CDR this))
(if
(= (.CDR this) NIL)
0 0
(inc (count (.CDR this)))) (inc (count (.CDR this)))))
0))
(empty [this] false) (empty [this] false)
(equiv [this other] false)) (equiv [this other] false))