[Swift-devel] array function in standard library

Mihael Hategan hategan at mcs.anl.gov
Mon Mar 9 15:05:51 CDT 2015


Hi,

I became suspicious that the proposed array functions aren't very well
thought of. So I believe that we should not attempt to implement them
without further thought.

Specifically:

1. T[K] slice(T[K] a, int start, int end)

What do start and end signify? If there is some ordering on K, then they
could make sense as indices in the ordered set of keys once the array is
closed. Unfortunately this requires one to wait for the array to be
closed. 

2. T[int][K] split(T[K], int n)

Same issue. If the splitting is to be deterministic, one needs to wait
for the array to be closed.

3. T[int] join(T[K1][K2] a)

Same.

To some extent, these could be implemented nicely if they worked on
"compacted" arrays (i.e. T[int] arrays for which the indices are known
to be consecutive).

Mihael




More information about the Swift-devel mailing list