fix subselect changing first matched element to nil when transformed to empty sequence

This commit is contained in:
nathanmarz 2017-12-21 22:24:37 -05:00
parent 6a5054feea
commit 7b646ca566
3 changed files with 4 additions and 1 deletions

View file

@ -4,6 +4,7 @@
* Add `vterminal` that takes in collected vals as vector in first argument rather than spliced into argument list.
* Add `compact` navigator. After each step of navigation of its subpath, `compact` removes the collection if it's empty.
* Change `terminal` to be a no-op on select codepath
* Bug fix: `subselect`/`filterer` removes first matched element instead of setting to nil when transformed to empty sequence
## 1.0.5

View file

@ -895,7 +895,7 @@
values-to-insert (i/mutable-cell transformed)]
(compiled-transform late
(fn [_] (let [vs (i/get-cell values-to-insert)]
(if vs
(if (seq vs)
(do (i/update-cell! values-to-insert next)
(first vs))
NONE

View file

@ -1535,6 +1535,8 @@
(deftest filterer-remove-test
(is (= [1 :a 3 5] (setval (s/filterer even?) [:a] [1 2 3 4 5])))
(is (= [1 3 5] (setval (s/filterer even?) [] [1 2 3 4 5])))
(is (= [1 3 5] (setval (s/filterer even?) nil [1 2 3 4 5])))
)
(deftest helper-preds-test