4 ms·
It would seem that you could implement that abstraction within the language def int int_indexing(int values[])[] { int i = 0 int result[] =
by adrusi 11y ago
It would seem that you could implement that abstraction within the language
def int int_indexing(int values[])[] {
int i = 0
int result[] = list_create(list_length(values))
foreach (values as dummy) {
result[i] = i
i = i + 1
}
return result
}
I haven't tested this, and I had to look in the source code to find the list_create function from the standard library. Of course, since the language lacks type parameterization, you'd need a different indexing function for each type of array.