apl: unified/dyalog key combinations
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 3 Mar 2015 20:23:07 +0000 (21:23 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 9 Jun 2015 03:43:43 +0000 (05:43 +0200)
apl.inc.pl
apl.plp

index 61c759d918fd6f147bc18aff809001f7fbac73a4..388b07d1ea192316eda47f98121138e67a5f312e 100644 (file)
@@ -1,62 +1,90 @@
 use utf8;
 (
 use utf8;
 (
-# monadic
-["∼", undef, "Not, Tilde\nLogical: ∼1 is 0, ∼0 is 1"],
-
 # dyadic, monadic
 # dyadic, monadic
-["+", "Add\nSum of A and B", "Identity\nNo change to B"],
-["−", "Subtract\nA minus B", "Negation\nChanges sign of B"],
-["×", "Multiply\nA multiplied by B", "Signum\n¯1 if B<0; 0 if B=0; 1 if B>0"],
-["÷", "Divide\nA divided by B", "Reciprocal\n1 divided by B"],
-["⋆", "Exponentiation\nA raised to the B power", "Exponential\ne to the B power"],
-["○", "Circle\nTrigonometric functions of B selected by A\nA=1: sin(B) A=2: cos(B) A=3: tan(B)", "Pi times\nMultiply by π"],
-["?", "Deal\nA distinct integers selected randomly from the first B integers", "Roll\nOne integer selected randomly from the first B integers"],
-["∈", "Membership, Epsilon\n1 for elements of A present in B; 0 where not."],
-["⌈", "Maximum, Ceiling\nThe greater value of A or B", "Ceiling\nLeast integer greater than or equal to B"],
-["⌊", "Minimum, Floor\nThe smaller value of A or B", "Floor\nGreatest integer less than or equal to B"],
-["⍴", "Reshape, Dyadic Rho\nArray of shape A with data B", "Shape, Rho\nNumber of components in each dimension of B"],
-["↑", "Take\nSelect the first (or last) A elements of B according to ×A"],
-["↓", "Drop\nRemove the first (or last) A elements of B according to ×A"],
-["⊥", "Decode\nValue of a polynomial whose coefficients are B at A"],
-["⊤", "Encode\nBase-A representation of the value of B"],
-["∣", "Residue\nB modulo A", "Absolute value\nMagnitude of B"],
+["∼\nt", undef, "Not, Tilde\nLogical: ∼1 is 0, ∼0 is 1"],
+["⍨\nT"],
+["+\n-", "Add\nSum of A and B", "Identity\nNo change to B"],
+["−\n_", "Subtract\nA minus B", "Negation\nChanges sign of B"],
+["×\n-", "Multiply\nA multiplied by B", "Signum\n¯1 if B<0; 0 if B=0; 1 if B>0"],
+["÷\n=", "Divide\nA divided by B", "Reciprocal\n1 divided by B"],
+["⋆\np", "Exponentiation\nA raised to the B power", "Exponential\ne to the B power"],
+["⍣\nP"],
+["○\no", "Circle\nTrigonometric functions of B selected by A\nA=1: sin(B) A=2: cos(B) A=3: tan(B)", "Pi times\nMultiply by π"],
+["⍥\nO"],
+["?\nq", "Deal\nA distinct integers selected randomly from the first B integers", "Roll\nOne integer selected randomly from the first B integers"],
+["∈\ne", "Membership, Epsilon\n1 for elements of A present in B; 0 where not."],
+["⍷\nE"],
+["⌈\ns", "Maximum, Ceiling\nThe greater value of A or B", "Ceiling\nLeast integer greater than or equal to B"],
+["⌊\nd", "Minimum, Floor\nThe smaller value of A or B", "Floor\nGreatest integer less than or equal to B"],
+["⍴\nr", "Reshape, Dyadic Rho\nArray of shape A with data B", "Shape, Rho\nNumber of components in each dimension of B"],
+["↑\ny", "Take\nSelect the first (or last) A elements of B according to ×A"],
+["↓\nu", "Drop\nRemove the first (or last) A elements of B according to ×A"],
+["⊥\nb", "Decode\nValue of a polynomial whose coefficients are B at A"],
+["⊤\nn", "Encode\nBase-A representation of the value of B"],
+["∣\nm", "Residue\nB modulo A", "Absolute value\nMagnitude of B"],
 [",", "Catenation\nElements of B appended to the elements of A", "Ravel, Catenate, Laminate\nReshapes B into a vector"],
 ["\\","Expansion, Dyadic Backslash\nInsert zeros (or blanks) in B corresponding to zeros in A", "Scan (last axis), Backslash\nRunning sum across B"],
 [",", "Catenation\nElements of B appended to the elements of A", "Ravel, Catenate, Laminate\nReshapes B into a vector"],
 ["\\","Expansion, Dyadic Backslash\nInsert zeros (or blanks) in B corresponding to zeros in A", "Scan (last axis), Backslash\nRunning sum across B"],
-["⍀", undef, "Scan (first axis)\nRunning sum down B"],
+["⍀\n.", undef, "Scan (first axis)\nRunning sum down B"],
 ["/", "Compression, Dyadic Slash\nSelect elements in B corresponding to ones in A", "Reduce (last axis), Slash\nSum across B"],
 ["/", "Compression, Dyadic Slash\nSelect elements in B corresponding to ones in A", "Reduce (last axis), Slash\nSum across B"],
-["⌿", undef, "Reduce (first axis)\nSum down B"],
-["⍳", "Index of, Dyadic Iota\nThe location (index) of B in A; 1+⌈/⍳⍴A if not found", "Index generator, Iota\nVector of the first B integers"],
-["⌹", "Matrix divide, Dyadic Quad Divide\nSolution to system of linear equations, multiple regression Ax = B", "Matrix inverse, Monadic Quad Divide\nInverse of matrix B"],
-["⌽", "Rotation\nThe elements of B are rotated A positions", "Reversal\nReverse elements of B along last axis"],
-["⊖", "Rotation\nThe elements of B are rotated A positions along the first axis", "Reversal\nReverse elements of B along first axis"],
-["⍟", "Logarithm\nLogarithm of B to base A", "Logarithm\nNatural logarithm of B"],
-["⍋", undef, "Grade up\nIndices of B which will arrange B in ascending order"],
-["⍒", undef, "Grade down\nIndices of B which will arrange B in descending order"],
-["⍎", undef, "Execute\nExecute an APL expression"],
-["⍕", "Dyadic formatting\nFormat B into a character matrix according to A", "Monadic formatting\nA character representation of B"],
-["⍉", "General transpose\nThe axes of B are ordered by A", "Monadic transpose\nReverse the axes of B"],
+["⌿\n/", undef, "Reduce (first axis)\nSum down B"],
+["⍳\ni", "Index of, Dyadic Iota\nThe location (index) of B in A; 1+⌈/⍳⍴A if not found", "Index generator, Iota\nVector of the first B integers"],
+["⌹\n+", "Matrix divide, Dyadic Quad Divide\nSolution to system of linear equations, multiple regression Ax = B", "Matrix inverse, Monadic Quad Divide\nInverse of matrix B"],
+["⌽\n%", "Rotation\nThe elements of B are rotated A positions", "Reversal\nReverse elements of B along last axis"],
+["⊖\n&", "Rotation\nThe elements of B are rotated A positions along the first axis", "Reversal\nReverse elements of B along first axis"],
+["⍟\n*", "Logarithm\nLogarithm of B to base A", "Logarithm\nNatural logarithm of B"],
+["⍋\n\$", undef, "Grade up\nIndices of B which will arrange B in ascending order"],
+["⍒\n#", undef, "Grade down\nIndices of B which will arrange B in descending order"],
+["⍎\n;", undef, "Execute\nExecute an APL expression"],
+["⍕\n'", "Dyadic formatting\nFormat B into a character matrix according to A", "Monadic formatting\nA character representation of B"],
+["⍉\n^", "General transpose\nThe axes of B are ordered by A", "Monadic transpose\nReverse the axes of B"],
 ["!", "Combinations\nNumber of combinations of B taken A at a time", "Factorial \nProduct of integers 1 to B"],
 ["!", "Combinations\nNumber of combinations of B taken A at a time", "Factorial \nProduct of integers 1 to B"],
-["¨", "Diaeresis, Double-Dot\nOver each, or perform each separately; B = on these; A = operation to perform or using(e.g. iota)"],
-["<", "Less than\nComparison: 1 if true, 0 if false"],
-["≤", "Less than or equal\nComparison: 1 if true, 0 if false"],
-["=", "Equal\nComparison: 1 if true, 0 if false"],
-["≥", "Greater than or equal\nComparison: 1 if true, 0 if false"],
-[">", "Greater than\nComparison: 1 if true, 0 if false"],
-["≠", "Not equal\nComparison: 1 if true, 0 if false"],
-["∨", "Or\nLogic: 0 if A and B are 0; 1 otherwise"],
-["∧", "And\nLogic: 1 if A and B are 1; 0 otherwise"],
-["⍱", "Nor\nLogic: 1 if both A and B are 0; otherwise 0"],
-["⍲", "Nand\nLogic: 0 if both A and B are 1; otherwise 1"],
+["¨\n1", "Diaeresis, Double-Dot\nOver each, or perform each separately; B = on these; A = operation to perform or using(e.g. iota)"],
+["<\n3", "Less than\nComparison: 1 if true, 0 if false"],
+["≤\n4", "Less than or equal\nComparison: 1 if true, 0 if false"],
+["=\n5", "Equal\nComparison: 1 if true, 0 if false"],
+["≥\n6", "Greater than or equal\nComparison: 1 if true, 0 if false"],
+[">\n7", "Greater than\nComparison: 1 if true, 0 if false"],
+["≠\n8", "Not equal\nComparison: 1 if true, 0 if false"],
+["∨\n9", "Or\nLogic: 0 if A and B are 0; 1 otherwise"],
+["∧\n0", "And\nLogic: 1 if A and B are 1; 0 otherwise"],
+["⍱\n(", "Nor\nLogic: 1 if both A and B are 0; otherwise 0"],
+["⍲\n)", "Nand\nLogic: 0 if both A and B are 1; otherwise 1"],
 
 # operators and axis indicator
 [".", undef, "Inner product\nMatrix product of A and B"],
 
 # operators and axis indicator
 [".", undef, "Inner product\nMatrix product of A and B"],
-["∘.", undef, "Outer product\nOuter product of A and B"],
+["∘.\nj", undef, "Outer product\nOuter product of A and B"],
+["⍤\nJ"],
 
 # miscellaneous
 
 # miscellaneous
-["¯", undef, "High minus\nDenotes a negative number"],
-["⍝", undef, "Lamp, Comment\nEverything to the right of ⍝ denotes a comment"],
-["→", undef, "RightArrow, Branch, GoTo\n→This_Label sends APL execution to This_Label:"],
-["←", undef, "Assign, LeftArrow, Set to\nB←A sets values and shape of B to match A"],
-["⎕", undef, "Quad"],
+["¯\n2", undef, "High minus\nDenotes a negative number"],
+["⍝\n,", undef, "Lamp, Comment\nEverything to the right of ⍝ denotes a comment"],
+["→\n]", undef, "RightArrow, Branch, GoTo\n→This_Label sends APL execution to This_Label:"],
+["←\n[", undef, "Assign, LeftArrow, Set to\nB←A sets values and shape of B to match A"],
+["⎕\nl", undef, "Quad"],
+["⌷\nL"],
+["⍞\n{"],
 [")", undef, "Hook"],
 [")", undef, "Hook"],
+
+["⋄\n`"],
+["⌶\n!"],
+["⍵\nw"],
+["∝\na"],
+["_\nf"],
+["∆\nh"],
+["∇\ng"],
+["⍫\n@"],
+["'\nk"],
+["⊂\nz"],
+["⊃\nx"],
+["∩\nc"],
+["∪\nv"],
+["⊢\n\\"],
+["⊣\n|"],
+["⍬\n}"],
+["⍪\n<"],
+["⍸\nI"],
+["⍙\n>"],
+["⍠\n?"],
+["≡\n:"],
+["≢\n\""],
 );
 );
diff --git a/apl.plp b/apl.plp
index 0e4ddcf47f4cc616b0aa695811f382de43abd66d..44adb74c0e0c722731583bab66422f5c65902df0 100644 (file)
--- a/apl.plp
+++ b/apl.plp
@@ -24,9 +24,10 @@ my @ops = do 'apl.inc.pl';
 <table class="mapped">
 <thead><tr>
        <td rowspan=2>op
 <table class="mapped">
 <thead><tr>
        <td rowspan=2>op
-       <td colspan=2>input
+       <td colspan=3>input
        <td colspan=2>meaning
 <tr>
        <td colspan=2>meaning
 <tr>
+       <td title="unified/Dyalog key combination">⎈
        <td><a href="/digraphs" title="digraph">di</a><td>html
        <td>monadic
        <td>dyadic
        <td><a href="/digraphs" title="digraph">di</a><td>html
        <td>monadic
        <td>dyadic
@@ -36,12 +37,15 @@ my @ops = do 'apl.inc.pl';
 <:
 for my $op (@ops) {
        my ($chr, $monad, $dyad) = @{$op};
 <:
 for my $op (@ops) {
        my ($chr, $monad, $dyad) = @{$op};
+       ($chr, my $altkey) = split /\n/, $chr;
        my $codepoint = ord $chr;
        my $ascii = $codepoint <= 127;
        my $info = $glyphs->glyph_info($codepoint);
        my ($class, $name, $mnem, $html, $string) = @{$info};
        my $codepoint = ord $chr;
        my $ascii = $codepoint <= 127;
        my $info = $glyphs->glyph_info($codepoint);
        my ($class, $name, $mnem, $html, $string) = @{$info};
+
        printf '<tr><th title="%2$s">%s'."\n", $chr, EscapeHTML($name || '?'), $class;
        printf '<td class="%s">%s', @{$_} for (
        printf '<tr><th title="%2$s">%s'."\n", $chr, EscapeHTML($name || '?'), $class;
        printf '<td class="%s">%s', @{$_} for (
+               [$ascii ? 'l5' : defined $altkey ? 'l4' : 'l3', $altkey],
                [defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : $ascii ? 'l5' : 'l1',
                        EscapeHTML($mnem) // sprintf('%s%0*X', $codepoint < 256 ? (x => 2) : (u => 4), $codepoint)],
                [defined $html ? 'l4' : $ascii ? 'l5' : 'l1', $html // "#$codepoint"],
                [defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : $ascii ? 'l5' : 'l1',
                        EscapeHTML($mnem) // sprintf('%s%0*X', $codepoint < 256 ? (x => 2) : (u => 4), $codepoint)],
                [defined $html ? 'l4' : $ascii ? 'l5' : 'l1', $html // "#$codepoint"],