# Arrp Core Library: array

## slice(start, len, a)

A segment of array with length len and starting at index start.

b[i] = a[i + start], if i < len;

## reverse(a)

The reverse of array a.

b[i] = a[#a - 1 - i];

## iterate(f, init)

A stream starting with init and continuing with the result of application of unary function f on the previous element.

s[0] = init; s[i] = f(s[i-1]);

## scan(f, a)

An array of equal length as a, containing the results of repetitive applications of the binary function f on each element of a and the result of the previous such application.

b[0] = a[0]; b[i] = f(b[i-1], a[i]), if i < len;

## fold(f, a)

The result of repeated application of the binary function f on each element of a and the result of the previous such application.

b[#a-1] where { b[0] = a[0]; b[i] = f(b[i-1], a[i]); }

## map(f, a)

An array resulting from the application of a unary function f on each element of array a.

b[i] = f(a[i]);