Suggested docs change for list_to_ord_set/2

The docs for list_to_ord_set/2 don’t tell you that it also removes duplicates. If that’s inherent to the definition of a set in SWI-Prolog then adding a note that indicates that might be considered redundant. But for someone coming to the page that doesn’t know that about SWI-Prolog sets it might be helpful. My two cents:

http://www.swi-prolog.org/pldoc/man?section=ordsets

[trace] 58 ?- list_to_ord_set([c,d,a,c,d,e], X).
X = [a, c, d, e].

Actually, with set in most programming languages, duplicates are removed. This is not special to SWI-Prolog.

1 Like

I can’t think of any programming language or library where a “set” has duplicates. If you allow duplicates, it’s called a “bag” or “multiset”.
See also list_to_set/2.

1 Like