Match List of Lists based on Index


I am trying to add a prefix number to a series of room numbers by level. I have the level number in a simple list, a sequence from 1 to 44. The room numbers are in a separate list of lists with each sublist being one level with a varying number of rooms. The value in Index [0] of List 1 matches all of the values in Index [0] of list 2.

When I use the List.Map function it adds the EACH prefix in List 1 to ALL values in List 2 rather than all the values of the matching index of List 2. This should be a relatively simple list management problem.

Questions that may or may not be related. Do i use List.LaceLongest/Shortest? What is a combinator?

Does Dynamo have the equivalent of Grasshopper’s graft function?

Is there a way to reference the ‘current index’ which is being mapped over?

Is there a way to capture and image of just a portion of the workspace (this should be a Dyanmo feature - had to old school screenshot)?



In this case, List.Combine would be a good choice, it’s the bigger brother of List.Map … :wink:

(although List.LaceLongest might work as well in this case, haven’t tried it)



Thanks Andreas. I went with LaceLongest, it was exactly what I needed. I thought I was getting the hang of the combinators, can you explain why the following situation is returning ‘null’

I tried to evaluate two Boolean lists through an AND gate and it is not working either way i try. See attached image. It should return all FALSE except index [3]



The AND node is one of the nodes that only accepts a single value, not a list of values (another example is the IF node).

You can identify them easily as they do not have a symbol that displays their lacing setting in the bottom right corner.

In this case, just use a code block with the following syntax:

a && b;

EDIT: Oh, and I have no idea why it doesn’t work using List.Combine …