Ben Cantrick (mackys) wrote,
Ben Cantrick

Map, Filter, Reduce: the Cliff Notes version.

A vast number computer algorithms can be expressed in terms of map, filter, and reduce operations.

* Map takes a list and a function and transforms each value by applying the function to each value.

* Filter takes a list and a predicate function (i.e. a function which returns a boolean value) and returns a new list containing only values for which the predicate returns false.

* Reduce takes a list and an associative function which combines two elements to produce a new value. The function is applied consecutively to values in the list pairwise until a single value is reached.

All three functions can be easily implemented in parallel. This observation forms the basis of the Google map-reduce project.

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.