- class PcSet a where
- class PcSet a => Selective a where
- complement :: a -> a

- class PcSet a => Inclusive a where
- data GenSet
- data StdSet
- data GenRow
- data StdRow
- genset :: Int -> [Int] -> GenSet
- stdset :: [Int] -> StdSet
- genrow :: Int -> [Int] -> GenRow
- stdrow :: [Int] -> StdRow
- transpose :: PcSet a => Int -> a -> a
- invert :: PcSet a => a -> a
- invertXY :: PcSet a => Int -> Int -> a -> a
- zero :: PcSet a => a -> a
- retrograde :: PcSet a => a -> a
- rotate :: PcSet a => Int -> a -> a
- sort :: (PcSet a, Selective a) => a -> a
- normal :: (PcSet a, Selective a) => a -> a
- reduced :: (PcSet a, Selective a) => a -> a
- prime :: (PcSet a, Selective a) => a -> a
- cardinality :: (PcSet a, Selective a) => a -> Int
- binaryValue :: (PcSet a, Selective a) => a -> Integer
- avec :: (PcSet a, Selective a) => a -> [Int]
- cvec :: (PcSet a, Selective a) => a -> [Int]
- ivec :: (PcSet a, Selective a) => a -> [Int]
- rowP :: (PcSet a, Inclusive a) => Int -> a -> a
- rowR :: (PcSet a, Inclusive a) => Int -> a -> a
- rowI :: (PcSet a, Inclusive a) => Int -> a -> a
- rowRI :: (PcSet a, Inclusive a) => Int -> a -> a

# Classes

The broadest class of Pitch Class Set. All members of this class
have a `modulus`

which restricts their `elements`

in some way. They
also have `pMap`

, a method for lifting integer list functions to act
on set elements. The `modulus`

corresponds to the underlying system
of equivalent pitch classes, for example, 12-TET = modulus 12.

Determines the range of possible `elements`

of the set,
from 0 to (m-1). If m = 0, the set can only be empty.

Returns the elements of the set as a list.

pMap :: ([Int] -> [Int]) -> a -> aSource

Maps an integer list function across the members of the set, and returns the results in a new set of the same type.

class PcSet a => Selective a whereSource

Selective Pitch Class Sets can have `elements`

in a range of values
permitted by their `modulus`

. They can have as few as 0 (the empty
set) or as many as all. The set `complement`

operation only makes
sense for `Selective`

sets.

complement :: a -> aSource

Returns a new PcSet which is the complement of the original:
it contains all the `elements`

which the original does not.

class PcSet a => Inclusive a whereSource

Inclusive Pitch Class Sets, or Tone Rows, have all the possible
`elements`

permitted by their `modulus`

. The most important
characteristic of a Tone Row is not its `elements`

, but the
*ordering* of its `elements`

.

# Types

## Selective (Sets)

General Pitch Class Set. This represents a Pitch Class Set that
can have a `modulus`

of any positive integer value, representing
the number of equivalent pitch classes in a given system; for
example, 19-TET would be a modulus 19 set. The members of a the
set can be as few as zero and as many as all possible values.

Standard Pitch Class Set. This represents the traditional definition of a pitch class set, based on 12-TET, with the pitch classes numbered C = 0, C#/Db = 1, D = 2, and so on up to B = 11. This set can have anywhere from zero to 12 members (the empty set vs. the chromatic scale).

## Inclusive (Rows)

Standard Tone Row. This is the traditional Tone Row, a collection
of all the elements `[0..11]`

, based on 12-TET. As with `GenRow`

,
the most significant information in this type of set is the ordering
of the elements. Since this is always a complete set, this set
always has a length of 12.

# Constructors

## Selective (Sets)

stdset :: [Int] -> StdSetSource

Constructor for Standard Pitch Class Sets. This constructor accepts
any `[Int]`

values for elements. The `modulus`

is always 12 (12-TET).

## Inclusive (Rows)

genrow :: Int -> [Int] -> GenRowSource

Constructor for General Tone Rows. This constructor accepts any `Int`

value for `modulus`

, and any `[Int]`

values for an input list. Zero
`modulus`

always returns an empty set; a negative `modulus`

is always
taken as positive (see `GenSet`

). If the input list of `elements`

is
incomplete, the remaining `elements`

are filled in at the end, in order.

# General Operations (All Sets)

## Transformations

transpose :: PcSet a => Int -> a -> aSource

Returns a new `PcSet`

which is the original transposed by *n*.

invert :: PcSet a => a -> aSource

Returns a new `PcSet`

which is the *standard inverse* of the original,
that is, about an axis containing pitch class 0.

invertXY :: PcSet a => Int -> Int -> a -> aSource

Inversion around an axis specified by pitch classes *x* and *y*.
This inverts the set in such a way that *x* becomes *y* and *y*
becomes *x*.

zero :: PcSet a => a -> aSource

Returns a new `PcSet`

in which the elements have been transposed
so that the first element is zero.

## Permutations

retrograde :: PcSet a => a -> aSource

Returns a new `PcSet`

with the elements of the original reversed.

rotate :: PcSet a => Int -> a -> aSource

Returns a new `PcSet`

with the elements shifted *n* places to the left.

# Selective Set Operations

## Systematically Equivalent Forms

## Scalar Quantities

cardinality :: (PcSet a, Selective a) => a -> IntSource

binaryValue :: (PcSet a, Selective a) => a -> IntegerSource

Binary Value. For a given `Selective`

`PcSet`

, this returns a
*unique* number relating to the elements of the set -- a measure
of the leftward packing of the sorted set (overall closeness
of each element to zero).

## Vector Quantities

ivec :: (PcSet a, Selective a) => a -> [Int]Source

Interval Vector. Each element of the interval vector represents
the number of intervals in the set for that particular interval
class. Element 0 measures the number of 1-interval leaps;
element 1 measures the number of 2-interval leaps, and so on,
up to half of the modulus *m*.

# Inclusive Set (Tone Row) Operations

rowP :: (PcSet a, Inclusive a) => Int -> a -> aSource

Returns a new Tone Row in which the elements are *Prograde*
(in their original order) and transposed so that the first
element is *n*.

rowR :: (PcSet a, Inclusive a) => Int -> a -> aSource

Returns a new Tone Row in which the elements are *Retrograde*
(reversed compared to their original order) and transposed so
that the first element is *n*.