def addTo = { Map m, String k, Object v -> m[k] = v } Map elements = [:] addTo elements, 'a', 1 def addTo2 = addTo.curry(elements) addTo2 'c', 3 assert elements == ['a':1, 'c':3]
Thursday, October 1, 2015
Groovy: Closure Currying Example
Really simple example of closure currying so I do not forget it and hope that it helps someone else:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment