@Norm The following function calls should all yield the same result:
sort($input)
sort($input, keys := identity#1)
sort($input, keys := string-to-codepoints#1)
Instead of subtracting 0x110000, we could as well use the negative value:
sort($input, keys := fn { string-to-codepoints(.) ! (-.), 1 })
If we compare strings as a plain sequence of (codepoint) integers, it shouldn’t matter whether the subtracted value is legal Unicode. That’s no option, however, as soon as collations come into play.
@Liam
• I believe that Dimitre was looking for alternatives for his fn:ranks approach.
• I assume that most users will prefer sort($input, orders = 'descending') or reverse(sort($input)).
• We have added sort-with($input, $comparators) a short while ago.