Aaron

Nice function composition
Download

Aaron Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • Brian Hicks
  • Publisher web site:
  • https://github.com/BrianHicks/

Aaron Tags


Aaron Description

Aaron is a Python module that adds some syntactic sugar to the Python function composition.How?Let's say you have the following functions:def add_one(n): return n + 1def double(n): return n * 2def ints_less_than(n): return range(1,n)def product(*ns): result = 1 for n in ns: result *= n return resultWith Aaron you could do something like this:def two_n_plus_one(n): return add_one(double(n))def product_of_lesser_numbers(n): return product(*ints_less_than(n))Or, you could use Aaron, decorate your functions with composable, and do this:two_n_plus_one = double > add_oneproduct_of_lesser_numbers = ints_less_than >> productYou've probably figured out by now that > is composition, and >> is will splat the results into the next function.Product's homepage


Aaron Related Software