# Concatenation

This page will present you all the functions that can be used to concatenate (e.g. add) things together in various ways. Each function will be presented following the same model:

**Type signature**: how the function is declared on the**Haskell**side.**Description**: verbal description of the function.**Examples**: a small list of examples that you can copy/paste in your editor.

## #

Many cats### #

cat`cat`

, (also known as `slowcat`

, to match with `fastcat`

defined below) concatenates a list of patterns into a new pattern; each pattern in the list will maintain its original duration. For example:

##### caution

There is also a `slowcat`

function, perfectly similar to `cat`

. This function exists as a mirror of `fastcat`

.

### #

fastcat`fastcat`

works like cat above, but squashes all the patterns to fit a single cycle.

### #

timeCat`timeCat`

is like `fastcat`

except that you provide proportionate sizes of the patterns to each other for when they're concatenated into one cycle. The larger the value in the list, the larger relative size the pattern takes in the final loop. If all values are equal then this is equivalent to `fastcat`

(e.g. the following two code fragments are equivalent).

### #

randcat`randcat`

is similar to `cat`

, but rather than playing the given patterns in order, it picks them at random. For example:

## #

Append family### #

append`append`

combines two patterns into a new pattern, where cycles alternate between the first and second pattern:

It has the alias `slowAppend`

, in sympathy with `fastAppend`

, described below.

### #

fastAppend`fastAppend`

works like append described above, but each pair of cycles from the two patterns are squashed to fit a single cycle.

## #

wedge`wedge`

combines two patterns by squashing them into a single cycle. It takes a ratio as the first argument. The ratio determines what percentage of the pattern cycle is taken up by the first pattern. The second pattern fills in the remainder of the pattern cycle. For example:

## #

brak`brak`

makes a pattern sound a bit like a breakbeat. It does this by every other cycle, squashing the pattern to fit half a cycle, and offsetting it by a quarter of a cycle.

## #

listToPat`listToPat`

takes a list of things and turns them into a pattern where each item in the list becomes an event all happening in the same cycle, looping upon subsequent cycles. Can also be called as `fastFromList`

is equivalent to

## #

fromList`fromList`

takes a list of things and turns them into a pattern where each item in the list has a duration of one cycle, looping back around at the end of the list.

is equivalent to

## #

fromMaybes`fromMaybes`

is much like `listToPat`

but when it encounters a Nothing it puts a gap in the pattern and when it encounters Just x puts x in the pattern.

is equivalent to

## #

flatpat`flatpat`

takes a pattern of lists and flattens it into a pattern where all the events in each list happen simultaneously. For example, the following code uses flatpat in combination with listToPat to create an alternating pattern of chords.

This code is equivalent to:

## #

runThe `run`

function generates a pattern representing a cycle of numbers from `0`

to `n-1`

inclusive. Notably used to `run`

through a folder of samples in order:

The first parameter to run can be given as a pattern:

## #

scan`scan`

is similar to `run`

, but starts at 1 for the first cycle, adding an additional number each cycle until it reaches `n`

: