miniapl is an APL calculator for mathematics, with an interactive terminal and a Python API. Work with whole arrays, define functions, and combine them with operators. Numbers include approximate reals, complex numbers and exact rationals.
+/⍳10 ⍝ 55
avg←+/÷≢ ⋄ avg 2 4 9 ⍝ 5
1r3+1r6 ⍝ 1r2
Each name below links to its definitions and examples. Examples show an equivalent APL value after ⍝. A monad takes one argument; a dyad takes two. Operators take functions or arrays and derive functions.
| Glyph | Monad | Dyad |
|---|---|---|
+ Plus |
Conjugate | Add |
- Minus |
Negate | Subtract |
× Times |
Direction | Multiply |
÷ Divide |
Reciprocal | Divide |
⌊ Floor |
Floor | Minimum |
⌈ Ceiling |
Ceiling | Maximum |
\| Stile |
Magnitude | Residue |
* Star |
Exponential | Power |
⍟ Log |
Natural log | Logarithm |
○ Circle |
Pi times | Circular functions |
! Factorial |
Factorial | Binomial |
ℙ Prime |
Nth prime (one-based) | Prime operations |
Ⓠ Factor |
Prime factors | Exponents / factor table |
Ⓟ Polynomial |
Roots / coefficients | Evaluate |
? Question |
Roll | Deal |
∨ Or |
— | OR / GCD |
∧ And |
— | AND / LCM |
⍲ Nand |
— | NAND |
⍱ Nor |
— | NOR |
~ Tilde |
NOT | Without |
= Equal |
— | Equal |
≠ Not equal |
Unique mask | Not equal |
< Less |
— | Less |
≤ Less or equal |
— | Less or equal |
> Greater |
— | Greater |
≥ Greater or equal |
— | Greater or equal |
≡ Match |
Depth | Match |
≢ Tally |
Tally | Not match |
⍴ Rho |
Shape | Reshape |
, Comma |
Ravel | Catenate |
⍪ Table |
Table | Catenate first |
⌽ Reverse |
Reverse last | Rotate last |
⊖ Reverse first |
Reverse first | Rotate first |
⍉ Transpose |
Transpose | Reorder / diagonal axes |
↑ Take |
Mix | Take |
↓ Drop |
Split | Drop |
↕ Windows |
— | Full leading-axis windows |
⊂ Enclose |
Enclose | Partitioned enclose |
⊆ Nest |
Nest | Partition |
⊃ Disclose |
First / disclose | Pick |
⌷ Squad |
Identity | Index |
⍳ Iota |
Index generator | Index of |
⍸ Where |
Where | Interval index |
∊ Member |
Enlist | Membership |
∪ Union |
Unique | Union |
∩ Intersection |
— | Intersection |
⍷ Find |
— | Find |
⍋ Grade up |
Grade up | Grade with collation |
⍒ Grade down |
Grade down | Grade with collation |
/ Slash |
— | Replicate last |
⌿ Slash bar |
— | Replicate first |
\ Backslash |
— | Expand last |
⍀ Backslash bar |
— | Expand first |
⊤ Encode |
— | Encode |
⊥ Decode |
— | Decode |
⌹ Domino |
Matrix inverse | Matrix divide |
⊣ Left |
Identity | Left |
⊢ Right |
Identity | Right |
⍎ Execute |
Execute | Execute in current scope (''⍎Y) |
⍕ Format |
Format | Format by specification |
f, g are functions; a, n, r are arrays or numbers.
| Glyph | Form | Meaning |
|---|---|---|
/ Slash |
f/ |
Reduce / n-wise reduce last |
⌿ Slash bar |
f⌿ |
Reduce / n-wise reduce first |
\ Backslash |
f\ |
Scan / seeded scan last |
⍀ Backslash bar |
f⍀ |
Scan / seeded scan first |
¨ Each |
f¨ |
Each |
⍨ Commute |
f⍨, a⍨ |
Self / commute / constant |
∘ Compose |
f∘g, a∘f, f∘a |
Compose / bind |
⍤ Rank |
f⍤g, f⍤r |
Atop / rank |
⍥ Over |
f⍥g |
Over |
⍛ Behind |
f⍛g |
Behind |
. Dot |
f.g |
Inner product |
⌝ Outer |
g⌝ |
Outer product |
⌸ Key |
f⌸ |
Key |
⍣ Power |
f⍣n, f⍣g |
Iterate / invert / repeat until |
⍣\ History |
f⍣\n, f⍣\g |
Iteration states, including initial state |
⇄ Inverse pair |
f⇄g |
Attach an explicit inverse |
⌾ Under |
f⌾g |
Transform, apply, inverse-transform |
∂ Derivative |
f∂ |
Gradient / vector–Jacobian product |
◶ Agenda |
selector◶cases |
Select and call one function |
@ At |
f@a, a@g |
Functional amend |
⌺ Stencil |
f⌺a |
Stencil |
| Form | Meaning |
|---|---|
‿ Strand |
Form a vector of values: 1‿+‿'abc' |
← Assign |
Assignment, including modified/indexed/selective forms |
(…) Parentheses |
Grouping / nested array literals / trains |
[…] Brackets |
Array literals, indexing and axes |
; Semicolon |
Index-axis separator |
{…} Braces |
Defined function or operator |
⍺ Alpha, ⍵ Omega |
Left / right argument |
⍺⍺ Alpha alpha, ⍵⍵ Omega omega |
Left / right operand |
∇ Nabla, ∇∇ Nabla nabla |
Function / operator self-reference |
: Colon, :: Error guard |
Boolean / error guard |
⋄ Diamond |
Statement or literal separator |
⍝ Comment |
Comment |
⎕← Quad |
Explicit output |
⍬ Zilde |
Empty numeric vector |
'…' Quote |
Character literal |
¯ Overbar |
Negative literal sign |
∞ Infinity |
Real infinity |
Numeric notation x, r, j, E: see numbers.
Names are case-insensitive. •A and •D are constant arrays; •C and •UCS are functions, usable with operators and composition.
| Name | Meaning |
|---|---|
•A Alphabet |
Uppercase Latin alphabet |
•D Digits |
Decimal digits |
•C Case |
Unicode case conversion |
•UCS Unicode |
Unicode code points / encodings |
Index origin: 1. Comparison tolerance: 1E¯14.