Search in sources :

Example 11 with Compound

use of nars.term.Compound in project narchy by automenta.

the class SubtermsTest method testUnionReusesInstance.

@Test
public void testUnionReusesInstance() throws Narsese.NarseseException {
    Compound container = $("{a,b}");
    Compound contained = $("{a}");
    assertSame(Terms.union(container.op(), container, contained), container);
    assertSame(Terms.union(contained.op(), contained, container), container);
    assertSame(Terms.union(container.op(), container, container), container);
}
Also used : Compound(nars.term.Compound) Test(org.junit.jupiter.api.Test)

Example 12 with Compound

use of nars.term.Compound in project narchy by automenta.

the class SubtermsTest method testIntersectReusesInstance.

@Test
public void testIntersectReusesInstance() throws Narsese.NarseseException {
    Compound x = $("{x,y}");
    Compound y = $("{x,y}");
    assertSame(Terms.intersect(x.op(), x, y), x);
}
Also used : Compound(nars.term.Compound) Test(org.junit.jupiter.api.Test)

Example 13 with Compound

use of nars.term.Compound in project narchy by automenta.

the class SubtermsTest method testSomething.

@Test
public void testSomething() throws Narsese.NarseseException {
    Compound x = $("{e,f}");
    Compound y = $("{e,d}");
    System.out.println(Terms.intersect(x.op(), x, y));
    System.out.println(Op.difference(x.op(), x, y));
    System.out.println(Terms.union(x.op(), x, y));
}
Also used : Compound(nars.term.Compound) Test(org.junit.jupiter.api.Test)

Example 14 with Compound

use of nars.term.Compound in project narchy by automenta.

the class RevisionTest method testIntermpolation0b.

@Test
public void testIntermpolation0b() throws Narsese.NarseseException {
    Compound a = $.$("(a &&+3 (b &&+3 c))");
    Compound b = $.$("(a &&+1 (b &&+1 c))");
    permuteChoose(a, b, "[((a &&+1 b) &&+1 c), ((a &&+1 b) &&+5 c), ((a &&+3 b) &&+3 c), ((a &&+2 c) &&+1 b)]");
}
Also used : Compound(nars.term.Compound) Test(org.junit.jupiter.api.Test)

Example 15 with Compound

use of nars.term.Compound in project narchy by automenta.

the class RevisionTest method testIntermpolationOrderMixDternal2.

@Test
public void testIntermpolationOrderMixDternal2() throws Narsese.NarseseException {
    Compound a = $.$("(a &&+1 (b &&+1 (c &&+1 d)))");
    Compound b = $.$("(a &&+1 (b &&+1 (c&&d)))");
    permuteChoose(a, b, "[((a &&+1 b) &&+1 (c&&d))]");
}
Also used : Compound(nars.term.Compound) Test(org.junit.jupiter.api.Test)

Aggregations

Compound (nars.term.Compound)58 Test (org.junit.jupiter.api.Test)38 Term (nars.term.Term)20 Unify (nars.term.subst.Unify)3 FasterList (jcog.list.FasterList)2 XorShift128PlusRandom (jcog.math.random.XorShift128PlusRandom)2 Op (nars.Op)2 PatternCompound (nars.derive.PatternCompound)2 PatternIndex (nars.index.term.PatternIndex)2 Atomic (nars.term.atom.Atomic)2 Variable (nars.term.var.Variable)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 alice.tuprolog (alice.tuprolog)1 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Prioritized (jcog.pri.Prioritized)1 Narsese (nars.Narsese)1