Power set: Difference between revisions

no edit summary
No edit summary
Line 700:
<lang Clojure>(defn powerset [coll]
(reduce (fn [a x]
(->>into a (map #(conj % x)) a))
(map #(set (concat #{x} %)))
(concat a)
set))
#{#{}} coll))
 
Line 1,176 ⟶ 1,173:
 
or, alternatively as:
 
<lang funl>import lists.foldr