[R] [R-pkgs] lambda.r 1.1.0 on CRAN

Brian Lee Yung Rowe rowe at muxspace.com
Mon Jan 21 19:34:38 CET 2013


Dear useRs,

I'm pleased to announce that version 1.1.0 of lambda.r is now available on CRAN (http://cran.r-project.org/web/packages/lambda.r/). This package provides a complete functional programming environment within R (and is backwards compatible with S3). Lambda.r introduces many concepts including:

. Multipart function definitions
. Guard statements to control execution of functions
. Pattern matching in function definitions
. An intuitive type system
. Optional strong typing via type constraints
. Type variables
. Cleaner syntax for attributes

Using these techniques, systems can be written more efficiently and with less headache. Here is a brief example of what you can do with lambda.r.

fib(n) %::% numeric : numeric
fib(n) %when% { n < 0 } %as% { stop("Negative numbers not allowed") }
fib(0) %as% 1
fib(1) %as% 1
fib(n) %as% { fib(n-1) + fib(n-2) }

> fib(-1)
Error in function (n)  : Negative numbers not allowed
> fib(5)
[1] 8

Documentation is available at the following locations:
. http://cartesianfaith.wordpress.com/category/r/lambda-r/
. https://github.com/muxspace/lambda.r

A more complete discussion on why analytical systems should be designed using functional programming principles will be available in my forthcoming book on functional programming and computational finance. 

Warm Regards,
Brian Rowe
_______________________________________________
R-packages mailing list
R-packages at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages



More information about the R-help mailing list