Anonymous user
Levenshtein distance: Difference between revisions
→{{header|Common Lisp}}: Local functions should be declared using `labels` or `flet`. `defun` always binds the function to a name in the package, an unwanted side effect here.
(→{{header|Rust}}: more concise and efficient initialization of 'matrix') |
(→{{header|Common Lisp}}: Local functions should be declared using `labels` or `flet`. `defun` always binds the function to a name in the package, an unwanted side effect here.) |
||
Line 1,247:
<lang lisp>(defun levenshtein (a b)
(let* ((la (length a))
(
((aref rec x y) (aref rec x y))
(+ (if (char= (char a (- la x)) (char b (- lb y))) 0 1)
▲ (leven la lb)))
(print (levenshtein "rosettacode" "raisethysword"))</lang>
|