static F1 wrapF1WithCache(Map cache, final F1 f) { ret func(A a) -> B { B b = cache.get(a); if (b == null) cache.put(a, b = callF(f, a)); ret b; }; }