A Clojure library providing ordered sets and maps that maintain insertion order of elements.
Ordered is a Clojure library that provides ordered sets and maps—persistent data structures that maintain the insertion order of their elements. It solves the problem of needing predictable iteration order in collections where standard Clojure sets and maps don't guarantee ordering. The library offers drop-in replacements for standard collections with added ordering guarantees.
Clojure developers who need predictable iteration order in their collections, particularly those working on serialization, UI rendering, or algorithms where element sequence matters.
Developers choose Ordered because it provides simple, pure-Clojure implementations of ordered collections that integrate seamlessly with existing Clojure code. Unlike rolling custom solutions, it offers battle-tested data structures with predictable behavior and no external dependencies.
Ordered sets and maps, implemented in pure clojure
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Sets and maps maintain exact insertion order, ensuring consistent iteration for tasks like serialization or UI rendering, as demonstrated in the README examples.
Adding an existing element does not change its position, preventing unintended order shifts, shown in the stable insertion behavior for both sets and maps.
Implemented entirely in Clojure with no external dependencies, making integration straightforward and reducing library conflicts in Clojure projects.
Removing and re-adding an element places it at the end, maintaining consistency with the insertion order model, as illustrated in the re-insertion examples.
Only provides insertion-order preservation, lacking support for sorted collections, which may require additional libraries or manual sorting for key- or value-based ordering.
As a pure Clojure implementation, it may not match the performance of Java's built-in ordered collections like LinkedHashMap, especially for large datasets or frequent mutations.
Does not offer thread-safe versions, necessitating external synchronization mechanisms for concurrent use, which can add complexity in multi-threaded applications.