This library provides commonly accepted basic predicates for list manipulation in the Prolog community. Some additional list manipulations are built-in. Their description is in section 4.28.
?- flatten([a, [b, [c, d], e]], X). X = [a, b, c, d, e]
The set predicates listed in this section work on ordinary unsorted
lists. Note that this makes many of the operations order N^2.
For larger sets consider the use of ordered sets as implemented by
library ordsets.pl
, running most these operations in order N.
See section A.15.
?- list_to_set([a,b,a], X) X = [a,b]