Created
August 23, 2016 14:38
-
-
Save skatenerd/6fc88253708c36f01e9a1919384bb3db to your computer and use it in GitHub Desktop.
pipeline vs composition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- pipelining | |
let x = 1 | |
doubled = x * 2 | |
squared = doubled * doubled | |
decremented = squared - 1 | |
in decremented | |
-- composition | |
let x = 1 | |
double = (*) 2 | |
square x = x * x | |
decrement x = x - 1 | |
in (decrement . square . double) x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@raganwald, Thanks for responding!
I'm not sure I understand the distinction. In this case, both
let
statements could just be the body of a first-class function, which could be named, passed around, composed, etc.Maybe this example is just too small.