Dyalog APL Vision
This is my vision for a realistic development of core Dyalog APL, including extending the domains of existing primitives/quad-names, and adding a few new ones. Requires Dyalog APL version 18.2 or higher.
You can easily play with these almost like you use normal Dyalog APL in a session:
From within Dyalog APL 18.2 or higher, enter ]get path/dyalog_vision or to import directly from GitHub ]get https://github.com/abrudz/dyalog_vision
You have three options:
- Use the extensions directly with the glyph names, e.g.
4 1 dyalog_vision.RightShoeUnderbar ⎕A. - Use
dyalog_vision.∆FIXas a drop in for⎕FIX. - Use
dyalog_vision.⍙REPL #to start a (limited) session where the glyphs work. Enter→to exit.
-
All scalar functions support leading axis agreement.
-
All set functions support arguments of any rank.
-
⎕Cand monadic⎕UCSare 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' '#' |
| 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. |
| 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 |
| 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 53√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 |
| ∆EM | ⎕EM |
🔵 | Self-inverse ⎕EM |
⎕EM'RANK ERROR' 'WS FULL' gives 4 1 |
| ∆NS | ⎕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 |
| ∆NG | ⎕NG |
🔺 | Name Get | ref⎕NG'Bea' 'Abe' |
| ∆SIGNAL | ⎕SIGNAL |
🔵 | Allows ⎕DMX-style ref argument |
⎕SIGNAL ⎕DMX |
* 🔺 new feature 🔶 added valence 🔵 expanded domain ⚠ breaking change ✅ scheduled for 20.0 (except monadic ⊇)