Given [1,2,3,4,5]
, how can I do something like
1/1, 1/2, 1/3,1/4,1/5, ...., 3/1,3/2,3/3,3/4,3/5,.... 5/1,5/2,5/3,5/4,5/5
I would like to store all the results, find the minimum, and return the two numbers used to find the minimum. So in the case I've described above I would like to return (1,5)
.
So basically I would like to do something like
for each element i
in the list
map some function across all elements in the list, taking i
and j
as parameters
store the result in a master list, find the minimum value in the master list, and return the arguments i
, j
used to calculate this minimum value.
In my real problem I have a list objects/coordinates, and the function I am using takes two coordinates and calculates the euclidean distance. I'm trying to find minimum euclidean distance between any two points but I don't need a fancy algorithm.