要打印值,可以使用string join和一个doseq
(require '[clojure.math.combinatorics :as combo])
(require '[clojure.string :as s])
(doseq [l (combo/subsets [1 2 3])]
(println (s/join ",", l)))
如果你想要去掉空集,可以使用filter。
(doseq [l (filter (complement empty?)
(combo/subsets [1 2 3]))]
(println (s/join ",", l)))