def hw_start

bend-edit-distance@0.2.2.0 · src/Myers.bend:582

import bend-edit-distance@0.2.2.0/src/Myers.bend as Myers
import Base
import bend-edit-distance@0.2.2.0/EdlibTypes.bend as E
import bend-edit-distance@0.2.2.0/src/Alignment.bend as A

582# Edlib selects the LAST optimal reverse-SHW end, hence the earliest start
583# for each forward end. Preserve the special forward end -1 with start 0.
584def hw_start(+end: Nat, reverse_location: A.Location) -> A.Location:
585  match reverse_location:
586    case A.Location{E.BeforeStart{}, _}:
587      A.Location{E.Position{end}, 1n+end}
588    case A.Location{E.Position{reverse_end}, _}:
589      A.Location{E.Position{end}, Nat.sub(end, reverse_end)}

Uses (4)

Used by (1)