Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Array slicing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===1968: [[Algol 68]]=== Algol68 final report contains an early example of slicing, slices are specified in the form: [lower bound:upper bound] ''Β’ for computers with extended character sets Β’'' or: (LOWER BOUND..UPPER BOUND) ''# FOR COMPUTERS WITH ONLY 6 BIT CHARACTERS. #'' Both bounds are inclusive and can be omitted, in which case they default to the declared array bounds. Neither the stride facility, nor diagonal slice aliases are part of the revised report. Examples: [3, 3]real a := ((1, 1, 1), (2, 4, 8), (3, 9, 27)); ''# declaration of a variable matrix #'' [,] real c = ((1, 1, 1), (2, 4, 8), (3, 9, 27)); ''# constant matrix, the size is implied #'' ref[]real row := a[2,]; ''# alias/<u>ref</u> to a row slice #'' ref[]real col2 = a[, 2]; ''# permanent alias/<u>ref</u> to second column #'' print ((a[:, 2], newline)); ''# second column slice #'' print ((a[1βa, :], newline)); ''# last row slice #'' print ((a[:, 2βa], newline)); ''# last column slice #'' print ((a[:2, :2], newline)); ''# leading 2-by-2 submatrix "slice" #'' +1.0000<sub>10</sub>+0 +4.0000<sub>10</sub>+0 +9.0000<sub>10</sub>+0 +3.0000<sub>10</sub>+0 +9.0000<sub>10</sub>+0 +2.7000<sub>10</sub>+1 +1.0000<sub>10</sub>+0 +8.0000<sub>10</sub>+0 +2.7000<sub>10</sub>+1 +1.0000<sub>10</sub>+0 +1.0000<sub>10</sub>+0 +2.0000<sub>10</sub>+0 +4.0000<sub>10</sub>+0
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)