Skip to content

Instantly share code, notes, and snippets.

@dbyrne
Created April 28, 2011 21:07
Show Gist options
  • Save dbyrne/947342 to your computer and use it in GitHub Desktop.
Save dbyrne/947342 to your computer and use it in GitHub Desktop.
power set
(fn [xs]
(let [n (count xs)
m (Math/pow 2 n)]
(for [i (range m)]
(for [j (range n) :when (bit-test i j)]
(nth xs j)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment