Anonymous user
Levenshtein distance: Difference between revisions
→Functional/Folding Version: Work around ugly !!
(→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(
previous[v+1] + 1,
previous[v] + charScore(s[u],t[v]))
row
})
|