12.4.4 Constructing Terms
AllApplicationManualNameSummaryHelp

  • 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_uint64()
            • 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()
            • PL_put_dict()
    • Packages
Availability:C-language interface function
int PL_cons_functor(term_t -h, functor_t f, ...)
Create a term whose arguments are filled from a variable argument list holding the same number of term_t objects as the arity of the functor. To create the term animal(gnu, 50), use:
{ term_t a1 = PL_new_term_ref();
  term_t a2 = PL_new_term_ref();
  term_t t  = PL_new_term_ref();
  functor_t animal2;

  /* animal2 is a constant that may be bound to a global
     variable and re-used
  */
  animal2 = PL_new_functor(PL_new_atom("animal"), 2);

  PL_put_atom_chars(a1, "gnu");
  PL_put_integer(a2, 50);
  PL_cons_functor(t, animal2, a1, a2);
}

After this sequence, the term references a1 and a2 may be used for other purposes.