def put
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/chacha.bend as Chachaimport Base
25# The list with element i replaced (unchanged past its end).
26def put(xs: List<&2, U32>, i: Nat, y: U32) -> List<&2, U32>:
27 match xs i:
28 case Nil{} _: Nil{}
29 case x <> rest 0n: y <> rest
30 case x <> rest 1n+p: x <> put(rest, p, y)