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
# PMAT-502ac (Tranche 2): map(lambda p: e, xs) -> materialized list of the
# transformed elements; result element type = the body's type.
def doubled(xs: list[int]) -> list[int]:
    return list(map(lambda x: x * 2, xs))


def lengths(words: list[str]) -> list[int]:
    return list(map(lambda w: len(w), words))


def to_floats(xs: list[int]) -> list[float]:
    return list(map(lambda x: float(x), xs))