def split_column

bend-edit-distance@0.2.2.0 · src/Reconstruction.bend:146

import bend-edit-distance@0.2.2.0/src/Reconstruction.bend as Reconstruction
import Base

146# Forward[j] + reverse[n-j] is the cost through the midpoint at column j.
147# Strict comparison keeps the first minimum; this is our deterministic split
148# policy and is deliberately separate from upstream Hirschberg compatibility.
149def split_column(forward: List<U32>, backward: List<U32>, +index: Nat,
150                  +best_index: Nat, +best_score: U32) -> Nat:
151  match forward backward:
152    case Nil{} _:
153      best_index
154    case _ Nil{}:
155      best_index
156    case a <> at b <> bt:
157      +score = U32.add(a, b)
158      +next = split_update(index, score, best_index, best_score,
159        U32.is_lt(score, best_score))
160      split_column(at, bt, 1n+index, split_index(next), split_score(next))

Uses (8)

Used by (1)