[det]list_to_set(+List,
?Set)True when Set has the same elements as List in the
same order. The left-most copy of duplicate elements is retained. List
may contain variables. Elements E1 and E2 are considered
duplicates iff E1 ==
E2 holds. The complexity
of the implementation is N*log(N)
.
- Errors
- List is type-checked.
- See also
- sort/2 can be used to
create an ordered set. Many set operations on ordered sets are order N
rather than order N
**
2. The list_to_set/2
predicate is more expensive than sort/2
because it involves, two sorts and a linear scan.
- Compatibility
- Up to version 6.3.11, list_to_set/2
had complexity N
**
2 and equality was tested using =/2.