One Pager Cheat Sheet
- Using
composition
, we can create apipe
function to call multiple functions and return a single output in a cleaner, more compact way. - We can simply
reduce()
an argument array of functions, each performing a different action according to their parameters and the result of the previous call.
This is our final solution.
To visualize the solution and step through the below code, click Visualize the Solution on the right-side menu or the VISUALIZE button in Interactive Mode.
xxxxxxxxxx
pipe([
times(2),
subtract(3),
divide(4)
])
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment
That's all we've got! Let's move on to the next tutorial.
If you had any problems with this tutorial, check out the main forum thread here.