Skip to content

Instantly share code, notes, and snippets.

@vishnuvyas
vishnuvyas / levenshtein.clj
Created May 6, 2011 05:29
A purely functional implementation of levenshtein distance in clojure
(ns levenshtein
^{:doc "A purely functional implementation of the levenshtien distance in clojure"})
(defn- compute-next-row
"computes the next row using the prev-row current-element and the other seq"
[prev-row current-element other-seq pred]
(reduce
(fn [row [diagonal above other-element]]
(let [update-val
(if (pred other-element current-element)