-
-
Save lucaswerkmeister/84fb2b308421711e2e95 to your computer and use it in GitHub Desktop.
Additional info for ceylon/ceylon-compiler#2077
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
Result memoize<Result> | |
(Result() f, variable Result? memo=null)() | |
given Result satisfies Object | |
=> memo = memo else f(); | |
T printit<T>(T t) => let (_ = print("evaluated ‘`` t?.string else "<null>" ``’")) t; | |
shared void run() { | |
print(1); | |
value m = memoize(() => printit("value")); | |
print(2); | |
print(m()); | |
print(3); | |
print(m()); | |
print(4); | |
} |
quintesse
commented
Mar 24, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment