Q:

Giving the list returned by purrr::map names

Is there a way to automatically give names to the returned list given by purrr:map? 
For example, I run code like this very often.
fn <- function(x) { paste0(x, "_") }
l <- map(LETTERS, fn)
names(l) <- LETTERS

I'd like for the vector that is being automated upon to automatically become the names of the resulting list.

A:

We can use imap
imap(setNames(LETTERS, LETTERS), ~ paste0(.x, "_"))

Or map with a named vector
map(setNames(LETTERS, LETTERS), ~ paste0(.x, "_"))

