Fork me on GitHub
#clojure-dev
<
2020-07-12
>
andy.fingerhut13:07:51

I have written a few published research articles in the area of computer networking, but nothing that has been cited terribly often. I was looking at a site that keeps track of your articles and citations for a job application recently, and just today came across one I never expected: a research article that cites the Clojure cheat sheet! https://www.bjmc.lu.lv/fileadmin/user_upload/lu_portal/projekti/bjmc/Contents/6_1_02_Vanags.pdf

ikitommi16:07:59

Is this a bug or a feature?

(sort ["kikka" :kukka "kakka"])
;Execution error (ClassCastException) at java.util.TimSort/countRunAndMakeAscending (TimSort.java:355).
;class java.lang.String cannot be cast to class clojure.lang.Keyword (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Keyword is in unnamed module of loader 'app')

plexus06:07:58

clj-arrangement is useful for cases like this https://github.com/greglook/clj-arrangement

ikitommi12:07:53

thanks, just what I needed

Alex Miller (Clojure team)16:07:12

The default comparator won’t work across types

Alex Miller (Clojure team)16:07:35

So you would need to supply a comparator that could compare strings and keywords

andy.fingerhut17:07:37

Maybe more detail than you care to read in this article, including some speculative stuff at the end about a function that is 50% of the way towards a 'universal comparator': https://clojure.org/guides/comparators