4,577
edits
(HOPL citation for Whitney inventing Rank) |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 5: | Line 5: | ||
The leading axis theory as a complete model of programming is best exemplified by [[J]], since it was designed entirely using the theory from the start. While various APLs have developed or adopted features of the leading axis model, [[backwards compatibility]] requirements can prevent them from making certain changes to align with the theory. | The leading axis theory as a complete model of programming is best exemplified by [[J]], since it was designed entirely using the theory from the start. While various APLs have developed or adopted features of the leading axis model, [[backwards compatibility]] requirements can prevent them from making certain changes to align with the theory. | ||
J defines all one-dimensional functions to work on the first [[axis]], that is, to manipulate [[major cell]]s of their arguments. In this way it unifies APL's pairs of first- and last-axis functions and operators including [[Reverse]], [[Rotate]], [[Replicate]], [[Expand]], [[Reduce]], and [[Scan]]. J retains two functions corresponding to < | J defines all one-dimensional functions to work on the first [[axis]], that is, to manipulate [[major cell]]s of their arguments. In this way it unifies APL's pairs of first- and last-axis functions and operators including [[Reverse]], [[Rotate]], [[Replicate]], [[Expand]], [[Reduce]], and [[Scan]]. J retains two functions corresponding to <syntaxhighlight lang=apl inline>,</source> and <syntaxhighlight lang=apl inline>⍪</source>, with <syntaxhighlight lang=j inline>,</source> as [[Ravel]] and [[Catenate First]] and <syntaxhighlight lang=j inline>,.</source> for second- (rather than last-) axis forms of these functions; <syntaxhighlight lang=j inline>,.</source> is identical to <syntaxhighlight lang=j inline>,"_1</source> (which transliterates to APL <syntaxhighlight lang=apl inline>,⍤¯1</source>) in both valences. | ||
J also extends [[Rotate]] so that it can work on multiple leading axes rather than a single axis: additional values in the left argument apply to leading axes of the right in order. This aligns Rotate with the [[SHARP APL]] extensions to [[Take]], [[Drop]], and [[Squad]] allowing short left arguments: in each case the left argument is a [[vector]] corresponding to axes of the right argument starting at the first. | J also extends [[Rotate]] so that it can work on multiple leading axes rather than a single axis: additional values in the left argument apply to leading axes of the right in order. This aligns Rotate with the [[SHARP APL]] extensions to [[Take]], [[Drop]], and [[Squad]] allowing short left arguments: in each case the left argument is a [[vector]] corresponding to axes of the right argument starting at the first. | ||
Line 20: | Line 20: | ||
! Compatibility !! Functions | ! Compatibility !! Functions | ||
|- | |- | ||
| Already compatible || [[Grade]] (< | | Already compatible || [[Grade]] (<syntaxhighlight lang=apl inline>⍋</source>, <syntaxhighlight lang=apl inline>⍒</source>), [[Decode]] (<syntaxhighlight lang=apl inline>⊥</source>), [[Encode]] (<syntaxhighlight lang=apl inline>⊤</source>) | ||
|- | |- | ||
| Use first axis form only || [[Reverse]], [[Rotate]] (< | | Use first axis form only || [[Reverse]], [[Rotate]] (<syntaxhighlight lang=apl inline>⊖</source>), [[Replicate]], [[Reduce]] (<syntaxhighlight lang=apl inline>⌿</source>), [[Expand]], [[Scan]] (<syntaxhighlight lang=apl inline>⍀</source>), [[Catenate]] (<syntaxhighlight lang=apl inline>⍪</source>) | ||
|- | |- | ||
| Extendible to leading axes || [[Take]] (< | | Extendible to leading axes || [[Take]] (<syntaxhighlight lang=apl inline>↑</source>), [[Drop]] (<syntaxhighlight lang=apl inline>↓</source>), [[Squad Indexing]] (<syntaxhighlight lang=apl inline>⌷</source>), [[scalar dyadic]]s, [[Unique]] (<syntaxhighlight lang=apl inline>∪</source> or <syntaxhighlight lang=apl inline>↑</source>) and most [[set function]]s (<syntaxhighlight lang=apl inline>⍳∪∩~</source>) | ||
|- | |- | ||
| Incompatible || [[Split]] (< | | Incompatible || [[Split]] (<syntaxhighlight lang=apl inline>↓</source>), [[First]] (<syntaxhighlight lang=apl inline>↑</source> or <syntaxhighlight lang=apl inline>⊃</source>), [[Membership]] (<syntaxhighlight lang=apl inline>∊</source>), [[Partition]] (<syntaxhighlight lang=apl inline>⊂</source> and <syntaxhighlight lang=apl inline>⊆</source>) | ||
|- | |- | ||
| Unclear || [[Find]] (< | | Unclear || [[Find]] (<syntaxhighlight lang=apl inline>⍷</source>) | ||
|- | |- | ||
| Designed for leading axes || [[Rank operator]] (< | | Designed for leading axes || [[Rank operator]] (<syntaxhighlight lang=apl inline>⍤</source>), [[Tally]] (<syntaxhighlight lang=apl inline>≢</source>), [[Interval Index]] (<syntaxhighlight lang=apl inline>⍸</source>), [[Key]] (<syntaxhighlight lang=apl inline>⌸</source>), [[Raze]] (<syntaxhighlight lang=apl inline>⊃</source>) | ||
|} | |} | ||
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 < | [[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 <syntaxhighlight 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 == |