How APL dialects are related to one another

Queries and discussions related to migrating from APLX

How APL dialects are related to one another

Postby augustk on Fri Apr 12, 2019 8:59 am

I have a question about the differences between the APL dialects Core APL (ISO), Extended APL (ISO), APL2, APLX and Dyalog APL. To my understanding Extended APL, APL2, APLX and Dyalog APL are all extensions of Core APL. Is Dyalog APL an extension of Extended APL, APLX and APL2?
augustk
 
Posts: 19
Joined: Tue Feb 05, 2019 11:54 am

Re: How APL dialects are related to one another

Postby Adam|Dyalog on Sun Apr 14, 2019 4:51 pm

Extended APL is only an ISO standard, not an actual implementation. APL2, APLX, and Dyalog are all based on Extended APL, but each has additions (mostly in system functions, "⎕XYZ") that can differ (although a lot of additions are the same). I'll try to give an overview without going into technical details, but please forgive me if I forget features. Note that by default ↑B and ⊃B have swapped meaning in APL2 and APLX compared to Dyalog APL, but a compatibility setting exists. I will also ignore the varied collections of system functions and Dyalog's ]USER.Commands, and only focus on core language features.

The ISO standard mostly deals with the addition of nested arrays (which APL2, APLX, and Dyalog APL adopt identically) and related primitives, but the standard leaves some aspects up to the implementors. For example, in Core APL, it was impossible to distinguish whether the slashes / \ ⌿ ⍀ were functions or operators because only scalar functions (the arithmetic ones) could be operands of operators and the user could not define additional operators. In Extended APL, these two rules ware relaxed. APL2 and APLX opted to consistently treat the slashes as operators, meaning that you cannot replicate-reduce as in //(1 2 3)'ABC' and replicate-each 1 2 3/¨'ABC' means (1 2 3/'A')(1 2 3/'B')(1 2 3/'C') because the entire left array binds as operand and the derived function 1 2 3/ is applied to each letter. Dyalog introduced the notion of hybrid function-operators so slashes behave as functions when an array is on their left. This means that //(1 2 3)'ABC' gives ⊂1 2 3/'ABC' and 1 2 3/¨'ABC' means (1/'A')(2/'B')(3/'C') .

Another question is the precedence of stranding (which was not generalised in Core APL) versus indexing. In Core APL 3 1 4[2] gave 1 which would indicate that standing is before indexing. Dyalog went with preserving this result so 'ABC'[2] and 'A' 'B' 'C'[2] mean the same thing (since in general 'ABC' and 'A' 'B' 'C' are equivalent) but (3 1 4)(2 7 1)[2](1 6 2) gives (⊂2 7 1)(1 6 2) which may seem counter-intuitive. APL2 and APLX opted for indexing before stranding so 3 1 4[2] and 'A' 'B' 'C'[2] error while (3 1 4)[2] and 'ABC'[2] work, and (3 1 4)(2 7 1)[2](1 6 2) gives (3 1 4)7(1 6 2) .

APL2 adds:
complex numbers 1J2
partition A⊂B
pick A⊃B
match A≡B
enclose ⊂B
mix ⊃B
max-depth ≡B
first ↑B
enlist ∊B
set difference A~B
picture format A⍕B
index function A⌷B

APLX adds:
into-object notation A.B
default character order (monadic ⍒ and ⍋ on simple character arrays)
partition A⊂B
pick A⊃B
match A≡B
not-match A≢B
enclose ⊂B
mix ⊃B
max-depth ≡B
first ↑B
enlist ∊B
set difference A~B
catenate-first A⍪B (same as A,[1]B)
component file read ⍇
component file write ⍈
drop component ⍗
component file hold ⍐
set difference A~B
set union A∪B
set intersection A∩B
set unique ∪B
format by example A⍺B
picture format A⍕B
left A⊣B
right A⊢B
same ⊢B
stop ⊣B (always returns 0 0⍴0)

Dyalog APL has so far added (but regularly adds more):
total array order (monadic ⍒ ⍋ and dyadic ⍸ on all, even non-simple, arrays consisting of characters and complex numbers)
complex numbers 1J2 3j4
into-object notation A.B
total array order (monadic ⍒B and ⍋B and ⍸B on even nested arrays of characters and/or numbers)
partition A⊆B
partition A⊂B
pick A⊃B
match A≡B
not-match A≢B
enclose ⊂B
first ⊃B
depth ≡B (negative if uneven)
mix ↑B
enlist/type ∊B (⎕ML 1 or 0)
set difference A~B
tally ≢B
catenate-first A⍪B (same as A,[1]B)
table ,⍤¯1
nest ⊆B (enclose if simple)
interval index A⍸B
where ⍸B
set difference A~B
set union A∪B
set intersection A∩B
unique major cells ∪B (for all arrays)
prefix take A↑B (A may have fewer elements than the rank of B)
rank padding for ↑B (elements of B are promoted to the highest rank of any element of B)
major cell lookup A⍳B
left A⊣B
right A⊢B
same ⊢B
same ⊣B (note difference from APLX)
index function A⌷B
materialise (get object data array) ⌷B
LCM A∧B
GCD A∨B
random fraction ?0
spawn "green" thread & (APLX has something similar in a system function)
dfns/dops {}
rank operator ⍤
key ⌸
stencil ⌺
power operator ⍣
commute ⍨
at @
compose ∘
variant ⍠
I-beam ⌶
tacit functions/operators f mop (f mop) (f dop g) (dop g) (f g) (f g h)
User avatar
Adam|Dyalog
 
Posts: 63
Joined: Thu Jun 25, 2015 1:13 pm


Return to APLX

Who is online

Users browsing this forum: No registered users and 1 guest