# Unexpected semantics of library(ordsets) for ordered \_lists\_ (not sets)

**URL:** <https://swi-prolog.discourse.group/t/unexpected-semantics-of-library-ordsets-for-ordered-lists-not-sets/9549>\
**Category:** General\
**Created:** [March 20, 2026, 3:09pm UTC](https://swi-prolog.discourse.group/t/unexpected-semantics-of-library-ordsets-for-ordered-lists-not-sets/9549 "2026-03-20T15:09:32Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 23, 2026, 5:36pm UTC](https://swi-prolog.discourse.group/t/unexpected-semantics-of-library-ordsets-for-ordered-lists-not-sets/9549/27 "2026-03-23T17:36:46Z")

</div>

> [@peter.ludemann](#):
>
> Given that the code is old, doesn’t seem to be buggy, and does what you want, documenting that it works for multi-sets seems reasonable

I am inclined to disagree. ordsets is a nice consistent library that could be optimized a lot further, even completely rewriting it using low-level primitives. I’d rather keep this option open. Then, multisets are probably best represented as a list of pairs Term-Count and supported by a proper library.

Of course, anyone can take the risk and use the ordsets library beyond its documentation. A simple assertion/1 call in a directive could be enough to warn that things changed.

---

_[View the full topic](https://swi-prolog.discourse.group/t/unexpected-semantics-of-library-ordsets-for-ordered-lists-not-sets/9549)._
