06 :: Functional programming for art and science


The sixth section is also an art class, this time focused on writing functions and using the functional programming toolkit in the purrr package. At the beginning the focus is on material for beginners: how to write a function and what the parts of a function are. Through the middle sections the discussion looks at how to write the functions necessary to make the “ashtree” system work, and how to organise those functions in a sensible way. The final sections provide an (minimal) introduction to purrr, and a (very) cursory discussion of scoping rules in R. Also it makes art!