Created
February 8, 2020 02:14
-
-
Save staydecent/6667a0a13f574892567c4c0dcd95d9d9 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 seq = (...args) => input => args.reduce((acc, el) => el(acc), input) | |
const cons = (a, b) => fn => fn(a, b) | |
const car = pair => pair((a, b) => a) | |
const cdr = pair => pair((a, b) => b) | |
const render = Comp => seq(car(Comp), cdr(Comp)) | |
const App = cons(state => state.count, count => `Count ${count}`) | |
console.log( | |
render(App)({count: 2}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment