4 ms·
We can just cut straight to “why is function composition backwards?”
by ves 8y ago
We can just cut straight to “why is function composition backwards?”
- gnulinux 8y ago`(root (mean (square x)))` Is this more readable? `x ~> square . mean . root` Where `~>` "sends" a value to a function `x ~> f := f(x)` and `.` is the "backwards" function composition `f . g := \x (g (f x)) I think I prefer the "backwards" notation ("root mean square"), but I can see the appeal of "square mean root"
- Silfen 8y agoI like having both notations at my disposal. For example, F#'s forward pipe operator[0], or pipes from a unix shell. [0]https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/functions/index#function-composition-and-pipelining https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...
- drbojingle 8y agoIt's not backwards. The text is linear, but the code isn't. It's outer most nested function to the innermost nested function. Makes most sense if you think of HTML <html> <body> <div> </div> </body> </html> would compose as compose( html, body, div )