mAPL Language Reference & Syntax Specification
mAPL extends traditional APL array operations with software-engineering constructs for building multi-file, maintainable applications.
1. Gradual Type & Shape Contracts (::)
add ← { :: num, num → num ⋄ ⍺ + ⍵ }
scale ← { :: int[] → int[] ⋄ (⍵ × 2) + 1 }
norm_sq ← { :: [x: num, y: num] → num ⋄ (⍵.x * 2) + (⍵.y * 2) }
2. First-Class Dictionaries & Destructuring
user ← [ name: 'Ada', role: 'Engineer', scores: 98 99 100 ]
[ name, scores ] ← user
cfg?.db?.port ?? 5432
3. Left-to-Right Triangle Pipelines (▷)
12 45 68 23 89 ▷ (⍵ ≥ 30)/⍵ ▷ (⍵ × 1.15) ▷ (+/ ÷ ≢)
4. Native Scoped Modules (import / export)
[ LinearRegression, MovingAverage ] ← import 'lib/stats.mapl'