Skip to content

Instantly share code, notes, and snippets.

@MattMS MattMS/eat.md
Last active Mar 21, 2019

Embed
What would you like to do?
Simplify calling curried functions.

Eat

Use eat to simplify calling curried functions.

You can rewrite a(b)(c) as eat(a, b, c).

CoffeeScript

eat = (curries...)->
	curries = curries[0] if Array.isArray curries[0]
	curries.reduce (f, v)-> f v

EcmaScript

const eat = (...curries) => (Array.isArray(curries[0]) ? curries[0] : curries).reduce((f, v) => f(v));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.