[Bug 1275] New: Add some basic array operations
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1275 Summary: Add some basic array operations Product: Swift Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: SwiftScript language AssignedTo: [email protected] ReportedBy: [email protected] There is no way to slice an array if the indices are not know and/or not sequential. A split function should be added: T[int][KT] split(T[KT] array, int n) This would split array into chunks of size n (except for the last element). a reverse function should also be added: T[KT] join(T[KT1][KT2]) T[KT] join(T[int][KT2]) -> this version would join in order of first index Additional array operations: T[int] slice(T[int] array, low, high) -> return sub array with indices between low and high. Array can be sparse, in which case the returned slice's size would not necessarily be T[int] compact(T[KT] array) -> returns and array with consecutive int indices and values taken (in some random order) from array. -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1275 --- Comment #1 from Mihael Hategan <[email protected]> 2014-05-19 16:30:55 --- (In reply to comment #0)
T[int] slice(T[int] array, low, high) -> return sub array with indices between low and high. Array can be sparse, in which case the returned slice's size would not necessarily be
... equal to (high - low) -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
bugzilla-daemon@mcs.anl.gov