Beispiel #1
0
def membero(x, coll):
    """ Goal such that x is an item of coll """
    if not isvar(x) and not isvar(coll):
        if x in coll:
            return success
        return (lany,) + tuple((eq, x, item) for item in coll)
    if isvar(x) and not isvar(coll):
        return (lany,) + tuple((eq, x, item) for item in coll)
    raise EarlyGoalError()
Beispiel #2
0
def test_isvar():
    assert not isvar(3)
    assert isvar(var(3))
Beispiel #3
0
def test_context_manager():
    with variables(1):
        assert isvar(1)
    assert not isvar(1)