The standard library provides a similar function, named reduce(), which does the same operation as fold. The difference between the two is that fold takes an explicit initial value, whereas reduce uses the first element from the list as the initial value.