Bendtorch.OptState.map: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 69-76 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=69&end_line=76 import Base # Two affine maps are supplied separately: each is called at most once. A packed tree is the same under any relabelling # of the parameters (Lin <-> Two), so it passes unchanged. def OptState.map(-P: Type, -Q: Type, st: OptState

, f: P -> Q, h: P -> Q) -> OptState: match st: case NoMom{}: NoMom{} case OneMom{m}: OneMom{f(m)} case TwoMom{m, v}: TwoMom{f(m), h(v)} case Packed{t}: Packed{t} Uses (1): https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=OptState