Automated storage and retrieval of results for Julia functions calls. ReusableFunctions is a module of MADS.
import Pkg; Pkg.add("ReusableFunctions")
import ReusableFunctions
function f(x)
@info("function f is executed!")
sleep(1)
return x
end
f_reuse = ReusableFunctions.maker3function(f);
julia> f(1) # normal function call
[ Info: function f is executed!
1
# function call using ReusableFunctions function
# the first time f_reuse() is called the original function f() is called
julia> f_reuse(1)
[ Info: function f is executed!
1
# function call using ReusableFunctions function
# the second time f_reuse() is called he original function f() is NOT called
# the already stored output from the first call is reported
julia> f_reuse(1)
1
ReusableFunctions functions are documented at https://madsjulia.github.io/Mads.jl/Modules/ReusableFunctions