On Tuesday, 12 November 2013 at 15:56:25 UTC, Andrei Alexandrescu wrote:
On 11/12/13 12:54 AM, tn wrote:
...
An alternative would be to check for nans explicitly.

I think NaNs are singular unordered values that make invalid inputs for either sort or isSorted. We should simply add an assert to isSorted.

But sort and isSorted both allow user to provide a custom "less" function. What if the user needs NaNs and, for example, wants to sort them before all the other values? Then he calls "arr.sort!((a,b) => a < b || (isnan(a) && !isnan(b)))" and the code asserts?

Reply via email to