Re: improvements to fn:sort functions

> For correctness sake, I guess you meant,
> sort($data, (), function($key) { 0 - $key })

Both are possible; see [1] for more details on unary expressions.

> Wouldn't this be inefficient, as compared to having a native "descending" argument to the fn:sort function?

I can’t talk for all implementations, but it’s easily optimizable (in
BaseX, you shouldn’t note the difference)

[1] https://www.w3.org/TR/xpath-30/#id-arithmetic

Received on Saturday, 16 January 2021 08:35:08 UTC