Grasshopper

algorithmic modeling for Rhino

removing repeated items in a list while maintaining the order of the items

I want to remove the repeated items in this list while maintaining the order of the items. I don't a want restricted solution. for example, I don't wanna a script that will remove items from index 8 to index 15, because this list will change if I change variables in the script.

So if there is a way to remove repeated items without changing the order of the items in the list, this solution will work.

or

if there is a way to script the following statement "if 2 items are repeated below each other in a list (in this example 8 and 8) remove the repeated item and everything below it. (which is in this example it will be from index 8 to index 15)"

Thanks in advance :)

Views: 287

Replies to This Discussion

here's one way:

sorry image compression on upload is pretty bad. But I think you can make it all out.

another way also (little weirder but might as well share) - expression in list length is x-1

Thanks for your help, I tried it too, to understand different ways of thinking and using of the components. 

Thanks for your help. I tried it, it worked perfectly :)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service