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
from typing import Optional


def or_int(x: Optional[int]) -> int:
    return x or -1


def or_str(x: Optional[str]) -> str:
    return x or "default"


def or_via_get(d: dict[str, int], k: str) -> int:
    return d.get(k) or 99