Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ordered set operations? #70

Open
mars0i opened this issue Jun 24, 2022 · 0 comments
Open

Add ordered set operations? #70

mars0i opened this issue Jun 24, 2022 · 0 comments

Comments

@mars0i
Copy link

mars0i commented Jun 24, 2022

Since, as noted in the ordered-set docstring, clojure.set/union and other operations in clojure.set may reorder elements for efficiency, perhaps it would be useful for ordered to include (less efficient?) set operations that preserve order. For example, I needed to preserve order with union, so I am using this definition (which might also be called "union"):

(defn multi-conj
  "Successively conj each element of ys onto xs."
  [xs ys]
  (reduce (fn [newxs y] (conj newxs y))
          xs ys))

(I need it for two-element sets on the right, so efficiency shouldn't be an issue in my case.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant