MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / cached_fn

Function cached_fn

Python/CP_Templates.py:163–170  ·  view source on GitHub ↗
(fn, *args)

Source from the content-addressed store, hash-verified

161
162
163def cached_fn(fn, *args):
164 global memory
165 if args in memory:
166 return memory[args]
167 else:
168 result = fn(*args)
169 memory[args] = result
170 return result
171
172
173def ncr(n, r):

Callers 2

fibonacci_modPFunction · 0.85
factorial_modP_WilsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected