Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Say we have this nested vector:
(def coll [nil [["this" nil "this"] nil] nil "this"])
How would you design a remove-nil function so that all nil disappear?
remove-nil
(remove-nil coll) ;> [[["this" "this"]] "this"]
(clojure.walk/postwalk #(if (coll? %) (into (empty %) (remove nil? %)) %) coll) ;=> [[["this" "this"]] "this"]