-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
universal comparator #103
Comments
I think using clojure.core/compare as stated in the documentation makes sense to me. Here as some odd facts about clojure.core/compare -- user> (instance? java.util.Comparator clojure.core/compare)
true
user> Yet it is defined just like any other function in core... -- all AFunction's are comparators. If you need to reverse the comparator then you can with a Comparator interface default function: user> (require '[tech.v3.datatype.argops :as argops])
nil
user> (require '[tech.v3.datatype :as dt])
nil
user> (argops/argsort (.reversed clojure.core/compare) ["ab" "bc"])
[1 0] So I don't think I want to add a dtype/functional wrapper for this as it seems reasonable to me. |
I guess if you knew the datatype of the incoming thing then you could choose a specific comparator to use and default to the code in the compare data. |
After fixing #99 some regression was introduced in tablecloth regarding comparison of any type. Till the last version, the following code was working.
<
or>
could be treated as an universal comparator.Is it possible to make a comparator which acts universally on every type or should I reach for Clojure comparator?
The text was updated successfully, but these errors were encountered: