apl: group similar operators into distinct table bodies
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 4 Mar 2015 19:29:56 +0000 (20:29 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 9 Jun 2015 03:43:43 +0000 (05:43 +0200)
apl.inc.pl
apl.plp

index 16f098f81b6e051ce875d13c4b1858761db31c28..355937232e021c3ab33c7da90b831302b759eb29 100644 (file)
@@ -15,6 +15,8 @@ use utf8;
 ["!", "binomial\nNumber of combinations of B taken A at a time", "factorial\nProduct of integers 1 to B"],
 ["?\nq", "deal\nA distinct integers selected randomly from the first B integers", "roll\nOne integer selected randomly from the first B integers"],
 
 ["!", "binomial\nNumber of combinations of B taken A at a time", "factorial\nProduct of integers 1 to B"],
 ["?\nq", "deal\nA distinct integers selected randomly from the first B integers", "roll\nOne integer selected randomly from the first B integers"],
 
+undef,
+
 # logical
 ["∼\nt", "difference\nItems found in B are removed from A", "not\nLogical: ∼1 is 0, ∼0 is 1"],
 ["∨\n9", "or\nLogic: 0 if A and B are 0; 1 otherwise"],
 # logical
 ["∼\nt", "difference\nItems found in B are removed from A", "not\nLogical: ∼1 is 0, ∼0 is 1"],
 ["∨\n9", "or\nLogic: 0 if A and B are 0; 1 otherwise"],
@@ -32,6 +34,9 @@ use utf8;
 ["≡\n:", "match\n1 if arguments are the same in every respect, 0 if not", "depth\nLevel of nesting: 1 + maximum array depth or 0 if scalar"],
 ["≢\n\"", "not match\n1 if arguments are different if any respect, 0 if not", "tally\nNumber of major cells in B, equivalent to {⍬⍴ (⍴⍵),1}"],
 
 ["≡\n:", "match\n1 if arguments are the same in every respect, 0 if not", "depth\nLevel of nesting: 1 + maximum array depth or 0 if scalar"],
 ["≢\n\"", "not match\n1 if arguments are different if any respect, 0 if not", "tally\nNumber of major cells in B, equivalent to {⍬⍴ (⍴⍵),1}"],
 
+undef,
+
+# vector
 ["∈\ne", "membership\n1 for elements of A present in B; 0 where not", "enlist\nEvery element in B as simple vector"],
 ["⍷\nE", "find\nElements of A within B, returning 1 if the start of A is found in B"],
 ["⌷\nL", "index", "materialise"],
 ["∈\ne", "membership\n1 for elements of A present in B; 0 where not", "enlist\nEvery element in B as simple vector"],
 ["⍷\nE", "find\nElements of A within B, returning 1 if the start of A is found in B"],
 ["⌷\nL", "index", "materialise"],
@@ -46,6 +51,8 @@ use utf8;
 ["⋄\n`", "statement separator\nSeparates multiple statements on a single line"],
 ["↑\ny", "take\nSelect the first (or last) A elements of B according to ×A", "nub"],
 ["↓\nu", "drop\nRemove the first (or last) A elements of B according to ×A", "split"],
 ["⋄\n`", "statement separator\nSeparates multiple statements on a single line"],
 ["↑\ny", "take\nSelect the first (or last) A elements of B according to ×A", "nub"],
 ["↓\nu", "drop\nRemove the first (or last) A elements of B according to ×A", "split"],
+
+# set
 ["⊂\nz", "partition\nDivide B into an array of vectors according to specification in A", "enclose\nProduce a scalar of vector B"],
 ["⊃\nx", "pick\nSelect item A from vector B", "disclose\nProduce an array made up of the items in B"],
 ["⊆", "subset\nElements in both A and B: (∧/A∈B)∧(∧/B∈A)"],
 ["⊂\nz", "partition\nDivide B into an array of vectors according to specification in A", "enclose\nProduce a scalar of vector B"],
 ["⊃\nx", "pick\nSelect item A from vector B", "disclose\nProduce an array made up of the items in B"],
 ["⊆", "subset\nElements in both A and B: (∧/A∈B)∧(∧/B∈A)"],
@@ -54,11 +61,14 @@ use utf8;
 [",", "catenate\nElements of B appended to the elements of A", "ravel\nReshapes B into a vector"],
 ["⍪\n<", "catenate first\nCatenate across the first axis"],
 
 [",", "catenate\nElements of B appended to the elements of A", "ravel\nReshapes B into a vector"],
 ["⍪\n<", "catenate first\nCatenate across the first axis"],
 
+# transform
 ["⌹\n+", "matrix divide\nSolution to system of linear equations, multiple regression Ax = B", "matrix inverse\nInverse of matrix B"],
 ["⌽\n%", "rotate first\nThe elements of B are rotated A positions", "reverse first\nReverse elements of B along last axis"],
 ["⊖\n&", "rotate\nThe elements of B are rotated A positions along the first axis", "reverse\nReverse elements of B along first axis"],
 ["⍉\n^", "general transpose\nThe axes of B are ordered by A", "monadic transpose\nReverse the axes of B"],
 
 ["⌹\n+", "matrix divide\nSolution to system of linear equations, multiple regression Ax = B", "matrix inverse\nInverse of matrix B"],
 ["⌽\n%", "rotate first\nThe elements of B are rotated A positions", "reverse first\nReverse elements of B along last axis"],
 ["⊖\n&", "rotate\nThe elements of B are rotated A positions along the first axis", "reverse\nReverse elements of B along first axis"],
 ["⍉\n^", "general transpose\nThe axes of B are ordered by A", "monadic transpose\nReverse the axes of B"],
 
+undef,
+
 # sorting and coding
 ["⍋\n\$", "grade up\nArrange B according to collating sequence specified by A", "grade up\nIndices of B which will arrange B in ascending order"],
 ["⍒\n#", "grade down\nArrange B according to inverse collating sequence specified by A", "grade down\nIndices of B which will arrange B in descending order"],
 # sorting and coding
 ["⍋\n\$", "grade up\nArrange B according to collating sequence specified by A", "grade up\nIndices of B which will arrange B in ascending order"],
 ["⍒\n#", "grade down\nArrange B according to inverse collating sequence specified by A", "grade down\nIndices of B which will arrange B in descending order"],
@@ -83,6 +93,8 @@ use utf8;
 ["'\nk"],
 ["⍙\n>"],
 
 ["'\nk"],
 ["⍙\n>"],
 
+undef,
+
 # operators
 ["\\","expand\nInsert zeros (or blanks) in B corresponding to zeros in A", "scan\nRunning sum across B"],
 ["⍀\n.", "expand first", "scan first\nRunning sum down B"],
 # operators
 ["\\","expand\nInsert zeros (or blanks) in B corresponding to zeros in A", "scan\nRunning sum across B"],
 ["⍀\n.", "expand first", "scan first\nRunning sum down B"],
diff --git a/apl.plp b/apl.plp
index 478533f1622e872da122bd4d70437a27a1ece2d5..804d80ea9c5c1813f9060cc6acc035aba858fba0 100644 (file)
--- a/apl.plp
+++ b/apl.plp
@@ -32,10 +32,15 @@ my @ops = do 'apl.inc.pl';
        <td><a href="/digraphs" title="digraph">di</a><td>html
        <td title="…B">monadic
        <td title="A…B">dyadic
        <td><a href="/digraphs" title="digraph">di</a><td>html
        <td title="…B">monadic
        <td title="A…B">dyadic
-</thead>
+<tbody>
 
 <:
 for my $op (@ops) {
 
 <:
 for my $op (@ops) {
+       $op or do {
+               print "<tbody>\n";
+               next;
+       };
+
        my ($chr, $dyad, $monad) = @{$op};
        ($chr, my $altkey) = split /\n/, $chr;
        my $codepoint = ord $chr;
        my ($chr, $dyad, $monad) = @{$op};
        ($chr, my $altkey) = split /\n/, $chr;
        my $codepoint = ord $chr;