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.
Executes and returns one of a collection of handlers based on the type of the switch object.
Clamps val into the given bounds. Result has the same type as val.
Performs a lexicographical comparison on two input ranges. 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.
Get the first argument a that passes an if (unaryFun!pred(a)) test. If no argument passes the test, return the last argument.
Checks if both ranges are permutations of each other.
Checks if two or more ranges have the same number of elements. This function is optimized to always take advantage of the length member of either range if it exists.
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 O(s.length * t.length) evaluations of equals and occupies O(min(s.length, t.length)) storage.
Returns the Levenshtein distance and the edit path between s and t.
Iterates the passed arguments and returns the maximum value.
Iterates the passed arguments and returns the minimum value.
Sequentially compares elements in rs 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 O(min(r[0].length, r[1].length, ...)) evaluations of pred.
Returns one of a collection of expressions based on the value of the switch expression.
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.
Compares two or more ranges for equality, as defined by predicate pred (which is == by default).
This is a submodule of std.algorithm. It contains generic comparison algorithms.