I should explain that the list on the right (L R) is the lift side and right side of a shape detected from a webcam. The list on the left(I, X) is the X vale of the center of the object.
The X value is already ordered based on which object is detected first but the left and right values are not ordered yet.
wait, so you want this to work with lists "of any length", but the data is in sets of four values, right? xval Ir Ir Ir sets.
You need to explain what you're expecting to get out a lot better. Also, you're not telling us what you want changed about the patch(es) you post here - you say you don't want to unpack, yet I see unpack and iter all over the place :-/