fork download
  1. def pipe(*functions):
  2. def fn(*arguments):
  3. for func in functions:
  4. if isinstance(arguments, tuple):
  5. arguments = func(*arguments)
  6. else:
  7. arguments = func(arguments)
  8. return fn
  9.  
  10. a = pipe(lambda x: x ** 2, print)
  11. a(10)
Success #stdin #stdout 0.03s 8856KB
stdin
Standard input is empty
stdout
100