def build_peq_word

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

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

37# Bit i matches query[i] literally or through an explicit symmetric pair.
38# Unused high bits are wildcards regardless of the pairs, as in buildPeq.
39def build_peq_word(query: String, +symbol: Char, +bit: U32,
40                   +pairs: List<&2, E.EqualityPair>) -> U32:
41  match query:
42    case SNil{}:
43      U32.not(U32.sub(bit, 1))
44    case SCon{h, t}:
45      (U32.mul(Bool.to_u32(E.equal(pairs, h, symbol)), bit) .|.
46        build_peq_word(t, symbol, U32.shl(bit), pairs) : U32)

Uses (12)

Used by (1)