Beispiel #1
0
def _pair_to_swipy_ref(item: Pair, swipy_ref, lit_var_store: Dict[Variable, int]):
    head = swipy.swipy_new_term_ref()
    tail = swipy.swipy_new_term_ref()

    _to_swipy_ref(item.get_left(), head, lit_var_store)
    _to_swipy_ref(item.get_right(), tail, lit_var_store)

    swipy.swipy_cons_list(swipy_ref, head, tail)
Beispiel #2
0
def _pair_to_pygp(p: Pair, lit_var_store: Dict[Variable, int]):
    left = _to_pygp(p.get_left(), lit_var_store)
    right = _to_pygp(p.get_right(), lit_var_store)

    functor = pygprolog.pygp_Find_Atom('.')
    if functor < 0:
        functor = pygprolog.pygp_Create_Allocate_Atom('.')

    args = [left, right]
    return pygprolog.pygp_Mk_Compound(functor, 2, args)