Euclidean distance in Clojure

When implementing collaborative filtering algorithms in a project, I couldn't find any decent implementations of the Euclidean Distance algorithm.

For those unfamiliar:

In Cartesian coordinates, if p = (p1, p2,..., pn) and q = (q1, q2,..., qn) are two points in Euclidean n-space, then the distance from p to q, or from q to p is given by: Eucledean distance formula

So I decided to be that reference I was looking for earlier. Here is the implementation in Clojure:

(defn square [x]
  (* x x))

(defn
… continue reading