Created
June 12, 2018 23:14
-
-
Save rjhilgefort/db05cabc94ce43c6361a2c70a0962b4f to your computer and use it in GitHub Desktop.
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
const { log } = console; | |
console.clear(); | |
const logHof = fn => (...args) => { | |
log('logHof') | |
log(args); | |
return fn(...args); | |
}; | |
const incrementHof = fn => (x, y) => { | |
log('incrementHof') | |
return fn(x + 1, y + 1); | |
} | |
const add2 = (x, y) => x + y; | |
const resultFn = compose( | |
logHof, | |
incrementHof, | |
)(add2); | |
resultFn(1, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment