Dyalog APL Vision: Difference between revisions

Jump to navigation Jump to search
m
→‎Features: Sort function links
m (archive.org link replacement for web.science.mq.edu.au)
m (→‎Features: Sort function links)
 
(5 intermediate revisions by one other user 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                = 2023
| released                = 2022
| latest release version  = unversioned/2023-04-21
| latest release version  = unversioned/2023-10-09
| developer                = [[Adám Brudzewsky]]
| developer                = [[Adám Brudzewsky]]
| implementation language  = [[Dyalog APL]]
| implementation language  = [[Dyalog APL]]
Line 17: Line 17:
}}
}}
'''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 22:
* <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 30:
! Examples
! Examples
|-
|-
| Circle Diaeresis
| CircleDiaeresis
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⍥</syntaxhighlight>
| 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 (<syntaxhighlight lang=apl inline>⍤</syntaxhighlight>) but applies at nesting level.
| Depth when right operand is array. This is similar to Rank (<code>⍤</code>) but applies at nesting level.
| <syntaxhighlight lang=apl inline>f⍥0</syntaxhighlight> applies <syntaxhighlight lang=apl inline>f</syntaxhighlight> like a scalar function and <syntaxhighlight lang=apl inline>f⍥1</syntaxhighlight> applies to flat subarrays. <syntaxhighlight lang=apl inline>f⍤1⍥1</syntaxhighlight> applies to flat vectors.
| <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.
|-
|-
| Del Diaeresis
| DelDiaeresis
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⍢</syntaxhighlight>
| style="text-align: center;"| <code>⍢</code>
| style="text-align: center;"| 🔺
| style="text-align: center;"| 🔺
| Under (a.k.a. Dual). Like <syntaxhighlight lang=apl inline>f⍥g</syntaxhighlight> but conceptually inverts the right operand when done. If <syntaxhighlight lang=apl inline>g</syntaxhighlight> is a selection function, it puts the data back where it came from
| 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
| <syntaxhighlight lang=apl inline>-⍢(2 3∘⊃)</syntaxhighlight> negates the 2nd element's 3rd element.
| <code>-⍢(2 3∘⊃)</code> negates the 2nd element's 3rd element.
|-
|-
| Del Tilde
| DelTilde
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⍫</syntaxhighlight>
| style="text-align: center;"| <code>⍫</code>
| style="text-align: center;"| 🔺
| style="text-align: center;"| 🔺
| Obverse; <syntaxhighlight lang=apl inline>⍺⍺</syntaxhighlight> but with inverse <syntaxhighlight lang=apl inline>⍵⍵</syntaxhighlight>
| Obverse; <code>⍺⍺</code> but with inverse <code>⍵⍵</code>
| <syntaxhighlight lang=apl inline>×⍢(FFT⍫iFFT)</syntaxhighlight>
| <code>×⍢(FFT⍫iFFT)</code>
|-
|-
| Dollar Sign
| DollarSign
| style="text-align: center;"| <syntaxhighlight lang=apl inline>$</syntaxhighlight>
| 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
| <syntaxhighlight lang=apl inline>'Dyer' 'Bob'$'Hi, ${2} ${1}!</syntaxhighlight><br/><syntaxhighlight lang=apl inline>$'Hi, ${first} ${last}!</syntaxhighlight><br/><syntaxhighlight lang=apl inline>$'2×3=${2×3}'</syntaxhighlight>
| <code>'Dyer' 'Bob'$'Hi, ${2} ${1}!</code><br/><code>$'Hi, ${first} ${last}!</code><br/><code>$'2×3=${2×3}'</code>
|-
|-
| Down Arrow
| DownArrow
| style="text-align: center;"| <syntaxhighlight lang=apl inline>↓</syntaxhighlight>
| style="text-align: center;"| <code>↓</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| dyad allows long <syntaxhighlight lang=apl inline>⍺</syntaxhighlight>
| dyad allows long <code>⍺</code>
| <syntaxhighlight lang=apl inline>0 1↓'abc'</syntaxhighlight> gives <syntaxhighlight lang=apl inline>1 2⍴'bc'</syntaxhighlight>
| <code>0 1↓'abc'</code> gives <code>1 2⍴'bc'</code>
|-
|-
| Down Tack
| DownTack
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⊤</syntaxhighlight>
| style="text-align: center;"| <code>⊤</code>
| style="text-align: center;"| ⚠
| style="text-align: center;"| ⚠
| <syntaxhighlight lang=apl inline>⊥⍣¯1</syntaxhighlight> when left argument is scalar
| <code>⊥⍣¯1</code> when left argument is scalar
| <syntaxhighlight lang=apl inline>2⊤123</syntaxhighlight> gives <syntaxhighlight lang=apl inline>1 1 1 1 0 1 1</syntaxhighlight>
| <code>2⊤123</code> gives <code>1 1 1 1 0 1 1</code>
|-
|-
| Epsilon Underbar
| EpsilonUnderbar
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⍷</syntaxhighlight>
| style="text-align: center;"| <code>⍷</code>
| style="text-align: center;"| 🔶
| style="text-align: center;"| 🔶
| monad: Type (like <syntaxhighlight lang=apl inline>∊</syntaxhighlight> with <syntaxhighlight lang=apl inline>⎕ML←0</syntaxhighlight>)
| monad: Type (like <code>∊</code> with <code>⎕ML←0</code>)
| <syntaxhighlight lang=apl inline>⍷1'a'#</syntaxhighlight> gives <syntaxhighlight lang=apl inline>0' '#</syntaxhighlight>'
| <code>⍷1'a'#</code> gives <code>0' '#</code>'
|-
|-
| Greater Than
| Equal
| style="text-align: center;"| <syntaxhighlight lang=apl inline>&gt;</syntaxhighlight>
| 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]]
| <syntaxhighlight lang=apl inline>&lt;3 1 4 1 5</syntaxhighlight> gives <syntaxhighlight lang=apl inline>5 4 3 1 1</syntaxhighlight>
| <code>≥3 1 4 1 5</code> gives <code>5 4 3 1 1</code>
|-
|-
| Jot Underbar
| GreaterThan
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⍛</syntaxhighlight>
| style="text-align: center;"| <code>&gt;</code>
| style="text-align: center;"| 🔺✅
| style="text-align: center;"| 🔵
| reverse composition <syntaxhighlight lang=apl inline>X f⍛g Y</syntaxhighlight> is <syntaxhighlight lang=apl inline>(f X) g Y</syntaxhighlight> and default argument
| monad: Join
| <syntaxhighlight lang=apl inline>⌽⍛≡</syntaxhighlight> checks for palindromes.<br/><syntaxhighlight lang=apl inline>a-⍛↑b</syntaxhighlight> takes the last <syntaxhighlight lang=apl inline>a</syntaxhighlight> from <syntaxhighlight lang=apl inline>b</syntaxhighlight>.
| <code>&gt;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>.
|-
|-
| Left Shoe
| LeftShoe
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⊂</syntaxhighlight>
| 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
| <syntaxhighlight lang=apl inline>(⊂1 1)⊂matrix</syntaxhighlight> separates out the first row and column.
| <code>(⊂1 1)⊂matrix</code> separates out the first row and column.
|-
|-
| Left ShoeUnderbar
| LeftShoeUnderbar
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⊆</syntaxhighlight>
| 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
| <syntaxhighlight lang=apl inline>(⊂1 0 1 1)⊆4 4⍴⎕A</syntaxhighlight> splits off the first row and column, and removes the second.
| <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>
|-
|-
| Less Than
| LessThan
| style="text-align: center;"| <syntaxhighlight lang=apl inline>&lt;</syntaxhighlight>
| style="text-align: center;"| <code>&lt;</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| monad: sort ascending
| monad: Major Cells
| <syntaxhighlight lang=apl inline>&lt;3 1 4 1 5</syntaxhighlight> gives <syntaxhighlight lang=apl inline>1 1 3 4 5</syntaxhighlight>
| <code>&lt;2 2 2⍴⎕A</code> gives <code>(2 2⍴'ABCD')(2 2⍴'EFGH')</code>
|-
|-
| Quad Equal
| QuadEqual
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⌸</syntaxhighlight>
| style="text-align: center;"| <code>⌸</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| allow array operand to be vocabulary (then uses <syntaxhighlight lang=apl inline>{⊂⍵}</syntaxhighlight> as internal operand)
| allow array operand to be vocabulary (then uses <code>{⊂⍵}</code> as internal operand)
| <syntaxhighlight lang=apl inline>≢¨'ACGT'⌸'ATT-ACA'</syntaxhighlight> gives <syntaxhighlight lang=apl inline>3 1 0 2</syntaxhighlight>
| <code>≢¨'ACGT'⌸'ATT-ACA'</code> gives <code>3 1 0 2</code>
|-
|-
| QuadDiamond
| QuadDiamond
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⌺</syntaxhighlight>
| style="text-align: center;"| <code>⌺</code>
| style="text-align: center;"| 🔶
| style="text-align: center;"| 🔶
| auto-extended <syntaxhighlight lang=apl inline>⍵⍵</syntaxhighlight>, allows small <syntaxhighlight lang=apl inline>⍵</syntaxhighlight>, optional edge spec(s) ([https://web.archive.org/web/20210822071458/http://web.science.mq.edu.au/~len/preprint/hamey-dicta2015-functional-border.pdf 0:Zero; 1:Repl; 2:Rev; 3:Mirror; 4:Wrap]; -:Twist) with masks as operand's <syntaxhighlight lang=apl inline>⍺</syntaxhighlight>
| 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: <syntaxhighlight lang=apl inline>0 4 Life⌺3 3</syntaxhighlight>
| 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;"| <syntaxhighlight lang=apl inline>⍴</syntaxhighlight>
| style="text-align: center;"| <code>⍴</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| dyad: negatives reverse axis, <syntaxhighlight lang=apl inline>0.5</syntaxhighlight> auto-size rounding down, <syntaxhighlight lang=apl inline>1.5</syntaxhighlight> auto-size rounding up, <syntaxhighlight lang=apl inline>2.5</syntaxhighlight> auto-size with padding
| 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: <syntaxhighlight lang=apl inline>0.5 2⍴data</syntaxhighlight>
| Reshape into two columns: <code>0.5 2⍴data</code>
|-
|-
| Right ShoeUnderbar
| RightShoeUnderbar
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⊇</syntaxhighlight>
| style="text-align: center;"| <code>⊇</code>
| style="text-align: center;"| 🔺✅
| style="text-align: center;"| 🔺
| monad: last (<syntaxhighlight lang=apl inline>⊃⌽,⍵</syntaxhighlight>)<br/>dyad: select (<syntaxhighlight lang=apl inline>⌷⍨∘⊃⍨⍤0 99</syntaxhighlight>)
| monad: last (<code>⊃⌽,⍵</code>)<br/>dyad: select (<code>⌷⍨∘⊃⍨⍤0 99</code>)
| <syntaxhighlight lang=apl inline>3 1 2⊇'abc'</syntaxhighlight> gives <syntaxhighlight lang=apl inline>'cab'</syntaxhighlight>
| <code>3 1 2⊇'abc'</code> gives <code>'cab'</code>
|-
|-
| Root
| Root
| style="text-align: center;"| <syntaxhighlight lang=apl inline>√</syntaxhighlight>
| style="text-align: center;"| <code>√</code>
| style="text-align: center;"| 🔺
| style="text-align: center;"| 🔺
| (Square) Root
| (Square) Root
| <syntaxhighlight lang=apl inline>√25</syntaxhighlight> gives <syntaxhighlight lang=apl inline>5</syntaxhighlight><br/><syntaxhighlight lang=apl inline>3√27 gives 3</syntaxhighlight>
| <code>√25</code> gives <code>5</code><br/><code>3√27 gives 3</code>
|-
|-
| Up Arrow
| UpArrow
| style="text-align: center;"| <syntaxhighlight lang=apl inline>↑</syntaxhighlight>
| style="text-align: center;"| <code>↑</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| allows long <syntaxhighlight lang=apl inline>⍺</syntaxhighlight>
| allows long <code>⍺</code>
| <syntaxhighlight lang=apl inline>2 3↑4 5</syntaxhighlight> gives <syntaxhighlight lang=apl inline>2 3⍴4 5 0 0 0 0</syntaxhighlight>
| <code>2 3↑4 5</code> gives <code>2 3⍴4 5 0 0 0 0</code>
|-
|-
| Vel
| Vel
| style="text-align: center;"| <syntaxhighlight lang=apl inline>∨</syntaxhighlight>
| style="text-align: center;"| <code>∨</code>
| style="text-align: center;"| 🔶
| style="text-align: center;"| 🔶
| monad: demote (<syntaxhighlight lang=apl inline>,[⍳2]</syntaxhighlight>)
| monad: demote (<code>,[⍳2]</code>)
| <syntaxhighlight lang=apl inline>∨2 3 4⍴⎕A</syntaxhighlight> gives <syntaxhighlight lang=apl inline>6 4⍴⎕A</syntaxhighlight>
| <code>∨2 3 4⍴⎕A</code> gives <code>6 4⍴⎕A</code>
|-
|-
| Wedge
| Wedge
| style="text-align: center;"| <syntaxhighlight lang=apl inline>∧</syntaxhighlight>
| style="text-align: center;"| <code>∧</code>
| style="text-align: center;"| 🔶
| style="text-align: center;"| 🔶
| monad: promote (<syntaxhighlight lang=apl inline>⍵⍴⍨1,⍴⍵</syntaxhighlight>)
| monad: promote (<code>⍵⍴⍨1,⍴⍵</code>)
| <syntaxhighlight lang=apl inline>'ABC'⍪⍥∧'DEF'</syntaxhighlight> gives <syntaxhighlight lang=apl inline>2 3⍴⎕A</syntaxhighlight>
| <code>'ABC'⍪⍥∧'DEF'</code> gives <code>2 3⍴⎕A</code>
|-
|-
| Error Message
| Event Message
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⎕EM</syntaxhighlight>
| style="text-align: center;"| <code>⎕EM</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| Self-inverse <syntaxhighlight lang=apl inline>⎕EM</syntaxhighlight>
| Self-inverse <code>⎕EM</code>
| <syntaxhighlight lang=apl inline>⎕EM'RANK ERROR' 'WS FULL'</syntaxhighlight> gives <syntaxhighlight lang=apl inline>4 1</syntaxhighlight>
| <code>⎕EM'RANK ERROR' 'WS FULL'</code> gives <code>4 1</code>
|-
|-
| Namespace
| Name Get
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⎕NS</syntaxhighlight>
| 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
| <syntaxhighlight lang=apl inline>ref←⎕NS('Abe' 10)('Bea' 12)</syntaxhighlight><br/><syntaxhighlight lang=apl inline>ref⎕NS⊂'Carl' 8</syntaxhighlight>
| <code>ref←⎕NS('Abe' 10)('Bea' 12)</code><br/><code>ref⎕NS⊂'Carl' 8</code>
|-
|-
| Name Get
| Name Value
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⎕NG</syntaxhighlight>
| style="text-align: center;"| <code>⎕NV</code>
| style="text-align: center;"| 🔺
| style="text-align: center;"| 🔺
| Dereference name, optionally with fallback value for when undefined
| Names and Values
| <syntaxhighlight lang=apl inline>ref⎕NG'Bea' 'Abe'</syntaxhighlight>
| `ref⎕NV -2 9
|-
|-
| Signal Event
| Signal Event
| style="text-align: center;"| <syntaxhighlight lang=apl inline>⎕SIGNAL</syntaxhighlight>
| style="text-align: center;"| <code>⎕SIGNAL</code>
| style="text-align: center;"| 🔵
| style="text-align: center;"| 🔵
| Allows <syntaxhighlight lang=apl inline>⎕DMX</syntaxhighlight>-style ref argument
| Allows <code>⎕DMX</code>-style ref argument
| <syntaxhighlight lang=apl inline>⎕SIGNAL ⎕DMX</syntaxhighlight>
| <code>⎕SIGNAL ⎕DMX</code>
|}
|}


* 🔺 new feature 🔶 added valence 🔵 expanded domain ⚠ breaking change ✅ scheduled for 20.0 (except monadic <syntaxhighlight lang=apl inline>⊇</syntaxhighlight>)
<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]]

Navigation menu