Return t as a list.

def getList(x):
    """
    Return t as a list.
    """

    t = PL_copy_term_ref(x)
    head = PL_new_term_ref()
    result = []
    while PL_get_list(t, head, t):
        result.append(getTerm(head))
        head = PL_new_term_ref()

    return result