Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,19 @@
import gleam/int
import gleam/list
import gleam/order.{type Order, Lt}
pub fn quick_sort(xs: List(a), compare: fn(a, a) -> Order) -> List(a) {
case xs {
[] -> []
[x, ..xs] -> {
let #(left, right) = list.partition(xs, fn(y) { compare(y, x) == Lt })
let ql = quick_sort(left, compare)
let qr = quick_sort(right, compare)
list.append(list.append(ql, [x]), qr)
}
}
}
pub fn main() {
[31, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8] |> quick_sort(int.compare) |> echo
}