Created
May 10, 2012 03:27
-
-
Save dryman/2650855 to your computer and use it in GitHub Desktop.
Power Set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn power-set [lst] | |
(if (seq lst) | |
(clojure.set/union | |
(apply hash-set (for [x (next lst)] #{(first lst) x})) | |
(power-set (next lst))) | |
#{#{}})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment