Memoize a currified function
const f = (arg1) => (arg2) => { /* returns something */ } Is it possible to memoize f with regard to the 2 arguments, namely: f(1)(2); f(1)(3); // Cache not hit f(4)(2); // Cache not hit f(1)(2); // Cache hit Nina Scholz You could take a Map as cache and take nested maps for all following arguments. This cache works for arbitrary count of arguments and reuses the values from the former calls. It works by taking a curried function and an optional Map . If the map is not supplied, a new map is created which serves as base cache for all other calls of the returned closure or the final result. The