And my most recent augmentation is function-type arrays, which do not store all their declared data, but generate it as a function of the index. Thus, a [2][3][4] array of the constant 142
can be created without actually storing 24 142
s in memory.
array b = array_new_function(3, (int[]){2,3,4},
(int[]){1,142}, 2, constant);
*elem()
for each index will return 142
. An array which simply consists of sequential integers 0
..n
can be created with the j_vector
function-type array. And a considerable degree of constant-folding can be done by modifying the elements of the ->weight
member array and the cons
member. Indeed the values of any polynomial can be enumerated by creation of suitable dimension and weight parameters.