def value_at

bendtorch-core@0.1.0.0 · src/autograd/tensor_backward.bend:954

import bendtorch-core@0.1.0.0/src/autograd/tensor_backward.bend as TensorBackward
import Base

954# A copy of the value of node id, in a newest-first list of count entries.
955def value_at(entries: List<&1, Entry>, +count: Nat, +id: Nat, same: Bool) -> Found():
956  match entries count same:
957    case Nil{} count same:
958      (Nil{}, Fail{UnknownNode{}})
959    case Con{entry, rest} 0n same:
960      (entry <> rest, Fail{UnknownNode{}})
961    case Con{entry, rest} 1n+below True{}:
962      found_value(entry, rest)
963    case Con{entry, rest} 1n+below False{}:
964      prepend_found(entry, value_at(rest, below, id, at_head(below, id)))

Uses (11)

Used by (1)