Dyalog Idioms CHEAT SHEET, Summaries of English

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

2022/2023

Uploaded on 03/14/2023

ameen
ameen 🇺🇸

4.6

(5)

236 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Dyalog Idioms
CHEAT SHEET
Dyalog v15.0
Idioms
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.
Description
The rank of XA (returned as a one-element vector)
The rank of XA (returned as a scalar)
BV/NS
The subset of
NS
corresponding to the 1s in
BV
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])
XA1 and XA2 are ignored (no result produced)
XA1 (XA2 is ignored)
XA2 (XA1 is ignored)
XA1 and XA2 as a two item vector (XA1 XA2)
0 irrespective of XA
0 corresponding to each item of XA
The enclose of the items of PV catenated along their last axes
The enclose of the items of PV catenated along their first axes
The item in the top right of
XA
(
ML<2
)
The item in the top right of XA (ML≥2)
The item in the bottom right of XA (ML<2)
The item in the bottom right of XA (ML≥2)
1 if XV has a shape of zero, 0 otherwise
1 if XA has a rank of zero (scalar), 0 otherwise
1 if XA has a depth of zero (simple scalar), 0 otherwise
XM1{(↓)⍳↓⍵}XM2
A simple vector comprising as many items as there are rows in
XM2
,
where each item is the number of the first row in XM1 that matches
each row in XM2.
↓⍉↑PV
A nested vector comprising vectors that each correspond to a
position in the original vectors of PVthe 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)
↓⍉⊃PV
A nested vector comprising vectors that each correspond to a
position in the original vectors of PVthe first vector contains the
first item from each vector in PV, padded to be the same length as
the largest vector, and so on (
ML2
)
A Boolean mask indicating the leading blank spaces in each row of CA
The number of leading blank spaces in each row of CA
+/^\BA
The number of leading 1s in each row of
BA
CV without any leading blank spaces
CV without any leading blank spaces
A nested vector comprising simple character vectors constructed
pf2

Partial preview of the text

Download Dyalog Idioms CHEAT SHEET and more Summaries English in PDF only on Docsity!

Dyalog Idioms

CHEAT SHEET

Dyalog v15.

Idioms

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.

↓⍉↑PV

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)

↓⍉⊃PV

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

{(+/∨' '≠⌽⍵)↑¨↓⍵}CA

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