Leading axis theory: Difference between revisions

Jump to navigation Jump to search
1,041 bytes added ,  15:08, 5 October 2020
no edit summary
(→‎Adoption in APL: Raze from A+)
No edit summary
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Leading axis theory''', or the '''leading axis model''', is an approach to array language design and use that emphasizes working with arrays by manipulating their [[cell]]s and mapping functions over leading [[Axis|axes]] implicitly using [[function rank]] or explicitly using the [[Rank operator]]. It was initially developed in [[SHARP APL]] in the early 1980s and is now a major feature of [[J]] and [[Dyalog APL]], as well as languages influenced by these. The name "leading axis" comes from the [[frame]], which consists of leading axes of an array, the related concept of [[leading axis agreement]], which extends [[scalar]] [[conformability]], and the emphasis on first axis forms of functions while deprecating or discarding other [[function axis|choices of axis]].
'''Leading axis theory''', or the '''leading axis model''', is an approach to array language design and use that emphasizes working with arrays by manipulating their [[cell]]s and mapping functions over leading [[Axis|axes]] implicitly using [[function rank]] or explicitly using the [[Rank (operator)|Rank operator]]. It was initially developed in [[SHARP APL]] in the early 1980s and is now a major feature of [[J]] and [[Dyalog APL]], as well as languages influenced by these. The name "leading axis" comes from the [[frame]], which consists of leading axes of an array, the related concept of [[leading axis agreement]], which extends [[scalar]] [[conformability]], and the emphasis on first axis forms of functions while deprecating or discarding other [[function axis|choices of axis]].


== Features ==
== Features ==
Line 24: Line 24:
| Use first axis form only  || [[Reverse]], [[Rotate]] (<source lang=apl inline>⊖</source>), [[Replicate]], [[Reduce]] (<source lang=apl inline>⌿</source>), [[Expand]], [[Scan]] (<source lang=apl inline>⍀</source>), [[Catenate]] (<source lang=apl inline>⍪</source>)
| Use first axis form only  || [[Reverse]], [[Rotate]] (<source lang=apl inline>⊖</source>), [[Replicate]], [[Reduce]] (<source lang=apl inline>⌿</source>), [[Expand]], [[Scan]] (<source lang=apl inline>⍀</source>), [[Catenate]] (<source lang=apl inline>⍪</source>)
|-
|-
| Extendible to leading axes || [[Take]] (<source lang=apl inline>↑</source>), [[Drop]] (<source lang=apl inline>↓</source>), [[indexing]] (<source lang=apl inline>⌷</source>), [[scalar dyadic]]s, [[Unique]] (<source lang=apl inline>∪</source> or <source lang=apl inline>↑</source>) and most [[set function]]s (<source lang=apl inline>⍳∪∩~</source>)
| Extendible to leading axes || [[Take]] (<source lang=apl inline>↑</source>), [[Drop]] (<source lang=apl inline>↓</source>), [[Squad Indexing]] (<source lang=apl inline>⌷</source>), [[scalar dyadic]]s, [[Unique]] (<source lang=apl inline>∪</source> or <source lang=apl inline>↑</source>) and most [[set function]]s (<source lang=apl inline>⍳∪∩~</source>)
|-
|-
| Incompatible              || [[Split]] (<source lang=apl inline>↓</source>), [[First]] (<source lang=apl inline>↑</source> or <source lang=apl inline>⊃</source>), [[Membership]] (<source lang=apl inline>∊</source>), [[Partition]] (<source lang=apl inline>⊂</source> and <source lang=apl inline>⊆</source>)
| Incompatible              || [[Split]] (<source lang=apl inline>↓</source>), [[First]] (<source lang=apl inline>↑</source> or <source lang=apl inline>⊃</source>), [[Membership]] (<source lang=apl inline>∊</source>), [[Partition]] (<source lang=apl inline>⊂</source> and <source lang=apl inline>⊆</source>)
Line 36: Line 36:


{|class=wikitable
{|class=wikitable
! Functions                                !! [[SHARP APL]] !!style="min-width:5em"| [[A+]]  !! [[Dyalog APL]]
! Functions                                !! [[SHARP APL]]       !! [[Dyalog APL]]      !!style="min-width:5em"| [[A+]]  !!style="min-width:5em"| [[J]]    !!style="min-width:5em"| [[BQN]]
|-
|-
| [[Take]], [[Drop]]                      || {{Yes|19.0}} || {{Yes}}                        || {{Yes|13.0}}
| [[Take]], [[Drop]]                      || {{Yes|19.0}}       || {{Yes|13.0}}        || {{Yes}}                        || {{Yes}}                        || {{Yes}}
|-
|-
| [[Indexing]] function                   || {{Yes|19.0}} || {{Yes}}                        || {{Yes|13.0}}
| [[Squad Indexing|Indexing]] function     || {{Yes|19.0}}       || {{Yes|13.0}}        || {{Yes}}                        || {{Yes}}                        || {{Yes}}
|-
|-
| [[Bracket indexing]]                    || {{No}}       || {{Yes}}                       || {{No}}
| [[Bracket indexing]]                    || {{No}}             || {{No}}             || {{Yes}}                       ||style="text-align:center;"| N/A  ||style="text-align:center;"| N/A
|-
|-
| [[Scalar dyadic]]s                      || {{Yes}}       || {{No}}                        || {{No}}
| [[Scalar dyadic]]s                      || {{Yes}}             || {{No}}              || {{No}}                        || {{Yes}}                        || {{Yes}}
|-
|-
| [[Unique]]                               || {{Yes}}       ||style="text-align:center;"| N/A || {{Yes|17.0}}
| [[Index Of]]                             || {{No|Incompatible}} || {{Yes|14.0}}       || {{Yes}}                        || {{Yes}}                        || {{Yes}}
|-
|-
| [[Index Of]]                             || {{No|No*}}   || {{Yes}}                        || {{Yes|14.0}}
| [[Membership]]                           || {{No|Incompatible}} || {{No|Incompatible}} || {{Yes}}                        || {{Yes}}                        || {{Yes}}
|-
|-
| [[Union]], [[Intersection]], [[Without]] || {{No}}       ||style="text-align:center;"| N/A || {{No}}
| [[Unique]]                              || {{Yes}}            || {{Yes|17.0}}        ||style="text-align:center;"| N/A || {{Yes}}                        || {{Yes}}
|-
| [[Union]], [[Intersection]], [[Without]] || {{No}}             || {{No}}              ||style="text-align:center;"| N/A || {{Yes}}                         ||style="text-align:center;"| N/A
|}
|}


[[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. The leading-axis extension of scalar dyadics in SHARP is a direct consequence of given them a function rank 0, as SHARP's concept of function rank includes [[leading axis 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). 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]].


== History ==
== History ==
Line 61: Line 63:
Leading axis theory was brought to [[Nested array theory|nested]] APLs by [[Dyalog APL]] in the 2010s after [[Dyalog Ltd.]] employed Hui. Working with [[Jay Foad]] and [[Morten Kromberg]], Hui designed and implemented versions of Rank and other J functionality compatible with Dyalog's nested arrays.
Leading axis theory was brought to [[Nested array theory|nested]] APLs by [[Dyalog APL]] in the 2010s after [[Dyalog Ltd.]] employed Hui. Working with [[Jay Foad]] and [[Morten Kromberg]], Hui designed and implemented versions of Rank and other J functionality compatible with Dyalog's nested arrays.


{{APL features}}
{{APL features}}[[Category:Leading axis theory| ]]

Navigation menu