Skip to content

Instantly share code, notes, and snippets.

@allswellthatsmaxwell
Created October 10, 2015 16:06
Show Gist options
  • Save allswellthatsmaxwell/dba2a958b0d05b6abc8f to your computer and use it in GitHub Desktop.
Save allswellthatsmaxwell/dba2a958b0d05b6abc8f to your computer and use it in GitHub Desktop.
my.map <- function(l, f) {
ifelse(length(l) > 0,
append(f(l[[1]]),
my.map(l[-1], f)),
list())
}
my.map(list(1,2,3), identity) # returns list(1); should return list(1,2,3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment