Reduction over one-dimensional arrays

Uses:
- One-dimensional arrays
- Functions of several arguments

The reduction of a function over a one-dimensional array is written as:
s:𝕊, reduce((s, s) s, Array1D(s)) : s

For array literals, it is implemented in Pharo:
s_:𝕊, f:((s_, s_) s_), a:Array1D(s_), reduce(f, a) ⇒ Pharo:"a ensureArrayTerm. a reduceFn: f reducer: reducer"

Example

Uses example Integers

The sum of an integer array is obtained as
example reduce(sum, {[1, 2, 3]}) ⇒ 6
with
example sum : (ℤ, ℤ)
example sum[a:, b:] ⇒ a + b

Reduction over an array with a single element is a valid edge case:
example reduce(sum, {[2]}) ⇒ 2

Reduction over an empty array is not defined:
example reduce(sum, {[]}) ⇒ reduce(sum, {[]})