Example #1
0
def isFunctionTerm(term):
    logging.debug('isFunctionTerm got ' + repr(term))
    pinp = shp.parseTerm(term.value())
    logging.debug('parseTerm {}'.format(repr(pinp)))
    if len(pinp) > 1:
        # yes it is
        dlvhex.output(())
Example #2
0
def functionDecomposeN(inp, N):
    logging.debug('functionDecomposeN got {} and {}'.format(repr(inp), N))
    pinp = shp.parseTerm(inp.value())
    logging.debug('parseTerm {}'.format(repr(pinp)))
    if len(pinp) == N + 1:
        otuple = [shp.shallowprint(x) for x in pinp]
        dlvhex.output(tuple(otuple))
Example #3
0
def functionDecompose(term, narg):
    logging.debug('functionDecompose got {} and {}'.format(repr(term), narg))
    pinp = shp.parseTerm(term.value())
    logging.debug('parseTerm {}'.format(repr(pinp)))
    argidx = narg.intValue()
    if argidx < len(pinp):
        dlvhex.output((shp.shallowprint(pinp[argidx]), ))
Example #4
0
def getArity(term):
    logging.debug('getArity got {}'.format(repr(term)))
    pinp = shp.parseTerm(term.value())
    logging.debug('parseTerm {}'.format(repr(pinp)))
    dlvhex.output((len(pinp) - 1, ))