Skip to content

madsjulia/ReusableFunctions.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReusableFunctions

Automated storage and retrieval of results for Julia functions calls. ReusableFunctions is a module of MADS.

Installation

import Pkg; Pkg.add("ReusableFunctions")

Example

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 the original function f() is NOT called
# the already stored output from the first call is reported
julia> f_reuse(1)
1

Documentation

ReusableFunctions functions are documented at https://madsjulia.github.io/Mads.jl/Modules/ReusableFunctions

Projects:

Publications, Presentations