# score.sieves

```"...sieve theory is the study of the internal symmetries of a series of points
either constructed intuitively, given by observation, or invented completely
from moduli of repetition." - Xenakis, Formalized Music, pp. 276

Sieve functions based on work by Iannis Xenakis. Sieves are represented as
a 2-vector of [modulo index].  U and I are used to create Union and
Intersection Sieves. Sieves may also be nil, though are factored out when a
Sieve is simplified, and generates no sequence when gen-sieve is called.

Code Consulted:
* C Code from "Sieves" article below.
* athenaCL (http://www.flexatone.org/athena.html)
* Music21 (http://web.mit.edu/music21/)

Literature:
* Xenakis and Rahn. "Sieves". Perspectives of New Music, Vol. 28, No. 1
(Winter, 1990), pp. 58-78.
* Xenakis. "Formalized Music". pp. 268-288.
```

### ->Intersection

`(->Intersection l r)`
```Positional factory function for class score.sieves.Intersection.
```

### ->Union

`(->Union l r)`
```Positional factory function for class score.sieves.Union.
```

### analyze-sieve

`(analyze-sieve pts)`
```Analyzes the formula of the sieve for a given sequence pts of number
values.  Sequence pts should be finite.

Returns a map containing:

* :analysis - vector of sieve vectors containing [modulus index
points-covered].
* :sieve - Union sieve of analysis vectors
* :period - period of the sieve```

### gen-sieve

`(gen-sieve n sieve)``(gen-sieve sieve)`
```Generate sequence using sieve. Can optionally provide number n of elements
to produce.```

### I

`(I & sieves)`
```Create new sieve that is the intersection of sieves
```

### map->Intersection

`(map->Intersection m__6522__auto__)`
```Factory function for class score.sieves.Intersection, taking a map of keywords to field values.
```

### map->Union

`(map->Union m__6522__auto__)`
```Factory function for class score.sieves.Union, taking a map of keywords to field values.
```

### Sieve

#### protocol

```Protocol for Sieves
```

### element?

`(element? s n)`
```Determines if number n is an element of this Sieve
```

### normalize

`(normalize s)`
```Reduces Sieves in [mod index] form to its normalized form
```

### period

`(period s)`
```Returns the period of the Sieve.
```

### reduce-sieve

`(reduce-sieve s)`
```Reduces the Sieve to its simplest form
```

### simplified

`(simplified sieve)`
```Returns simplified (normalized and reduce) version of sieve
```

### U

`(U & sieves)`
```Create new sieve that is the union of sieves
```