If I evaluate something like (sort ["π₯" "π"]) in node SCI, what system is responsible for the sort? Is it happening in JS?
This is just using CLJS's sort function
cljs.core/sort
([coll] [comp coll])
Returns a sorted sequence of the items in coll. Comp can be
boolean-valued comparison function, or a -/0/+ valued comparator.
Comp defaults to compare.cljs.core/compare
([x y])
Comparator. Returns a negative number, zero, or a positive number
when x is logically 'less than', 'equal to', or 'greater than'
y. Uses IComparable if available and google.array.defaultCompare for objects
of the same type and special-cases nil to be less than any other object.The behavior seems to be the same in JS for this example
cljs.user=> (sort ["π₯" "π"])
("π" "π₯")
cljs.user=> (.sort #js ["π₯" "π"])
#js ["π" "π₯"]Thanks! Yes, itβs the same in JS, which led me to start thinking about this. But if I understand correctly it is not JS per se that is responsible for the sorting? I guess the unicode characters carry a collating order with them or something.
true, CLJS has its own sorting system as described in the docstrings