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
Related#
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]