G.3.1.1 Supported iterations over arrays

libmbfl-containers.bash implements multiple variations of iterations over a single array or multiple arrays.

Left iteration

An operator is applied slot–by–slot to values from one or more arrays, left–to–right: first values from slots ‘0’, then values from slots ‘1’, and so on.

Right iteration

An operator is applied slot–by–slot to values from one or more arrays, right–to–left: first values from the ultimate slots, then values from the penultimate slots, and so on.

Multi iteration

An operator is applied slot–by–slot to values from the homologous slots of indexed arrays themselves stored in an indexed array, which is usually named ARRYS.

Foreach iteration

An operator is applied slot–by–slot to every value from one or more source arrays; the purpose of the application is to generate some side effects.

Map iteration

An operator is applied slot–by–slot to every value from one or more source arrays; the purpose of the application is to compute values which are stored in a result array.

Fold iteration

An operator is applied slot–by–slot to every value from one or more source arrays in such a way that a result value is “accumulated”; the purpose of the application is to compute the accumulated value. The accumulator has an initial value, which is composed with values from the slots.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.