use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testVariableBinding5.
public void testVariableBinding5() {
Variable Anon = new Variable("_");
Term lhs = new Compound("p", new Term[] { Anon, Anon });
Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
Term goal = new Compound("=", new Term[] { lhs, rhs });
assertTrue("two references to an anonymous Variable can unify with differing atoms", new Query(goal).hasSolution());
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testVariableBinding4.
public void testVariableBinding4() {
Term lhs = new Compound("p", new Term[] { new Variable("_"), new Variable("_") });
Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
Term goal = new Compound("=", new Term[] { lhs, rhs });
assertTrue("two distinct anonymous Variables can unify with distinct atoms", new Query(goal).hasSolution());
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testAtomHasFunctorNameZero.
public void testAtomHasFunctorNameZero() {
String name = "sam";
Atom a = new Atom(name);
assertTrue("a text atom has a functor whose name is the name of the atom, and whose arity is zero", a.hasFunctor(name, 0));
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testVariableBinding2.
public void testVariableBinding2() {
Term lhs = new Compound("p", new Term[] { new Variable("X"), new Variable("X") });
Term rhs = new Compound("p", new Term[] { new Atom("a"), new Atom("b") });
Term goal = new Compound("=", new Term[] { lhs, rhs });
assertFalse("two distinct Variables with same name cannot unify with distinct atoms", new Query(goal).hasSolution());
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestOLD method test10j.
private static void test10j() {
Term l2 = Util.termArrayToList(new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
Query q9 = new Query(new Compound("append", new Term[] { new Variable("Xs"), new Variable("Ys"), l2 }));
Map<String, Term>[] s9s = q9.allSolutions();
System.err.println("test10j:");
for (int i = 0; i < s9s.length; i++) {
System.err.println(" append(Xs,Ys,[a,b,c,d,e]) -> " + Util.toString(s9s[i]));
}
System.err.println();
}
Aggregations