Combine each and everyone of the elements in a list


#1

Hello!

I am currently trying to combine all the elements of a list in order to obtain all the possible combinations:

(a,b,c) -> function = (a,ab,abc,bc,ca)

Which I am trying to do with this code in a python script node:

1

Sadly, when I run it, it’s not combining the elements and just returning the same input.

Any ideas why?

Thanks in advance


#2


right click the node and set lacing to cross product


#3

Wonderful Mr Marcel_Rijsmus! Thanks a lot once again!

Is there any way to also reverse this process? Let’s say I get the sum of the numbers I wanted and after selecting the one that i needed from the list, I want to see which numbers from the original list can sum up to reach that new number. Is that possible?


#4

sure
-If equal return index- and -get item at index- are the nodes, there are other ways aswell, find the logic in the http://dynamoprimer.com/en/ and http://designscript.io/DesignScript_user_manual_0.1.pdf and http://dynamoprimer.com/en/07_Code-Block/7-2_Design-Script-syntax.html
this will get you some basics too
http://plevit1.blogspot.nl/2015/01/examples-for-all-list-actions-in-dynamo.html
the rest is getting to know what nodes are there.
see https://dynamonodes.com/
and use google or search the forum, most of it has been done before, all you have to do is find it