Find value among values, returning the 1-based index
of the first matching value in values, or 0 if value
is not among values. The predicate pred is used to
compare values, and uses equality by default.
Performs three-way lexicographical comparison on two input ranges
according to predicate pred. Iterating r1 and r2 in
lockstep, cmp compares each element e1 of r1 with the
corresponding element e2 in r2. If one of the ranges has been
finished, cmp returns a negative value if r1 has fewer
elements than r2, a positive value if r1 has more elements
than r2, and 0 if the ranges have the same number of
elements.
Returns the Levenshtein
distance between s and t. The Levenshtein distance computes
the minimal amount of edit operations necessary to transform s
into t. Performs Ο(s.length * t.length) evaluations of equals and occupies Ο(s.length * t.length) storage.
Sequentially compares elements in r1 and r2 in lockstep, and
stops at the first mismatch (according to pred, by default
equality). Returns a tuple with the reduced ranges that start with the
two mismatched values. Performs Ο(min(r1.length, r2.length))
evaluations of pred.
Encodes
edit operations necessary to transform one sequence into
another. Given sequences s (source) and t (target), a
sequence of EditOp encodes the steps that need to be taken to
convert s into t. For example, if s = "cat" and "cars", the minimal sequence that transforms s into t is:
skip two characters, replace 't' with 'r', and insert an 's'. Working
with edit operations is useful in applications such as spell-checkers
(to find the closest word to a given misspelled word), approximate
searches, diff-style programs that compute the difference between
files, efficient encoding of patches, DNA sequence analysis, and
plagiarism detection.
Find value among values, returning the 1-based index
of the first matching value in values, or 0 if value
is not among values. The predicate pred is used to
compare values, and uses equality by default.