This repository contains a handful of basic APL snippets, demonstrating each and every operator's purpose and behavior.
The ex/
directory contains a few examples, mostly from Programming Puzzles & Code Golf Stack Exchange.
Filename | Symbol name | Symbol | Monadic | Dyadic | Operator (higher-order) |
assign | left arrow | ← | Assignment | ||
index | iota | ⍳ | Index Generator | Index of | |
reduce-replicate | slash | / | Replicate | Reduce | |
shaped | rho | ⍴ | Shape-of | Reshape | |
mix-take | up arrow | ↑ | Mix | Take | |
enclose | left shoe | ⊂ | Enclose | Partitioned enclose | |
first-pick | right shoe | ⊃ | First | Pick | |
rand | question mark | ? | Roll | Deal | |
commute | tilde dieresis | ⍨ | Commute | ||
element-s | epsilon | ∊ | Enlist (flat) | Membership | |
rev-rot | circle stile | ⌽ | Reverse (inner) | Rotate (inner) | |
rev-rot-first | circle bar | ⊖ | Reverse first (outer) | Rotate first (outer) | |
not-without | tilde | ~ | Not | Without | |
cat | comma | , | Ravel | Concatenate | |
logic | Logical {N,}{and,or} | ∧, ∨, ⍲, ⍱ | and, or, nand, nor | ||
compare | {Not,} Equal | {Greater,Lower} than{,or equal} | <, >, ≤, ≥, =, ≠ | lower, greater, lower-or-eq, greater-or-eq, eq, not-eq | ||
grade | grade {up,down} | ⍋ (up), ⍒ (down) | Grade {Up,Down} | Dyadic Grade {Up,Down} | |
each | dieresis | ¨ | Each | ||
function | braces | { and } | ⍵ (monadic argument) / ⍵⍵ (function monadic argument) | ⍺ (dyadic argument) / ⍺⍺ (function dyadic argument) | Function |
depth-match | equal underbash | ≡ | Depth | Match | |
tally-notmatch | equal underbash slash | ≢ | Tally | Not-match | |
statement | diamond | ⋄ | Statement separator | ||
short-circuit | colon | : | returns ⍵ from ∇ if ⍺=1 | ||
compose | jot | ∘ | Monadic compose (e.g.: ⍴∘⍴) / Currying | ||
pointfree (implicit composition) | |||||
inner-product | dot | . | Inner product (e.g.: +.×) | ||
outer-product | jot + dot | ∘. | Outer product (e.g.: ∘.+) | ||
rank | jot diaerisis | ⍤ | (⍵ is the new rank of the operator) | changes the rank of ⍺⍺ | |
variant | quad colon | ⍠ | Sets option value | ||
key | quad equal | ⌸ | Returns an scalar vector (key, positions for the key) |