APL Cheat Sheet
Core APL array-language notation covering arithmetic, indexing, custom dfns, and reduction/scan operators for concise array programming.
1 PageAdvancedApr 5, 2026
Basic Arithmetic & Arrays
Scalar and array arithmetic evaluated right-to-left.
apl
2 + 3 ⍝ 5⍳5 ⍝ 1 2 3 4 5 (index generator)2 × ⍳5 ⍝ 2 4 6 8 10V ← 1 2 3 4 5 ⍝ assign a vector⍴V ⍝ 5 (shape of V)V[2] ⍝ 2 (indexing, 1-based by default)
Core Symbols
Primitive glyphs used constantly in APL code.
- ←- assignment, e.g. V ← 1 2 3
- ⍳ (iota)- generates an index vector, e.g. ⍳5 is 1 2 3 4 5
- ⍴ (rho)- monadic: returns shape; dyadic: reshapes an array
- ⌽- reverses the elements of a vector
- ⍉- transposes a matrix
- / (reduce)- inserts a function between elements, e.g. +/1 2 3 sums to 6
- \ (scan)- like reduce but keeps every intermediate result
- ⍺ / ⍵- left and right arguments inside a dfn (curly-brace function)
Custom Functions (dfns)
Defining small anonymous functions with curly braces.
apl
square ← {⍵ × ⍵}square 5 ⍝ 25add ← {⍺ + ⍵}3 add 4 ⍝ 7avg ← {(+/⍵) ÷ ≢⍵}avg 1 2 3 4 ⍝ 2.5
Reduction & Scan
Folding a function across an array's elements.
apl
+/1 2 3 4 ⍝ 10 (sum)×/1 2 3 4 ⍝ 24 (product)+\1 2 3 4 ⍝ 1 3 6 10 (running sum)⌈/3 1 4 1 5 ⍝ 5 (maximum via reduce)
Pro Tip
APL expressions evaluate strictly right-to-left with no operator precedence, so read code from right to left to understand it — `2 × 3 + 4` is `2 × (3 + 4)`, giving 14, not 10.
Was this cheat sheet helpful?
Explore Topics
#APL#APLCheatSheet#Programming#Advanced#BasicArithmeticArrays#CoreSymbols#CustomFunctionsDfns#ReductionScan#DataStructures#Databases#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance