Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View EEmery's full-sized avatar

Eduardo Emery EEmery

View GitHub Profile
@EEmery
EEmery / thread_functions.py
Last active May 18, 2021 07:29
Threading Functions with Python (Similar to Clojure's Threading Macro/Arrow Macro)
# Author: Eduardo Emery
#
# The function `thread_functions` below implements in Python a Clojure macro
# called "Threading", also known as "Arrow Macro". As explained in the guide,
# the macro "convert nested function calls into a linear flow of function
# calls, improving readability" (https://clojure.org/guides/threading_macros).
#
# The goal of `thread_functions` is to sequentially execute functions from a
# starting point, to improve readability. It receives an initial set of
# parameters and a set of functions. The initial parameters are applied to