Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function program() {
- return [[
- window.confirm, 'Have a good day?'],[
- (truthy, falsy, pred) => pred ? truthy : falsy, 'Great', 'Sorry'],[
- console.info
- ]]
- }
- function run(main) {
- const flatten = (args = []) => args.map(arg => Array.isArray(arg) ? run([arg])() : arg)
- return main
- .map(([fn, ...args]) => ([fn, ...flatten(args)]))
- .map(([fn, ...args]) => fn.bind(null, ...args))
- .reduce((thunk, suspend) => suspend.bind(null, thunk()))
- }
- run(program())()
Add Comment
Please, Sign In to add comment