Skip to content

Instantly share code, notes, and snippets.

@sahilseth
Created November 13, 2015 22:02
Show Gist options
  • Select an option

  • Save sahilseth/12fb77cb17a245a0ec5a to your computer and use it in GitHub Desktop.

Select an option

Save sahilseth/12fb77cb17a245a0ec5a to your computer and use it in GitHub Desktop.
list or functions in R
a<-1:5
fn<-lapply(a, function(i) {
force(i)
function(x) {
x * i
}
})
fn[[1]](1)
fn[[5]](1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment