setReduce

Reduces a set to a single value by calling a function with an accumulator and each element.

setReduce(set, callback, initialValue) → returns any

Member Function Syntax

mySet.reduce(callback, initialValue)

This function requires Adobe ColdFusion 2025.0.8 and up.  Not supported on Lucee, etc.

Argument Reference

set any
Required

The set.

callback function
Required

Function that receives the accumulator and an element, and returns the new accumulator.

initialValue any
Required

The starting value of the accumulator.

Links more information about setReduce

Examples
Sample code invoking the setReduce function

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub