From 7357353c6f526ae2d1c5a2884332be27b9f3698c Mon Sep 17 00:00:00 2001 From: Noah Bogart Date: Mon, 13 May 2024 15:11:44 -0400 Subject: [PATCH] Remove 'resolve' from ordered set See [#71](https://github.com/clj-commons/ordered/issues/71). `clojure.core/hash-unordered-coll` has been around since 1.6 and ordered only supports 1.8+ so there's no need to check for its existence anymore. --- CHANGELOG.md | 4 +++- src/flatland/ordered/set.clj | 9 +-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ced2c1a..c7493ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +* Remove use of `resolve` in ordered-set. [#71](https://github.com/clj-commons/ordered/issues/71) + ## 1.15.12 - 2024-05-13 -* Fix NPE when hashing ordered-set that contain `nil`. +* Fix NPE when hashing ordered-set that contain `nil`. [#73](https://github.com/clj-commons/ordered/issues/73) ## 1.15.11 - 2023-03-26 diff --git a/src/flatland/ordered/set.clj b/src/flatland/ordered/set.clj index 0257069..6b3bb04 100644 --- a/src/flatland/ordered/set.clj +++ b/src/flatland/ordered/set.clj @@ -9,13 +9,6 @@ (declare transient-ordered-set) -;; We could use compile-if technique here, but hoping to avoid -;; an AOT issue using this way instead. -(def hasheq-ordered-set - (or (resolve 'clojure.core/hash-unordered-coll) - (fn old-hasheq-ordered-set [^Seqable s] - (reduce + (map hash (.seq s)))))) - (deftype OrderedSet [^clojure.lang.IPersistentMap k->i ^clojure.lang.IPersistentVector i->k] IPersistentSet @@ -66,7 +59,7 @@ IHashEq (hasheq [this] - (hasheq-ordered-set this)) + (hash-unordered-coll this)) Set (iterator [this]