memo1<A, R> function
R Function(A)
memo1<A, R>(
- R f(
- A
memo-ize the given function, caching the return result.
Implementation
R Function(A) memo1<A, R>(R Function(A) f) {
final cache = HashMap<A, R>();
return (A a) => cache.putIfAbsent(a, () => f(a));
}