memo2<A, B, R> function

R Function(A, B) memo2<A, B, R>(
  1. R f(
    1. A,
    2. B
    )
)

memo-ize the given function, caching the return result.

Implementation

R Function(A, B) memo2<A, B, R>(R Function(A, B) f) {
  final mf = memo1((A a) => memo1((B b) => f(a, b)));
  return (A a, B b) => mf(a)(b);
}