def put
import bend-collections-laws-math@1.0.0.0/spec/math/random/chacha8rand.bend as Chacha8randimport Base
45def put(xs: List<&2, U32>, i: Nat, y: U32) -> List<&2, U32>:
46 match xs i:
47 case Nil{} _:
48 Nil{}
49 case Con{x, rest} 0n:
50 Con{y, rest}
51 case Con{x, rest} 1n+p:
52 Con{x, put(rest, p, y)}