############################################################################ # # File: distance.icn # # Subject: Procedure to compute distance in n-dimensions # # Author: Ralph E. Griswold # # Date: January 3, 1994 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # distance(d1, d2, d3, ...) returns the distance between points in n-space # distances d1, d2, d3, ... from the origin. # ############################################################################ procedure distance(d[]) local sum sum := 0 every sum +:= !d ^ 2 return sqrt(sum) end