I’m trying to develop a way of removing List A from List B, such that the result is “any item in List B that does not have an equivalent in List A”. I have a feeling that current nodes out there find all equal values and remove them at once. If there are 4 values in List B “apples,apples,pears,pears” and 2 values in List B “apples,pears”, I want the output to be “apples,pears” - because two of those items are unaccounted for in the subtraction list. In other words, actual ‘count’ of item results is important, not just the values themselves.
Okay, so I have tried with recursion but I can’t get it working. See below for my current work:
![recursionnode](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/8/825416ead86e033c0109bf6fb6dfcce94a34ba5f.png)
![recursiondyn](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/d/d12ae116bbe3e76b88b8f0590e0aaddee33e5426.png)
Please help, thanks ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=9)
I got what I wanted in Python, I will publish eventually in Bakery package:
![pythonanswer](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/6/6b89d37496f3102768a04c66293b98907a8ec921.png)
Have you tried the SetIntersection node?
![20150714-1](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/2/292b2831e5ff47af44375093fd496ec4efd7c250.jpg)
I’m not too sure if this does what you want. But it is in Rhythm.
![2015-07-14_07h31_27](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/1X/466811fa05bc28cdaadaa4c38be78d556d2af1b7.png)
Luke,
My earlier response wasn’t what you were looking for, I realized.
I suppose the Design Script code I’ve attached below should do what you are trying to achieve. (“actual ‘count’ of item results is important, not just the values themselves”)
File: Remove InstancesFromList.dyn
![20150715-1](http://dynamobim.com/wp-content/uploads/forum-assets/testingwaters/07/15/20150715-1-600x254.jpg)
@John - A similar result is obtained by using the SetDifference node
Vikram,
Thanks for your designscript example, it does work and gets a similar result to the Python version I showed above.
However, I cannot get it working in a custom node. I am running 0.8.0 and when I add the function to the custom node as per image below, Dynamo essentially just stalls ‘not responding’. Am I doing this wrong?
![not working as node](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/6/6e7e1184e6fa1f6489c3c8851afc065bb56682aa.png)
1 Like
Luke - Might have something to do with ‘from’ in your Input node.
Node file (created in Dynamo Studio, so the version is 0.8.0): RemoveList Instances.dyf
![20150716-1](http://dynamobim.com/wp-content/uploads/forum-assets/testingwaters/07/16/20150716-1-300x261.jpg)
I had a problem with the login screen for a few days. Here’s another way that can get into nested lists…
![recursion](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/1/1234a2c1b466bcb63bb48e2a6961eab7010892a9.png)