reduce1

Returns the combination of the elements of collection according to function.

An error is signaled if collection is empty.

reduce1 is similar to reduce, except that the first element of collection is taken as the initial value, and all the remaining elements of collection are processed as if by reduce.  (In other words, the first value isn’t used twice.)

For unstable collections, “first” element effectively means “an element chosen at random.”  Processing is done in the natural order for collection.

reduce1 (\+, #(1, 2, 3, 4, 5))
⇒ 15

Exported from

Modifiers

open

Arguments

functionAn instance of <function>.
collectionAn instance of <collection>.

Values

valueAn instance of <object>.
Returns the combination of the elements of collection according to function.
Returns the result of combining the elements of collection and initial-value according to function.
The common-dylan module.
Whenever possible, we have tried to keep the Dylan module pristine and unextended, preferring to add our extensions to separate modules or libraries.
The class of objects that can be applied to arguments.
The class of collections, aggregate data structures.
The class of all Dylan objects.