Data and Math

vdifflib

Compares two texts, or two lists of lines, and shows what changed.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/difflib.ven"

Compares two texts, or two lists of lines, and reports what changed, with a longest common substring search written in Venutian.

vdifflib.ven
print find_longest_match("abcxyz", "xyzabc", 0, 6, 0, 6)
Reference (4 functions)

API reference

find_longest_match(a, b, alo, ahi, blo, bhi)

The single longest contiguous run shared between a[alo:ahi] and b[blo:bhi].

find_longest_match("abcxyz", "xyzabc", 0, 6, 0, 6)

get_matching_blocks(a, b)

Every non-overlapping matching block between a and b, in order.

get_matching_blocks("abcxyz", "xyzabc")

ratio(a, b)

ratio("abcxyz", "xyzabc")

unified_diff(a_lines, b_lines, fromfile, tofile, context = 3)

Renders a unified diff between a_lines and b_lines as Text lines.

unified_diff(["one", "two", "three"], ["one", "two", "THREE"], "a.txt", "b.txt")

Get notified when vdifflib changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.