def distance_with_equalities

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

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

71# Public entry point: importing this module does not import or call Myers.
72def distance_with_equalities(query: String, target: String,
73                             pairs: List<&2, E.EqualityPair>) -> Nat:
74  match query target:
75    case SNil{} _:
76      String.length(target)
77    case SCon{h, t} SNil{}:
78      1n+String.length(t)
79    case SCon{qh, qt} SCon{th, tt}:
80      +q = {SCon{qh, qt} : String}
81      +t = {SCon{th, tt} : String}
82      +qn +tn = String.length(q) String.length(t)
83      distance_shorter(q, t, qn, tn, Nat.is_le(qn, tn), pairs)

Uses (7)

Used by (2)