From ad4ed220b6fe38ed4d40e58c90903568f88eae07 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 5 Mar 2023 21:22:29 -0500 Subject: [PATCH] Add sub_all_clause --- ir.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ir.py b/ir.py index 7c1b950..e6e2a06 100644 --- a/ir.py +++ b/ir.py @@ -181,6 +181,19 @@ Applies every substitution to the term in order kismesis(Karkat(), Karkat()) """ +sub_all_clause: Callable[[Substitutions, Clause], Clause] = uncurry2(c(p_map, cur2(sub_all))) #type:ignore +""" +Perform a series of substitutions on every term in a list + +Effectively calls `sub_all()` on every element of the list. + +>>> sub_all_clause( +... [Subst('x1', IRVar('Dave')), Subst('x2', IRProp('Karkat'))], +... [IRProp('dating', [IRVar('x1'), IRVar('x2')]), IRVar('x1')], +... ) +[dating(Dave(),Karkat()), Dave()] +""" + def unify(t1: IRTerm, t2: IRTerm) -> Result[Substitutions, UnificationError]: """ Attempt to find a substitution that unifies two terms