A Programming Language: Difference between revisions

Jump to navigation Jump to search
m (9 revisions imported: Migrate from miraheze)
(Fix math)
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: <math>ν</math> gives the length of a vector, and <math>ν</math> and <math>μ</math> 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 <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).
* [[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]] (<math>+</math>), [[Difference]] (<math>-</math>), [[Product]] (<math>×</math>), and [[Quotient]] (<math>÷</math>) 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]] (<math></math>) and [[Or]] (<math></math>) 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 (<math>|a|</math>, <math>⌈a⌉</math>, and <math>⌊a⌋</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.
* 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 <math>|</math> 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 <math>\iota</math> with an optional [[index origin]] subscript.
* [[Iota]] is called "Interval" and uses the letter <math>\iota</math> with an optional [[index origin]] subscript.
Line 21: Line 21:
* [[Membership]] is <math>\epsilon</math> as in APL.
* [[Membership]] is <math>\epsilon</math> as in APL.
* [[Reduction]] (<math>/</math>, or <math>//</math> instead of <source lang=apl inline>⌿</source>) 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 <source lang=apl inline>⌿</source>) starts from the left rather than the right. For reductions of [[empty]] arrays, the [[identity element]] is returned.
* [[Rotate]] is written with arrows: <math></math> for left rotation and <math></math> 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 (<math>\tilde{}</math>) above a matrix, e.g. <math>\tilde M</math>.
* [[Transpose]] is written with a tilde (<math>\tilde{}</math>) above a matrix, e.g. <math>\tilde M</math>.
* [[Compress|Compression]] and [[Expand|Expansion]] use <math>/</math> and <math>\backslash</math> 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 <math>∫_j</math> to allow [[index origin]] specification.
* [[Indexing]] is written with a subscript, or <math>\int_j</math> to allow [[index origin]] specification.
* [[Grade]] is called "ordering", and the Grade of <math>x</math> with [[index origin]] <math>j</math> is written <math>0_j/x</math>
* [[Grade]] is called "ordering", and the Grade of <math>x</math> with [[index origin]] <math>j</math> is written <math>0_j/x</math>
* [[Base]] (<math></math>) 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 <math></math> and <math></math>, and the [[Set Difference]] with <math>\Delta</math>.
* 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, e.g. <math>u\,^+_×v</math>, and the [[Outer Product]] by using <math></math> 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.
{{APL dialects}}
{{APL dialects}}