char
**. The list is built tail-to-head. The PL_unify_*()
functions can be used to build a list head-to-tail.
void
put_list(term_t l, int n, char **words)
{ term_t a = PL_new_term_ref();
PL_put_nil(l);
while( --n >= 0 )
{ PL_put_atom_chars(a, words[n]);
PL_cons_list(l, a, l);
}
}
Note that l can be redefined within a PL_cons_list
call as shown here because operationally its old value is consumed
before its new value is set.