UniformBooleanValueSorting.gh (15.7 KB)
Hi, I am not quite clear on what you are trying to achieve, and I think your question would be better with a bit more context about why you need the results you are working with, and where is the input data coming from.
For instance are you comparing strings, as in is the character “0” same as the character “False”? I think this is unlikely, although if this is the case it can be achieved with minimal coding added in the grasshopper script.
What I assumed though, is that you are comparing Boolean values, whether something is True of False. And as has been mentioned, often in such Boolean operations, 0 is considered as False and 1 as True. (So just in case this was not your intention, it may be bad practice to mix binary number with boolean values, if you do not want people to assume they are used interchangeably).
One way to do what you need, if your tree branch length is fixed (and you need to place as many equality components as your list length minus 1, so not practical for long lists), is to compare the items within each branch, and if the same, send them one way, if different send them a different way. However you can compare any numerical values in your lists.
The other way, and probably I assume, the best way for your needs, works with any tree branch length, and the different branches of the tree need not even be equal lengths. You sum the all the values of each branch, it the sum is 0, all values are false (and the same), if the sum is equal to the list length, all values are True and the same, otherwise, the branch is not uniform. However this only works with Boolean and binary values.