### glyphs ←+-×÷*⍟⌹○!?|⌈⌊⊥⊤⊣⊢=≠≤<>≥≡≢∨∧⍲⍱↑↓⊂⊃⌷⍋⍒⍳⍷∪∩∊~/\⌿⍀,⍪⍴⌽⊖⍉¨⍨⍣.∘⍞⎕⍠⍎⍕⋄⍝→⍵⍺∇&¯⍬[]{}'⌸⍤ ### Left Arrow ``` Key: `[ Dyadic: Assignment X←3 5⍴'ABCDEFG' X ABCDE FGABC DEFGA X,←3 4 5 X ABCDE 3 FGABC 4 DEFGA 5 ``` ### Plus ``` Key: + Monadic: Conjugate + 3.2 ¯12.666 3J¯1.3 3.2 ¯12.666 3J1.3 Dyadic: Plus 1 2 3 4 + 5 6 7 8 6 8 10 12 ``` ### Minus ``` Key: - Monadic: Negate - 3 2 5.5 ¯7 0 ¯3 ¯2 ¯5.5 7 0 Dyadic: Minus 3 7 9 - 5 ¯2 2 4 ``` ### Times ``` Key: `- Monadic: Sign Of × 3 2 ¯2 0 8 1 1 ¯1 0 1 Dyadic: Times 2 ¯8 2 5 4 × 3 2 ¯2 0 8 6 ¯16 ¯4 0 32 ``` ### Divide ``` Key: `= Monadic: Reciprocal ÷ 1 2 3 1 0.5 0.333333 Dyadic: Divide 1 2 3 4 ÷ 5 6 7 8 0.2 0.333333 0.428571 0.5 ``` ### Star ``` Key: * or `p Monadic: Exponential * 2 2⍴1 2 3 4 2.71828 7.38906 20.0855 54.5982 Dyadic: Power (2 2⍴1 2 3 4) * 2 2⍴1 2 3 4 1 4 27 256 ``` ### Log ``` Key: `* Monadic: Natural Logarithm ⍟ 1 2 3 2.7182818285 0 0.693147 1.09861 1 Dyadic: Logarithm 10 ⍟ 1 10 100 1000 0 1 2 3 ``` ### Domino ``` Key: `+ Monadic: Matrix Inverse ⌹ (2 2⍴1 2 3 4) ¯2 1 1.5 ¯0.5 Dyadic: Matrix Divide 5 6 ⌹ 2 2⍴1 2 3 4 ¯4 4.5 ``` ### Circle ``` Key: `o Monadic: Pi Times ○ 0 1 2 0 3.14159 6.28319 Dyadic: Circular (Trig) Functions Note: Angles are in radians radians ← ○ degrees ÷ 180 1 ○ 0 1.5707963 3.1415927 0 1 ¯4.64102E¯8 ⍺ ⍺ ○ ⍵ ⍺ ⍺ ○ ⍵ 0 (1-⍵*2)*0.5 ¯1 Arcsin ⍵ 1 Sine ⍵ ¯2 Arccos ⍵ 2 Cosine ⍵ ¯3 Arctan ⍵ 3 Tangent ⍵ ¯4 (¯1+⍵*2)*0.5 4 (1+⍵*2)≠0.5 ¯5 Arcsinh ⍵ 5 Sinh ⍵ ¯6 Arccosh ⍵ 6 Cosh ⍵ ¯7 Arctanh ⍵ 7 Tanh ⍵ ¯8 -8○⍵ 8 (-1+⍵*2)*0.5 ¯9 ⍵ 9 real part of ⍵ ¯10 +⍵ 10 |⍵ ¯11 ⍵×0J1 11 imaginary part of ⍵ ¯12 *⍵×0J1 12 phase of ⍵ ``` ### Exclamation Mark ``` Key: ! Monadic: Factorial ! 3 9 ¯0.11 6 362880 1.07683 Dyadic: Binomial 2 1 3 ! 3 10 ¯0.11 3 10 ¯0.0429385 ``` ### Question Mark ``` Key: ? or `q Monadic: Roll ? 1000 1000 1000 9000 756 459 533 1971 Dyadic: Deal 7 ? 1000 67 418 687 589 931 847 527 ``` ### Stile ``` Key: | or `m Monadic: Magnitude (Modulus) | 2.3 4 ¯2 0 2.3 4 2 0 Dyadic: Residue 2 | 2.3 4 ¯2 0 ¯2.3 0.3 0 0 0 1.7 ``` ### Upstile ``` Key: `s Monadic: Ceiling (Round Up) ⌈ 3.4 2 8.1 ¯3.44 0 4 2 9 ¯3 0 Dyadic: Maximum 3 1.1 ¯2 ⌈ 3.4 8.1 ¯3.44 3.4 8.1 ¯2 ``` ### Downstile ``` Key: `d Monadic: Floor (Round Down) ⌊ 3.4 ¯2.1 8.1 3 0 3 ¯3 8 3 0 Dyadic: Minimum 3 1.1 ¯2 ⌊ 3.4 8.1 ¯3.44 3 1.1 ¯3.44 ``` ### Up Tack ``` Key: `b Dyadic: Decode 2 ⊥ 2 3⍴0 1 1 1 0 1 1 2 3 ``` ### Down Tack ``` Key: `n Dyadic: Encode 2 2 2 2 2 2 ⊤ 8 16 32 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 ``` ### Left Tack ``` Key: `| Monadic: Same ⊣ 1 2 3 1 2 3 Dyadic: Left 'Left' ⊣ 'Right' Left ``` ### Right Tack ``` Key: `\ Monadic: Same ⊢ 1 2 3 1 2 3 Dyadic: Right 'Left' ⊢ 'Right' Right ``` ### Equal ``` Key: = or `5 Dyadic: Equal To 2 = 2 2 ¯2 0 8 1 1 0 0 0 ``` ### Not Equal ``` Key: `8 Dyadic: Not Equal To (XOR) 3 ≠ 2 2 2⍴1 2 3 1 1 0 1 1 0 1 1 ``` ### Less Than Or Equal To ``` Key: `4 Dyadic: Less Than or Equal To 2 ¯8 2 5 4 ≤ 2 2 ¯2 0 8 1 1 0 0 1 ``` ### Less Than ``` Key: < or `3 Dyadic: Less Than 2 ¯8 2 5 4 < 2 2 ¯2 0 8 0 1 0 0 1 ``` ### Greater Than ``` Key: > or `7 Dyadic: Greater Than 2 ¯8 2 5 4 > 2 2 ¯2 0 8 0 0 1 1 0 ``` ### Greater Than Or Equal To ``` Key: `6 Dyadic: Greater Than or Equal To 2 ¯8 2 5 4 ≥ 2 2 ¯2 0 8 1 0 1 1 0 ``` ### Equal Underbar ``` Key: `: Monadic: Depth ≡ 1 (1 2)('ab' 'def') ¯3 Dyadic: Match 'b' 'e' 'x' ≡ 'bex' 1 ``` ### Equal Underbar Slash ``` Key: `" Monadic: Tally ≢ 5 4 3⍴0 5 Dyadic: Not Match 'bex' ≢ 'b','e','x' 0 ``` ### Logical OR ``` Key: `9 Dyadic: OR / Greatest Common Divisor 0 1 0 1 ∨ 0 0 1 1 0 1 1 1 15 1 2 7 ∨ 35 1 4 0 5 1 2 7 ``` ### Logical AND ``` Key: ^ or `0 Dyadic: AND / Lowest Common Multiple 0 1 0 1 ∧ 0 0 1 1 0 0 0 1 15 1 2 7 ∧ 35 1 4 0 105 1 4 0 ``` ### Logical NAND ``` Key: `) Dyadic: NAND 0 1 0 1 ⍲ 0 0 1 1 1 1 1 0 ``` ### Logical NOR ``` Key: `( Dyadic: NOR 0 1 0 1 ⍱ 0 0 1 1 1 0 0 0 ``` ### Up Arrow ``` Key: `y Monadic: Mix ↑ (6 4) 5 3 6 4 5 0 3 0 Dyadic: Take 2 3 ↑ 7 7 0 0 0 0 0 ``` ### Down Arrow ``` Key: `u Monadic: Split ↓ 3 3⍴1 2 3 4 1 2 3 4 1 2 3 4 1 Dyadic: Drop 1 1 ↓ 3 3⍴1 2 3 4 5 6 5 6 2 3 ``` ### Left Shoe ``` Key: `z Monadic: Enclose ⊂ 1 (2 2) (2 2⍴3) 1 2 2 3 3 3 3 ]display ⊂ 1 (2 2) (2 2⍴3) ┌───────────────────┐ │ ┌→──────────────┐ │ │ │ ┌→──┐ ┌→──┐ │ │ │ │ 1 │2 2│ ↓3 3│ │ │ │ │ └~──┘ │3 3│ │ │ │ │ └~──┘ │ │ │ └∊──────────────┘ │ └∊──────────────────┘ Dyadic: Partitioned Enclose 0 1 0 1 ⊂ 1 2 3 4 2 3 4 ]display 0 1 0 1 ⊂ 1 2 3 4 ┌→──────────┐ │ ┌→──┐ ┌→┐ │ │ │2 3│ │4│ │ │ └~──┘ └~┘ │ └∊──────────┘ ``` ### Right Shoe ``` Key: `x Monadic: First ⊃ (2 2)(3 3 3) 2 2 Dyadic: Pick 2 ⊃ (2 2)(2 3⍴3) 3 3 3 3 3 3 ``` ### Squad ``` Key: `L Monadic: Materialise ⌷⍵ If ⍵ is an array, returns ⍵. If ⍵ is ref to an instance of a Class with a Default property, all elements of the Default property are returned. Dyadic: Index 2 3⌷4 3⍴⍳12 6 2⌷[1]⍳2 3 4 2 1 1 2 1 2 2 1 3 2 1 4 2 2 1 2 2 2 2 2 3 2 2 4 2 3 1 2 3 2 2 3 3 2 3 4 ``` ### Grade Up ``` Key: `$ Monadic: Grade Up Returns indices sorted in ascending order ⍋ 3 1 4 6 2 2 5 1 3 4 names←'Joe' 'Sue' 'Sam' ages←34 22 25 names[⍋ages] Sue Sam Joe Dyadic: Dyadic Grade Up 'ABCDEFG'⍋'CDEDEDE' 1 2 4 6 3 5 7 ``` ### Grade Down ``` Key: `# Monadic: Grade Down Returns indices sorted in descending order ⍒ 3 1 4 6 2 4 3 1 5 2 names←'Joe' 'Sue' 'Sam' ages←34 22 25 names[⍒ages] Joe Sam Sue Dyadic: Dyadic Grade Down 'ABCDEFG' ⍒ 'CDEDEDE' 3 5 7 2 4 6 1 ``` ### Iota ``` Key: `i Monadic: Index Generator ⍳10 1 2 3 4 5 6 7 8 9 10 Dyadic: Index Of 'ABCDABCDEF' ⍳ 'ACF' 1 3 10 ``` ### Epsilon Underbar ``` Key: `E Dyadic: Find 0 0 ⍷ 4 4⍴0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 ``` ### Up Shoe ``` Key: `v Monadic: Unique ∪ 'ab' 'ba' 'ab' 1 1 2 ab ba 1 2 Dyadic: Union 'ab' 'cde' 'fg' ∪ 'a' 'ab' ab cde fg a ``` ### Down Shoe ``` Key: `c Dyadic: Intersection 22 'ab' 'fg' ∩ 'a' 'ab' 22 22 ab ``` ### Epsilon ``` Key: `e Monadic: Enlist ∊ 3 3⍴1 'abc' 1 abc 1 abc 1 abc 1 abc 1 Dyadic: Membership 'abc' 1.1 ∊ 1.1 'ab' 'abcd' 0 1 ``` ### Tilde ``` Key: ~ or `t Monadic: NOT ~ 3 3⍴0 1 1 0 1 0 1 0 1 0 1 Dyadic: Without 'ab' 'ce' 'fg' ~ 'ce' 'ab' fg ``` ### Slash ``` Key: / Dyadic: Replicate / Compress 2 1 3 3 / 3.1 4 1 3.2 3.1 3.1 4 1 1 1 3.2 3.2 3.2 Operator: Reduce / N-Wise Reduce ∧/ 2 3 4⍴1 1 1 1 0 1 0 0 0 0 1 ¯2 -/ 1 3 4 1 ⍝ N-Wise Reduce 2 1 ¯3 ``` ### Backslash ``` Key: \ Dyadic: Expand 3 ¯2 4 \ 3 2⍴1.1 2.2 3.3 1.1 1.1 1.1 0 0 2.2 2.2 2.2 2.2 3.3 3.3 3.3 0 0 1.1 1.1 1.1 1.1 2.2 2.2 2.2 0 0 3.3 3.3 3.3 3.3 Operator: Scan +\ 1 2 3 4 5 6 7 8 9 10 1 3 6 10 15 21 28 36 45 55 ``` ### Slash Bar ``` Key: `/ Dyadic: Replicate First / Compress First 2 3 ⌿ 2 29⍴'NETHOTSONDS1' NETHOTSONDS1NETHOTSONDS1NETHO NETHOTSONDS1NETHOTSONDS1NETHO TSONDS1NETHOTSONDS1NETHOTSOND TSONDS1NETHOTSONDS1NETHOTSOND TSONDS1NETHOTSONDS1NETHOTSOND Operator: Reduce First +⌿ 10 3⍴5 50 50 50 ``` ### Backslash Bar ``` Key: `. Dyadic: Expand First 0 1 1 2 ⍀ 3 6⍴'ABCDE' ABCDEA BCDEAB CDEABC CDEABC Operator: Scan First =⍀ 5 6⍴0 1 0 0 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 0 ``` ### Comma ``` Key: , Monadic: Ravel , 2 2 2 2⍴3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Dyadic: Catenate/Laminate (2 3⍴9) , 2 4⍴8 9 9 9 8 8 8 8 9 9 9 8 8 8 8 ``` ### Comma Bar ``` Key: `< Monadic: Table If 2>⍴⍴⍵, ⍪⍵ will produce a one column matrix of the elements of ⍵ ⍪ 2 3 4 2 3 4 Dyadic: Catenate First / Laminate (3 2⍴9) ⍪ 4 2⍴8 9 9 9 9 9 9 8 8 8 8 8 8 8 8 ``` ### Rho ``` Key: `r Monadic: Shape ⍴ 15 3 7 8 75.53 5 Dyadic: Reshape 2 3 4 ⍴ 15 3 7 8 75.53 15 3 7 8 75.53 15 3 7 8 75.53 15 3 7 8 75.53 15 3 7 8 75.53 15 3 7 8 ``` ### Circle Stile ``` Key: `% Monadic: Reverse ⌽ 8 2 5 6.6 ¯2 ¯2 6.6 5 2 8 Dyadic: Rotate 1 2 ¯1 ⌽ 3 3⍴⍳9 2 3 1 6 4 5 9 7 8 ``` ### Circle Bar ``` Key: `& Monadic: Reverse First ⊖ 3 2⍴1 2 3 4 5 6 5 6 3 4 1 2 Dyadic: Rotate First 1 2 ⊖ 3 2⍴1 2 3 4 5 6 3 6 5 2 1 4 ``` ### Circle Backslash ``` Key: `^ Monadic: Transpose ⍉ 3 3⍴1 2 3 4 5 6 7 8 9 1 4 7 2 5 8 3 6 9 Dyadic: Dyadic Transpose 2 1 3 ⍉ 2 3 4⍴⍳24 1 2 3 4 13 14 15 16 5 6 7 8 17 18 19 20 9 10 11 12 21 22 23 24 ``` ### Dieresis ``` Key: `1 Operator: Each ⊃¨ 1 2 3 'ABC' (9 8 7) 1 2 3 A 9 3 ↑¨ 1 2 3 (2 3) 'A' 1 0 0 2 0 0 3 0 0 2 3 0 A ``` ### Tilde Dieresis ``` Key: `T Operator: Commute 3.1243 - 4.1234 1 0 ⍝ ⍺ - ⍵ ¯0.9991 2.1243 3.1243 3.1243 -⍨ 4.1234 1 0 ⍝ ⍵ - ⍺ 0.9991 ¯2.124 ¯3.124 ⍴⍨ 3 ⍝ ⍵ ⍴ ⍵ 3 3 3 ``` ### Star Dieresis ``` Key: `P Operator: Power alph←'ABCDEFGHIJKLMNOP' (↓⍣1) 2 2 2 2 ⍴ alph ⍝ split once. AB CD EF GH IJ KL MN OP (↓⍣3) 2 2 2 2⍴alph ⍝ split thrice AB CD EF GH IJ KL MN OP ⍝ Fahrenheit from Celsius f←(32∘+)∘(×∘1.8) f ¯273 ¯40 0 100 ¯459.4 ¯40 32 212 ⍝ Inverse: Celsius from Fahrenheit c←f⍣¯1 c ¯459.4 ¯40 32 212 ¯273 ¯40 0 100 ⍝ fixpoint: golden mean. 1+∘÷⍣=1 1.61803 ``` ### Dot ``` Key: . Operator: Inner Product f.g 1 2 3+.×4 5 6 32 Operator: Outer Product ∘.g 1 2 3∘.×4 5 6 4 5 6 8 10 12 12 15 18 ``` ### Jot ``` Key: `j Operator: Outer Product 1 2 3∘.×4 5 6 4 5 6 8 10 12 12 15 18 Operator: Compose Form I: f∘g Y (function composition) rank ← ⍴∘⍴ rank 2 3 4⍴⍳24 3 Form II: A∘g Y (left argument currying) next ← 1∘+ next 23 24 Form III: (f∘B) Y (right argument currying) sqrt ← *∘0.5 sqrt 1 2 3 4 5 6 1 1.41421 1.73205 2 2.23607 2.44949 Form IV: X f∘g Y (function composition) 0 ,∘⍳¨ 1 3 2 0 1 0 1 2 3 0 1 2 ``` ### Quote Quad ``` Key: `{ Niladic: Character Input / Output Input←⍞ (user types "Bob Dylan" and presses ) Input Bob Dylan ⍞←'Prompt: ' Prompt: (displays test and leaves cursor at end) ``` ### Quad ``` Key: `l Evaluated Input inp←⎕ ⎕: 2+2 inp 4 System Name Prefix 'ZI3' ⎕FMT 1 0 10 100 ⍝ format 001 010 100 ⎕TS ⍝ timestamp 2012 1 20 12 52 58 950 ⎕IO←1 ⍝ index origin ⍳5 1 2 3 4 5 ⎕IO←0 ⍳5 0 1 2 3 4 System Names available in TryAPL ⎕CT Comparizon Tolerance ⎕FMT Format ⎕IO Index Origin ⎕NC Name Class ⎕NL Name List ⎕PP Print Precision ⎕R Regex Replace ⎕RL Random Link ⎕S Regex Search ⎕SIZE Object Size (memory consumption) ⎕TS Timestamp ⎕UCS Unicode Conversion ⎕VFI Character to Number conversion ⎕XML XML Conversion ``` ### Quad Colon ``` Key: `? Operator: Variant ('a' ⎕R 'x') 'ABC' ABC ('a' ⎕R 'x' ⍠ 'IC' 1) 'ABC' xBC ``` ### Hydrant ``` Key: `; Monadic: Execute ⍎ '1+1' 2 Dyadic: Dyadic Execute '⎕SE' ⍎ 'B←42' ⎕SE.B 42 ``` ### Thorn ``` Key: `' Monadic: Format ⍕ 0.0000003 3.87687857858 3E¯7 3.87688 Dyadic: Format By Specification 8 3 ⍕ 0.00003 3.87687 0.000 3.877 ``` ### Diamond ``` Key: `~ Function: Statement Separator When executed, the expressions separated by diamonds are evaluated sequentially from left to right. A←10 ⋄ A+←1 ⋄ A÷2 5.5 ``` ### Lamp ``` Key: `< Function: Begin comment Any text to the right of the ⍝ symbol is treated as a comment. 1 2 3 ⍝ this is a commment 1 2 3 ``` ### Right Arrow ``` Key: `] Niladic: Abort → Monadic: Branch To → Label1 ``` ### Omega ``` Key: `w Argument: Right Argument to a D-function {(+/⍵)÷⍴⍵} 2 3 4 ⍝ Arithmetic Mean 3 ``` ### Alpha ``` Key: `a Argument: Left Argument to a D-function 3 {⍵*÷⍺} 64 ⍝ ⍺th root 4 ``` ### Del ``` Key: `g Function: Self Reference (Recursion) fact←{ ⍝ Factorial ⍵. ⍵≤1: 1 ⍝ Small ⍵, finished, ⍵×∇ ⍵-1 ⍝ Otherwise recur. } ``` ### Ampersand ``` Key: & Operator: Spawn (Thread of Execution) ⍎& '⌹4 4⍴1 2 3 4 5' ¯0.171429 0.214286 0.0142857 0.0142857 0.0285714 ¯0.185714 0.214286 0.0142857 0.0285714 0.0142857 ¯0.185714 0.214286 0.257143 0.0285714 0.0285714 ¯0.171429 3 2 1 4 ⌹& 4 4⍴1 2 3 4 5 ¯0.0142857 ¯0.0142857 0.785714 0.171429 ``` ### High Minus ``` Key: `2 Symbol: A number prefixed by ¯ signifies that the number is negative. 1+¯1 0 1 ¯3 0 1 2 ¯2 ``` ### Zilde ``` Key: `} Niladic: Empty Numeric Vector ⍬≡⍳0 1 ⍬≢'' 1 ⍬≡0⍴0 1 ``` ### Left/Right Bracket ``` Keys: [] Data: Indexing 2 4 6 8 10[5 1 3] 10 2 6 (3 3⍴⍳9)[1 2;2 3] 2 3 5 6 Function/Operator: Axis Specification +/[1] 2 4⍴⍳8 6 8 10 12 +/[2] 2 4⍴⍳8 10 26 2↑[1] 4 3⍴'BobTomSueJoe' Bob Tom ``` ### Left/Right Brace ``` Keys: {} Dfn/Dop Definition avg←{(+/⍵)÷⍴⍵} avg 10 15 20 25 17.5 {(+/∧\' '=⍵)↓⍵} ⍝ remove leading blanks txt←',break-up,words now' ' ,-'{1↓¨(⍵∊⍺)⊂⍵} txt break up words now ]display ' ,-'{1↓¨(⍵∊⍺)⊂⍵} txt ┌→───────────────────────────┐ │ ┌→────┐ ┌→─┐ ┌→────┐ ┌→──┐ │ │ │break│ │up│ │words│ │now│ │ │ └─────┘ └──┘ └─────┘ └───┘ │ └∊───────────────────────────┘ ``` ### Quote ``` Key: ' or `k Delimit Character String 'Hello World' Hello World 'Say it isn''t so' ⍝ note the '' Say it isn't so ``` ### Quad Equal ``` Key: `K Monadic operator: Key {⍺ ⍵}⌸ 'Mississippi' M 1 i 2 5 8 11 s 3 4 6 7 p 9 10 {≢⍵}⌸ 'Mississippi' 1 4 4 2 'Mississippi'{+/⍵}⌸ 3 1 4 1 5 9 2 6 5 3 6 3 18 16 8 ``` ### Jot Diaerisis ``` Key: `J Dyadic operator: Rank (⍋ ⍤ 1) 2 3 ⍴ 'abczxy' 1 2 3 2 3 1 10 20 30 (+ ⍤ 0 1) 3 4 ⍴ ⍳ 12 11 12 13 14 25 26 27 28 39 40 41 42 ```