def kept.go

bend-ml-llama@0.2.1.0 · main.bend:1214

import bend-ml-llama@0.2.1.0/main.bend as BendMlLlama
import Base

1214# g: whether the head of cs is kept (the weight acc before it is below lim = p·Z; the first is always kept)
1215def kept.go(cs: List<&2, Cand>, g: Bool, +temp: F32, +top: F32, +lim: F32, +n: Nat, +acc: F32) -> Kept:
1216  match cs g:
1217    case Nil{} _:
1218      Kept{n, acc}
1219    case Con{h, t} False{}:
1220      Kept{n, acc}
1221    case Con{Cand{+v, i}, t} True{}:
1222      +acc2 = F32.add(acc, weight(v, temp, top))
1223      kept.go(t, F32.is_lt(acc2, lim), temp, top, lim, 1n+n, acc2)

Uses (9)

Used by (2)