0

私は一連のアイテムを持っています(と思います)。これに似ています:

(def a ({:answers 3 :comments 12} {} {} {:answers 43 :comments 23} {}))

そのリスト内のすべての空のアイテムを理想的に削除したいのですが、それ以外の場合はセットをそのままにしておきます..私がやろうとしていることは次のとおりです。

(defn drop-empty-items
 [a]
 (take-when #(not empty? %) a))

しかし、これは明らかにまったく機能しません..

どうすればいいですか?

私は何かを返そうとしています:

({:answers 3 :comments 12} {:answers 43 :comments 23})

からdrop-empty-items

4

1 に答える 1

2
(def a '({:answers 3 :comments 12} {} {} {:answers 43 :comments 23} {}))

(remove empty? a) 
;=> ({:answers 3, :comments 12} {:answers 43, :comments 23})
于 2013-07-23T13:20:18.017 に答える