News for hackers. Stuff that matters.
Re:Crema: A Sub-Turing Programming Language by tromp on Wednesday August 05, 2015 @02:05PM (#10011612)
Instead of Crema's

    int i = 0
    int values[] = [6, 3, 8, 7, 2, 1, 4, 9, 0, 5]
    foreach (values as dummy) {
      int_print(values[i])
      i = i + 1
    }
it would be more straightforward to define loops over array indexing ranges, as in

    foreach (int i indexing values) {
      int_print(values[i])
    }
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.