List.ReplaceItemAtIndex - multiple indeces in same list

Struggling with the List.ReplaceItemAtIndex node… is it possible to replace more than one index with a matching amount of nested lists in the same list? To make things more complicated, I would like to do this across multiple lists – likely using the ListAtLevel feature to pair structures.

I also tried the List.ReplaceItemAtIndex+ node from Clockwork but no luck…

20170726_DynamoForum_List-ReplaceItemAtIndex.dyn (13.2 KB)

I have a thought but it’s midnight and I’m out of the office. I’ll try to vocalize/test it in the morning.

2 Likes

@Kyle_Martin how are you getting the indexes to replace with the new list? Is there an index of node or other test earlier in your graph?

My overall goal is to take values in the “originalList” and replace some of them them with a pair of sub-values that still add up to the original number. That way both the original list and new list still have same overall sum, the only difference being the count of items within each list.

The image below is from context. The values in List.Transpose contain the calculated replacement sub-values and List.Reverse contains the indeces from earlier steps:

Hi Kyle,

Please have a look at this:

I still can’t find a way to not use the ReplaceItemAtIndex twice.

In this case I think it could be worth looking at Python too.
image

Tougher than I’d thought - merging the lists based on length might work but I’m locked up and getting distracted too much. I’ll try again tonight.

Hi All,
I’m struggling with something pretty similar… Thanks to all for previous posts that got me this far!

I have a list of sub lists, some of which I wish to replace (with a " " in the final version). I can’t get List.ReplaceItemAtIndex to treat the sublists based on the sublists fed to it. Any thoughts?
Many thanks!

Replace Item.dyn (8.9 KB)

Can you recreate this post as a new topic and link to this thread? It helps to keep things organized and solutions matching.

1 Like