Revision: 12646
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 23, 2009 11:12 by narkisr
Initial Code
def multiply = { x, y -> return x * y } // closure def triple = multiply.curry(3) // triple = { y -> return 3 * y } def quadruple = multiply.curry(4) // quadruple = { y -> return 4 * y } def composition = { f, g, x -> return f(g(x)) } def twelveTimes = composition.curry(triple, quadruple) def threeDozen = twelveTimes(3) println "threeDozen: ${threeDozen}" // threeDozen: 36
Initial URL
Initial Description
Clojsure composition in Groovy (functional style programing). @http://www.ibm.com/developerworks/java/library/j-pg08235/index.html
Initial Title
Closure composition in Groovy
Initial Tags
style, groovy
Initial Language
Groovy