daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Use same range specification in for loop as for matrix indexing #906

Open m-birke opened 1 week ago

m-birke commented 1 week ago

When a matrix is indexed like A[:4,], it returns four values (0..3)

It is confusing that the same does not apply to for loop ranges, for (i in 0:4) iterates five times/ five values 0..4 a single iteration needs for (i in 0:0) which is unintuitive

A = as.matrix([0,1,2,3,4,5,6]);
print(transpose(A[:4,]));

for (i in 0:4) {
    print(A[i,]);
}