memo4<A, B, C, D, R> function

R Function(A, B, C, D) memo4<A, B, C, D, R>(
  1. R f(
    1. A,
    2. B,
    3. C,
    4. D,
    )
)

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

Implementation

R Function(A, B, C, D) memo4<A, B, C, D, R>(R Function(A, B, C, D) f) {
  final mf = memo1(
      (A a) => memo1((B b) => memo1((C c) => memo1((D d) => f(a, b, c, d)))));
  return (A a, B b, C c, D d) => mf(a)(b)(c)(d);
}