Skip to content

Tag: memoization

Memoize a recursive Fibonacci function

I created a withMemo function that returns a memoized version of the provided function. How can I memoize this fibonacci function that works with recursion ? Indeed withMemo(fibo) doesn’t improve performance since the recursive calls inside fibo still point to the unmemoized version… So I have to …

memoizee – Cached based on arguments

I would like to memoize results of function based on provided arguments. For example: This invocations should be independent and should have standalone cached results. Currently I always receive the result from the first call. I tried used other library than memoizee. With fast-memoize I got expected effect, …

Memoize a curried function

Is it possible to memoize f with regard to the 2 arguments, namely: Answer 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. I…