

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A cheat sheet for Dyalog v15.0 Idioms. It provides a key to the types and ranks of the arguments in the idioms. The idioms are described with their corresponding descriptions and examples. useful for those who want to learn Dyalog Idioms and need a quick reference guide.
Typology: Summaries
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Dyalog Idioms
CHEAT SHEET
Dyalog v15.
Key to the types and ranks of the arguments in the idioms:
Type Description Rank Description C Character S Scalar or single item vector B Boolean V Vector N Numeric M Matrix P Nested A Array of any rank X any type
The idioms described below must be entered precisely as shown to be recognised.
Idiom Description ⍴⍴XA The rank of XA (returned as a one-element vector) ≢⍴XA The rank of XA (returned as a scalar) BV/⍳NS The subset of NS corresponding to the 1s in BV BV/⍳⍴XV The positions in XV corresponding to the 1s in BV
NA⊃¨⊂XV The subset of XV in the index positions defined by NA (equivalent to XV[NA]) XA 1 {}XA 2 XA 1 and XA 2 are ignored (no result produced) XA 1 {⍺}XA 2 XA 1 (XA 2 is ignored) XA 1 {⍵}XA 2 XA 2 (XA 1 is ignored) XA 1 {⍺ ⍵}XA 2 XA 1 and XA 2 as a two item vector (XA 1 XA 2 ) {0}XA 0 irrespective of XA {0}¨XA 0 corresponding to each item of XA ,/PV The enclose of the items of PV catenated along their last axes ⍪/PV The enclose of the items of PV catenated along their first axes ⊃⌽XA The item in the top right of XA (⎕ML<2) ↑⌽XA The item in the top right of XA (⎕ML≥2) ⊃⌽,XA The item in the bottom right of XA (⎕ML<2) ↑⌽,XA (^) The item in the bottom right of XA (⎕ML≥2) 0=⍴XV 1 if XV has a shape of zero, 0 otherwise 0=⍴⍴XA 1 if XA has a rank of zero (scalar), 0 otherwise 0=≡XA 1 if XA has a depth of zero (simple scalar), 0 otherwise
XM 1 {(↓⍺)⍳↓⍵}XM (^2)
A simple vector comprising as many items as there are rows in XM 2 , where each item is the number of the first row in XM 1 that matches each row in XM 2.
A nested vector comprising vectors that each correspond to a position in the original vectors of PV – the first vector contains the first item from each vector in PV, padded to be the same length as the largest vector, and so on (⎕ML<2)
A nested vector comprising vectors that each correspond to a position in the original vectors of PV – the first vector contains the first item from each vector in PV, padded to be the same length as the largest vector, and so on (⎕ML≥ 2 ) ^' '=CA A Boolean mask indicating the leading blank spaces in each row of CA +/^' '=CA The number of leading blank spaces in each row of CA +/^\BA The number of leading 1s in each row of BA {(∨' '≠⍵)/⍵}CV CV without any leading blank spaces {(+/^' '=⍵)↓⍵}CV CV without any leading blank spaces ~∘' '¨↓CA A nested vector comprising simple character vectors constructed
Dyalog Idioms
CHEAT SHEET
Dyalog v15.
Idiom Description from the rows of CA (which must be of depth 1) with all blank spaces removed
A nested vector comprising simple character vectors constructed from the rows of CA (which must be of depth 1) with trailing blank spaces removed ⊃∘⍴¨XA The length of the first axis of each item in XA (⎕ML<2) ↑∘⍴¨XA The length of the first axis of each item in XA (⎕ML≥2) XA 1 ,←XA 2 XA 1 redefined to be XA 1 with XA 2 catenated along its last axis XA 1 ⍪←XA 2 XA 1 redefined to be XA 1 with XA 2 catenated along its first axis {⍵[⍋⍵]}XV XV sorted into numerical or alphabetical order {⍵[⍒⍵]}XV XV sorted into reverse numerical or alphabetical order {⍵[⍋⍵;]}XM XM with the rows sorted into numerical or alphabetical order {⍵[⍒⍵;]}XM XM with the rows sorted into reverse numerical or alphabetical order 1=≡XA (^) 1 if XA has a depth of 1 (simple array), 0 otherwise 1=≡,XA 1 if XA has a depth of 0 or 1 (simple scalar, vector, etc.), 0 otherwise 0 ∊⍴XA 1 if XA is empty, 0 otherwise ~0∊⍴XA 1 if XA is not empty, 0 otherwise ⊣⌿XA The first sub-array along the first axis of XA ⊣/XA The first sub-array along the last axis of XA ⊢⌿XA The last sub-array along the first axis of XA ⊢/XA The last sub-array along the last axis of XA *○NA Euler's idiom (accurate when NA is a multiple of 0J0.5) 0=⊃⍴XA 1 if XA has an empty first dimension, 0 otherwise (⎕ML<2) 0≠⊃⍴XA 1 if XA does not have an empty first dimension, 0 otherwise (⎕ML<2) ⌊0.5+NA The content of NA with each item rounded to the nearest integer
XA↓⍨←NS XA redefined to be XA with the last -NS items along the leading axis removed; NS should be negative
⎕AV⍳CA Classic version only: The character numbers (atomic vector index) corresponding to the characters in CA