(defn subsets [s]
(reduce (fn [ss x] (concat ss (map #(conj % x) ss))) [#{}] s))
Monday, October 20, 2008
Clojure Golf: subsets
This post has moved,
go to its new location
Subscribe to:
Post Comments (Atom)
When the pupil is ready to learn, a teacher will appear.
(defn subsets [s]
(reduce (fn [ss x] (concat ss (map #(conj % x) ss))) [#{}] s))
No comments:
Post a Comment