Created
October 29, 2017 13:27
-
-
Save nhz-io/3ee1d477ae3be376d8e58ba95ee5985b to your computer and use it in GitHub Desktop.
Magic pipe
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
const $ = (...fs) => { | |
const g = (fs, f = fs.shift(), n = f.length, a = []) => | |
x => (--n > 0) | |
? g(fs, f, n, [...a, x]) | |
: fs.length ? g(fs)(f(...a, x)) : f(...a, x) | |
return g(fs) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment