DEV Community

Discussion on: JS Functional Concepts: Pipe and Compose

 
dmass profile image
Douglas Massolari

Yes, but even in Javascript this concept can be different as you can see in fp-ts’ pipe.

I love coding in Elm! It is my first option when creating a Frontend.

From what I see, it seems some companies are adopting it, so, it seems it’s growing

Thread Thread
 
joelbonetr profile image
JoelBonetR πŸ₯‡ • Edited

I picked the mathematical explanation for function composition:

In abstract algebra, a composite function is a function formed by the composition or successive application of more than one function. To do this, the function closest to the argument is applied to the argument, and the next function is applied to the result of the previous calculation.

in which case, this will fit in the description:

compose(function3, function2, function1)(initialArg);
Enter fullscreen mode Exit fullscreen mode

The implementation details or nuances in Elm (or any other) is a different matter of discussion 😁

BTW glad to hear Elm it's getting a bit more love!

Thread Thread
 
dmass profile image
Douglas Massolari

You are right.
But the point of my comment is pipe.
This is the one that have different implementations.
I just highlighted that the affirmation β€œpipe is the same as composition but reversed” is not always true

Thread Thread
 
joelbonetr profile image
JoelBonetR πŸ₯‡

oh! understood now 😁 my bad

Some comments have been hidden by the post's author - find out more