Solve discrepancy between objet lists and sets - ordered / unordered

I have a function in typescript and also in python that takes a list of objects - not a set - and applies a reduce logic before returning a new list of results.

The results depend on the list’s order. Lists are ordered wheras sets are not.

While the order in widgets like the object selector seems to matter, it is lost when being assigned to an object set variable.

What would be the recommended way of actually retaining the order of objects and maybe also manually re-ordering them by drag and drop?

I also intend to store the object keys in an array property in the ontology so that the ordered list can be reloaded at a later point in time to do the computation again.

Best,
Florian