Total array ordering: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
No edit summary
(Most content moved to Array ordering, see talk page)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
In APL, a '''total array ordering''', or '''TAO''', is an [[ordering]] on all arrays which is used by [[Grade]] and [[Interval Index]]. Traditionally ordering is defined only for [[simple]] arrays of the same [[shape]], so TAO refers to the extension to [[Nested array|nested]] or [[box]]ed arrays of arbitrary [[shape]] and [[rank]]. While [[J]] has had such an ordering since 1996 (release 3.01), total array ordering in APL was first seen in [[Dyalog APL 17.0]].
:'''''TAO''' links here. For the chat room, see The [[APL Orchard]].''


Dyalog's ordering is not a true total order because it does not handle arrays containing [[simple scalar]]s other than [[number]]s or [[character]]s, such as [[namespace]]s or [[object]]s. [[Roger Hui]] has argued that these scalars are not truly arrays, and are not in the scope of a total array ordering.
'''Total array ordering''', or '''TAO''', is the [[array ordering]] defined by [[Dyalog APL]] in [[Dyalog APL 17.0|version 17.0]] (2018), which pertains to arrays of nulls, [[number]]s, and [[character]]s in any arrangement. It extends the concept of [[wikipedia:lexicographic order|lexicographic order]] to higher ranks. The name ''total array ordering'' is taken partly from the mathematical concept of a [[wikipedia:total order|total order]], which must order any two values, with values ordering equally only if they are identical. This concept is transferred to APL by specifying that arrays should only order equally if they [[match]]. The name has also been applied retroactively to [[J]]'s array ordering, which has different rules from Dyalog,<ref>[[Roger Hui|Hui, R.]]. [https://code.jsoftware.com/wiki/Essays/The_TAO_of_J The TAO of J].</ref> and is used in [[TinyAPL]], which bases its ordering on Dyalog's but treats scalars differently.


The name "total array ordering" is taken partly from the mathematical concept of a [[wikipedia:total order|total order]], which must order any two elements, with elements ordering equally only if they are identical. This concept is transferred to APL by specifying that arrays should only order equally if they [[match]].
The extensions made in Dyalog 17.0 are support for [[complex number]]s and the special value <syntaxhighlight lang=apl inline>⎕null</syntaxhighlight>, the ability to compare values of different types, and the extension to differing shapes and ranks. There is no support for [[simple scalar]]s other than nulls, [[number]]s or [[character]]s (namely [[namespace]]s, [[object]]s, and [[object representation]]s), because ordering those was considered "contentious but of little incremental benefit."<ref name=bfh>[[Adám Brudzewsky|Brudzewsky, A.]], [[Jay Foad|J. Foad]], and R. Hui. [https://www.jsoftware.com/papers/TAOaxioms.htm TAO Axioms]. 2018-02-02.</ref> [[Roger Hui]] has argued that these scalars are not truly arrays, and are not in the scope of a total array ordering. However, the [[dfns workspace]] includes an APL model which is truly total, though it differs from the native implementation in ordering characters before numbers instead of the opposite.<ref>[[Dfns workspace]]. [http://dfns.dyalog.com/n_le.htm <syntaxhighlight lang=apl inline>le</syntaxhighlight>] ― Total array ordering (TAO) comparison.</ref>


== External links ==
== References ==
<references/>


[https://www.jsoftware.com/papers/TAOaxioms.htm TAO Axioms] for [[Dyalog APL]]
{{APL features}}[[Category:Paradigms]]
 
[http://dfns.dyalog.com/n_le.htm n_le], a [[dfn]] implementation of a total array ordering
 
[https://code.jsoftware.com/wiki/Essays/The_TAO_of_J The TAO of J]

Latest revision as of 15:40, 17 October 2024

TAO links here. For the chat room, see The APL Orchard.

Total array ordering, or TAO, is the array ordering defined by Dyalog APL in version 17.0 (2018), which pertains to arrays of nulls, numbers, and characters in any arrangement. It extends the concept of lexicographic order to higher ranks. The name total array ordering is taken partly from the mathematical concept of a total order, which must order any two values, with values ordering equally only if they are identical. This concept is transferred to APL by specifying that arrays should only order equally if they match. The name has also been applied retroactively to J's array ordering, which has different rules from Dyalog,[1] and is used in TinyAPL, which bases its ordering on Dyalog's but treats scalars differently.

The extensions made in Dyalog 17.0 are support for complex numbers and the special value ⎕null, the ability to compare values of different types, and the extension to differing shapes and ranks. There is no support for simple scalars other than nulls, numbers or characters (namely namespaces, objects, and object representations), because ordering those was considered "contentious but of little incremental benefit."[2] Roger Hui has argued that these scalars are not truly arrays, and are not in the scope of a total array ordering. However, the dfns workspace includes an APL model which is truly total, though it differs from the native implementation in ordering characters before numbers instead of the opposite.[3]

References

  1. Hui, R.. The TAO of J.
  2. Brudzewsky, A., J. Foad, and R. Hui. TAO Axioms. 2018-02-02.
  3. Dfns workspace. le ― Total array ordering (TAO) comparison.


APL features [edit]
Built-ins Primitives (functions, operators) ∙ Quad name
Array model ShapeRankDepthBoundIndex (Indexing) ∙ AxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayCellMajor cellSubarrayEmpty arrayPrototype
Data types Number (Boolean, Complex number) ∙ Character (String) ∙ BoxNamespaceFunction array
Concepts and paradigms Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity elementComplex floorArray ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ GlyphLeading axis theoryMajor cell searchFirst-class function
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROREVOLUTION ERROR