API for clojure.math.combinatorics - math.combinatorics 0.2.1-SNAPSHOT (in development)

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



cartesian-product

function
Usage: (cartesian-product & 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
  


count-combinations

function
Usage: (count-combinations items t)
(count (combinations items t)) but computed more directly

    
    
    Source
  


count-permutations

function
Usage: (count-permutations l)
Counts the number of distinct permutations of l

    
    
    Source
  


count-subsets

function
Usage: (count-subsets items)
(count (subsets items)) but computed more directly

    
    
    Source
  


drop-permutations

function
Usage: (drop-permutations items n)
(drop n (permutations items)) but calculated more directly.

    
    
    Source
  


nth-combination

function
Usage: (nth-combination items t n)
The nth element of the sequence of t-combinations of items

    
    
    Source
  


nth-permutation

function
Usage: (nth-permutation 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
  


permutation-index

function
Usage: (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

function
Usage: (permutations items)
All the distinct permutations of items, lexicographic by index 
(special handling for duplicate items).

    
    
    Source
  


permuted-combinations

function
Usage: (permuted-combinations items t)
Every permutation of every combination of t elements from 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
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.