MemoZ
MemoZ run recursive while memoizing anonymous function. MemoLoop is a macro to simplify it.
Installation
Adding memoz to your list of dependencies in mix.exs:
def deps do
[{:memoz, "~> 0.2.0"}]
endExample
function version
MemoZ.init(fn f -> fn
0 -> 0
1 -> 1
x -> f.(x-1) + f.(x-2)
end end).(100) #=> 354224848179261915075macro version
import MemoLoop
loop 100 do
0 -> 0
1 -> 1
x -> recur(x-1) + recur(x-2)
end #=> 354224848179261915075