qtspecs icon indicating copy to clipboard operation
qtspecs copied to clipboard

Parameters to fn:sort

Open michaelhkay opened this issue 11 months ago • 5 comments

An interesting suggestion made in passing in the thread discussing fn:ranks(). It would be possible to combine the collation argument and the ascending/descending argument of fn:sort into a single argument, whose value is an optional "ascending|descending" keyword followed by an optional collation URI (whitespace-separated, presumably).

This might seem a little bizarre at first sight, but having a list of collation URIs followed by a list of sort key functions followed by a list of ascending/descending keywords is also a little bizarre, and it would have two advantages - it would make better use of the second argument which is currently nearly always set to (), and it would put the two parts of the order specification (the collation and its direction) in closer proximity. After all, they are used in combination to decide whether one value precedes or follows another.

I'm not 100% convinced by the idea, but it seems worth considering. What do people think?

michaelhkay avatar Mar 14 '24 22:03 michaelhkay