I have a set of lists.

These lists contain two dimensional coordinates of natural numbers. So a list can be

 list1 = {{1, 1}, {1, 2}, {3, 4}} 
 list2 = {{3, 6}, {5, 5}}.  

In each step of the calculation a list can disappear, can grow, can diminish, new lists can appear and so on.

I want for some points, elements of the lists, say for example {3, 3} to do bookkeeping to see in which list it is contained in every step of the calculation.

It can be contained in one and only one list or in no list at all.

So I want to do bookkeeping for {3, 3} in the sense that I want to know exactly at every step in which list it is contained.

For example

bookkeeping[ {3, 3}] = {list2, list5, list3, none} 

which says that at the first step {3, 3} is in list2, at the second step {3, 3} is in list5, at the third step {3, 3} is in list3 an at the last step it is in none of the lists.

I have not the faintest idea how to do it.

Should I define a bookkeeping[] function with downvalues? Or what is an elegant way to deal with it?

What is the most elegant data structure I can use for such kind of bookkeeping?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.