distance function, example of array from article