def nth
import bend-collections-laws-math@1.0.0.0/src/math/random/rand.bend as Randimport Base
252def nth(-A: Data, xs: List<&2, A>, i: Nat) -> Maybe<&2, A>:
253 match xs i:
254 case Nil{} _:
255 None{}
256 case Con{h, t} 0n:
257 Some{h}
258 case Con{h, t} 1n+p:
259 nth(A, t, p)
Uses (3)
Used by (6)
- bend-collections-laws-math@1.0.0.0/src/math/random/rand:swap
- bend-collections-laws-math@1.0.0.0/proofs/math/random/shuffle:nth_put
- bend-collections-laws-math@1.0.0.0/proofs/math/random/shuffle:put_occ
- bend-collections-laws-math@1.0.0.0/proofs/math/random/shuffle:swap_m_occ
- bend-collections-laws-math@1.0.0.0/proofs/math/random/shuffle:swap_occ
- …