xpile 0.1.616

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
# PMAT-502u (Tranche 2): list query methods xs.count(x) / xs.index(x) (int list).
def how_many(xs: list[int], x: int) -> int:
    return xs.count(x)


def first_at(xs: list[int], x: int) -> int:
    return xs.index(x)