Scripting reference · Nerdamer Language

each

Evaluates a body once for each value in a parser container.

each(container,value,body) traverses a Vector, Matrix, ValuesSet, Collection, or Dictionary and binds each visited value to the supplied local variable while the body runs.

Matrices are traversed in row-major order. The iteration variable is local to each body evaluation.

Examples

These examples use Nerdamer Scripting.

Accumulate values from a Vector.

block(total:0,each([1,2,3],x,total:total+x),total)
// → 6

Interfaces

The same operation is available through the interfaces below.

Nerdamer Scripting

Nerdamer Scripting

Use this form in Nerdamer Scripting input passed to nerdamer(...).

each(container, value, body)

Parameters

  • container — Vector, matrix, set, collection, or dictionary to traverse.
  • value — Local variable bound to the current value.
  • body — Deferred body evaluated for each value. Matrices are traversed in row-major order.

← Back to Nerdamer Scripting