def find

bendtorch-core@0.1.0.0 · src/autograd/backward.bend:67

import bendtorch-core@0.1.0.0/src/autograd/backward.bend as Backward
import Base

67# The element with id `id` in a newest-first list of count elements: the head
68# has id count - 1, and the walk counts down from it.
69def find(-A: Data, xs: List<&2, A>, +count: Nat, +id: Nat) -> Maybe<&2, A>:
70  match xs count:
71    case Nil{} count:
72      None{}
73    case Con{head, rest} 0n:
74      None{}
75    case Con{head, +rest} 1n+below:
76      picked(A, head, unit => find(A, rest, below, id), Nat.is_eq(below, id))

Uses (5)

Used by (3)