Have "merge" component output list order according to input order

(thomas) #1

This post suggests a minor evolution of the “merge” component.

The “as-is” situation is that output order is not following the input order. There are cases (Does the “tangent curve” component confuses input order?) when it might prove confusing.

Suggestion : the output order of the “merge” component should not be a runtime decision by GH, but rather a compile time decision from the specification, hence the input order.

Does the "tangent curve" component confuses input order?


// Rolf

(qythium) #3

I opened the gh file from your original post, and it looks like the ‘bug’ was actually expected behaviour due to your D1 / D2 inputs being on different branches:

and if you unflatten the output this is what you see:
The two lists were never merged in the first place- flattening the output obscured that fact and made things confusing by respecting the branch indexing order.

In your case, all you have to do is flatten the inputs to get things in the desired order:

(thomas) #4

Thank you qythium. Sorry, I’m still on the learning curve with trees. Next time, I will think about output elements in a panel.


@Peugeot Actually this is a common mistake, when tree branches are reduced to a single item, or a single list, it is not obvious to figure out which one is going where after the merge.

If you’re interested, I’ve developped a small component which takes a variable number of lists and output them back to back in a single list, in order. It’s definately not rocket science but if you need it, I can share it with you.


(thomas) #6

Thks @Xavier_Ayme. I would be interested.