Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save flengyel/1446362 to your computer and use it in GitHub Desktop.
Save flengyel/1446362 to your computer and use it in GitHub Desktop.
;; flengyel's solution to Power Set
;; https://4clojure.com/problem/85
(fn power [s]
(if (empty? s)
#{#{}}
(let [x (set (list (first s)))
dx (clojure.set/difference s x)
t (power dx)]
(clojure.set/union t
(map (partial into x) t)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment