Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

sort-nan-text-order-en

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Syntax:

Category#

collection

None.

Examples#

radix/corpus/sort/nan-text-order.fab (canonical · concept)#

# NaNs sort above every number by the IEEE total order, -0.0 before +0.0,
# and text orders by Unicode code point; each list is bound with let.
main {
    let list<float> xs ← [2.0, nan, 1.0, -1.0, nan, 0.0]
    print sort via asc from xs
    print sort via desc from xs
    let list<float> ys ← [0.0, -0.0]
    print sort via asc from ys
    let list<string> ts ← ["b", "É", "a", "B", "", "aa"]
    print sort via asc from ts
    print sort via desc from ts
}

Expected output:

[-1.0, 0.0, 1.0, 2.0, NaN, NaN]
[NaN, NaN, 2.0, 1.0, 0.0, -1.0]
[-0.0, 0.0]
["", "B", "a", "aa", "b", "É"]
["É", "b", "aa", "a", "B", ""]