Re:Crema: A Sub-Turing Programming Language
by tromp on Wednesday August 05, 2015 @02:05PM
(#10011612)
Instead of Crema's
it would be more straightforward to define loops over array indexing ranges, as in
[ Parent
| on HN ]
Re:Crema: A Sub-Turing Programming Language
by adrusi on Wednesday August 05, 2015 @03:31PM
(#10012236)
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.