public override bool Unify(BaseTerm t, VarStack varStack) { if ((t = t.ChainEnd()) is Variable) // t not unified { ((Variable)t).Bind(this); varStack.Push(t); return(true); } if (t is ListPatternTerm && arity == t.Arity) // two ListPatternTerms match if their rangeTerms match { for (int i = 0; i < arity; i++) { if (!args[i].Unify(t.Args[i], varStack)) { return(false); } } return(true); } if (t is ListTerm) { pattern = args; // pattern is searched ... target = ((ListTerm)t).ToList(); // ... in target int ip = 0; int it = 0; return(UnifyTailEx(ip, it, varStack)); } return(false); }
public override bool Unify(BaseTerm t, VarStack varStack) { NextUnifyCount(); if (!((t = t.ChainEnd()) is ListPatternElem)) { return(false); // should never occur } #if old if (isNegSearch != ((ListPatternElem)t).isNegSearch) { return(false); } #endif for (int i = 0; i < arity; i++) { if (!((args[i] == null && t.Args[i] == null) || args[i].Unify(t.Args[i], varStack))) { return(false); } } return(true); }
public AltListTerm(string leftBracket, string rightBracket, BaseTerm t0, BaseTerm t1) : base(t0.ChainEnd(), t1.ChainEnd()) { isAltList = true; functor = leftBracket + ".." + rightBracket; this.leftBracket = leftBracket; this.rightBracket = rightBracket; }
public override bool Unify (BaseTerm t, VarStack varStack) { if ((t = t.ChainEnd ()) is Variable) // t not unified { ((Variable)t).Bind (this); varStack.Push (t); return true; } if (t is ListPatternTerm && arity == t.Arity) // two ListPatternTerms match if their rangeTerms match { for (int i = 0; i < arity; i++) if (!args [i].Unify (t.Args [i], varStack)) return false; return true; } if (t is ListTerm) { pattern = args; // pattern is searched ... target = ((ListTerm)t).ToList (); // ... in target int ip = 0; int it = 0; return UnifyTailEx (ip, it, varStack); } return false; }
public override bool Unify (BaseTerm t, VarStack varStack) { NextUnifyCount (); if (!((t = t.ChainEnd ()) is ListPatternElem)) return false; // should never occur #if old if (isNegSearch != ((ListPatternElem)t).isNegSearch) return false; #endif for (int i = 0; i < arity; i++) if (!((args [i] == null && t.Args [i] == null) || args [i].Unify (t.Args [i], varStack))) return false; return true; }