# Gather dependency on list order?

I get intrigued about Gather behavior on this post. I thought that Gather was invariant under list order?

Here is the result I spect:

l1={{1, 1}, {0, 0}, {2, 2}, {5, 5}, {4, 4}, {6, 6}}
Gather[l1,ManhattanDistance[#1, #2] <= 2 &]


{{{1,1},{0,0},{2,2}},{{5,5},{4,4},{6,6}}}

When the list order is changed, I get this:

l2={{0, 0}, {1, 1}, {2, 2}, {4, 4}, {5, 5}, {6, 6}}
Gather[l2,ManhattanDistance[#1,#2]<= 2&]


{{{0,0},{1,1}},{{2,2}},{{4,4},{5,5}},{{6,6}}}

Someone know why?

-
Counter question: how can it determine the correct order? E.g. {4,5}>{5,4} or {4,5}<{5,4}? – ybeltukov Sep 21 '13 at 0:09
I don;t know where's @ssch 's comment but I think he's right. Relation has to be transitive. If it's not the result may vary with order. For example, for the case of l2 the result {{{0,0}}, {{1,1}, {2,2}}, {{4,4}}, {{5,5}, {6,6}}} is as good as the one you obtained. – Kuba Sep 21 '13 at 0:15
@Murta No, it starts again as soon as it meets False. Try Reap@Gather[l2, (Sow[{#, #2}]; ManhattanDistance[#1, #2] <= 2) &] – Kuba Sep 21 '13 at 0:21