Skip to content

Commit

Permalink
No need for list_call anymore
Browse files Browse the repository at this point in the history
We evaluate only called arguments (using `match.call()`) and default
arguments.
  • Loading branch information
jimhester committed Apr 20, 2017
1 parent 70d959b commit 1b75a6f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions R/memoise.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ memoise <- memoize <- function(f, ..., envir = environment(f), cache = cache_mem
f_formal_names <- names(f_formals)
f_formal_name_list <- lapply(f_formal_names, as.name)

# list(...)
list_call <- make_call(quote(list), f_formal_name_list)

# memoised_function(...)
init_call_args <- setNames(f_formal_name_list, f_formal_names)
init_call <- make_call(quote(`_f`), init_call_args)
Expand Down Expand Up @@ -147,7 +144,7 @@ memoise <- memoize <- function(f, ..., envir = environment(f), cache = cache_mem
invisible(res$value)
}
},
as.environment(list(list_call = list_call, init_call = init_call)))
as.environment(list(init_call = init_call)))
)
formals(memo_f) <- f_formals
attr(memo_f, "memoised") <- TRUE
Expand Down

0 comments on commit 1b75a6f

Please sign in to comment.