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(())
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))
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]), ))
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, ))