Reputation: 6399
I have a set (I think) of items; similar to this:
(def a ({:answers 3 :comments 12} {} {} {:answers 43 :comments 23} {}))
I want to ideally remove all empty items in that list, but keep the set intact otherwise.. what I am trying to do is:
(defn drop-empty-items
[a]
(take-when #(not empty? %) a))
but this obviously doesn't work at all..
How do I do this, please?
I'm trying to return something to the effect of:
({:answers 3 :comments 12} {:answers 43 :comments 23})
from drop-empty-items
Upvotes: 0
Views: 84
Reputation: 26446
(def a '({:answers 3 :comments 12} {} {} {:answers 43 :comments 23} {}))
(remove empty? a)
;=> ({:answers 3, :comments 12} {:answers 43, :comments 23})
Upvotes: 2