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: [[BASIC programming language|BASIC]]=== HP's [[HP 2000]] systems, introduced in November 1968, used [[HP Time-Shared BASIC]] as their primary interface and programming language. This version of BASIC used slicing for most string manipulation operations. 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: <syntaxhighlight lang="basic"> 10 A$="HELLO, WORLD" 20 PRINT A$(1,5) 30 PRINT A$[7,11] </syntaxhighlight> Will produce: <syntaxhighlight lang="output"> HELLO WORLD </syntaxhighlight> The HP systems were widely used in the early 1970s, especially in technical [[high school]]s and many small industrial and scientific settings.<ref>{{Cite magazine |url=http://hpmemoryproject.org/news/tenyears_comp/measure_page_00.htm |title= Passing the 10-year mark |magazine= MEASURE Magazine |date= October 1976 |publisher= Hewlett Packard}}</ref> As the first [[microcomputer]]s emerged in the mid-1970s, HP was often used as the pattern for their BASIC dialects as well. Notable examples include 1977's [[Integer BASIC|Apple BASIC]], 1978's [[Atari BASIC]], and 1979's [[Sinclair BASIC]]. This style of manipulation generally offers advantages in terms of memory use, and was often chosen on systems that shipped with small amounts of memory. Only Sinclair's dialect differed in any meaningful way, using the {{code|TO}} keyword instead of a comma-separated list: <syntaxhighlight lang="basic"> 10 LET a$="ABCDE"(2 to 4) 20 PRINT a$ </syntaxhighlight> 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: <syntaxhighlight lang="basic"> 10 DIM A$(5) 20 LET A$(2)="HELLO, WORLD" 30 PRINT A$(2)(1:5) </syntaxhighlight> 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 {{code|LEFT$}}, {{code|RIGHT$}} and {{code|MID$}} string functions. [[Microsoft BASIC]] was written on the [[PDP-10]] and its BASIC was used as the pattern. 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.
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)