powerset

powerset

Example code from https://gerritjvv.github.io/blog/methods-of-problem-solving-power-set/

Installation

Download from https://github.com/blog/powerset.

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(require '[blog.combinations :as c] :reload)
 
(c/combinations [:a :b])
;; [:a :a]
;; [:a :b]
;; [:b :a]
;; [:b :b]

(c/powerset [:a :b :c])
;; #{:a}
;; #{:b :a}
;; #{:c :a}
;; #{:c :b :a}
;; #{:b}
;; #{:c :b}
;;#{:c}

Run the project’s tests (they’ll fail until you edit them):

1
$ clojure -A:test:runner

License

Copyright © 2020 Gvanvuuren

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.