Functional Programming

From wikinotes

Documentation

gentle intro https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming

map/reduce

Functional programmers talk about pipelines, or map/reduce. This is simply a way of passing the same value through several functions.

import functools

def pipeline(data, fn_list):
    return functools.reduce(
         lambda a, x: map(x, a),  # run each fn on `data`, returning a new `data`
         fn_list,                 # list of functions to apply to `data`
         data                     # data being operated on
    )