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
16
17
18
# PMAT-714: `"{}".format(x)` over a float/bool was rejected ("needs a spec"),
# though f"{x}" and str(x) produce the correct Python repr. The no-spec `{}` now
# wraps a float/bool arg in the f-string display conversion (float → `3.0`/`3.14`,
# bool → `True`/`False`) when the arg is referenced once.
def show_float(x: float) -> str:
    return "val={}".format(x)


def show_bool(b: bool) -> str:
    return "flag={}".format(b)


def whole_float(x: float) -> str:
    return "{}".format(x)


def mixed(n: int, x: float, s: str) -> str:
    return "{} {} {}".format(n, x, s)