API for clojure.math.combinatorics -
by Mark Engelberg
Full namespace name:
clojure.math.combinatoricsOverview
Efficient, functional algorithms for generating lazy
sequences for common combinatorial functions. (See the source code
for a longer description.)
Public Variables and Functions
cartesian-product
functionUsage: (cartesian-product & seqs)
All the ways to take one item from each sequence
Source
combinations
functionUsage: (combinations items t)
All the unique ways of taking t different elements from items
Source
count-combinations
functionUsage: (count-combinations items t)
(count (combinations items t)) but computed more directly
Source
count-permutations
functionUsage: (count-permutations l)
Counts the number of distinct permutations of l
Source
count-subsets
functionUsage: (count-subsets items)
(count (subsets items)) but computed more directly
Source
drop-permutations
functionUsage: (drop-permutations items n)
(drop n (permutations items)) but calculated more directly.
Source
nth-combination
functionUsage: (nth-combination items t n)
The nth element of the sequence of t-combinations of items
Source
nth-permutation
functionUsage: (nth-permutation items n)
(nth (permutations items)) but calculated more directly.
Source
partitions
functionUsage: (partitions items & args)
All the lexicographic distinct partitions of items.
Optionally pass in :min and/or :max to specify inclusive bounds on the number of parts the items can be split into.
Source
permutation-index
functionUsage: (permutation-index items)
Input must be a sortable collection of items. Returns the n such that
(nth-permutation (sort items) n) is items.
Source
permutations
functionUsage: (permutations items)
All the distinct permutations of items, lexicographic by index
(special handling for duplicate items).
Source
permuted-combinations
functionUsage: (permuted-combinations items t)
Every permutation of every combination of t elements from items
Source
selections
functionUsage: (selections items n)
All the ways of taking n (possibly the same) elements from the sequence of items
Source
subsets
functionUsage: (subsets items)
All the subsets of items
Source