match method
Attempts to unify this node with other, returning variable bindings or null.
Implementation
@override
Map<Variable, Node>? match(Node other) {
if (other is Term) {
if (name != other.name) {
return null;
}
if (arguments.length != other.arguments.length) {
return null;
}
return [arguments, other.arguments]
.zip()
.map((arg) => arg[0].match(arg[1]))
.fold(_newBindings(), _mergeBindings);
}
return other.match(this);
}