Skip to content

Instantly share code, notes, and snippets.

@kohta
Created September 2, 2010 02:38
Show Gist options
  • Save kohta/561754 to your computer and use it in GitHub Desktop.
Save kohta/561754 to your computer and use it in GitHub Desktop.
f <- function(x){x**2}
fgen <- function(k){
return(function(x){
f(k*x)
})
}
generatedfuncs <- lapply(c(1:4),fgen)
evaluatedfuncs <- lapply(generatedfuncs,function(g){g(1)})
print(evaluatedfuncs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment