Code blocks, lacing, levels - processing a list through a code block

I have some fairly complex formulas I need to run some lists of data through.

I’d like to translate the indices in the lists of lists into something more readable first, then run the translated values through another code block.

In the end I still need a list the same length as the original lists of lists with all the data from the formula processing.

I know this all has to do with lacing, levels, etc. inside a code block, but the syntax for that is still confusing to me. Hoping to demystify it here! :slight_smile:

Here’s a simplified example:

@TheMattatonAP Add a List.Transpose node in between as shown below:

2 Likes

Another way …


getItem.dyn (5.9 KB)

2 Likes

Excellent! Thank you both!

@Vikram_Subbaiah Thanks for that lesson on lacing. I’m still figuring out lacing in general, so lacing in a Code Block really throws me! :smiley:
So, is using the <1> after ‘data’ a form of cross-product? What’s its equivalent when setting lacing on a normal node?
I see that the <1> iterates over the initial list and the number after the comma denotes the index to use from each item in the sub-lists. Makes sense. It’s the ‘why’ that I’m missing. Why does <1> do that?

I’m not even getting into what your first Code Block does with creating the dummy list. You are a master, sir. :slight_smile:

1 Like

It’s more like Longest actually (or L2 if you’re working with levels)

I’ve tried to explain my understanding in in these two articles (1 and 2)
Hope it helps.

1 Like