public bool termEqual(object term)
 {
     term = YP.getValue(term);
     if (term is Functor1)
     {
         Functor1 termFunctor = (Functor1)term;
         return(_name.Equals(termFunctor._name) && YP.termEqual(_arg1, termFunctor._arg1));
     }
     return(false);
 }
        public bool lessThan(Functor1 functor)
        {
            // Do the equal check first since it is faster.
            if (!_name.Equals(functor._name))
            {
                return(_name.lessThan(functor._name));
            }

            return(YP.termLessThan(_arg1, functor._arg1));
        }
 /// <summary>
 /// If arg is another Functor1, then succeed (yield once) if this and arg have the
 /// same name and the functor args unify, otherwise fail (don't yield).
 /// If arg is a Variable, then call its unify to unify with this.
 /// Otherwise fail (don't yield).
 /// </summary>
 /// <param name="arg"></param>
 /// <returns></returns>
 public IEnumerable <bool> unify(object arg)
 {
     arg = YP.getValue(arg);
     if (arg is Functor1)
     {
         Functor1 argFunctor = (Functor1)arg;
         if (_name.Equals(argFunctor._name))
         {
             foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
             {
                 yield return(false);
             }
         }
     }
     else if (arg is Variable)
     {
         foreach (bool l1 in ((Variable)arg).unify(this))
         {
             yield return(false);
         }
     }
 }
Exemple #4
0
        public bool lessThan(Functor1 functor)
        {
            // Do the equal check first since it is faster.
            if (!_name.Equals(functor._name))
                return _name.lessThan(functor._name);

            return YP.termLessThan(_arg1, functor._arg1);
        }