I have modified glue using purrr::partial and it works fine except when I try to using it together with purrr::map. There are multiple workaround but I'm confused on why this does not work?
library(purrr)
library(glue)
glue_css <- partial(glue, .open = "{{", .close = "}}")
a <- 5
glue_css("{{a}}") #OK
map(c("id1", "id2"), ~glue("{{.x}} {a}", .open = "{{", .close = "}}")) #OK
glue_css("{{a}} {a}") # OK
map(c("id1", "id2"), ~glue_css("{{.x}} {a}")) #.x not found
.envir = parent.frame()to thepartialfunction, otherwise it cannot access the environment where.xhas been defined.