Re: Reciprocal data structures

2017-06-19 Thread Christopher Reimer
> On Jun 18, 2017, at 11:02 PM, Chris Angelico wrote: > > On Mon, Jun 19, 2017 at 3:54 PM, Steven D'Aprano wrote: >>> With a list? No, I would say it's a bad idea. >> >> >> Why a bad idea? >> >> As opposed to "can't be done", or "too hard and slow". > > Maintaining a record of list indices i

Re: Reciprocal data structures

2017-06-18 Thread Chris Angelico
On Mon, Jun 19, 2017 at 3:54 PM, Steven D'Aprano wrote: >> With a list? No, I would say it's a bad idea. > > > Why a bad idea? > > As opposed to "can't be done", or "too hard and slow". Maintaining a record of list indices inside an object, with the specific proviso that: > If the list is change

Re: Reciprocal data structures

2017-06-18 Thread Steven D'Aprano
On Mon, 19 Jun 2017 06:04:57 +1000, Chris Angelico wrote: > On Mon, Jun 19, 2017 at 5:27 AM, wrote: >> I am thinking of a list that actively maintains in its items a member >> that contains the item's own index in the list. Basically, the item >> knows its index into the list and the list ensur

Re: Reciprocal data structures

2017-06-18 Thread Chris Angelico
On Mon, Jun 19, 2017 at 5:27 AM, wrote: > I am thinking of a list that actively maintains in its items a member that > contains the item's own index in the list. Basically, the item knows its > index into the list and the list ensures that the index remains in sync. If > the list is changed,

Reciprocal data structures

2017-06-18 Thread pavlovevidence
I'm not sure if "reciprocal" is the right word, or if there is an official term for this. I am thinking of a list that actively maintains in its items a member that contains the item's own index in the list. Basically, the item knows its index into the list and the list ensures that the index