Function axis: Difference between revisions
Jump to navigation
Jump to search
→Functions with Axis
Miraheze>Adám Brudzewsky m (Adám Brudzewsky moved page Function axis to Bracket axis: New name covers ops too) |
Miraheze>Adám Brudzewsky |
||
Line 1: | Line 1: | ||
In many APLs the behavior of a function may be modified using bracket notation, for example <source lang=apl inline>⌽[2]</source> to [[Rotate]] along the second [[axis]]. Axis specification was a feature of [[Iverson notation]] and was ubiquitous in early APLs; many newer APLs which adhere to [[leading axis theory]] reject the use of axis specification in favor of the [[Rank operator]] because it is a fully general operator while the behavior of functions with axis must be defined for each function separately. | In many APLs the behavior of a function may be modified using bracket notation, for example <source lang=apl inline>⌽[2]</source> to [[Rotate]] along the second [[axis]]. Axis specification was a feature of [[Iverson notation]] and was ubiquitous in early APLs; many newer APLs which adhere to [[leading axis theory]] reject the use of axis specification in favor of the [[Rank operator]] because it is a fully general operator while the behavior of functions with axis must be defined for each function separately. | ||
== Functions | == Functions == | ||
=== Monadic functions === | |||
The following [[Monadic function|monads]] may allow an axis: | The following [[Monadic function|monads]] may allow an axis: | ||
* [[Mix]] accepts a list of axes to specify where the axes of argument elements will be placed in the result. | * [[Mix]] accepts a list of axes to specify where the axes of argument elements will be placed in the result. | ||
Line 9: | Line 9: | ||
* [[Split]] accepts a single axis, and encloses each [[vector]] along that axis. | * [[Split]] accepts a single axis, and encloses each [[vector]] along that axis. | ||
* [[Reverse]] reverses along the specified axis. | * [[Reverse]] reverses along the specified axis. | ||
=== Dyadic functions === | |||
The following [[Dyadic function|dyads]] may allow one: | The following [[Dyadic function|dyads]] may allow one: | ||
* [[Scalar dyadics]] accept a list of axes to override [[conformability]] rules: it specifies , for each axis in the lower-rank (or left, in case of a tie) argument, which axis in the other argument it is paired with. | * [[Scalar dyadics]] accept a list of axes to override [[conformability]] rules: it specifies , for each axis in the lower-rank (or left, in case of a tie) argument, which axis in the other argument it is paired with. | ||
Line 19: | Line 19: | ||
* [[Partition]] and [[Partitioned Enclose]] have complicated and different behavior. | * [[Partition]] and [[Partitioned Enclose]] have complicated and different behavior. | ||
== Operators == | |||
The following [[operator]]s may admit axis specification: | |||
* [[Reduction]] removes the specified right argument axis. | |||
* [[Scan]] works on the specified right argument axis. | |||
In [[Dyalog APL]], a slash with axis retains its [[function-operator overloading]]: it can be applied as an operator or as a dyadic function ([[Replicate]] or [[Expand]]). | |||
{{APL programming language}} | {{APL programming language}} |