Skip to content

Instantly share code, notes, and snippets.

@sw-samuraj
Created April 4, 2017 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sw-samuraj/dbe92816a7a7b208f102bf3b90149af4 to your computer and use it in GitHub Desktop.
Save sw-samuraj/dbe92816a7a7b208f102bf3b90149af4 to your computer and use it in GitHub Desktop.
An example of currying in Groovy for a blog post.
def spicy = { first, second, third ->
println "I like food with $first, $second and $third."
}
def curry = spicy.curry("curry")
def moreCurry = curry.curry("curry")
def curryAndChilli = moreCurry.curry("chilli")
curryAndChilli.call()
// prints:
// I like food with curry, curry and chilli.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment