Popularity
198 Stars
Updated Last
1 Year Ago
Started In
August 2013

Travis Build Status Appveyor Build Status Test Coverage PkgEval.jl Status on Julia 0.5 PkgEval.jl Status on Julia 0.6 Documentation Status

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.

Required Packages

No packages found.