Pattern Matching and Enumerated Types in R
Extract Result or Return
Create Enumerated Type
Enum Type
Create an 'Err' Result
Fall Through Match
Compose Functions
Create Function
Convert Object into Option
Convert Object into Result
Is Object an Enum
Check Enum Type
Check if Result is an Err
Check if Option is None
Check if Result is Ok
Check if Option is Some
Check Enum Variant
Match Value Against Multiple Values
Check and Evaluate Match Condition
Match Each Object in List or Vector
Create an 'Ok' Result
Create an 'Some' Option
Execute Expression as Result
Extract the Value Contained in Enum
Enum Variant
Inspired by pattern matching and enum types in Rust and many functional programming languages, this package offers an updated version of the 'switch' function called 'Match' that accepts atomic values, functions, expressions, and enum variants. Conditions and return expressions are separated by '->' and multiple conditions can be associated with the same return expression using '|'. 'Match' also includes support for 'fallthrough'. The package also replicates the Result and Option enums from Rust.