conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
457 stars 102 forks source link

Why is suffix_union so complicated? #530

Closed maresb closed 8 months ago

maresb commented 8 months ago

What happened?

I'm having a very difficult time understanding how suffix_union works. It seems to me like it should be simpler.

Maybe first we should define prefix_union, and then suffix_union would be the reverse of prefix_union with all the arguments reversed.

Now I think prefix_union should be:

In particular, I don't see why we should have SupportsRichComparisonT.

Context: I'm trying to review #529.

Attn: @mariusvniekerk, @jacksmith15

maresb commented 8 months ago

Probably for implementation it's simpler to flip the order of iteration: the outer loop should be over sequences, the inner loop should be over the elements of the outer-selected sequence, and the result should be a list containing the currently-largest prefix sequence.