termcol: move generated xcolors include to data/
[sheet.git] / apl.inc.pl
index 388b07d1ea192316eda47f98121138e67a5f312e..355937232e021c3ab33c7da90b831302b759eb29 100644 (file)
 use utf8;
-(
-# dyadic, monadic
-["∼\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"],
-["⍀\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"],
-["⌿\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"],
-["¨\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"],
-["∘.\nj", undef, "Outer product\nOuter product of A and B"],
-["⍤\nJ"],
+( # dyadic, monadic
+
+# arithmetic
+["+\n-", "add\nSum of A and B", "conjugate\nNo change to B"],
+["−\n_", "subtract\nA minus B", "negate\nChanges sign of B"],
+["×\n-", "multiply\nA multiplied by B", "sign\n¯1 if B<0; 0 if B=0; 1 if B>0"],
+["÷\n=", "divide\nA divided by B", "reciprocal\n1 divided by B"],
+["∣\nm", "residue\nRemainder of division: B modulo A", "magnitude\nAbsolute value of B"],
+["⋆\np", "power\nA raised to the B power", "exponential\ne to the B power"],
+["⍟\n*", "logarithm\nLogarithm of B to base A", "natural logarithm\nNatural logarithm of B"],
+["○\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 π"],
+["⌈\ns", "maximum\nThe greater value of A or B", "ceiling\nLeast integer greater than or equal to B"],
+["⌊\nd", "minimum\nThe smaller value of A or B", "floor\nGreatest integer less than or equal to B"],
+["!", "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"],
+["∧\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"],
+
+# comparative
+["<\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"],
+["≡\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"],
+["⍬\n}", undef, "zilde\nEmpty numeric vector, equivalent to ⍳0 or 0⍴0"],
+["⍳\ni", "index of\nThe location (index) of B in A; 1+⌈/⍳⍴A if not found", "count\nVector of the first B integers"],
+["⍸\nI", "string index\nThe index of B in A using ⍷ as primary function"],
+["⍴\nr", "reshape\nArray of shape A with data B", "shape\nNumber of components in each dimension of B"],
+
+# selection
+["⊢\n\\", "right\nDiscard A and pass B unchanged", "pass\nPasses argument unchanged, useful to force display of non-printing result"],
+["⊣\n|", "left\nDiscard B and pass A unchanged", "stop\nDiscard argument and return empty matrix"],
+["⋄\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)"],
+["∩\nc", "intersection\nElements of A that are in B: (A∈B)/A"],
+["∪\nv", "union\nCatenate A and B determined by combining ranks: A,(∼A∈B)/A", "unique"],
+[",", "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"],
+
+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"],
+["⊤\nn", "encode\nBase-A representation of the value of B"],
+["⊥\nb", "decode\nValue of a polynomial whose coefficients are B at A"],
 
 # miscellaneous
-["¯\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"],
-
-["⋄\n`"],
-["⌶\n!"],
-["⍵\nw"],
-["∝\na"],
+["⍺", "picture format\nDisplays the numbers in B according to the instructions in A", "alpha"],
+["⍕\n'", "specified format\nFormat B into a character matrix according to A", "format\nConvert to characters according to default display rules"],
+["⍎\n;", "execute", "execute\nExecute an APL expression"],
+["⎕\nl", undef, "evaluated I/O\nRead number or expression typed on the keyboard or display result with newline"],
+["⍞\n{", undef, "bare I/O\nRead data typed on the keyboard as characters or display without terminating newline"],
+[")", undef, "hook"],
+["→\n]", undef, "goto\n→This_Label sends APL execution to This_Label:"],
+["←\n[", undef, "assign\nB←A sets values and shape of B to match A"],
+["⍝\n,", undef, "comment\nEverything to the right of ⍝ denotes a comment"],
+
 ["_\nf"],
-["∆\nh"],
-["∇\ng"],
-["⍫\n@"],
+["∆\nh", "difference", "derivative"],
+["∇\ng", undef, "edit\nToggle function definition mode"],
+["⍫\n@", undef, "lock\nEdit a function which cannot be edited or displayed"],
 ["'\nk"],
-["⊂\nz"],
-["⊃\nx"],
-["∩\nc"],
-["∪\nv"],
-["⊢\n\\"],
-["⊣\n|"],
-["⍬\n}"],
-["⍪\n<"],
-["⍸\nI"],
 ["⍙\n>"],
-["⍠\n?"],
-["≡\n:"],
-["≢\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"],
+["/", "replicate\nSelect elements in B corresponding to ones in A", "reduce\nSum across B"],
+["⌿\n/", "replicate first", "reduce first\nSum down B"],
+
+# array
+["¯\n2", undef, "negative\nDenotes a negative number"],
+["∝\na"],
+["⍵\nw", "omega"],
+
+# monadic
+["¨\n1", "each\nOver each, or perform each separately; B = on these; A = operation to perform or using (e.g. iota)"],
+["⍨\nT", "commute\nExchanges the arguments of a dyadic function: A+⍨B ↔ B+A"],
+["&", undef, "spawn"],
+["⌶\n!", undef, "I-beam"],
+
+# dyadic
+["⍠\n?", "variant"],
+["⌸", "key\nApply function to each unique key in A and major cells of B having that key", "key\nApply function A to each unique key in B and elements of ⍳≢B having that key"],
+["⍣\nP", "reapply\nThe function A is applied B times"],
+[".", "inner product\nMatrix product of A and B"],
+["∘.\nj", "outer product\nOuter product of A and B"],
+["∘\nj", "compose"],
+["⍤\nJ", "rank\nApply function successively to the sub-arrays in B specified by k"],
+["⍥\nO", "coax"],
+
 );