by Brian Rowe
The computational sciences are still learning the benefits of functional programming. Most users of R are familiar with object-oriented programming but have not been exposed to functional programming.
In this session I discuss why functional programming is important for the computational sciences in terms of modeling, program organisation, and reasoning about the correctness of a program. We will review the mechanics of lambda.r, a package I wrote that enables a functional programming style in the R language.
Using examples based on my work modeling consumer financial transactions, I will discuss when and why I use the various features of lambda.r, including multipart function definitions, guard expressions, type constraints and variables, and attributes in my models.
The session also explores practical uses of the lambda calculus to reason about numerical programs and show the equivalence between various forms. As R supports vectors natively, there are some surprising results that stem from this.
24th–25th October 2013