Last active
September 23, 2017 03:27
-
-
Save entyo/7a6b149ec59a15f3ff5d8995d6ddad8a to your computer and use it in GitHub Desktop.
JavaScriptで学ぶ関数型プログラミング
This file contains 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
function splat(fn) { | |
return array => { | |
return fn.apply(null, array); | |
}; | |
} | |
const addArrayElements = splat((x, y) => x + y); | |
// returns 3 | |
addArrayElements([1, 2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment