I have a vector (a Base.KeySet to be precise) and I would like to iterate over all pairs of items in the vector. The simplest attempt is a nested loop
for y1 in 1:length(col)
for y2 in y1+1:length(col)
# do work with col[y1] and col[y2]
end
end
(Note that I do not care about the order of the indices within each pair, so I skip e.g. (2,1) because that's redundant with (1,2).)
I learnt I can use eachindex(col) to possibly be more efficient (or at least make the code easier to read) instead of 1:length(col) for the outer loop, but it doesn't help me for the inner loop.
Is there a better way than using the manual loop above?