Created
April 4, 2017 08:54
-
-
Save sw-samuraj/dbe92816a7a7b208f102bf3b90149af4 to your computer and use it in GitHub Desktop.
An example of currying in Groovy for a blog post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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