Read code

Good morning.
I’m trying to learn some textual programming language I’m new to this.
I found a definition code that what it does in essence is to be able to replace elements and sublists of a general list starting from the base list and introducing the index and the new elements to replace… well the thing is that I try to understand what is its logic seen from the human language following each line of code what meaning does each of the instructions have…
Thank you very much for your time, this will help me a lot in being able to understand the codes and eventually generate my own way of reading and understanding them… thank you very much for your help.

A.- CODE FOUND IN THE DYNAMO FORUM.


B.- I AM TRYING TO SEGMENT THE CODE TO BE ABLE TO LEARN TO READ IT BY LINE…

C.- I AM TRYING TO START WITH THE FIRST LINE OF CODE… I DON’T UNDERSTAND WHAT THIS PART MEANS OR WHAT IT MEANS…?

The first part is obviously the variable, lst. The part that follows is an optional input to define the object type and/or structure of that variable. Because Dynamo automatically iterates lists, you sometimes have to explicitly define the structure of the input so that Dynamo iterates the data correctly, otherwise it has to make assumptions. It’s similar to how list levels allow you to define the structure within an input.

In this case all the variables are var (typeless) with a specified structure of at least an @L3 list.

item: var represents a singleton
list: var[] represents a list
listOfList: var[]..[] represents a list with multiple levels

3 Likes

Hello, in addition to Mr. Nick’s already well-argued answer

You can download Mr. Sol’s document (very well done, I learn a lot with it)

Cordially
christian.stan

2 Likes

Thank you very much for sharing the links … I did not know that such manuals existed.

1 Like

To add to this, if you get explicit with defining the types, it will execute faster as the Dynamo Engine can get more swiftly to the end result :wink:

2 Likes

I’ll also chime in here… the code you’ve found online is not Python code, but design script. They have a lot of similarities, but code from one bit won’t necessarily run in the other (in fact it’d be rare). Saving as a .py is likely not a great idea as a result. :slight_smile:

If they are right…
It was very strange to me that when I copied it to the IDE it pointed me with certain errors…
Thanks for your comments.

1 Like