Skip to content

Instantly share code, notes, and snippets.

@dtinth
Created October 13, 2016 08:47
Show Gist options
  • Save dtinth/fad72fb92b22e66d9f26dec00e04c282 to your computer and use it in GitHub Desktop.
Save dtinth/fad72fb92b22e66d9f26dec00e04c282 to your computer and use it in GitHub Desktop.
const 管 = (a, f) => f(a)
const plus = (n) => (x) => x + n
const times = (n) => (x) => x * n
const ops = [ plus(1), times(2) ]
ops.reduce(管, 9) // 20
ops.reduceRight(管, 9) // 19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment