Distance in N-dimensions |
![]() ![]() ![]() |
(define (distance point-1 point-2) (sqrt (dist-square point-1 point-2))) (define (dist-square p1 p2) (if (zero-dimension? p1) 0 (+ (square (- (first-dimension p1) (first-dimension p2))) (dist-square (other-dimensions p1) (other-dimensions p2)))))
Jim Miller | ![]() |