Skip to content

Instantly share code, notes, and snippets.

@timdeschryver
Created April 22, 2018 07:14
Show Gist options
  • Save timdeschryver/edb6ed0fa0b94780399e1a11f1c74952 to your computer and use it in GitHub Desktop.
Save timdeschryver/edb6ed0fa0b94780399e1a11f1c74952 to your computer and use it in GitHub Desktop.
carbon-example.js
const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj)
const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res)
const unfold = (f, seed) => {
const go = (f, seed, acc) => {
const res = f(seed)
return res ? go(f, res[1], acc.concat([res[0]])) : acc
}
return go(f, seed, [])
}
@orkhan55555
Copy link

Jsjsjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment