• Stars
    star
    238
  • Rank 168,932 (Top 4 %)
  • Language
    Julia
  • License
    Other
  • Created about 11 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Advanced Pattern Matching for Julia

Stable Dev Build Status Coverage

Advanced Pattern Matching for Julia

Features:

  • Matching against almost any data type with a first-match policy
  • Deep matching within data types and matrices
  • Variable binding within matches

For alternatives to Match, check out

Installation

Use the Julia package manager. Within Julia, do:

Pkg.add("Match")

Usage

The package provides one macro, @match, which can be used as:

using Match

@match item begin
    pattern1              => result1
    pattern2, if cond end => result2
    pattern3 || pattern4  => result3
    _                     => default_result
end

It is possible to supply variables inside pattern, which will be bound to corresponding values.

See the documentation for examples of this and other features.