Skip to content

Instantly share code, notes, and snippets.

@abrudz
Created March 9, 2023 17:06
Show Gist options
  • Save abrudz/ccaa17e785da9a8431eb0b43e7480525 to your computer and use it in GitHub Desktop.
Save abrudz/ccaa17e785da9a8431eb0b43e7480525 to your computer and use it in GitHub Desktop.
Session transcript from Adám's presentation at BAA Vector Webinar 2023-03-09
{1,2=/⍵}'rooobert'
1 0 1 1 0 0 0 0
{1,2≠/⍵}'rooobert'
1 1 0 0 1 1 1 1
{⍵/⍨1,2≠/⍵}'rooobert'
robert
≢'⎕←{⍵/⍨1,2≠/⍵}⍞'
14
'UTF-8'⎕UCS'⎕←{⍵/⍨1,2≠/⍵}⍞'
226 142 149 226 134 144 123 226 141 181 47 226 141 168 49 44 50 226 137 160
47 226 141 181 125 226 141 158
≢'UTF-8'⎕UCS'⎕←{⍵/⍨1,2≠/⍵}⍞'
28
10{⍺⍵}10 20 30
10 10 20 30
]box on
Was OFF
10{⍺⍵}10 20 30
┌──┬────────┐
│10│10 20 30│
└──┴────────┘
{⍺⍵}10 20 30
VALUE ERROR
{⍺ ⍵}10 20 30
10{⍺←⊢ ⋄ ⍺⍵}10 20 30
┌──┬────────┐
│10│10 20 30│
└──┴────────┘
{⍺←⊢ ⋄ ⍺⍵}10 20 30
10 20 30
F← {⍺←⊢ ⋄ ⍺⍵}
a←3 4⍴⎕A
b←2 3 4⍴⎕C⎕A
a
ABCD
EFGH
IJKL
b
abcd
efgh
ijkl
mnop
qrst
uvwx
F←{⍺←⊢ ⋄ ⍺'F'⍵}
F 10
F 10
30 F 10
30 F 10
b
abcd
efgh
ijkl
mnop
qrst
uvwx
(F⍤2)b
┌─┬────┐
│F│abcd│
│ │efgh│
│ │ijkl│
├─┼────┤
│F│mnop│
│ │qrst│
│ │uvwx│
└─┴────┘
a(F⍤2)b
┌────┬─┬────┐
│ABCD│F│abcd│
│EFGH│ │efgh│
│IJKL│ │ijkl│
├────┼─┼────┤
│ABCD│F│mnop│
│EFGH│ │qrst│
│IJKL│ │uvwx│
└────┴─┴────┘
a
ABCD
EFGH
IJKL
b
abcd
efgh
ijkl
mnop
qrst
uvwx
c←2 5⍴⎕D
c
01234
56789
b
abcd
efgh
ijkl
mnop
qrst
uvwx
c(F⍤1 2)b
┌─────┬─┬────┐
│01234│F│abcd│
│ │ │efgh│
│ │ │ijkl│
├─────┼─┼────┤
│56789│F│mnop│
│ │ │qrst│
│ │ │uvwx│
└─────┴─┴────┘
(F⍤1 2)b
┌─┬────┐
│F│abcd│
│ │efgh│
│ │ijkl│
├─┼────┤
│F│mnop│
│ │qrst│
│ │uvwx│
└─┴────┘
(F⍤3 1 2)b
┌─┬────┐
│F│abcd│
│ │efgh│
│ │ijkl│
│ │ │
│ │mnop│
│ │qrst│
│ │uvwx│
└─┴────┘
c(F⍤3 1 2)b
┌─────┬─┬────┐
│01234│F│abcd│
│ │ │efgh│
│ │ │ijkl│
├─────┼─┼────┤
│56789│F│mnop│
│ │ │qrst│
│ │ │uvwx│
└─────┴─┴────┘
G←{⍺←'xyz' ⋄ ⍺ ⍵}
(G⍤2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
├───┼────┤
│xyz│mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
c(G⍤2)b
┌─────┬────┐
│01234│abcd│
│56789│efgh│
│ │ijkl│
├─────┼────┤
│01234│mnop│
│56789│qrst│
│ │uvwx│
└─────┴────┘
c(G⍤1 2)b
┌─────┬────┐
│01234│abcd│
│ │efgh│
│ │ijkl│
├─────┼────┤
│56789│mnop│
│ │qrst│
│ │uvwx│
└─────┴────┘
(G⍤1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
├───┼────┤
│xyz│mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
(G⍤3 1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
│ │ │
│ │mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
c(G⍤3 1 2)b
┌─────┬────┐
│01234│abcd│
│ │efgh│
│ │ijkl│
├─────┼────┤
│56789│mnop│
│ │qrst│
│ │uvwx│
└─────┴────┘
c(G⍤2 1 2)b
┌─────┬────┐
│01234│abcd│
│ │efgh│
│ │ijkl│
├─────┼────┤
│56789│mnop│
│ │qrst│
│ │uvwx│
└─────┴────┘
(G⍤2 1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
├───┼────┤
│xyz│mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
(G⍤3 1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
│ │ │
│ │mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
(G⍤1 1 2)b
┌───┬────┐
│xyz│abcd│
├───┼────┤
│xyz│efgh│
├───┼────┤
│xyz│ijkl│
└───┴────┘
┌───┬────┐
│xyz│mnop│
├───┼────┤
│xyz│qrst│
├───┼────┤
│xyz│uvwx│
└───┴────┘
(G⍤0 1 2)b
┌───┬─┐
│xyz│a│
├───┼─┤
│xyz│b│
├───┼─┤
│xyz│c│
├───┼─┤
│xyz│d│
└───┴─┘
┌───┬─┐
│xyz│e│
├───┼─┤
│xyz│f│
├───┼─┤
│xyz│g│
├───┼─┤
│xyz│h│
└───┴─┘
┌───┬─┐
│xyz│i│
├───┼─┤
│xyz│j│
├───┼─┤
│xyz│k│
├───┼─┤
│xyz│l│
└───┴─┘
┌───┬─┐
│xyz│m│
├───┼─┤
│xyz│n│
├───┼─┤
│xyz│o│
├───┼─┤
│xyz│p│
└───┴─┘
┌───┬─┐
│xyz│q│
├───┼─┤
│xyz│r│
├───┼─┤
│xyz│s│
├───┼─┤
│xyz│t│
└───┴─┘
┌───┬─┐
│xyz│u│
├───┼─┤
│xyz│v│
├───┼─┤
│xyz│w│
├───┼─┤
│xyz│x│
└───┴─┘
(G⍤5 1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
│ │ │
│ │mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
(G⍤99 1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
│ │ │
│ │mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
(G⍤(⌊/⍬) 1 2)b
┌───┬────┐
│xyz│abcd│
│ │efgh│
│ │ijkl│
│ │ │
│ │mnop│
│ │qrst│
│ │uvwx│
└───┴────┘
(G⍤0)c
┌───┬─┐
│xyz│0│
├───┼─┤
│xyz│1│
├───┼─┤
│xyz│2│
├───┼─┤
│xyz│3│
├───┼─┤
│xyz│4│
└───┴─┘
┌───┬─┐
│xyz│5│
├───┼─┤
│xyz│6│
├───┼─┤
│xyz│7│
├───┼─┤
│xyz│8│
├───┼─┤
│xyz│9│
└───┴─┘
c
01234
56789
G¨c
┌───────┬───────┬───────┬───────┬───────┐
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│0│││xyz│1│││xyz│2│││xyz│3│││xyz│4││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
├───────┼───────┼───────┼───────┼───────┤
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│5│││xyz│6│││xyz│7│││xyz│8│││xyz│9││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
└───────┴───────┴───────┴───────┴───────┘
(G⍤0)c
┌───┬─┐
│xyz│0│
├───┼─┤
│xyz│1│
├───┼─┤
│xyz│2│
├───┼─┤
│xyz│3│
├───┼─┤
│xyz│4│
└───┴─┘
┌───┬─┐
│xyz│5│
├───┼─┤
│xyz│6│
├───┼─┤
│xyz│7│
├───┼─┤
│xyz│8│
├───┼─┤
│xyz│9│
└───┴─┘
G
{⍺←'xyz' ⋄ ⍺ ⍵}
G¨c
┌───────┬───────┬───────┬───────┬───────┐
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│0│││xyz│1│││xyz│2│││xyz│3│││xyz│4││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
├───────┼───────┼───────┼───────┼───────┤
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│5│││xyz│6│││xyz│7│││xyz│8│││xyz│9││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
└───────┴───────┴───────┴───────┴───────┘
G 10 20 30
┌───┬────────┐
│xyz│10 20 30│
└───┴────────┘
⊂⍤G 10 20 30
┌──────────────┐
│┌───┬────────┐│
││xyz│10 20 30││
│└───┴────────┘│
└──────────────┘
G¨c
┌───────┬───────┬───────┬───────┬───────┐
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│0│││xyz│1│││xyz│2│││xyz│3│││xyz│4││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
├───────┼───────┼───────┼───────┼───────┤
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│5│││xyz│6│││xyz│7│││xyz│8│││xyz│9││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
└───────┴───────┴───────┴───────┴───────┘
(⊂⍤G⍤0)c
┌───────┬───────┬───────┬───────┬───────┐
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│0│││xyz│1│││xyz│2│││xyz│3│││xyz│4││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
├───────┼───────┼───────┼───────┼───────┤
│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│┌───┬─┐│
││xyz│5│││xyz│6│││xyz│7│││xyz│8│││xyz│9││
│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│└───┴─┘│
└───────┴───────┴───────┴───────┴───────┘
Each←{⍺←⊢ ⋄ ⍺⊂⍤⍺⍺⍥⊃⍤0⊢⍵}
'abc','XYZ'
abcXYZ
'abc',⍥⌽'XYZ'
cbaZYX
'abc',⍥⌽'XYZ'
cbaZYX
]aplcart holler
X,Y,Z:any M,N:num I,J:int A,B:Bool C,D:char f,g,h:fn ax:axis s:scal v:vec m:mat
───────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────
Showing 0 of 0 matches (suggestions? mailto://ideas@aplcart.info )
]aplcart pout
X,Y,Z:any M,N:num I,J:int A,B:Bool C,D:char f,g,h:fn ax:axis s:scal v:vec m:mat
──────────────────────────────────────────────────────────────────────────────────────────────────────
X f⍤g Y ⍝ Atop (B₁-combinator): f on the result of X g Y, that is, f X g Y
f⍤g Y ⍝ Atop (B-combinator): f on the result of g on Y, that is, f g Y
X(f⍤Is Js)Y ⍝ Rank: f between every trailing rank-Is subarray of X and every trailing rank-Js
subarray of Y
(f⍤Js)Y ⍝ Rank: f on every trailing rank-Js subarray of Y
──────────────────────────────────────────────────────────────────────────────────────────────────────
Showing 4 of 4 matches
]aplcart splat
X,Y,Z:any M,N:num I,J:int A,B:Bool C,D:char f,g,h:fn ax:axis s:scal v:vec m:mat
───────────────────────────────────────────────────────────────────────────────
⍟N ⍝ Natural logarithm of N
M⍟N ⍝ Base-M logarithm of N
───────────────────────────────────────────────────────────────────────────────
Showing 2 of 2 matches
]aplcart r2d2
X,Y,Z:any M,N:num I,J:int A,B:Bool C,D:char f,g,h:fn ax:axis s:scal v:vec m:mat
───────────────────────────────────────────────────────────────────────────────
⍝ ⍝ Comment symbol (disables rest of line)
───────────────────────────────────────────────────────────────────────────────
Showing 1 of 1 matches
]aplcart -?
───────────────────────────────────────────────────────────────────────────────
]TOOLS.APLCart
Access a searchable collection of over 3000 short APL phrases
]APLCart [<terms>] [-list[=n]] [-url] [-browser] [-popup] [-theme=b|w] [-refresh]
]APLCart -?? ⍝ for details and examples
]APLCart is a frontend for the ⎕SE.Dyalog.Utils.APLcart function.
]
───────────────────────────────────────────────────────────────────────────────
General Help for User Commands
]cmd ⍝ Execute Cmd command
]⎕←cmd ⍝ Display Cmd's result line-by-line
]var←cmd ⍝ Capture Cmd's result in var
]grp -? ⍝ Brief information on commands in group "GRP"
]grp.cmd -? ⍝ Brief information on command "Cmd" of the "GRP" group
]grp.cmd -?? ⍝ Detailed information on command
]grp.cmd -??? ⍝ add question marks for more info
] ⍝ This help message
] -? ⍝ List all commands
] -?? ⍝ List all commands with summaries
]X*YZ* -? ⍝ List commands or groups that match a pattern
]/path/dir -? ⍝ List commands in /path/dir
]ucmd -? ⍝ List commands for working with user commands
10 20 × 1 2 3
LENGTH ERROR: Mismatched left and right argument shapes
10 20×1 2 3
10 20(×⍤0 1)1 2 3
10 20 30
20 40 60
10 20(×⍤1 0)1 2 3
10 20
20 40
30 60
'abc'×'def'
DOMAIN ERROR
'abc'×'def'
⎕DMX.InternalLocation
┌─────┬───┐
│acc.c│132│
└─────┴───┘
⍝ Diagonstic Message eXtended
⎕DM
┌────────────┬─────────────────┬────────────┐
│DOMAIN ERROR│ 'abc'×'def'│ ∧│
└────────────┴─────────────────┴────────────┘
⎕DMX.Vendor
Dyalog
⎕DMX.HelpURL
⎕JSON⎕DMX
{"Category":"","DM":["DOMAIN ERROR"," 'abc'×'def'"," ∧"],"EM":"DOMAIN ERROR","EN":11,"E
NX":0,"HelpURL":"","InternalLocation":["acc.c",132],"Message":"","OSError":[0,0,""],"Vendor":"Dy
alog"}
⎕DMX
EM DOMAIN ERROR
Message
→→⍳⌹
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment