BASICS: What is the most elegant way to simply replace values in a list

Im trying to rewrite my brain as I have worked for years with other packages so, after most of the day searching as to how to do basic stuff, I have relented to being a newb and grasping the logic of a simple workflow

EXAMPLE:
I have to replace the Z coordinate with a constant/scalar from a list of points (in this example, 3 points!)
Trying to get around the siltation of simply typing a loop with a list address…how does one mimic that without the seeming verbosity of the only example I could find that was similar
If it was python it would be seconds of code…but Im adamant of doing the best way possible within the framework of grasshopper

Im sure it must be something super simple but I have watched hours of youtube as well :slight_smile:
So conceptually, how can you simply do a replace on the 3 (tuple?) item in this list with eg 0?

Like this?

3 Likes

Thought I could smell smoke…the speed of your reply! Thanks
So there is no need to manipulate the list then…the construct is the point of edit and is just appending the static Z…thanks so much for the perspective…simple when you dont wrestle…

Nothing is appended, the Z value of each point is replaced.

You are correct, I should have said implicitly replaced…there is no actual need to manage it as a list entity and manually do the work…as you would normally in text based coding; the iteration implicitly replaces by the nature of the construct in gh…take a bit of getting used to but the support on the forum here is amazing…

Doesnt let me edit/correct the post though…:slight_smile:

Beg to differ again but I would say “explicitly replaced”.

GH works on lists (and lists of lists, AKA data trees).

But the action is implicit? there is no further action on the part of the user; the action is “im” versus “ex” ie from the action of the user…perspectives vary and English is not my only language. Thanks Joseph

Semantics. The explicit action is arranging the components and connecting the wires as @HS_Kim did. What you are calling “implicit” is the nature of GH, which is obviously new to you.

1 Like