How APL dialects are related to one another
2 posts
• Page 1 of 1
How APL dialects are related to one another
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: 27
 Joined: Tue Feb 05, 2019 11:54 am
Re: How APL dialects are related to one another
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 replicatereduce as in //(1 2 3)'ABC' and replicateeach 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 functionoperators 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 counterintuitive. 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
maxdepth ≡B
first ↑B
enlist ∊B
set difference A~B
picture format A⍕B
index function A⌷B
APLX adds:
intoobject notation A.B
default character order (monadic ⍒ and ⍋ on simple character arrays)
partition A⊂B
pick A⊃B
match A≡B
notmatch A≢B
enclose ⊂B
mix ⊃B
maxdepth ≡B
first ↑B
enlist ∊B
set difference A~B
catenatefirst 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 nonsimple, arrays consisting of characters and complex numbers)
complex numbers 1J2 3j4
intoobject 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
notmatch 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
catenatefirst 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 ⍠
Ibeam ⌶
tacit functions/operators f mop (f mop) (f dop g) (dop g) (f g) (f g h)
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 replicatereduce as in //(1 2 3)'ABC' and replicateeach 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 functionoperators 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 counterintuitive. 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
maxdepth ≡B
first ↑B
enlist ∊B
set difference A~B
picture format A⍕B
index function A⌷B
APLX adds:
intoobject notation A.B
default character order (monadic ⍒ and ⍋ on simple character arrays)
partition A⊂B
pick A⊃B
match A≡B
notmatch A≢B
enclose ⊂B
mix ⊃B
maxdepth ≡B
first ↑B
enlist ∊B
set difference A~B
catenatefirst 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 nonsimple, arrays consisting of characters and complex numbers)
complex numbers 1J2 3j4
intoobject 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
notmatch 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
catenatefirst 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 ⍠
Ibeam ⌶
tacit functions/operators f mop (f mop) (f dop g) (dop g) (f g) (f g h)

AdamDyalog  Posts: 124
 Joined: Thu Jun 25, 2015 1:13 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group