12.4.3.5 Reading a list
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • The Foreign Include File
          • Analysing Terms via the Foreign Interface
            • Reading a list
              • PL_get_list()
              • PL_get_head()
              • PL_get_tail()
              • PL_get_nil()
              • PL_skip_list()
    • Packages
Availability:C-language interface function
int PL_skip_list(term_t +list, term_t -tail, size_t *len)
This is a multi-purpose function to deal with lists. It allows for finding the length of a list, checking whether something is a list, etc. The reference tail is set to point to the end of the list, len is filled with the number of list-cells skipped, and the return value indicates the status of the list:
PL_LIST
The list is a‘proper' list: one that ends in the list terminator constant and tail is filled with the terminator constant.
PL_PARTIAL_LIST
The list is a‘partial' list: one that ends in a variable and tail is a reference to this variable.
PL_CYCLIC_TERM
The list is cyclic (e.g. X = [a|X]). tail points to an arbitrary cell of the list and len is at most twice the cycle length of the list.
PL_NOT_A_LIST
The term list is not a list at all. tail is bound to the non-list term and len is set to the number of list-cells skipped.

It is allowed to pass 0 for tail and NULL for len.