Example #1
0
 ListTerm deleteFromList(int index, ListTerm l) {
   ListTerm r = new ListTermImpl();
   ListTerm last = r;
   int i = 0;
   for (Term t : l) {
     if ((i++) != index) last = last.append(t.clone());
   }
   return r;
 }
Example #2
0
 ListTerm deleteFromList(Term element, ListTerm l, Unifier un) {
   Unifier bak = un;
   ListTerm r = new ListTermImpl();
   ListTerm last = r;
   for (Term t : l) {
     boolean u = un.unifies(element, t);
     if (u) un = bak.clone();
     else last = last.append(t.clone());
   }
   return r;
 }