Previous | Next --- Slide 15 of 55
Back to Lecture Thumbnails
alrcdilaliaou

How does "reduce" get started? It appears that it only has a list of A, but its operator needs a B, which it doesn't have?

sirej

It is started with a default initial value depending on the datatype and operation. For adding ints, this value would be 0, and for multiplying ints, this value would be 1. You can think of reduce + being the same as fold 0 +.

Please log in to leave a comment.