diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/resp.hpp | 1 | ||||
-rw-r--r-- | src/unify.cpp | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 8cdb75e..f4689a0 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -534,6 +534,7 @@ struct Subst : public list<Constraint> { if (s && t) { assert(s != t); push_back(Constraint(s, t)); } } static Subst compose(const Subst& delta, const Subst& gamma); + void augment(const Subst& subst); void add(const AST* from, const AST* to) { assert(from && to); push_back(Constraint(from, to)); diff --git a/src/unify.cpp b/src/unify.cpp index a7f7822..48ae1dd 100644 --- a/src/unify.cpp +++ b/src/unify.cpp @@ -85,6 +85,16 @@ substitute(const AST* in, const AST* from, const AST* to) return ret.head; } +void +Subst::augment(const Subst& subst) +{ + for (Subst::const_iterator s = subst.begin(); s != subst.end(); ++s) { + if (!contains(s->first)) { + add(s->first, s->second); + } + } +} + /// Compose two substitutions (TAPL 22.1.1) Subst Subst::compose(const Subst& delta, const Subst& gamma) |