2017-08-27

create and analyse selections from sets: permutations, combinations, n-tuples

(sph vector selection)

- sph-vector-selection-description
- vector-distinct-count
- vector-distinct-maximum
- vector-distinct-stream
- vector-numeric-increment-be
- vector-numeric-increment-be!
- vector-numeric-increment-le
- vector-numeric-increment-le!
- vector-selection
- vector-selection-maximum
- vector-selections
- vector-selections-stream

variable

procedure## signature

## description

a [min-width max-width] ->

vector integer integer -> integer

count all distinct sub-vectors in a vector with lengths from min-width to max-width.

distinctness is defined by elements, order and length

procedure## signature

## description

width [min-width] ->

integer integer -> integer

calculate the maximum number of possible distinct tuples in a tuple up to width, optionally ignoring widths smaller than min-width

procedure## signature

## description

a [min-width max-width] ->

vector [integer integer] -> stream

return a stream of all distinct sub-vectors in a vector with lengths from min-width to max-width.

top to bottom.

distinctness is defined as with vector-distinct-count

procedure## signature

## description

a base ->

vector integer -> vector

treat a vector of integers as a whole like one number to "base" in big endian and increment it

returns false if the maximum value has been reached

procedure## signature

## description

a base ->

vector integer -> true/false

like "vector-numeric-increment-be" but modifies the input vector

procedure## signature

## description

a base ->

vector integer -> vector

treat a vector of integers as a whole like one number to "base" in little endian and increment it.

returns false if the maximum value has been reached

procedure## signature

## description

a base ->

vector integer -> true/false

like "vector-numeric-increment-le" but modifies the input vector

procedure## signature

## description

set-indices set ->

vector:#(integer ...) vector -> vector

return a new vector of values at indices in set

procedure## signature

## description

set-length [selection-width] ->

integer integer -> integer

calculate the maximum number of possible distinct selections from a set with length "set-length" and

optional "selection-width" which defaults to "set-length"

procedure## signature

## description

set [width] ->

vector integer -> (vector ...)

return a list of all distinct selections of values from "set" with duplicate elements allowed. set can contain any datatype.

the optional parameter "width" specifies the length of selections.

for example, a width of two creates all possible two element selections of set.

the default for "width" is the length of the set

procedure## signature

## description

selection [width] ->

vector width -> stream

like vector-selections but returns an srfi-41-stream and calculates next results on demand