def put

bend-collections@1.0.0.0 · spec/crypto/chacha.bend:25

import bend-collections@1.0.0.0/spec/crypto/chacha.bend as Chacha
import 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)

Uses (3)

Used by (1)