Applying functions to multiple items at specific indexes in a multi-dimensional list

Hey guys!
I searched all around the forum and could not find a solution to this:

I’m working with multi-dimensional lists (5 levels deep in my case, but could be any other depth).
I need to replace some specific items in this list given their specific indexes, or, in other cases, I need to apply functions to specific items in the same way.
In either cases I want in output a with the same exact structure and content of the starting one having changed just the specific elements.

Let me give you an example to be more clear:
I have this list of points. As you can see is a simple rectangular grid with some points that lay outside of the grid.
For reasons that would be unuseful to explain they must be arranged in a @L5 list.

Now, let’s say that I want to replace items at these indeces:
[0][0][0][1][0], [0][0][0][2][0] and [0][1][0][1][1] (the list could be longer and dynamic)
with this string: “A”
Or, let’s say that I want to apply a function just to these items. For example translating them +1 in the Z axis.
And at the end I want to get in output the same input list with just these three changed items.

Here is a graph that, of course, won’t work, but gives you the idea of what I want to do.
Unfortunately it seems that most of the Dynamo nodes won’t take in input DesignScript sintax for nested indeces…

Have you got any idea of how this could be done?
Any hint would be super precious

Thanks!!

Python is your friend here. This thread discusses how to do this in pure python, but I believe it would also accept nested lists if you use the [i1][i2][i3] etc. syntax.

1 Like

Try setting the list level to @L3, @L2, and lacing to longest.

1 Like