Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def chained(functions):
  2. accumulator = None
  3.  
  4. def call_functions(unaryinput):
  5. if len(functions) == 0:
  6. return None
  7. accumulator = functions[0](unaryinput)
  8. for function in functions[1:]:
  9. accumulator = function(accumulator)
  10.  
  11. return accumulator
  12.  
  13. return call_functions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement