def bump

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

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

98def bump(slots: List<&2, Maybe<&2, F32>>, +count: Nat, +target: Nat, +contribution: F32) -> List<&2, Maybe<&2, F32>>:
99  match slots count:
100    case Nil{} count:
101      Nil{}
102    case Con{slot, rest} 0n:
103      slot <> rest
104    case Con{slot, +rest} 1n+below:
105      bumped(slot, rest, contribution, unit => bump(rest, below, target, contribution), Nat.is_eq(below, target))

Uses (6)

Used by (6)