private IEnumerable <Context> UnifySequences([NotNull] PairVar left, [NotNull] PairVar right) { if (left.IsEmpty || right.IsEmpty) { return(left.IsEmpty && right.IsEmpty ? Just(this) : Nothing); } return(Unify(left.Head(), right.Head()) .SelectMany(c => c.Unify(left.Tail(), right.Tail()))); }
private Var ReifyImpl([NotNull] PairVar pair) => pair.IsEmpty ? Kanrenmo.Var.Empty : new PairVar(Reify(pair.Head()), Reify(pair.Tail()));