A functional programming language extension for R with pattern matching, guard statements, and optional type safety.
Lambda.r is an R package that extends the R language with functional programming constructs, including pattern matching, guard statements, and an optional type system. It allows developers to write more expressive and reliable R code by enabling multi-part function definitions and type constraints, reducing boilerplate and improving code clarity.
R developers and data scientists who want to adopt functional programming patterns, write more declarative code, or add type safety to their R projects without leaving the R ecosystem.
Lambda.r provides a unique blend of functional programming features tailored for R, offering a syntax that is both familiar and powerful, with optional type checking that doesn't force a rigid type system, giving developers flexibility and control.
Functional programming in R
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables multi-part function definitions with literal matching, as shown in fib(0) %as% 1, reducing nested conditionals and improving code clarity.
Optional type constraints with %::% allow gradual adoption of type safety, letting developers enforce argument and return types without a rigid framework.
Provides declarative syntax for FP concepts like guard statements and composition, making code more modular and testable, as seen in monad examples.
Supports R features like optional arguments and ellipsis, allowing integration with existing code while adding FP enhancements.
Requires learning non-standard operators like %as% and %::%, which can be a barrier for developers accustomed to base R and increase initial setup time.
Standard debug() doesn't work; must use debug.lr and undebug.lr, adding steps and complexity to the debugging process, as noted in the README.
Pattern matching and type checking introduce abstraction layers that may slow down execution, making it less ideal for performance-sensitive applications.
Extensive use ties code to lambda.r, reducing portability and interoperability with packages expecting traditional R function definitions.