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
8
9
10
11
12
13
14
15
def sq_plus_one(n: int) -> int:
    def helper(x: int) -> int:
        sq = x * x
        return sq + 1

    return helper(n)


def clamped(n: int) -> int:
    def guard(x: int) -> int:
        if x < 0:
            return 0
        return x

    return guard(n)