Finds the Longest Common Subsequence between a-ls and
b-ls, comparing elements with eq (default
equal?. Returns this sequence as a list, using the
elements from a-ls. Uses quadratic time and space.
Variant of lcs which returns the annotated sequence. The
result is a list of the common elements, each represented as a
list of 3 values: the element, the zero-indexed position in
a-ls where the element occurred, and the position in
b-ls.
Utility to run lcs on text. a and b can be strings or
ports, which are tokenized into a sequence by calling reader
until eof-object is found. Returns a list of three values,
the sequences read from a and b, and the lcs
result. Unless minimal? is set, we trim common
prefixes/suffixes before computing the lcs.
Utility to format the result of a diff to output port
out (default (current-output-port)). Applies
writer to successive diff chunks. writer should be a
procedure of three arguments: (writer subsequence type
out). subsequence is a subsequence from the original input,
type is a symbol indicating the type of diff: 'same
if this is part of the lcs, 'add if it is unique to the
second input, or 'remove if it is unique to the first
input. writer defaults to write-line-diffs,
assuming the default line diffs.
Equivalent to write-diff but collects the output to a string.
The default writer for write-diff, annotates simple +/-
prefixes for added/removed lines.
A variant of write-line-diffs which adds red/green ANSI
coloring to the +/- prefix.
A diff writer for sequences of characters (when a diff was
generated with read-char), enclosing added characters in
«...» brackets and removed characters in »...«.
A diff writer for sequences of characters (when a diff was
generated with read-char), formatting added characters in
green and removed characters in red.
Utility to format the result of a diff with respect to a
single input sequence ls. lcs is the annotated common
sequence from diff or lcs-with-positions, and
index is the index (0 or 1, default 1) of ls in the
original call. Since we have no information about the other
input, we can only format what is the same and what is different,
formatting the differences as either added (if index is 0)
or removed (if index is 1).
Equivalent to write-edits but collects the output to a string.
Equivalent to write-edits but collects the output to a
string and uses a color-aware writer by default. Note with a
character diff this returns the original input string as-is, with
only ANSI escapes indicating what changed.