Returns a function that determines if an expression matches the given pattern.
oryx.experimental.matching.matcher.matcher(
pattern: Any
) -> Matcher
matcher
is a single-dispatch function so its behavior can be overridden
for any type. Its default implementation uses Python equality to determine if
a pattern matches an expression.
Args |
pattern
|
A Python object that describes a set of expressions to match.
|
Returns |
A function that takes in three arguments: 1. an expression expr
to be matched against, 2. a dictionary mapping names to values bindings
that encapsulate the results of matches made up to this point, and 3.
succeed , a continuation function that takes in bindings and returns an
iterator. The function returns an iterator over bindings. By default, the
match is successful if expr matches pattern using Python equality. For
more details, refer to the matcher module docstring.
|