Tweeted twitter.com/StackMma/status/659248890659651584
2 corrected my acronymous dyslexia
source | link

I'm looking for a way to reference an element within a List to get another element in the same parent List. I can't really see any way to do this without either being able to specify a level that is above that element in a getter function or without some kind of self-referencing construct like .this() for object-oriented ABDsADTs.

As a minimal example, is there a way to get

listex={MemoryInUse[],f[x],MemoryInUse[],difference}

where difference=listex[[3]]-listex[[1]], or is my sole option to generate a List without these dependent elements and then Insert/Append them post-creation?

I'm looking for a way to reference an element within a List to get another element in the same parent List. I can't really see any way to do this without either being able to specify a level that is above that element in a getter function or without some kind of self-referencing construct like .this() for object-oriented ABDs.

As a minimal example, is there a way to get

listex={MemoryInUse[],f[x],MemoryInUse[],difference}

where difference=listex[[3]]-listex[[1]], or is my sole option to generate a List without these dependent elements and then Insert/Append them post-creation?

I'm looking for a way to reference an element within a List to get another element in the same parent List. I can't really see any way to do this without either being able to specify a level that is above that element in a getter function or without some kind of self-referencing construct like .this() for object-oriented ADTs.

As a minimal example, is there a way to get

listex={MemoryInUse[],f[x],MemoryInUse[],difference}

where difference=listex[[3]]-listex[[1]], or is my sole option to generate a List without these dependent elements and then Insert/Append them post-creation?

1
source | link

Referencing previous elements in the same List

I'm looking for a way to reference an element within a List to get another element in the same parent List. I can't really see any way to do this without either being able to specify a level that is above that element in a getter function or without some kind of self-referencing construct like .this() for object-oriented ABDs.

As a minimal example, is there a way to get

listex={MemoryInUse[],f[x],MemoryInUse[],difference}

where difference=listex[[3]]-listex[[1]], or is my sole option to generate a List without these dependent elements and then Insert/Append them post-creation?