Confusing on how to use Code Block in List.Map?


#1

How to use Code Block in List.Map ?

Hi, everyone.

I am a new one in Dynamo.

This few days I am study about List, and List.Map is confusing me.

In the attatchment is the file about the question.

I want to add a number to all item in a List, and I use several way.

  1. The builtin funformula, it works well.

  2. The formula, it can only work for the first run time, and will not change for the next time when I change the formula.

  3. When I use the code block, both I use the normal code block or self-define function, I can not get a result, they are all null.

I must have made some problems. Would you please help me to solve it, thank you very much.

question about list map


#2

In the examples above you are trying to swat a fly with a hammer. Most of what you’re attempting can be achieved in a simple and direct manner.

20160217-3

Study the many definitions already posted on the forum for a better understanding of the List.Map node.

The f(x) port takes in an node (with one of the input ports left unwired). Code blocks are not a valid input.


#3

Hi, dear VIKRAM SUBBAIAH,

Thank you very much for your replying and give me a very simple way.

Now I know that the code block can not be treated as a f(x).

I will study more in this forum for other knowledge.

I ask this question because I have ever learned some Lisp. In lisp Lambda like f(x) in Dynamo (but it can also a self-defined function), Mapcar likes List.Map, and they can combine together.

Thank you again!