def put
import bend-collections@1.0.0.0/src/math/random/rand.bend as Randimport Base
261def put(-A: Data, xs: List<&2, A>, i: Nat, x: A) -> List<&2, A>:
262 match xs i:
263 case Nil{} _:
264 Nil{}
265 case Con{h, t} 0n:
266 Con{x, t}
267 case Con{h, t} 1n+p:
268 Con{h, put(A, t, p, x)}