Search in sources :

Example 36 with Op

use of nars.Op in project narchy by automenta.

the class EllipsisTest method testEllipsisInMinArity.

@Test
public void testEllipsisInMinArity() {
    Atomic a = Atomic.the("a");
    Ellipsis b = new EllipsisOneOrMore($.varPattern(1));
    for (Op o : Op.values()) {
        if (o.minSize <= 1)
            continue;
        if (o.statement)
            continue;
        if (o != DIFFe && o != DIFFi) {
            assertEquals(a, o.the(DTERNAL, a), o + " with normal term");
        } else {
            assertEquals(Null, o.the(DTERNAL, a));
        }
        assertEquals(o.statement ? VAR_PATTERN : o, o.the(DTERNAL, b).op(), o + " with ellipsis not reduced");
    }
}
Also used : Op(nars.Op) Ellipsis(nars.derive.match.Ellipsis) Ellipsis.firstEllipsis(nars.derive.match.Ellipsis.firstEllipsis) EllipsisOneOrMore(nars.derive.match.EllipsisOneOrMore) Atomic(nars.term.atom.Atomic) Test(org.junit.jupiter.api.Test)

Aggregations

Op (nars.Op)36 Term (nars.term.Term)13 Subterms (nars.subterm.Subterms)11 Nullable (org.jetbrains.annotations.Nullable)8 Atomic (nars.term.atom.Atomic)4 Test (org.junit.jupiter.api.Test)4 FasterList (jcog.list.FasterList)3 NAR (nars.NAR)3 Termed (nars.term.Termed)3 Atom (nars.term.atom.Atom)3 Bool (nars.term.atom.Bool)3 Pair (org.eclipse.collections.api.tuple.Pair)3 NotNull (org.jetbrains.annotations.NotNull)3 java.io (java.io)2 java.util (java.util)2 List (java.util.List)2 Map (java.util.Map)2 Stream (java.util.stream.Stream)2 nars.$ (nars.$)2 Concept (nars.concept.Concept)2