export function memoize(f) { const memo = {}; function g(...args) { if (!(args in memo)) { memo[args] = f(...args); } return memo[args]; } return g; }