match method

  1. @override
Map<Variable, Node>? match(
  1. Node other
)
override

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);
}