Jump to content

Levenshtein distance: Difference between revisions

(→‎Functional/Folding Version: Work around ugly !!)
Line 2,015:
return (0 until s.length).fold(initialRow, { previous, u ->
(0 until t.length).fold( mutableListOf(u+1), {
row, v -> row.add(listOfminOf(row.last() + 1,
previous[v+1] + 1,
previous[v] + charScore(s[u],t[v])).min()!!)
row
})
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.