I was oggling r-lib/fs today and my goodness would filesystem lenses be amazing.
ext_l <- lens(view = fs::path_ext, set = fs::path_ext_set)
dirn_l <- lens(view = dirname, set = function(d, x){
mapply(function(dir, rpl, pth) sub(dir, rpl, pth, fixed = TRUE)
, dirname(d), x, d, SIMPLIFY = FALSE)
})
with
left as an exercise for the reader
I was oggling r-lib/fs today and my goodness would filesystem lenses be amazing.
with
left as an exercise for the reader