# Programming

## Mapping leaves

Recursive functional programming

I love purrr.1 Aside from its anonymous function notation, one of the functions that made me love the package was at_depth, which iterates across a list at a specified level of nesting. It has since been deprecated in favor of modify_depth, which is more powerful, but is significantly more finicky.

## Anonymous Functions, Part II: gsubfn

gsubfn's as.function and fn\$* notation

I am a very heavy purrr user. The killer feature is clearly map_df (fairly recently rebranded as map_dfr and map_dfc for row and column binding, respectively) to iterate over a list à la lapply and simplify the result to a data frame. Thanks to the power of dplyr::bind_rows, it fixes all the drawbacks of sapply’s simplify2array behavior: