Dyalog APL Vision: Difference between revisions
Jump to navigation
Jump to search
m (archive.org link replacement for web.science.mq.edu.au) |
m (Influenced TinyAPL) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
| numeric types = [[complex]] floats, [[decimal float]]s | | numeric types = [[complex]] floats, [[decimal float]]s | ||
| unicode support = full | | unicode support = full | ||
| released = | | released = 2022 | ||
| latest release version = unversioned/2023- | | latest release version = unversioned/2023-10-09 | ||
| developer = [[Adám Brudzewsky]] | | developer = [[Adám Brudzewsky]] | ||
| implementation language = [[Dyalog APL]] | | implementation language = [[Dyalog APL]] | ||
Line 15: | Line 15: | ||
| license = [[wikipedia:MIT License|MIT]] | | license = [[wikipedia:MIT License|MIT]] | ||
| influenced by = [[Dyalog APL]], [[Extended Dyalog APL]] | | influenced by = [[Dyalog APL]], [[Extended Dyalog APL]] | ||
| influenced = [[TinyAPL]] | |||
}} | }} | ||
'''Dyalog APL Vision''' continues the role of [[Extended Dyalog APL]], but tries to provide realistic extensions of [[Dyalog APL]] rather than simply extending the language as much as possible. It extends the domains of existing [[primitive]]s and [[quad name]]s and adds a few new ones. | '''Dyalog APL Vision''' continues the role of [[Extended Dyalog APL]], but tries to provide realistic extensions of [[Dyalog APL]] rather than simply extending the language as much as possible. It extends the domains of existing [[primitive]]s and [[quad name]]s and adds a few new ones. | ||
== Features == | == Features == | ||
All scalar functions support [[leading axis agreement]]. | All scalar functions support [[leading axis agreement]]. | ||
Line 23: | Line 23: | ||
* <syntaxhighlight lang=apl inline>⎕C</syntaxhighlight> and monadic <syntaxhighlight lang=apl inline>⎕UCS</syntaxhighlight> are scalar functions. | * <syntaxhighlight lang=apl inline>⎕C</syntaxhighlight> and monadic <syntaxhighlight lang=apl inline>⎕UCS</syntaxhighlight> are scalar functions. | ||
* In addition, the following is included: | * In addition, the following is included: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 32: | Line 31: | ||
! Examples | ! Examples | ||
|- | |- | ||
| | | CircleDiaeresis | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⍥</code> | ||
| style="text-align: center;"| | | style="text-align: center;"| 🔵 | ||
| Depth when right operand is array. This is similar to Rank (< | | ✅ Depth when right operand is array. This is similar to Rank (<code>⍤</code>) but applies at nesting level. | ||
| < | | <code>f⍥0</code> applies <code>f</code> like a scalar function and <code>f⍥1</code> applies to flat subarrays. <code>f⍤1⍥1</code> applies to flat vectors. | ||
|- | |- | ||
| | | DelDiaeresis | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⍢</code> | ||
| style="text-align: center;"| 🔺 | | style="text-align: center;"| 🔺 | ||
| Under (a.k.a. Dual). Like < | | Under (a.k.a. Dual). Like <code>f⍥g</code> but conceptually inverts the right operand when done. If <code>g</code> is a selection function, it puts the data back where it came from | ||
| < | | <code>-⍢(2 3∘⊃)</code> negates the 2nd element's 3rd element. | ||
|- | |- | ||
| | | DelTilde | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⍫</code> | ||
| style="text-align: center;"| 🔺 | | style="text-align: center;"| 🔺 | ||
| Obverse; < | | Obverse; <code>⍺⍺</code> but with inverse <code>⍵⍵</code> | ||
| < | | <code>×⍢(FFT⍫iFFT)</code> | ||
|- | |- | ||
| | | DollarSign | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>$</code> | ||
| style="text-align: center;"| 🔺 | | style="text-align: center;"| 🔺 | ||
| string enhancement <syntaxhighlight lang=apl inline>${1}</syntaxhighlight>:<syntaxhighlight lang=apl inline>1⊃⍺</syntaxhighlight>, <syntaxhighlight lang=apl inline>${expr}</syntaxhighlight>:<syntaxhighlight lang=apl inline>⍎expr</syntaxhighlight>, <syntaxhighlight lang=apl inline>\n</syntaxhighlight>:JSON | | string enhancement <syntaxhighlight lang=apl inline>${1}</syntaxhighlight>:<syntaxhighlight lang=apl inline>1⊃⍺</syntaxhighlight>, <syntaxhighlight lang=apl inline>${expr}</syntaxhighlight>:<syntaxhighlight lang=apl inline>⍎expr</syntaxhighlight>, <syntaxhighlight lang=apl inline>\n</syntaxhighlight>:JSON | ||
| < | | <code>'Dyer' 'Bob'$'Hi, ${2} ${1}!</code><br/><code>$'Hi, ${first} ${last}!</code><br/><code>$'2×3=${2×3}'</code> | ||
|- | |- | ||
| | | DownArrow | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>↓</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| dyad allows long < | | dyad allows long <code>⍺</code> | ||
| < | | <code>0 1↓'abc'</code> gives <code>1 2⍴'bc'</code> | ||
|- | |- | ||
| | | DownTack | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⊤</code> | ||
| style="text-align: center;"| ⚠ | | style="text-align: center;"| ⚠ | ||
| < | | <code>⊥⍣¯1</code> when left argument is scalar | ||
| < | | <code>2⊤123</code> gives <code>1 1 1 1 0 1 1</code> | ||
|- | |- | ||
| | | EpsilonUnderbar | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⍷</code> | ||
| style="text-align: center;"| 🔶 | | style="text-align: center;"| 🔶 | ||
| monad: Type (like < | | monad: Type (like <code>∊</code> with <code>⎕ML←0</code>) | ||
| < | | <code>⍷1'a'#</code> gives <code>0' '#</code>' | ||
|- | |- | ||
| | | Equal | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>=</code> | ||
| style="text-align: center;"| 🔶 | |||
| monad: Rank (<code>≢⍴</code>) | |||
| <code>=10 20 30</code> gives <code>1</code>' | |||
|- | |||
| GreaterOrEqual | |||
| style="text-align: center;"| <code>≥</code> | |||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| monad: sort descending | | monad: [[sort descending]] | ||
| < | | <code>≥3 1 4 1 5</code> gives <code>5 4 3 1 1</code> | ||
|- | |- | ||
| | | GreaterThan | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>></code> | ||
| style="text-align: center;"| | | style="text-align: center;"| 🔵 | ||
| reverse composition < | | monad: Join | ||
| < | | <code>>2 2⍴⍪¨1 2 3 4</code> gives <code>2 2⍴1 2 3 4</code> | ||
|- | |||
| JotUnderbar | |||
| style="text-align: center;"| <code>⍛</code> | |||
| style="text-align: center;"| 🔺 | |||
| ✅ reverse composition <code>X f⍛g Y</code> is <code>(f X) g Y</code> and default argument | |||
| <code>⌽⍛≡</code> checks for palindromes.<br/><code>a-⍛↑b</code> takes the last <code>a</code> from <code>b</code>. | |||
|- | |- | ||
| | | LeftShoe | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⊂</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| dyad allows partitioning along multiple leading axes | | dyad allows partitioning along multiple leading axes | ||
| < | | <code>(⊂1 1)⊂matrix</code> separates out the first row and column. | ||
|- | |- | ||
| | | LeftShoeUnderbar | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⊆</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| dyad allows partitioning along multiple leading axes | | dyad allows partitioning along multiple leading axes | ||
| < | | <code>(⊂1 0 1 1)⊆4 4⍴⎕A</code> splits off the first row and column, and removes the second. | ||
|- | |||
| LessOrEqual | |||
| style="text-align: center;"| <code>≤</code> | |||
| style="text-align: center;"| 🔵 | |||
| monad: [[sort ascending]] | |||
| <code>≤3 1 4 1 5</code> gives <code>1 1 3 4 5</code> | |||
|- | |- | ||
| | | LessThan | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code><</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| monad: | | monad: Major Cells | ||
| < | | <code><2 2 2⍴⎕A</code> gives <code>(2 2⍴'ABCD')(2 2⍴'EFGH')</code> | ||
|- | |- | ||
| | | QuadEqual | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⌸</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| allow array operand to be vocabulary (then uses < | | allow array operand to be vocabulary (then uses <code>{⊂⍵}</code> as internal operand) | ||
| < | | <code>≢¨'ACGT'⌸'ATT-ACA'</code> gives <code>3 1 0 2</code> | ||
|- | |- | ||
| QuadDiamond | | QuadDiamond | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⌺</code> | ||
| style="text-align: center;"| 🔶 | | style="text-align: center;"| 🔶 | ||
| auto-extended < | | auto-extended <code>⍵⍵</code>, allows small <code>⍵</code>, optional edge spec(s) ([http://web.science.mq.edu.au/~len/preprint/hamey-dicta2015-functional-border.pdf#page=3 0:Zero; 1:Repl; 2:Rev; 3:Mirror; 4:Wrap]; -:Twist) with masks as operand's <code>⍺</code> | ||
| Life on a cylinder: < | | Life on a cylinder: <code>0 4 Life⌺3 3</code> | ||
|- | |||
| QuestionMark | |||
| style="text-align: center;"| <code>?</code> | |||
| style="text-align: center;"| 🔵 | |||
| dyadic allows <code>⍺</code> to be any shape (not just vector shape) and <code>⍵</code> is shape of array to select indices from | |||
| <code>3 5?4 13</code> deals 3 hands of 5 cards from deck of 4 suits from A to K | |||
|- | |- | ||
| Rho | | Rho | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⍴</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| dyad: negatives reverse axis, < | | dyad: negatives reverse axis, <code>0.5</code> auto-size rounding down, <code>1.5</code> auto-size rounding up, <code>2.5</code> auto-size with padding | ||
| Reshape into two columns: < | | Reshape into two columns: <code>0.5 2⍴data</code> | ||
|- | |- | ||
| | | RightShoeUnderbar | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⊇</code> | ||
| style="text-align: center;"| | | style="text-align: center;"| 🔺 | ||
| monad: last (< | | monad: last (<code>⊃⌽,⍵</code>)<br/>✅ dyad: select (<code>⌷⍨∘⊃⍨⍤0 99</code>) | ||
| < | | <code>3 1 2⊇'abc'</code> gives <code>'cab'</code> | ||
|- | |- | ||
| Root | | Root | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>√</code> | ||
| style="text-align: center;"| 🔺 | | style="text-align: center;"| 🔺 | ||
| (Square) Root | | (Square) Root | ||
| < | | <code>√25</code> gives <code>5</code><br/><code>3√27 gives 3</code> | ||
|- | |- | ||
| | | UpArrow | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>↑</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| allows long < | | allows long <code>⍺</code> | ||
| < | | <code>2 3↑4 5</code> gives <code>2 3⍴4 5 0 0 0 0</code> | ||
|- | |- | ||
| Vel | | Vel | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>∨</code> | ||
| style="text-align: center;"| 🔶 | | style="text-align: center;"| 🔶 | ||
| monad: demote (< | | monad: demote (<code>,[⍳2]</code>) | ||
| < | | <code>∨2 3 4⍴⎕A</code> gives <code>6 4⍴⎕A</code> | ||
|- | |- | ||
| Wedge | | Wedge | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>∧</code> | ||
| style="text-align: center;"| 🔶 | | style="text-align: center;"| 🔶 | ||
| monad: promote (< | | monad: promote (<code>⍵⍴⍨1,⍴⍵</code>) | ||
| < | | <code>'ABC'⍪⍥∧'DEF'</code> gives <code>2 3⍴⎕A</code> | ||
|- | |- | ||
| | | Event Message | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⎕EM</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| Self-inverse < | | Self-inverse <code>⎕EM</code> | ||
| < | | <code>⎕EM'RANK ERROR' 'WS FULL'</code> gives <code>4 1</code> | ||
|- | |- | ||
| | | Name Get | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⎕NG</code> | ||
| style="text-align: center;"| 🔺 | |||
| Name Get | |||
| <code>ref⎕NG'Bea' 'Abe'</code> | |||
|- | |||
| Name Set | |||
| style="text-align: center;"| <code>⎕NS</code> | |||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| Accepts ref left arg. Name Set: The list of values to copy into the new/target namespace can have 2-element name-value vectors, setting the name to the given value | | Accepts ref left arg. Name Set: The list of values to copy into the new/target namespace can have 2-element name-value vectors, setting the name to the given value | ||
| < | | <code>ref←⎕NS('Abe' 10)('Bea' 12)</code><br/><code>ref⎕NS⊂'Carl' 8</code> | ||
|- | |- | ||
| Name | | Name Value | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⎕NV</code> | ||
| style="text-align: center;"| 🔺 | | style="text-align: center;"| 🔺 | ||
| | | Names and Values | ||
| | | `ref⎕NV -2 9 | ||
|- | |- | ||
| Signal Event | | Signal Event | ||
| style="text-align: center;"| < | | style="text-align: center;"| <code>⎕SIGNAL</code> | ||
| style="text-align: center;"| 🔵 | | style="text-align: center;"| 🔵 | ||
| Allows < | | Allows <code>⎕DMX</code>-style ref argument | ||
| < | | <code>⎕SIGNAL ⎕DMX</code> | ||
|} | |} | ||
* 🔺 new feature 🔶 added valence 🔵 expanded domain ⚠ breaking change ✅ scheduled for 20.0 | <nowiki>*</nowiki> 🔺 new feature 🔶 added valence 🔵 expanded domain ⚠ breaking change ✅ scheduled for 20.0 | ||
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]] | {{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]] |
Latest revision as of 11:54, 29 August 2024
Dyalog APL Vision continues the role of Extended Dyalog APL, but tries to provide realistic extensions of Dyalog APL rather than simply extending the language as much as possible. It extends the domains of existing primitives and quad names and adds a few new ones.
Features
All scalar functions support leading axis agreement.
- All set functions support arguments of any rank.
⎕C
and monadic⎕UCS
are scalar functions.- In addition, the following is included:
Name | Symbol | Type* | Extension | Examples |
---|---|---|---|---|
CircleDiaeresis | ⍥
|
🔵 | ✅ Depth when right operand is array. This is similar to Rank (⍤ ) but applies at nesting level.
|
f⍥0 applies f like a scalar function and f⍥1 applies to flat subarrays. f⍤1⍥1 applies to flat vectors.
|
DelDiaeresis | ⍢
|
🔺 | Under (a.k.a. Dual). Like f⍥g but conceptually inverts the right operand when done. If g is a selection function, it puts the data back where it came from
|
-⍢(2 3∘⊃) negates the 2nd element's 3rd element.
|
DelTilde | ⍫
|
🔺 | Obverse; ⍺⍺ but with inverse ⍵⍵
|
×⍢(FFT⍫iFFT)
|
DollarSign | $
|
🔺 | string enhancement ${1} :1⊃⍺ , ${expr} :⍎expr , \n :JSON
|
'Dyer' 'Bob'$'Hi, ${2} ${1}! $'Hi, ${first} ${last}! $'2×3=${2×3}'
|
DownArrow | ↓
|
🔵 | dyad allows long ⍺
|
0 1↓'abc' gives 1 2⍴'bc'
|
DownTack | ⊤
|
⚠ | ⊥⍣¯1 when left argument is scalar
|
2⊤123 gives 1 1 1 1 0 1 1
|
EpsilonUnderbar | ⍷
|
🔶 | monad: Type (like ∊ with ⎕ML←0 )
|
⍷1'a'# gives 0' '# '
|
Equal | =
|
🔶 | monad: Rank (≢⍴ )
|
=10 20 30 gives 1 '
|
GreaterOrEqual | ≥
|
🔵 | monad: sort descending | ≥3 1 4 1 5 gives 5 4 3 1 1
|
GreaterThan | >
|
🔵 | monad: Join | >2 2⍴⍪¨1 2 3 4 gives 2 2⍴1 2 3 4
|
JotUnderbar | ⍛
|
🔺 | ✅ reverse composition X f⍛g Y is (f X) g Y and default argument
|
⌽⍛≡ checks for palindromes.a-⍛↑b takes the last a from b .
|
LeftShoe | ⊂
|
🔵 | dyad allows partitioning along multiple leading axes | (⊂1 1)⊂matrix separates out the first row and column.
|
LeftShoeUnderbar | ⊆
|
🔵 | dyad allows partitioning along multiple leading axes | (⊂1 0 1 1)⊆4 4⍴⎕A splits off the first row and column, and removes the second.
|
LessOrEqual | ≤
|
🔵 | monad: sort ascending | ≤3 1 4 1 5 gives 1 1 3 4 5
|
LessThan | <
|
🔵 | monad: Major Cells | <2 2 2⍴⎕A gives (2 2⍴'ABCD')(2 2⍴'EFGH')
|
QuadEqual | ⌸
|
🔵 | allow array operand to be vocabulary (then uses {⊂⍵} as internal operand)
|
≢¨'ACGT'⌸'ATT-ACA' gives 3 1 0 2
|
QuadDiamond | ⌺
|
🔶 | auto-extended ⍵⍵ , allows small ⍵ , optional edge spec(s) (0:Zero; 1:Repl; 2:Rev; 3:Mirror; 4:Wrap; -:Twist) with masks as operand's ⍺
|
Life on a cylinder: 0 4 Life⌺3 3
|
QuestionMark | ?
|
🔵 | dyadic allows ⍺ to be any shape (not just vector shape) and ⍵ is shape of array to select indices from
|
3 5?4 13 deals 3 hands of 5 cards from deck of 4 suits from A to K
|
Rho | ⍴
|
🔵 | dyad: negatives reverse axis, 0.5 auto-size rounding down, 1.5 auto-size rounding up, 2.5 auto-size with padding
|
Reshape into two columns: 0.5 2⍴data
|
RightShoeUnderbar | ⊇
|
🔺 | monad: last (⊃⌽,⍵ )✅ dyad: select ( ⌷⍨∘⊃⍨⍤0 99 )
|
3 1 2⊇'abc' gives 'cab'
|
Root | √
|
🔺 | (Square) Root | √25 gives 5 3√27 gives 3
|
UpArrow | ↑
|
🔵 | allows long ⍺
|
2 3↑4 5 gives 2 3⍴4 5 0 0 0 0
|
Vel | ∨
|
🔶 | monad: demote (,[⍳2] )
|
∨2 3 4⍴⎕A gives 6 4⍴⎕A
|
Wedge | ∧
|
🔶 | monad: promote (⍵⍴⍨1,⍴⍵ )
|
'ABC'⍪⍥∧'DEF' gives 2 3⍴⎕A
|
Event Message | ⎕EM
|
🔵 | Self-inverse ⎕EM
|
⎕EM'RANK ERROR' 'WS FULL' gives 4 1
|
Name Get | ⎕NG
|
🔺 | Name Get | ref⎕NG'Bea' 'Abe'
|
Name Set | ⎕NS
|
🔵 | Accepts ref left arg. Name Set: The list of values to copy into the new/target namespace can have 2-element name-value vectors, setting the name to the given value | ref←⎕NS('Abe' 10)('Bea' 12) ref⎕NS⊂'Carl' 8
|
Name Value | ⎕NV
|
🔺 | Names and Values | `ref⎕NV -2 9 |
Signal Event | ⎕SIGNAL
|
🔵 | Allows ⎕DMX -style ref argument
|
⎕SIGNAL ⎕DMX
|
* 🔺 new feature 🔶 added valence 🔵 expanded domain ⚠ breaking change ✅ scheduled for 20.0
APL dialects [edit] | |
---|---|
Maintained | APL+Win ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Aplette ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ Dyalog APL Vision ∙ dzaima/APL ∙ GNU APL ∙ Kap ∙ NARS2000 ∙ Pometo ∙ TinyAPL |
Historical | A Programming Language ∙ A+ (A) ∙ APL# ∙ APL2C ∙ APL\360 ∙ APL/700 ∙ APL\1130 ∙ APL\3000 ∙ APL.68000 ∙ APL*PLUS ∙ APL.jl ∙ APL.SV ∙ APLX ∙ Extended Dyalog APL ∙ Iverson notation ∙ IVSYS/7090 ∙ NARS ∙ ngn/apl ∙ openAPL ∙ Operators and Functions ∙ PAT ∙ Rowan ∙ SAX ∙ SHARP APL ∙ Rationalized APL ∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL |
Derivatives | AHPL ∙ BQN ∙ CoSy ∙ ELI ∙ Glee ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Goal, Klong, Q) ∙ KamilaLisp ∙ Lang5 ∙ Lil ∙ Nial ∙ RAD ∙ Uiua |
Overviews | Comparison of APL dialects ∙ Timeline of array languages ∙ Timeline of influential array languages ∙ Family tree of array languages |