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
14
15
# PMAT-502bh (Tranche 2): str.format with sequential {} placeholders.
def one(x: int) -> str:
    return "val={}".format(x)


def two(a: int, b: int) -> str:
    return "{} + {} done".format(a, b)


def with_str(name: str, n: int) -> str:
    return "{}: {}".format(name, n)


def escaped(x: int) -> str:
    return "{{literal}} {}".format(x)