API for clojure.math.combinatorics

by Mark Engelberg
Full namespace name:
clojure.math.combinatorics
Overview
Efficient, functional algorithms for generating lazy
sequences for common combinatorial functions. (See the source code
for a longer description.)
Public Variables and Functions
cartesianproduct
function
Usage: (cartesianproduct & seqs)
All the ways to take one item from each sequence
Source
combinations
function
Usage: (combinations items t)
All the unique ways of taking t different elements from items
Source
countcombinations
function
Usage: (countcombinations items t)
(count (combinations items t)) but computed more directly
Source
countpermutations
function
Usage: (countpermutations l)
Counts the number of distinct permutations of l
Source
countsubsets
function
Usage: (countsubsets items)
(count (subsets items)) but computed more directly
Source
droppermutations
function
Usage: (droppermutations items n)
(drop n (permutations items)) but calculated more directly.
Source
nthcombination
function
Usage: (nthcombination items t n)
The nth element of the sequence of tcombinations of items
Source
nthpermutation
function
Usage: (nthpermutation items n)
(nth (permutations items)) but calculated more directly.
Source
partitions
function
Usage: (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
permutationindex
function
Usage: (permutationindex items)
Input must be a sortable collection of items. Returns the n such that
(nthpermutation (sort items) n) is items.
Source
permutations
function
Usage: (permutations items)
All the distinct permutations of items, lexicographic by index
(special handling for duplicate items).
Source
selections
function
Usage: (selections items n)
All the ways of taking n (possibly the same) elements from the sequence of items
Source
subsets
function
Usage: (subsets items)
All the subsets of items
Source