def row_cells

bend-edit-distance@0.2.2.0 · src/DistanceDP.bend:24

import bend-edit-distance@0.2.2.0/src/DistanceDP.bend as DistanceDP
import Base
import bend-edit-distance@0.2.2.0/EdlibTypes.bend as E

24# Consume the old row as the new row is built. The left/diagonal dependency
25# makes adjacent cells sequential; copying a full matrix is unnecessary.
26def row_cells(columns: String, previous: List<U32>, diagonal: U32,
27              left: U32, +symbol: Char, +pairs: List<&2, E.EqualityPair>) -> List<U32>:
28  match columns previous:
29    case SNil{} _:
30      Nil{}
31    case SCon{h, t} Nil{}:
32      Nil{}
33    case SCon{h, t} +above <> rest:
34      +next = cell(above, left, diagonal, symbol, h, pairs)
35      next <> row_cells(t, rest, above, next, symbol, pairs)

Uses (6)

Used by (1)