improve compact implementation

This commit is contained in:
nathanmarz 2017-12-24 10:50:22 -05:00
parent 70d9fef5cc
commit 09d0d071ef

View file

@ -1456,10 +1456,11 @@
coll? [ALL-WITH-META p] coll? [ALL-WITH-META p]
))) )))
(let [compact* (stay-then-continue (if-path empty? (terminal-val NONE)))] (let [empty->NONE (if-path empty? (terminal-val NONE))
compact* (fn [nav] (multi-path nav empty->NONE))]
(defdynamicnav compact (defdynamicnav compact
"During transforms, after each step of navigation in subpath check if the "During transforms, after each step of navigation in subpath check if the
value is empty. If so, remove that value by setting it to NONE." value is empty. If so, remove that value by setting it to NONE."
[& path] [& path]
(interleave (repeat (count path) compact*) path) (map compact* path)
)) ))