Array Notation

The array notation such as that which copies two arrays

t[k .. hi by s] = _t[i .. m]; //

is very clear and nice and tight. It predates the foreach statement. I note that

foreach (_k, _i) in zip(k .. hi by s, i .. m)
{
    t[_k] = _t[_i];
}

will today run faster the line of code using the earlier array notation, albeit more verbosely.

Should the former be implemented in terms of the latter at some stage?

It should not necessarily be a high priority task. Thanks.

Hi Damian,

This has been a long-standing wish that recently surfaced in other contexts, too.

proposal: optimize whole-array operations on array views · Issue #16133 · chapel-lang/chapel · GitHub is the best issue that captures the request and potential solutions.

It should not necessarily be a high priority task.

Thanks for this info as well. Personally, I see this as a fun rainy day task that's on my mind these days. I might impulsively implement it one day, but I'd be happy if someone else beats me to it :slight_smile: Please let us know if your sense of priorities change before we can add the optimization.

Engin

1 Like