The EditDistance structure
Author: John Reppy
Keywords: Standard ML, SML, SML/NJ Library

The SML of NJ Library
The `EditDistance` structure

The `EditDistance` structure computes the "optimal string alignment" (or Levenshtein) distance between two strings.

## Synopsis

    structure EditDistance

## Interface

    val distance : string * string -> int

## Description

`val distance : string * string -> int`

  `distance (s1, s2)` returns the number of edit operations required to make the two strings equal. Edit operations include deleting a character, inserting a character, replacing a character with another, and swapping two adjacent characters.

## See Also

The Util Library, Wikipedia article on Damerau-Levenshtein distance

SML/NJ Version 110.99.9 (November 4, 2025)
Last updated 2025-11-04 15:48:25 UTC