shed CodeIndex for control predicates in disjuncts.rs (#1791)

This commit is contained in:
Mark
2023-08-06 01:26:01 -06:00
parent 094cf2ac5d
commit fad363e64a
2 changed files with 30 additions and 43 deletions

View File

@@ -830,30 +830,3 @@ pub fn unfold_by_str(mut term: Term, s: Atom) -> Vec<Term> {
terms.push(term);
terms
}
fn unfold_by_str_ref_once(term: &Term, s: Atom) -> Option<(&Term, &Term)> {
if let Term::Clause(_, ref name, ref subterms) = term {
if name == &s && subterms.len() == 2 {
let fst = &subterms[0];
let snd = &subterms[1];
return Some((fst, snd));
}
}
None
}
pub fn unfold_by_str_ref(mut term: &Term, s: Atom) -> Vec<&Term> {
let mut terms = vec![];
while let Some((fst, snd)) = unfold_by_str_ref_once(&term, s) {
terms.push(fst);
term = snd;
}
terms.push(term);
terms
}