View source on GitHub |
Constructs a rewrite rule from a pattern and handler function.
oryx.experimental.matching.rules.make_rule(
pattern: Any, handler
) -> Rule
Args | |
---|---|
pattern
|
Any object registered as a matcher. |
handler
|
A function that takes in bindings as keyword arguments and returns an expression. |
Returns | |
---|---|
A rule function that rewrites an expression if it matches pattern to the
expression returned by handler with the matched bindings. If there is
no match, it returns the expression unchanged.
|