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-bool-key-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/bool-key.fab (canonical · concept)#

# A body may return a bool key: ascending puts the false group first and
# descending the true group first, ties keeping source order; the binder is let.
main {
    let list<int> xs ← [3, 1, 2, 4]
    print sort via asc from xs let x { return x % 2 ≡ 0 }
    print sort via desc from xs let x { return x % 2 ≡ 0 }
}

Expected output:

[3, 1, 2, 4]
[2, 4, 3, 1]