Julio Sergio Santana gmail.com> writes:
> ...
> Producer <- function(f) function(x) 1/f(x)
>
Counsulting a previous post, I got to the solution, I just need to rewrite
the function Producer forcing it to eavaluate its argument, as follows
Producer <- function(f) {f ;function(x) 1/f(x)
Let's say I define a simple list of functions, as follows
lf <- list(
function(x) x+5,
function(x) 2*x
)
Then I can take any individual function from the list and
use it with any value, as it is shown:
lf[[1]](3)
[1] 8
lf[[2]](3)
[1] 6
this gives me
2 matches
Mail list logo