gap
Functions
pub fn compare_lists(first_sequence: List(a), second_sequence: List(
a,
)) -> Comparison(a)
Compare two lists and return a ListComparison
which will be styled as list
when passed to to_styled
Will use the default myers
algorithm
pub fn compare_lists_with_algorithm(first_sequence: List(a), second_sequence: List(
a,
), algorithm: fn(List(a), List(a)) -> Comparison(a)) -> Comparison(
a,
)
Compare two lists and return a ListComparison
which will be styled as list
when passed to to_styled
Algorithm can be used to select either myers
or the legacy lcs
algorithm
pub fn compare_strings(first: String, second: String) -> Comparison(
String,
)
Compare two string and return a StringComparison
which will be styled as string
when passed to to_styled
Will use the default myers
algorithm
pub fn compare_strings_with_algorithm(first: String, second: String, algorithm: fn(
List(String),
List(String),
) -> Comparison(String)) -> Comparison(String)
Compare two string and return a StringComparison
which will be styled as string
when passed to to_styled
Algorithm can be used to select either myers
or the legacy lcs
algorithm
pub fn lcs(first_sequence: List(a), second_sequence: List(a)) -> Comparison(
a,
)
An adapter for the the lcs
(longest common subsequence) algorithm.
Intended to be use as an argument to compare_strings_with_algorithm
or
compare_lists_with_algorithm
pub fn myers(first_sequence: List(a), second_sequence: List(a)) -> Comparison(
a,
)
An adapter for the the myers
algorithm.
Intended to be use as an argument to compare_strings_with_algorithm
or
compare_lists_with_algorithm
pub fn to_styled(comparison: Comparison(a)) -> StyledComparison
Creates a StyledComparison
from Comparison
using default values for
highting and serialization.
Example
> compare_strings("abc", "abe") |> to_styled()
This will return a StyledComparison(first, second)
where “c” in first
is green
and “e” in second
is red.