Compose and Pipe Functions

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

Write two functions that chain other functions into one. pipe(...fns) returns a function that runs fns from left to right, each one getting the previous one's result. compose(...fns) does the same from right to left. The first function to run gets all the arguments, and the others get one value each. With no functions at all, the result just returns its first argument unchanged.

Your code must pass

  • pipe runs the functions left to right
  • compose runs the functions right to left
  • The first function to run gets every argument
  • With no functions, returns the first argument