Package: matchr 0.1.0
matchr: Pattern Matching and Enumerated Types in R
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.
Authors:
matchr_0.1.0.tar.gz
matchr_0.1.0.zip(r-4.5)matchr_0.1.0.zip(r-4.4)matchr_0.1.0.zip(r-4.3)
matchr_0.1.0.tgz(r-4.4-any)matchr_0.1.0.tgz(r-4.3-any)
matchr_0.1.0.tar.gz(r-4.5-noble)matchr_0.1.0.tar.gz(r-4.4-noble)
matchr_0.1.0.tgz(r-4.4-emscripten)matchr_0.1.0.tgz(r-4.3-emscripten)
matchr.pdf |matchr.html✨
matchr/json (API)
# Install 'matchr' in R: |
install.packages('matchr', repos = c('https://cmann3.r-universe.dev', 'https://cloud.r-project.org')) |
This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.
Last updated 3 years agofrom:e28e696695. Checks:OK: 3 NOTE: 4. Indexed: yes.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Oct 26 2024 |
R-4.5-win | NOTE | Oct 26 2024 |
R-4.5-linux | NOTE | Oct 26 2024 |
R-4.4-win | NOTE | Oct 26 2024 |
R-4.4-mac | NOTE | Oct 26 2024 |
R-4.3-win | OK | Oct 26 2024 |
R-4.3-mac | OK | Oct 26 2024 |
Exports:%.%%fn%Enumenum_typeErrfallthroughinto_optioninto_resultis.enumis.enum_typeis.erris.noneis.okis.someis.variantMatchmatch_condMatchplyOkSomeTryunwrapunwrap_orvariant
Dependencies:rlang
Readme and manuals
Help Manual
Help page | Topics |
---|---|
Compose Functions | %.% |
Create Function | %fn% |
Extract Result or Return | !.Option !.Result bang |
Create Enumerated Type | Enum |
Enum Type | enum_type |
Create an 'Err' Result | Err |
Fall Through Match | fallthrough |
Convert Object into Option | into_option |
Convert Object into Result | into_result |
Is Object an Enum | is.enum |
Check Enum Type | is.enum_type |
Check if Result is an Err | is.err |
Check if Option is None | is.none |
Check if Result is Ok | is.ok |
Check if Option is Some | is.some |
Check Enum Variant | is.variant |
Match Value Against Multiple Values | Match |
Check and Evaluate Match Condition | match_cond |
Match Each Object in List or Vector | Matchply |
None | None |
Create an 'Ok' Result | Ok |
Option | Option |
Result | Result |
Create an 'Some' Option | Some |
Execute Expression as Result | Try |
Extract the Value Contained in Enum | unwrap unwrap_or |
Enum Variant | variant |