Comparison of APL dialects: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (→‎Language features: header cell links)
(→‎Language features: Control structures, namespaces)
Line 40: Line 40:


== Language features ==
== Language features ==
The following table shows support for various APL features: nesting either with [[box]]es or the [[nested array model]], [[defined function]]s or similar syntax, [[control structure]]s, [[dfn]]-style anonymous functions, [[tacit]] programming, particularly with [[train]]s, [[complex number]]s, arbitrary-precision integers, [[Unicode]] support, and namespaces. The precise syntax and capabilities of these features might differ between dialects that support them.


{|class=wikitable
{|class=wikitable
!                        !! nesting        !! [[tradfn]]s !! [[dfn]]s             !! [[tacit]]         !! [[complex]] !! big ints !! Unicode
!                        !! Nesting !! [[Tradfn]]s !! [[Control structure|Control]] !! [[Dfn]]s !! [[Tacit]] !! [[Complex]] !! Big int !! Unicode         !! [[Namespace]]
|-
|-
| [[APL\1130]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL\1130]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL\360]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL\360]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL*PLUS]]            || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL*PLUS]]            || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL/700]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL/700]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL.SV]]              || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL.SV]]              || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL 5100]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL 5100]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[MCM/70]]              || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[MCM/70]]              || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[VS APL]]              || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[VS APL]]              || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[SHARP APL]]          || {{Yes|Boxes}}  || {{Yes}} || {{No}}            || {{No}}        || {{Yes}} || {{No}}   || {{No}}
| [[SHARP APL]]          || {{Yes|Boxes}}  || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{Yes}} || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL\3000]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL\3000]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[NARS]]                || {{Yes|Nested}}  || {{Yes}} || {{Maybe|[[direct definition (NARS)|direct def]]}}
| [[NARS]]                || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{Maybe|[[direct definition (NARS)|direct def]]}}
                                                                              | {{No}}        || {{No}}  || {{No}}   || {{No}}
                                                                                                  | {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[Dyalog APL]]          || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}}   || {{Yes}}
| [[Dyalog APL]]          || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}} || {{Yes}}        || {{Yes}}
|-
|-
| [[APL2]]                || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}        || {{Yes}} || {{No}}   || {{No}}
| [[APL2]]                || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{Yes}} || {{No}} || {{No}}          || {{Yes}}
|-
|-
| [[A+]]                  || {{Yes|Boxes}}  || {{Yes}} || {{No}}            || {{Yes}}       || {{No}}  || {{No}}   || {{No}}
| [[A+]]                  || {{Yes|Boxes}}  || {{Yes}} || {{Yes}}          || {{No}}            || {{Maybe|Some}} || {{No}} || {{No}}  || {{No}}         || {{No}}
|-
|-
| [[SAX]]                || {{Yes|Boxes}}  || {{Yes}} || {{No}}            || {{Maybe|Some}} || {{No}}  || {{No}}   || {{No}}
| [[SAX]]                || {{Yes|Boxes}}  || {{Yes}} || {{Yes}}          || {{No}}            || {{Maybe|Some}} || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[APL+Win]]            || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APL+Win]]            || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{Yes}}
|-
|-
| [[APLX]]                || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[APLX]]                || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[NARS2000]]            || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}        || {{Yes}} || {{Yes}} || {{Maybe|UCS-2}}
| [[NARS2000]]            || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}          || {{Yes}}        || {{Yes}} || {{Yes}} || {{Maybe|UCS-2}} || {{No}}
|-
|-
| [[VisualAPL]]          || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{Yes}}
| [[VisualAPL]]          || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{Yes}}        || {{Yes}}
|-
|-
| [[APL#]]                || {{Yes|Nested}}  ||colspan=2 {{Yes|Hybrid}}     || {{No}}        || {{No}}  || {{No}}   || {{Yes}}
| [[APL#]]                || {{Yes|Nested}}  ||colspan=3 {{Yes|Hybrid}}                           || {{No}}        || {{No}}  || {{No}} || {{Yes}}        || {{Yes}}
|-
|-
| [[ngn/apl]]            || {{Yes|Nested}}  || {{No}}  || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}}   || {{Yes}}
| [[ngn/apl]]            || {{Yes|Nested}}  || {{No}}  || {{No}}            || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}} || {{Yes}}        || {{No}}
|-
|-
| [[GNU APL]]            || {{Yes|Nested}}  || {{Yes}} || {{Maybe|Limited}} || {{No}}        || {{Yes}} || {{Yes}} || {{Yes}}
| [[GNU APL]]            || {{Yes|Nested}}  || {{Yes}} || {{Maybe|If-else}} || {{Maybe|Limited}} || {{No}}        || {{Yes}} || {{Yes}} || {{Yes}}        || {{No}}
|-
|-
| [[Aplette]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{No}}
| [[Aplette]]            || {{No}}          || {{Yes}} || {{No}}            || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{No}}          || {{No}}
|-
|-
| [[Co-dfns]]            || {{Yes|Nested}}  || {{No}}  || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}}   || {{Yes}}
| [[Co-dfns]]            || {{Yes|Nested}}  || {{No}}  || {{No}}            || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}} || {{Yes}}        || {{Maybe|Partial}}
|-
|-
| [[April]]              || {{Yes|Nested}}  || {{No}}  || {{Yes}}          || {{Yes}}        || {{Yes}} || {{Yes}} || {{Yes}}
| [[April]]              || {{Yes|Nested}}  || {{No}}  || {{No}}            || {{Yes}}          || {{Yes}}        || {{Yes}} || {{Yes}} || {{Yes}}        || {{Yes}}
|-
|-
| [[Dzaima/APL]]          || {{Yes|Nested}}  || {{No}}  || {{Yes}}          || {{Yes}}        || {{No}}  || {{Yes}} || {{Yes}}
| [[Dzaima/APL]]          || {{Yes|Nested}}  || {{No}}  || {{No}}            || {{Yes}}          || {{Yes}}        || {{No}}  || {{Yes}} || {{Yes}}        || {{No}}
|-
|-
| [[APL\iv]]              || {{Maybe|Lists}} || {{No}}  || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}}   || {{Yes}}
| [[APL\iv]]              || {{Maybe|Lists}} || {{No}}  || {{No}}            || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}} || {{Yes}}        || {{No}}
|-
|-
| [[Extended Dyalog APL]] || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}}   || {{Yes}}
| [[Extended Dyalog APL]] || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}} || {{Yes}}        || {{Yes}}
|-
|-
| [[Kap]]                || {{Yes|Nested}}  || {{No}} || {{Yes}}          || {{Yes}}        || {{Yes}} || {{Yes}} || {{Yes}}
| [[Kap]]                || {{Yes|Nested}}  || {{Yes}} || {{Yes}}           || {{Yes}}          || {{Yes}}        || {{Yes}} || {{Yes}} || {{Yes}}        || {{Yes}}
|-
|-
| [[APL64]]              || {{Yes|Nested}}  || {{Yes}} || {{No}}            || {{No}}        || {{No}}  || {{No}}   || {{Yes}}
| [[APL64]]              || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{No}}            || {{No}}        || {{No}}  || {{No}} || {{Yes}}        || {{Yes}}
|-
|-
| [[Dyalog APL Vision]]  || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}}   || {{Yes}}
| [[Dyalog APL Vision]]  || {{Yes|Nested}}  || {{Yes}} || {{Yes}}          || {{Yes}}          || {{Yes}}        || {{Yes}} || {{No}} || {{Yes}}        || {{Yes}}
|}
|}



Revision as of 18:57, 21 February 2024

All APL dialects share core features, and at least the primitives are backwards compatible with those of APL.SV. However, there are important dialectal differences, the most significant of which are described in this article.

Flat versus Nested

One of the most significant differences between APLs is the choice of array model, namely nested or flat. Originally, all APLs were entirely flat, that is, the only scalar values supported were simple and had to be either numbers and characters, 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 scalars, 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 >, 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 , and it was extended to First by NARS and to Mix by APL2. The other possible meaning is given the glyph 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.

Glyph Meaning Dialects
> Mix SHARP APL, A, A+
Mix APL2, ISO/IEC 13751:2001, APLX, NARS2000, GNU APL, Kap
First ngn/apl, Co-dfns, dzaima/APL, April
Configurable Dyalog APL, APL*PLUS, APL+Win, APL64

Complex numbers

Most dialects support complex numbers, but some (dzaima/APL, APLX, APL+Win) don't. Dialects with complex numbers also extend Circular () to left arguments designed for complex numbers.

Conformability

All APLs implement scalar extension in scalar dyadic functions, and Each if present. However, a few dialects differ in their support for singleton extension. Most support it fully, so that a singleton of any rank is extended. APL2 supports it only for scalars and one-element vectors (and ISO/IEC_13751:2001 specifies only this behavior), and dzaima/APL and Kap support scalar extension only.

Furthermore, dialects that implement the Rank operator differ in their conformability rules for frames. Dyalog APL and SHARP APL implement scalar agreement only, NARS2000 implements singleton agreement, and A+ implements leading axis agreement (in addition to extra options allowing the programmer to specify outer-product-like treatment of some axes).

Depth

Dyalog APL defines Depth () to return negative numbers when the depth is uneven. Most other dialects instead define it to return the maximum depth. The original NARS paper assigned the glyph to a function called Simple, which simply answered if the argument was simple or not, without reporting the actual depth. It was thus equivalent to today's 1=≡,Y.

Language features

The following table shows support for various APL features: nesting either with boxes or the nested array model, defined functions or similar syntax, control structures, dfn-style anonymous functions, tacit programming, particularly with trains, complex numbers, arbitrary-precision integers, Unicode support, and namespaces. The precise syntax and capabilities of these features might differ between dialects that support them.

Nesting Tradfns Control Dfns Tacit Complex Big int Unicode Namespace
APL\1130 No Yes No No No No No No No
APL\360 No Yes No No No No No No No
APL*PLUS Nested Yes No No No No No No No
APL/700 No Yes No No No No No No No
APL.SV No Yes No No No No No No No
APL 5100 No Yes No No No No No No No
MCM/70 No Yes No No No No No No No
VS APL No Yes No No No No No No No
SHARP APL Boxes Yes No No No Yes No No No
APL\3000 No Yes No No No No No No No
NARS Nested Yes No direct def No No No No No
Dyalog APL Nested Yes Yes Yes Yes Yes No Yes Yes
APL2 Nested Yes No No No Yes No No Yes
A+ Boxes Yes Yes No Some No No No No
SAX Boxes Yes Yes No Some No No No No
APL+Win Nested Yes Yes No No No No No Yes
APLX Nested Yes Yes No No No No No No
NARS2000 Nested Yes Yes Yes Yes Yes Yes UCS-2 No
VisualAPL Nested Yes Yes No No No No Yes Yes
APL# Nested Hybrid No No No Yes Yes
ngn/apl Nested No No Yes Yes Yes No Yes No
GNU APL Nested Yes If-else Limited No Yes Yes Yes No
Aplette No Yes No No No No No No No
Co-dfns Nested No No Yes Yes Yes No Yes Partial
April Nested No No Yes Yes Yes Yes Yes Yes
Dzaima/APL Nested No No Yes Yes No Yes Yes No
APL\iv Lists No No Yes Yes Yes No Yes No
Extended Dyalog APL Nested Yes Yes Yes Yes Yes No Yes Yes
Kap Nested Yes Yes Yes Yes Yes Yes Yes Yes
APL64 Nested Yes Yes No No No No Yes Yes
Dyalog APL Vision Nested Yes Yes Yes Yes Yes No Yes Yes

External links

  • Omnibar lists all glyphs with their meanings and allows custom comparisons between dialects:
APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000PometoTinyAPL
Historical A Programming LanguageA+ (A) ∙ APL#APL2CAPL\360APL/700APL\1130APL\3000APL.68000APL*PLUSAPL.jlAPL.SVAPLXExtended Dyalog APLIverson notationIVSYS/7090NARSngn/aplopenAPLOperators and FunctionsPATRowanSAXSHARP APLRationalized APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLBQNCoSyELIGleeIIvyJJellyK (Goal, Klong, Q) ∙ KamilaLispLang5LilNialRADUiua
Overviews Comparison of APL dialectsTimeline of array languagesTimeline of influential array languagesFamily tree of array languages