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
def replace_first(s: str) -> str:
    # 3-arg replace: only the first occurrence.
    return s.replace("a", "X", 1)


def replace_two(s: str) -> str:
    return s.replace("o", "0", 2)


def replace_all(s: str) -> str:
    # 2-arg form is unchanged.
    return s.replace("z", "Z")