Skip to content

Instantly share code, notes, and snippets.

@fauxneticien
Created October 2, 2023 15:50
Show Gist options
  • Save fauxneticien/1ce71fc352c798025140e1dd3b3e1e50 to your computer and use it in GitHub Desktop.
Save fauxneticien/1ce71fc352c798025140e1dd3b3e1e50 to your computer and use it in GitHub Desktop.
Apply a list of functions to some input
from functools import reduce
input = 1
f1 = lambda i: i+1
f2 = lambda i: i+2
f3 = lambda i: i+3
output = reduce(lambda i, f: f(i), [f1, f2, f3], input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment