2-node-supercomputer.net 2022-08-02

reduce(op,arr)

I was trying to explain the concept of the function reduce(op,arr) that takes an array arr and reduces it pairwise using the binary operator op until just one number is left.

For example, the sum() function can then be written

sum(arr) = reduce(+, arr)

To explain what reduce() does, I thought it would be nice to have a great graph, but I couldn’t find one online.

Thus, I attempted to make one myself using TikZ. I failed:

reduce