From 3f4e873e749ac72ff6d8a0b65b99ba8b64c63a40 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Fri, 16 Aug 2019 17:03:17 +0100 Subject: [PATCH] Removal of redundant code. --- src/beowulf/cons_cell.clj | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/beowulf/cons_cell.clj b/src/beowulf/cons_cell.clj index 46affd2..a83830b 100644 --- a/src/beowulf/cons_cell.clj +++ b/src/beowulf/cons_cell.clj @@ -14,19 +14,13 @@ ;; next and more must return ISeq: ;; https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java (more [this] (if - (seq? this) - (if - (= (.CDR this) NIL) - clojure.lang.PersistentList/EMPTY - (.CDR this)) - NIL)) + (seq? (.CDR this)) + clojure.lang.PersistentList/EMPTY + (.CDR this))) (next [this] (if - (seq? this) - (if - (= (.CDR this) NIL) - nil ;; next returns nil when empty - (.CDR this)) - NIL)) + (seq? (.CDR this)) + nil ;; next returns nil when empty + (.CDR this))) clojure.lang.Seqable (seq [this] this) @@ -37,12 +31,9 @@ clojure.lang.IPersistentCollection (count [this] (if - (seq? this) - (if - (= (.CDR this) NIL) - 0 - (inc (count (.CDR this)))) - 0)) + (seq? (.CDR this)) + 0 + (inc (count (.CDR this))))) (empty [this] false) (equiv [this other] false))