Memoize.function: Memoize a function

View source: R/function.R

Memoize.functionR Documentation

Memoize a function

Description

Before each call of a function, check that the cache holds the results and returns it if available. Otherwise, compute f and cache the result for next evluations.

Usage

Memoize.function(fun, suffix = ".RcacheDiceView")

Arguments

fun

function to memoize

suffix

suffix to use for cache files (default ".RcacheDiceView")

Value

a function with same behavior than argument one, but using cache.

Examples

f=function(n) rnorm(n);
F=Memoize.function(f);
F(5); F(6); F(5)

DiceView documentation built on June 13, 2025, 5:08 p.m.