Recursive data changes to a list with on demand iterations

Hello all. I’m am trying to change data in a recursive way so that I can update a list in multiple operations.
For instance:
having a list form 1,2,3,4,5,6
Changing the 2 to 6… AND THEN changing the 9 to 50 and so forth , remembering the prior changes each time. Obviously, this means that the output of each change is the new input for the next … a.k.a a loop. Alongside, each iteration should be manually triggered.
I couldn’t not wrap my head around solving it with Anemone…

Any advice?

Yeah, read this and post a file:

3. Attach minimal versions of all the relevant files

Well …

This has 2 options:

  1. the fire and forget (i.e. auto, piece of cake > see attached).
  2. the interactive (requires advanced to expert level in order to cut the mustard properly). Briefly: for each execution store volatile data as persistent (in a suitable parameter) and read them (by accessing the parameter via the Nickname) IF something triggers (say a slider change) a re-execution. (8.1 KB)

So … 1 to 10 what is your coding level?

Please have a look at he newly inserted image. The idea is to trigger the operations manually each time with a button.
Not a loop with auto iterations.

Thank you, Peter. Unfortunately, my coding knowledge is not great:) I tried operating your def bit didn;t really understand it. Please have a look at the new image I posted for the explainer. Your help would be greatly appreciated.

Well … it’s simple: working solely in a demo mode (i.e. not accepting any user input) it makes integers 0 - testN and stores them in a history tree at branch 0 (called Loop). Then sets Loop 1. Then for each next Loop (<Loops) reads the history at branch Loop-1 and changes randomly (by a rnd index) an item (values within the changeMin/Max range). Just a 3 minutes naive demo - since you asked for Recursion, that is. That said Recursion is something where a main Method calls itself … until something happens and stops.

Added a visual clue upon what is changed (per Loop). (11.1 KB)

For the real thing/workflow of yours … well … you’ll need an interactive approach (where you can decide if you should store or not a value, recall some other from previous history versions etc etc). That said as you may know GH is not interactive (at least having individual items in collections in mind).

Thanks Peter, the idea is really simple here, probably simpler than what you wrote.
I want to replace a value by on demand and have that value changed so I can make the next change.
Let’s give an example:
You have a list of phone numbers and John just notified you he changed his number.
So you change it, than one hour later, Mike tells you he changed his number, so you want to update that too… but not forgetting the first change.
Basically it’s an input box that I update every time regarding to the specific list item I want to change.
Another example: yo have a bunch of cubes coming out of your Grasshopper definition (unbaked), and want to edit their size manually. So, you go one by one and tweak them parametrically by replacing their output value with a new one, then moving to the next cube and so forth. Each one in it’s own operation.
Hope the graphic description helps:)))

Well … that does that stupid C# (playing randomly with these #%#^% integers).

The diff is that John is John (i.e. not a Random thing) meaning that he has an index assosiated with him (in the phone List … or wait: in fact in a Class that tells you the customer ID, the Name, the Number, the Address, the Calls that he made … and anything else you want). So … it’s an Event driven situation: If John informs you (by providing, say, his ID and some verification) about the change then the stupid computer makes the change by swapping old/new nums. In the C# attached all that are done Randomly: kinda like any John in the List has a bright idea about some change.

So - for you - what are the series of Events that could cause a change? By what means you can know them? Are they by-products of some other thing? (say a portion of code that validates something and rates it A to F AND makes this rating accessible to anyone who has permission etc etc). And what happens if a mistake occurs? And how often John changes his num? (Is this suspicious or not?).

UNLESS you have some predefined rules/scenarios in mind: For each John who lives in Manhattan and he’s 7 feet tall and has 2.56 dogs … change his number with an invalid one (LOL) … etc etc

Here’s an Intercative brief outline:

First of all your yesterday data: each time that you reopen GH your data (as persistent ones) stored in this Parameter are accessible (via param’s Nickname). All that provited that the Parameter CAN hold the data (not a given). Parameter is NOT connected to anything. Obvioulsy you can have many Parameters - with different Nicknames - around (for better data organization).

You should have various actions on hand: read data from some other source, clear all (or some) param data, insert a new record, modify a record, delete it …etc etc. Obviously you need some confirm action. Plus you may want to inspect/access the history and recall some other “version” to work with.

Prior execution the C# reads data (List, DataTree, or way better a List of some custom Type) from the Parameter. If you access a record by branch/index (or by some ID Property in some Class) you can see the content. If you have a change in mind, input the change, pick the proper action, confirm and the whole collection is stored again in the Parameter. This is volatile to persistent stuff in case that you ask.

if you want to manually confirm each iteration by (for instance) clicking a button, then you can use something like this, and click the play button on the Trigger component (right click on the Trigger and set to Manual) :

the Counter component comes from Kangaroo 1

but the main question is: what is the logic the loop should iterate? :slight_smile: