/ Published in: Groovy
URL: http://cromwellian.blogspot.com/2006/07/infinite-streams-in-groovy-in-my-last.html
This example shows how its possible to cache (memoization) a Closure value, note that this works only for a single value per each delay method call (the Closure creates a closed scope in which its "state" is kept).
Expand |
Embed | Plain Text
{ } } c = {v -> println 'hello' 1+v } d = delay(c)
You need to login to post a comment.
