Leading axis theory: Difference between revisions

Jump to navigation Jump to search
121 bytes added ,  20:02, 19 February 2021
→‎Adoption in APL: Looks like SHARP doesn't use leading axis agreement; I think I misread SATN-45 originally
No edit summary
(→‎Adoption in APL: Looks like SHARP doesn't use leading axis agreement; I think I misread SATN-45 originally)
Line 15: Line 15:
== Adoption in APL ==
== Adoption in APL ==


Because APL was designed before the leading axis model was developed, many APL primitives do not naturally adhere to the theory and some are not compatible with it at all. The following table describes how functions and operators that act on specific axes of their arguments (omitting for example [[Enclose]] and [[Match]] which apply to entire arrays) interact with leading axis theory.
Because APL was designed before the leading axis model was developed, many APL primitives do not naturally adhere to the theory and some are not [[compatible]] with it at all. The following table describes how functions and operators that act on specific axes of their arguments (omitting for example [[Enclose]] and [[Match]] which apply to entire arrays) interact with leading axis theory.


{|class=wikitable
{|class=wikitable
Line 33: Line 33:
|}
|}


Backwards-compatible language changes are only effective for functions which are extendible to leading axes. The following extensions have been made in order to support leading axis theory:
In addition to these, the [[Rank operator]] and [[scalar dyadic]]s can be extended with [[leading axis agreement]], so that arguments with different-length frames can be match as long as one frame is a prefix of the other. The original introduction of Rank had only an analogue of [[scalar extension]], where an argument with an empty frame is repeated to pair it with an argument with a non-empty frame. The following extensions have been made in order to support leading axis theory:


{|class=wikitable
{|class=wikitable
Line 44: Line 44:
| [[Bracket indexing]]                    || {{No}}              || {{No}}              || {{Yes}}                        ||style="text-align:center;"| N/A  ||style="text-align:center;"| N/A
| [[Bracket indexing]]                    || {{No}}              || {{No}}              || {{Yes}}                        ||style="text-align:center;"| N/A  ||style="text-align:center;"| N/A
|-
|-
| [[Scalar dyadic]]s                      || {{Yes}}             || {{No}}              || {{No}}                        || {{Yes}}                        || {{Yes}}
| [[Scalar dyadic]]s                      || {{No}}             || {{No}}              || {{No}}                        || {{Yes}}                        || {{Yes}}
|-
|-
| [[Index Of]]                            || {{No|Incompatible}} || {{Yes|14.0}}        || {{Yes}}                        || {{Yes}}                        || {{Yes}}
| [[Index Of]]                            || {{No|Incompatible}} || {{Yes|14.0}}        || {{Yes}}                        || {{Yes}}                        || {{Yes}}
Line 55: Line 55:
|}
|}


[[Index Of]] in SHARP APL was not extended to apply to left argument [[major cell]]s as in J and Dyalog; instead it was given rank <source lang=apl inline>1 0</source> making such a change impossible. In A+ not only [[Index Of]] but also [[Membership]] was changed to follow the leading axis model, breaking compatibility with other APLs. A+ also restricts [[Take]] and [[Drop]] to allow only a [[singleton]] left argument (but any right argument rank is permitted). The leading-axis extension of scalar dyadics in SHARP is a direct consequence of giving them a function rank 0, as SHARP's concept of function rank includes [[prefix agreement]].
[[Index Of]] in SHARP APL was not extended to apply to left argument [[major cell]]s as in J and Dyalog; instead it was given rank <source lang=apl inline>1 0</source> making such a change impossible. In A+ not only [[Index Of]] but also [[Membership]] was changed to follow the leading axis model, breaking compatibility with other APLs. A+ also restricts [[Take]] and [[Drop]] to allow only a [[singleton]] left argument (but any right argument rank is permitted).


== History ==
== History ==

Navigation menu