Comparison of APL dialects: Difference between revisions

Jump to navigation Jump to search
(Embed Omnibar)
(Table of various Discloses (which also serves for boxed vs nested))
Line 4: Line 4:


One of the most significant differences between APLs is the choice of [[array model]], namely [[Nested array theory|nested]] or [[Flat array theory|flat]]. Originally, all APLs were entirely flat, that is, the only [[scalar]] values supported were  [[simple]] and had to be either [[number]]s and [[character]]s, and an array had to be homogeneous, that is, consisting entirely of a single [[type]]. [[SHARP APL]] introduced the [[box]] as a third type, such that a box could hold any other array (including a box array), and this allowed for arrays contain other arrays. [[NARS]] introduced the nested array model, where any arrays can be an actual [[element]] of another array. Most currently maintained dialects ([[Dyalog APL]], [[NARS2000]], [[APL2]], [[GNU APL]], and others) use the nested array model.
One of the most significant differences between APLs is the choice of [[array model]], namely [[Nested array theory|nested]] or [[Flat array theory|flat]]. Originally, all APLs were entirely flat, that is, the only [[scalar]] values supported were  [[simple]] and had to be either [[number]]s and [[character]]s, and an array had to be homogeneous, that is, consisting entirely of a single [[type]]. [[SHARP APL]] introduced the [[box]] as a third type, such that a box could hold any other array (including a box array), and this allowed for arrays contain other arrays. [[NARS]] introduced the nested array model, where any arrays can be an actual [[element]] of another array. Most currently maintained dialects ([[Dyalog APL]], [[NARS2000]], [[APL2]], [[GNU APL]], and others) use the nested array model.
=== Disclose ===
[[Disclose]] is defined, on [[scalar]]s, to be the inverse of [[Enclose]], giving the sole [[element]] of that scalar. This behavior is extended to arbitrary arrays in one of two ways: [[Mix]], which combines all elements, and [[First]], which returns only the first (in [[ravel order]]).
In the [[SHARP APL]] family, Disclose is written <syntaxhighlight lang=apl inline>></syntaxhighlight>, and given a [[function rank]] of 0, which causes it to behave as [[Mix]]. [[First]] is not a primitive.
In nested APL dialects, Disclose is written <syntaxhighlight lang=apl inline>⊃</syntaxhighlight>, and it [[Disclose#History|was extended]] to First by [[NARS]] and to Mix by [[APL2]]. The other possible meaning is given the glyph <syntaxhighlight lang=apl inline>↑</syntaxhighlight> and named "Mix" or "First" (not "Disclose") as appropriate. Dialects might choose either assignment of glyphs, and [[Dyalog APL]] and [[APL*PLUS]] allow either to be chosen based on [[Migration Level]].
{|class=wikitable
! Glyph !! Meaning !! Dialects
|-
| <syntaxhighlight lang=apl inline>></syntaxhighlight> || [[Mix]]      || [[SHARP APL]], [[A]], [[A+]]
|-
| <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> || [[Mix]]      || [[APL2]], [[APLX]], [[NARS2000]], [[GNU APL]], [[Kap]]
|-
| <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> || [[First]]    || [[ngn/apl]], [[Co-dfns]], [[dzaima/APL]], [[April]]
|-
| <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> || Configurable || [[Dyalog APL]], [[APL*PLUS]], [[APL+Win]], [[APL64]]
|}


== Complex numbers ==
== Complex numbers ==


Most dialects support [[complex number]]s, but some ([[dzaima/APL]], [[APLX]], [[APL+Win]]) don't. Dialects with complex numbers also extend [[Circular]] (<syntaxhighlight lang=apl inline>○</syntaxhighlight>) to left arguments designed for complex numbers.
Most dialects support [[complex number]]s, but some ([[dzaima/APL]], [[APLX]], [[APL+Win]]) don't. Dialects with complex numbers also extend [[Circular]] (<syntaxhighlight lang=apl inline>○</syntaxhighlight>) to left arguments designed for complex numbers.
== First/Mix ==
In dialects implementing [[nested array theory]], the two [[glyph]]s commonly used for [[Disclose]] are [[Right Shoe]] (<syntaxhighlight lang=apl inline>⊃</syntaxhighlight>) and [[Up Arrow]] (<syntaxhighlight lang=apl inline>↑</syntaxhighlight>). The original [[NARS]] paper specified [[monadic]] <syntaxhighlight lang=apl inline>↑</syntaxhighlight> as [[Mix]] and <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> as [[First]], so [[Dyalog]] and [[STSC]] implemented [[Dyalog APL]] and [[APL*PLUS]] accordingly. [[IBM]] decided to swap them in [[APL2]], causing the others to implement [[Migration Level]], as APL2 was seen as the authoritative implementation. When the ISO [[standard]] was written, it closely followed APL2, causing [[APLX]], [[NARS2000]], [[GNU APL]], and [[ngn/apl]] to adopt these notations. However, ngn/apl later switched to follow Dyalog.


== Depth ==
== Depth ==