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
# PMAT-502co (Tranche 2): no-arg str.split() — whitespace split (collapses
# runs of whitespace, drops empty fields), like Rust's split_whitespace.
def word_count(s: str) -> int:
    return len(s.split())


def first_word(s: str) -> str:
    parts = s.split()
    return parts[0]