However, since the range can be specified at run-time, type-checked languages may require an explicit (compile-time) notation to actually eliminate the trivial indices.
For languages that allow arbitrary lower bounds for indices, like Pascal, the dope vector needs 1 + 3d entries.
Slicing as a language feature probably started with FORTRAN (1957), more as a consequence of non-existent type and range checking than by design.
The concept was also alluded to in the preliminary report for the IAL (ALGOL 58) in that the syntax allowed one or more indices of an array element (or, for that matter, of a procedure call) to be omitted when used as an actual parameter.
Kenneth Iverson's APL (1957) had very flexible multi-dimensional array slicing, which contributed much to the language's expressive power and popularity.
Array slicing facilities have been incorporated in several modern languages, such as Ada 2005, Cobra, D, Fortran 90, Go, Rust, Julia, MATLAB, Perl, Python, S-Lang, Windows PowerShell and the mathematical/statistical languages GNU Octave, S and R. PL/I provides two facilities for array slicing.
The Fortran 66 programmers were only able to take advantage of slicing matrices by row, and then only when passing that row to a subroutine: Result: Note that there is no dope vector in FORTRAN 66 hence the length of the slice must also be passed as an argument - or some other means - to the SUBROUTINE.
One oddity of the language was that it allowed round or square braces interchangeably, and which was used in practice was typically a function of the computer terminal being used.
Example: Will produce: The HP systems were widely used in the early 1970s, especially in technical high schools and many small industrial and scientific settings.
Only Sinclair's dialect differed in any meaningful way, using the TO keyword instead of a comma-separated list: Slicing was also selected as the basis for the ANSI Full BASIC standard, using the colon as the separator and thus differentiating between slicing and array access: While this style of access offered a number of advantages, especially for the small machines of the era, sometime after 1970 Digital Equipment Corporation introduced their own variation of BASIC that used the LEFT$, RIGHT$ and MID$ string functions.
Through the late 1970s the two styles were both widely used, but by the early 1980s the DEC-style functions were the de facto standard.
The Fortran 77 standard introduced the ability to slice and concatenate strings: Produces: Such strings could be passed by reference to another subroutine, the length would also be passed transparently to the subroutine as a kind of short dope vector.
Produces: Note: Since in Ada indices are n-based the term Text (2 .. 4) will result in an Array with the base index of 2.
In addition, Perl supports slicing based on expressions, for example: If you have the following list: Then it is possible to slice by using a notation similar to element retrieval: Note that Python allows negative list indices.
For example: The stride syntax (nums[1:5:2]) was introduced in the second half of the 1990s, as a result of requests put forward by scientific users in the Python "matrix-SIG" (special interest group).
A deeper advantage is that expressions generalize automatically and safely without requiring a rewrite when the number of dimensions of X changes.
To create a copy of the array data, instead of only an alias, do: Unlike Python, D slice bounds don't saturate, so code equivalent to this Python code is an error in D: The programming language SuperCollider implements some concepts from J/APL.