This is a short post showing an implementation of map, filter, and reduce using generic in Go.
Map creates a new slice and populates it with the results of calling the provided function on every element in input slice.
Filter returns a new slice that contains elements from the input slice which return
true when they’re passed as a parameter to the provided testing function.
Reduce runs a reducer function (the provided function) over all elements in the array, in ascending-index order, and accumulates them into a single value.
Every time, the return value of the reducer function is passed again to the next invocation of the function as the accumulator. Reduce returns the final value of the accumulator.