Combining two lists and replacing values

Hey,
I am currently struggeling with combining two lists.
List 1 and 2 includes several values from -1 to 0. The majority of values is 0.

Now, I would like to combine both lists. §very time a 0 appears in list 1 and at the same place in list 2 there is a value not equal to 0, the 0 is to be replaced by this value.
For Example:

List 1:
0 - 0
1 - 0.3
2 - 0.2
3 - 0

List 2:
0 - 1
1 - 0
2 - 0
3 - -0.3

Merged List:
0 - 1
1 - 0.3
2 - 0.2
3 - -0.3

I already tried to replace members and so on but didn’t manage to get the required results.

Thank you for your help :slight_smile:


List combine.gh (37.2 KB)

Hey

Is this something you’re looking for?

Hey @marteen.petrov,
seems like the right, quite smart solution :slight_smile:
Haven’t thought about Pick’n’choose simply based on the decision if its 0 or not.

Thank you!

Glad that fixes it. Any value that isn’t 0, turns into 1 when using the Boolean container. So that’s a nice trick :slight_smile:

min

That also works , if list 2 is always <0.