Foldable


A value which has a Foldable must provide a reduce method. The reduce method takes two arguments:

xs.reduce(f, m)

Graphic

graph LR; A[Foldable]

Example:

Ramda:

const toArray xs => xs.reduce(
  (acc, x) => acc.concat([x]), []
)

u.reduce(f) === toArray(u).reduce(f)

Read More: