def nth
import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as Commonimport Base
70# Element i, if any.
71def nth(-A: Data, xs: List<&2, A>, i: Nat) -> Maybe<&2, A>:
72 match xs i:
73 case Nil{} _:
74 None{}
75 case Con{h, t} 0n:
76 Some{h}
77 case Con{h, t} 1n+p:
78 nth(A, t, p)
Uses (3)
Used by (9)
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_append_left
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_append_right
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_lt_length
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_none
- bend-collections-laws-math@1.0.0.0/proofs/lib/list:nth_update_other
- …