def update
import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as Commonimport Base
80# Replace element i (no change when i is out of range).
81def update(-A: Data, xs: List<&2, A>, i: Nat, x: A) -> List<&2, A>:
82 match xs i:
83 case Nil{} _:
84 Nil{}
85 case Con{h, t} 0n:
86 Con{x, t}
87 case Con{h, t} 1n+p:
88 Con{h, update(A, t, p, x)}
Uses (2)
Used by (8)
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:length_update
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_update_other
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_update_same
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:sc_take_update
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:update_append_left
- …