A Programming Language: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Marshall
m (Ordering is written with theta, not 0)
 
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
''A Programming Language'' is a book published in 1962 by [[Kenneth E. Iverson]] to describe one iteration of his [[Iverson notation]]. The book's title later was used to form the acronym APL. At the time of writing Iverson notation was used for mathematics and description of IBM's hardware, and its purely human purposes are reflected in the loose conventions (relative to APL) and two-dimensional structure of the notation presented in ''A Programming Language''.
'''''A Programming Language''''' is the title of a book and a paper, both published in 1962 by [[Kenneth E. Iverson]]. It describes one iteration of [[Iverson notation|his notation]]. The initials of the book's title later was used to form [[the name APL]]. At the time of writing Iverson notation was used for mathematics and description of IBM's hardware, and its purely human purposes are reflected in the loose conventions (relative to APL) and two-dimensional structure of the notation presented in ''A Programming Language''.


== Notation ==
== Notation ==


''A Programming Language'' does not feature a full multidimensional [[array model]]. Rather, operations are defined on [[scalars]], [[vectors]], and [[matrices]] and higher-[[rank]] arrays are not discussed. Nonetheless, it features many of the array conveniences that became characteristics of APL:
''A Programming Language'' does not feature a full multidimensional [[array model]]. Rather, operations are defined on [[scalar]]s, [[vector]]s, and [[Matrix|matrices]] while higher-[[rank]] arrays are not discussed. Nonetheless, it features many of the array conveniences that became characteristics of APL:
* [[Scalar functions]] are present with the name "basic operations".
* [[Scalar functions]] are present with the name "basic operations".
* While [[scalar extension]] is not defined in general, a scalar can be multiplied by an array as a "scalar multiple".
* While [[scalar extension]] is not defined in general, a scalar can be multiplied by an array as a "scalar multiple".
Line 11: Line 11:


''A Programming Language'' features precursors of many APL [[primitive functions]]. These include:
''A Programming Language'' features precursors of many APL [[primitive functions]]. These include:
* The [[shape]] vector is not used, but dimension functions are present: ν gives the length of a vector, and ν and μ give the row length and column length of a matrix.
* The [[shape]] vector is not used, but dimension functions are present: <math>\nu</math> gives the length of a vector, and <math>\nu</math> and <math>\mu</math> give the row length and column length of a matrix.
* [[Comparison functions]] are defined using the symbols <code><</code>, <code>></code>, and <code>=</code> and the rules that a vertical bar negates a relation and that an underline combines it with <code>=</code> (relations are combined by or-ing them together).
* [[Comparison functions]] are defined using the symbols <math><</math>, <math>></math>, and <math>=</math> and the rules that a vertical bar negates a relation and that an underline combines it with <math>=</math> (relations are combined by or-ing them together).
* The arithmetic [[scalar functions]] [[Sum]] (<code>+</code>), [[Difference]] (<code>-</code>), [[Product]] (×), and [[Quotient]] (÷) are defined as in mathematics.
* The arithmetic [[scalar functions]] [[Sum]] (<math>+</math>), [[Difference]] (<math>-</math>), [[Product]] (<math>\times</math>), and [[Quotient]] (<math>\div</math>) are defined as in mathematics.
* The logical functions [[And]] (<code></code>) and [[Or]] (<code></code>) also match mathematical usage. [[Logical negation]] is denoted with an overbar.
* The logical functions [[And]] (<math>\wedge</math>) and [[Or]] (<math>\vee</math>) also match mathematical usage. [[Logical negation]] is denoted with an overbar.
* The functions [[Absolute Value]], [[Ceiling]], and [[Floor]] use paired symbols. The paired symbols for ceiling and floor were adopted by mathematicians (absolute value was already in use), but APL implementations dropped the closing symbol for consistency with monadic function syntax.
* The functions [[Absolute Value]], [[Ceiling]], and [[Floor]] use paired symbols (<math>|a|</math>, <math>\lceil a\rceil</math>, and <math>\lfloor a\rfloor</math>). The paired symbols for ceiling and floor were adopted by mathematicians (absolute value was already in use), but APL implementations dropped the closing symbol for consistency with monadic function syntax.
* [[Residue]] uses <code>|</code> as in APL, but allows a subscript to indicate the smallest value allowed—mirroring [[index origin]].
* [[Residue]] uses <math>|</math> as in APL, but allows a subscript to indicate the smallest value allowed—mirroring [[index origin]].
* [[Iota]] is called "Interval" and uses the letter <code></code> with an optional [[index origin]] subscript.
* [[Interval]] (renamed "Index Generator" in [[APL\360]]) uses the letter <math>\iota</math> with an optional [[index origin]] subscript.
* [[Index-Of]] is also written with <code></code> and an [[index origin]] subscript. It is defined on vector left arguments and vector or scalar right arguments.
* [[Index-Of]] is also written with <math>\iota</math> and an [[index origin]] subscript. It is defined on vector left arguments and vector or scalar right arguments.
* [[Membership]] is <code></code> as in APL.
* [[Membership]] is <math>\epsilon</math> as in APL.
* [[Reduction]] (<code>/</code>, or <code>//</code> instead of <code>⌿</code>) starts from the left rather than the right. For reductions of [[empty]] arrays, the [[identity element]] is returned.
* [[Reduction]] (<math>/</math>, or <math>/\!/</math> instead of <syntaxhighlight lang=apl inline>⌿</syntaxhighlight>) starts from the left rather than the right. For reductions of [[empty]] arrays, the [[identity element]] is returned.
* [[Rotate]] is written with arrows: <code></code> for left rotation and <code></code> for right rotation.
* [[Rotate]] is written with arrows: <math>\uparrow</math> for left rotation and <math>\downarrow</math> for right rotation.
* [[Reverse]] is written with an arrow in some direction above the argument.
* [[Reverse]] is written with an arrow in some direction above the argument.
* [[Transpose]] is written with a tilde <code>~</code> above a matrix.
* [[Transpose]] is written with a tilde (<math>\tilde{}</math>) above a matrix, e.g. <math>\tilde M</math>.
* [[Compress|Compression]] and [[Expand|Expansion]] use <code>/</code> and <code>\</code> as in APL.
* [[Compress|Compression]] and [[Expand|Expansion]] use <math>/</math> and <math>\backslash</math> as in APL.
* [[Catenate]] uses a circled comma.
* [[Catenate]] uses a circled comma.
* [[Indexing]] is written with a subscript, or <code>∫<sub>j</sub></code> to allow [[index origin]] specification.
* [[Indexing]] is written with a subscript, or <math>\textstyle\int_j</math> to allow [[index origin]] specification.
* [[Grade]] is called "ordering", and the Grade of <code>x</code> with [[index origin]] <code>j</code> is written <code>0<sub>j</sub>/x</code>
* [[Grade]] is called "ordering", and the Grade of <math>x</math> with [[index origin]] <math>j</math> is written <math>\theta_j/x</math>
* [[Base]] (<code></code>) on vectors works like in APL. On matrices, rows are paired up, or columns with a doubled base symbol.
* [[Base]] (<math>\bot</math>) on vectors works like in APL. On matrices, rows are paired up, or columns with a doubled base symbol.
* The [[Intersection]] and [[Union]] are written with <code></code> and <code></code>, and the [[Set Difference]] with <code></code>.
* The [[Intersection]] and [[Union]] are written with <math>\cap</math> and <math>\cup</math>, and the [[Set Difference]] with <math>\Delta</math>.
* The [[Inner Product]] is written by placing one scalar function above another, and the [[Outer Product]] by using <code></code> in place of the top function with two vector arguments.
* The [[Inner Product]] is written by placing one scalar function above another, e.g. <math>u\,^+_\times{}v</math>, and the [[Outer Product]] by using <math>\circ</math> in place of the top function with two vector arguments
== External links ==
* [https://www.jsoftware.com/papers/AFIPS196205.htm Digitised version of the paper]
* [https://www.jsoftware.com/papers/APL.htm Partially digitised version of the book]
* [http://www.softwarepreservation.org/projects/apl/Books/APROGRAMMING%20LANGUAGE Scan of the full book]
{{APL dialects}}[[Category:Iverson notation]][[Category:Publications]]

Latest revision as of 20:30, 17 February 2024

A Programming Language is the title of a book and a paper, both published in 1962 by Kenneth E. Iverson. It describes one iteration of his notation. The initials of the book's title later was used to form the name APL. At the time of writing Iverson notation was used for mathematics and description of IBM's hardware, and its purely human purposes are reflected in the loose conventions (relative to APL) and two-dimensional structure of the notation presented in A Programming Language.

Notation

A Programming Language does not feature a full multidimensional array model. Rather, operations are defined on scalars, vectors, and matrices while higher-rank arrays are not discussed. Nonetheless, it features many of the array conveniences that became characteristics of APL:

  • Scalar functions are present with the name "basic operations".
  • While scalar extension is not defined in general, a scalar can be multiplied by an array as a "scalar multiple".
  • Vector functions are usually extended to work on the rows of matrices (the opposite of the leading axis model). When doubled typographically, they work on columns instead.

In addition to scalars, vectors, and matrices, tree and file types are defined.

A Programming Language features precursors of many APL primitive functions. These include:

  • The shape vector is not used, but dimension functions are present: gives the length of a vector, and and give the row length and column length of a matrix.
  • Comparison functions are defined using the symbols , , and and the rules that a vertical bar negates a relation and that an underline combines it with (relations are combined by or-ing them together).
  • The arithmetic scalar functions Sum (), Difference (), Product (), and Quotient () are defined as in mathematics.
  • The logical functions And () and Or () also match mathematical usage. Logical negation is denoted with an overbar.
  • The functions Absolute Value, Ceiling, and Floor use paired symbols (, , and ). The paired symbols for ceiling and floor were adopted by mathematicians (absolute value was already in use), but APL implementations dropped the closing symbol for consistency with monadic function syntax.
  • Residue uses as in APL, but allows a subscript to indicate the smallest value allowed—mirroring index origin.
  • Interval (renamed "Index Generator" in APL\360) uses the letter with an optional index origin subscript.
  • Index-Of is also written with and an index origin subscript. It is defined on vector left arguments and vector or scalar right arguments.
  • Membership is as in APL.
  • Reduction (, or instead of ) starts from the left rather than the right. For reductions of empty arrays, the identity element is returned.
  • Rotate is written with arrows: for left rotation and for right rotation.
  • Reverse is written with an arrow in some direction above the argument.
  • Transpose is written with a tilde () above a matrix, e.g. .
  • Compression and Expansion use and as in APL.
  • Catenate uses a circled comma.
  • Indexing is written with a subscript, or to allow index origin specification.
  • Grade is called "ordering", and the Grade of with index origin is written
  • Base () on vectors works like in APL. On matrices, rows are paired up, or columns with a doubled base symbol.
  • The Intersection and Union are written with and , and the Set Difference with .
  • The Inner Product is written by placing one scalar function above another, e.g. , and the Outer Product by using in place of the top function with two vector arguments

External links

APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000PometoTinyAPL
Historical A Programming LanguageA+ (A) ∙ APL#APL2CAPL\360APL/700APL\1130APL\3000APL.68000APL*PLUSAPL.jlAPL.SVAPLXExtended Dyalog APLIverson notationIVSYS/7090NARSngn/aplopenAPLOperators and FunctionsPATRowanSAXSHARP APLRationalized APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLBQNCoSyELIGleeIIvyJJellyK (Goal, Klong, Q) ∙ KamilaLispLang5LilNialRADUiua
Overviews Comparison of APL dialectsTimeline of array languagesTimeline of influential array languagesFamily tree of array languages