Hi all,
Match.jl provides both simple and advanced pattern matching capabilities
for Julia. Features include:
- Matching against most data types
- Deep matching within data types and matrices
- Variable binding within matches
Usage generally looks like this:
using Match
@match item begin
pattern1 => result1
pattern2, if cond end => result2
pattern3 || pattern4 => result3
_ => default_result
end
Docs can be found at https://matchjl.readthedocs.org/en/latest/, and the
repository is at https://github.com/kmsquire/Match.jl.
Version 0.1.0 of Match.jl fixes a few long-standing bugs (and removes some
undesirable code). In the process of cleaning things up, matching against
regular expressions with named captures was removed. While I rather liked
the functionality (it was one of the reasons I created Match.jl), it relied
on `eval` to find global Regex definitions, which caused a number of other
issues. (In my defense, I wrote that code long before I understood the
relationship between macros and eval.)
I doubt there were many people using Match with regular expression
matching, but if you rely on that functionality, you might want to pin
`Match.jl` at v0.0.6, at least until you update your code.
Cheers!
Kevin