The following array occupies 10000 slots in memory:
a = [0,1,2,3,4,5,6,7,8,9,10,...,10000]
But one could easily represent the same array as:
a = {len:10000, get: λ idx -> idx}
Which is much more compact. Similarly, there are several arrays that can be represented compactly:
a = {a:1000, get: λ idx -> idx * 2}
Is a description for [0,2,4,6,8,10,...,2000]
a = {a:1000, get λ idx -> idx ^ 2}
Is a description for [0,1,2,4,9,...1000000]
And so on...
Providing so many arrays can be represented in much shorter ways than storing each element on memory, I ask:
- Is there a name for this phenomena?
- Is there a way to find the minimal representation for a specific array?
- Considering this probably depends on the language of description (in this case, I used an imaginary programming language with functions, objects and math operators). Is there a specific language that is optimal for finding that kind of minimal description for objects?