- Documentation
- Reference manual
- Foreign Language Interface
- The Foreign Include File
- Constructing Terms
- PL_put_variable()
- PL_put_atom()
- PL_put_bool()
- PL_put_chars()
- PL_put_atom_chars()
- PL_put_string_chars()
- PL_put_string_nchars()
- PL_put_list_chars()
- PL_put_integer()
- PL_put_int64()
- PL_put_pointer()
- PL_put_float()
- PL_put_functor()
- PL_put_list()
- PL_put_nil()
- PL_put_term()
- PL_cons_functor()
- PL_cons_functor_v()
- PL_cons_list()
- Constructing Terms
- The Foreign Include File
- Foreign Language Interface
- Packages
- Reference manual
Availability:C-language interface function
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.