There are five library files that are specifically concerned with list processing. They are
library(basics)
library(lists)
library(sets)
library(ordsets)
compare/3
in
the reference pages)
so as to be much more efficient than library(sets)
for any but the smallest
sets.
library(listparts)
As a general rule, if a predicate defined here has a counter
(a non-negative integer) as one of its arguments, it will suffice
for the counter argument to be instantiated. Otherwise, at least one of
the list arguments must be a proper list. Failing this, the
predicate may backtrack forever trying ever longer lists.
When you look at the code you will see that some of the library routines
use same_length/2
or same_length/3
to ensure termination.