(defun dist (row1 row2 d) (in data d (let ((n 0) (sumSq 0)) (dovn (cell1 col row1) (unless (= col classid) (unless (unknownp cell1) (let ((cell2 (svref row2 col)) (min (svref mins col)) (max (svref maxs col))) (unless (unknownp cell2) (incf n) (incf sumSq (expt (dist1 cell1 cell2 min max) 2))))))) (/ (sqrt sumSq) (sqrt n))))) (defmethod dist1 ((n1 number) (n2 number) min max) (/ (- n2 n1) (- max min))) (defmethod dist1 ((n1 t) (n2 t) min max) (declare (ignore min max)) (if (eql n1 n2) 0 1)) (defun unknownp (x) (eql x #\?))