xpile 0.1.615

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
6
7
8
9
10
11
12
13
def srt(xs: list[float]) -> list[float]:
    # `sorted()` over a float list previously emitted `Vec<f64>::sort()`, which
    # fails to compile (f64: Ord not satisfied). Now uses `sort_by(partial_cmp)`.
    return sorted(xs)


def srt_rev(xs: list[float]) -> list[float]:
    return sorted(xs, reverse=True)


def srt_int(xs: list[int]) -> list[int]:
    # int list keeps the plain `.sort()` — must remain unchanged.
    return sorted(xs)