fix issue with NONE-ELEM on nil value

This commit is contained in:
nathanmarz 2017-02-17 17:54:11 -05:00
parent 84fdc7f1b4
commit e7b595c4ca
3 changed files with 6 additions and 3 deletions

View file

@ -165,7 +165,7 @@
(let [data [1 2 3 4 5 6 7 8 9 10]]
(run-benchmark "first value of a vector" 10000000
(run-benchmark "first value of a size 10 vector" 10000000
(first data)
(select-any ALL data)
(select-any FIRST data)

View file

@ -738,8 +738,10 @@
(let [newe (next-fn NONE)]
(if (identical? NONE newe)
structure
(conj structure newe)
))))
(if (nil? structure)
#{newe}
(conj structure newe)
)))))
(defnav
^{:doc "Navigate to 'void' element before the sequence.

View file

@ -1441,6 +1441,7 @@
(is (predand= list? '(3 1 2) (setval s/BEFORE-ELEM 3 '(1 2))))
(is (predand= list? '(1) (setval s/BEFORE-ELEM 1 nil)))
(is (= #{1 2 3} (setval s/NONE-ELEM 3 #{1 2})))
(is (= #{1} (setval s/NONE-ELEM 1 nil)))
)
(deftest subvec-test