aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/bqn.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/docs/bqn.js b/docs/bqn.js
index 8bdfccdc..5d382bca 100644
--- a/docs/bqn.js
+++ b/docs/bqn.js
@@ -143,6 +143,10 @@ let runtime = run(
,provide.concat([0,1,2,32,3,8,Infinity,-Infinity,-1,str("Argument to fold must be a list"),str("Equal-rank argument shapes don't agree"),str("Argument shape prefixes don't agree"),str("Grade argument must have rank at least 1"),str("Replication argument in Indices or Replicate must have rank 1"),str("Amounts to replicate must be natural numbers"),str("Right argument to Select must be an array"),str("Indices in Select must be integers"),str("Select indices out of range"),str("Reverse argument must have rank at least 1"),str("Amount to rotate must be an integer"),str("Elements in Merge argument must have matching shapes"),str("No monadic form: ≥"),str("No monadic form: ≤"),str("Identity not found"),str("Shape argument to Reshape must have rank at most 1"),str("Shape in Reshape must consist of natural numbers"),str("Range argument must consist of natural numbers"),str("Range argument must be a number or list"),str("Insert argument must have rank at least 1"),str("First-axis function right argument must have rank at least 1"),str("Left argument must have rank at most 1"),str("Left argument length must be at most right argument rank"),str("Rank of joined arguments must differ by at most 1"),str("Cell shapes of joined arguments must match"),str("Left argument to Take or Drop must be an integer"),str("Prefixes argument must have rank at least 1"),str("Suffixes argument must have rank at least 1"),str("Windows right argument must be an array"),str("Windows left argument must have rank at most 1"),str("Windows left argument length must be at most right argument rank"),str("Windows left argument must consist of natural numbers"),str("Window length must be at most axis length plus one"),str("Replicate argument lengths must match"),str("Join argument must be an array"),str("Join argument elements must all have the same rank"),str("Join argument element rank must be at least argument rank"),str("Join argument element shapes must be compatible"),str("Grouping argument must be a list"),str("Grouping argument must consist of integers"),str("Grouping argument values cannot be less than ¯1"),str("Group Indices argument must be an array"),str("Group right argument must be an array"),str("Group left argument must consist of lists"),str("Group left argument length must be at most right argument rank"),str("Group argument lengths must be compatible"),str("Indices in compound Pick must be lists"),str("Pick index length must match right argument rank"),str("Pick indices must consist of integers"),str("Pick index out of range"),str("Bins argument must have rank at least 1"),str("Bins right argument rank is too small"),str("Bins left argument must be sorted"),str("Search principal argument must have rank at least 1"),str("Unique mask argument must have rank at least 1"),str("Find left argument rank cannot exceed right argument rank"),str("Left argument to Reorder Axes must have rank at most 1"),str("Reorder Axes left argument length must not exceed right argument rank"),str("Reorder Axes left argument must consist of natural numbers"),str("No such axis in Reorder Axes"),str("Inverse failed"),str("Inverse not found"),str("Repetition numbers must be integers")])
,[[0,1,0,127],[2,0,2607,6],[0,0,2634,3],[0,0,2638,3],[0,0,2642,3],[1,0,2646,5],[2,0,2664,6],[2,0,2679,6],[2,0,2698,6],[2,0,2720,6],[2,0,2742,6],[0,0,2774,3],[0,0,2785,3],[0,0,2794,3],[1,0,2803,9],[0,0,2916,3],[0,0,2956,4],[1,1,3032,4],[1,1,3105,3],[0,0,3169,3],[0,0,3180,5],[2,0,3264,12],[0,0,3470,4],[0,0,3519,6],[0,0,3609,4],[0,0,3765,4],[0,0,3826,4],[2,0,3928,16],[1,1,4158,2],[0,0,4182,3],[0,0,4209,3],[0,0,4235,3],[0,0,4274,4],[0,0,4371,3],[0,0,4398,3],[0,0,4420,3],[0,0,4442,3],[0,0,4453,3],[0,0,4482,3],[0,0,4488,5],[0,0,4606,5],[0,0,4639,3],[0,0,4648,3],[1,1,4654,2],[2,0,4723,10],[2,0,4782,8],[1,1,4969,2],[1,0,4979,5],[2,1,5021,4],[0,0,5057,8],[0,0,5293,4],[0,0,5374,3],[0,0,5424,4],[0,0,5545,3],[0,0,5595,4],[0,0,5761,3],[0,0,5779,3],[0,0,5813,3],[0,0,5827,7],[0,0,5874,11],[1,0,6139,8],[0,0,6257,4],[0,0,6341,5],[0,0,6500,4],[0,0,6713,3],[0,0,6731,4],[1,0,6803,9],[1,1,6872,3],[1,0,6896,14],[1,1,7330,4],[1,0,7379,6],[0,0,7527,4],[0,0,7595,4],[0,0,7864,3],[2,0,7904,6],[0,0,7932,3],[0,0,7969,3],[0,0,8056,3],[1,1,8111,2],[2,0,8119,13],[1,1,8270,2],[1,1,8284,2],[1,1,8288,2],[0,0,8292,3],[0,0,8304,3],[0,0,8327,3],[1,0,8348,6],[1,0,8465,11],[1,0,8686,5],[0,0,8701,3],[0,0,8715,3],[0,0,8729,3],[1,0,8774,8],[0,0,8912,8],[0,0,9079,5],[0,0,9154,3],[0,0,9171,3],[0,0,9177,4],[0,0,9226,3],[1,0,9236,5],[0,0,9247,3],[0,0,9293,3],[0,0,9313,3],[1,0,9367,6],[0,0,9520,6],[0,0,9648,3],[0,0,9678,5],[0,0,9777,10],[0,0,9962,3],[0,0,10062,3],[0,0,10104,3],[0,0,10157,4],[0,0,10217,3],[0,0,10248,3],[0,0,10278,3],[0,0,10396,6],[0,0,10503,6],[0,0,10553,4],[0,0,10583,3],[0,0,10602,4],[1,1,10760,2],[0,0,10764,3],[1,0,10807,5],[1,0,10844,5],[1,0,10855,5],[0,0,10866,14],[0,0,11042,3],[0,0,11063,3],[0,0,11087,3],[0,0,11143,4],[1,0,11203,5],[0,0,11270,3],[0,0,11299,3],[0,0,11316,5],[0,0,11427,3],[0,0,11482,3],[0,0,11506,5],[0,0,11635,3],[0,0,11675,3],[0,0,11758,3],[0,0,11792,3],[0,0,11821,3],[0,0,11839,3],[0,0,11856,3],[0,0,11885,3],[0,0,11928,6],[0,0,12007,3]]
);
+runtime.map((r,i) => {
+ let prims = "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!˜˘¨⌜⁼´˝`∘○⊸⟜⌾⊘◶⎉⚇⍟";
+ r.glyph = prims.charAt(i); // Used to format
+});
// Compiler
let compile = run(
@@ -153,11 +157,17 @@ let compile = run(
let bqn = src => run.apply(null,compile(str(src),runtime));
// Formatter
+let fmt0 = x =>
+ typeof x === "number" ?
+ (x==Infinity?"∞":x==-Infinity?"¯∞":(""+x).replace("-","¯"))
+ : typeof x === "function" ?
+ (x.glyph||(x.m?"*"+x.m+"-modifier*":"*function*"))
+ : ""+x;
let fmt1 = run(
new Uint8Array([0,46,22,0,0,11,14,15,1,25,21,0,4,22,0,5,11,14,0,9,0,7,0,43,19,0,38,15,2,8,22,0,6,11,14,15,3,22,0,7,11,14,21,0,6,0,33,21,0,7,8,22,0,8,11,14,15,4,22,0,9,11,14,21,0,9,15,5,3,2,0,36,15,6,8,22,0,10,11,14,0,56,0,17,0,55,17,15,7,15,8,3,2,0,36,0,8,0,9,0,42,19,0,6,0,9,0,8,0,43,19,19,8,3,2,0,36,0,12,0,12,0,42,0,42,3,2,19,8,22,0,11,11,14,15,9,0,35,15,10,8,22,0,12,11,14,15,11,22,0,13,11,14,0,13,0,16,0,16,19,0,32,0,61,8,21,0,5,3,2,0,36,0,40,0,33,0,10,8,8,0,17,9,15,12,21,0,13,3,3,0,36,0,11,0,3,0,43,19,8,22,0,14,11,14,21,0,1,21,0,14,16,0,26,21,1,0,0,33,0,16,8,7,16,0,15,16,0,19,0,39,17,25,21,0,1,0,12,16,0,19,0,39,17,22,0,3,11,14,0,41,0,27,0,18,7,21,0,3,0,4,0,41,17,0,1,16,17,0,20,0,34,0,31,0,25,0,28,0,2,7,7,7,8,16,0,29,0,39,0,40,3,2,0,37,0,0,8,7,16,0,15,16,22,0,4,11,14,21,0,4,0,23,0,32,0,39,8,0,34,0,42,8,16,22,0,4,12,14,15,13,22,0,5,11,14,21,0,1,0,15,21,0,1,0,12,16,0,23,0,39,17,0,16,21,0,3,0,29,0,2,7,16,17,17,21,0,5,0,18,0,32,0,29,0,0,7,8,3,2,0,36,21,0,3,0,24,0,42,17,0,23,16,8,21,0,4,17,25,21,0,1,0,13,0,41,0,37,0,16,8,0,41,0,37,0,16,8,19,0,47,0,21,21,0,2,17,17,25,0,49,0,16,21,0,1,0,22,16,0,19,0,41,17,0,19,0,39,17,17,0,16,0,48,17,0,17,16,25,21,0,1,0,12,16,0,23,0,39,17,22,0,3,11,14,0,51,21,0,2,0,14,0,3,0,41,19,0,25,0,22,7,0,52,19,0,15,9,21,1,5,3,2,0,36,0,7,0,32,0,44,8,8,16,3,2,0,16,16,0,18,0,41,21,0,3,3,2,17,21,0,1,0,23,0,34,0,53,0,23,0,41,0,1,21,0,2,17,0,4,0,42,17,0,3,0,45,17,17,8,16,0,54,0,18,21,0,3,0,1,16,0,16,0,41,17,17,3,3,0,16,16,25,21,0,1,0,22,16,0,28,0,9,7,0,50,17,0,30,0,1,7,16,0,31,0,0,7,16,0,24,0,43,17,0,23,16,0,6,21,0,1,0,8,16,0,8,0,41,17,17,0,6,21,0,2,0,8,0,41,17,17,25,21,0,1,0,27,0,47,7,16,21,1,7,0,41,17,21,1,10,0,43,17,0,23,0,32,0,42,0,39,3,2,8,0,34,0,57,8,16,25,21,0,1,0,12,16,0,58,0,27,21,1,5,7,0,27,0,60,0,33,0,16,8,7,9,0,16,9,0,23,0,32,0,39,8,0,34,0,59,8,9,3,2,0,36,0,8,0,7,0,41,19,8,16,0,25,0,16,7,0,50,17,0,17,16,25,21,0,1,0,27,0,12,7,16,22,0,3,11,14,21,0,3,0,27,0,23,7,0,41,17,0,15,0,25,0,41,7,0,1,0,9,19,0,38,0,30,0,4,7,8,3,2,0,36,0,9,0,7,0,42,19,8,16,22,0,4,11,14,21,0,3,0,27,0,23,7,16,0,9,0,7,0,42,19,0,38,0,41,0,37,0,30,0,4,7,8,8,16,22,0,5,11,14,21,0,1,0,27,0,18,7,0,41,0,18,21,0,4,0,8,16,0,2,21,0,2,17,0,1,16,17,0,5,21,0,4,17,0,2,21,0,2,17,0,28,0,16,7,21,0,5,17,17,0,9,0,1,0,43,19,0,4,0,42,19,0,38,0,17,8,16,0,43,0,37,0,16,8,16,25,21,0,1,21,1,12,0,41,17,25,21,0,1,0,27,21,1,14,7,16,21,1,12,21,0,2,17,21,1,8,0,43,17,21,1,10,21,0,1,0,9,16,17,25,0,40,0,10,21,0,1,17,22,0,3,11,14,21,0,1,0,9,16,22,0,4,11,14,21,0,1,15,14,15,15,15,16,3,3,0,36,21,0,3,0,15,16,0,29,0,0,7,0,10,0,0,0,7,0,32,0,42,8,19,0,8,19,16,8,16,25,21,0,2,0,0,0,41,17,0,21,16,22,0,3,11,14,0,47,0,15,21,0,1,0,12,16,0,23,0,39,17,17,0,16,21,0,1,17,0,22,21,0,3,0,21,0,32,21,0,3,0,24,16,0,5,16,8,0,34,0,27,0,39,7,8,16,17,25,21,0,1,0,12,16,0,19,0,39,17,22,0,3,11,0,8,16,0,1,16,0,9,0,32,0,42,8,0,38,0,40,8,16,22,0,4,11,14,0,62,22,0,5,11,14,21,0,1,0,40,0,9,21,0,4,17,0,38,0,21,0,32,0,14,0,9,21,0,5,19,0,0,0,41,19,8,8,16,22,0,1,12,14,21,0,5,0,18,21,0,3,17,0,15,0,34,0,20,8,16,21,0,4,0,37,0,16,8,21,0,1,17,21,0,4,0,37,0,16,8,21,0,5,0,18,21,0,3,17,17,0,17,16,21,1,4,0,8,0,41,17,0,38,21,2,6,21,2,7,0,41,19,21,2,10,21,1,4,19,8,16,25,21,0,1,21,2,13,21,2,11,3,2,0,36,0,12,0,9,0,42,19,0,29,0,6,7,9,8,16,25,21,0,1,21,2,13,0,39,17,25])
,[runtime[0],runtime[1],runtime[2],runtime[6],runtime[7],runtime[9],runtime[11],runtime[12],runtime[14],runtime[15],runtime[16],runtime[18],runtime[19],runtime[20],runtime[21],runtime[22],runtime[23],runtime[24],runtime[25],runtime[26],runtime[28],runtime[30],runtime[33],runtime[34],runtime[37],runtime[41],runtime[42],runtime[43],runtime[44],runtime[46],runtime[47],runtime[48],runtime[51],runtime[52],runtime[53],runtime[54],runtime[55],runtime[56],runtime[58],-1,Infinity,1,0,2,5,4,'\n',str(" "),str("⟨"),str("⟩"),str("⟨⟩"),str("┌"),str("·─"),str("·╵╎┆┊"),str("┘"),str("┌┐"),str("└┘"),'┐',str(""),'⥊',str("‿"),str("'"),'"']
,[[0,1,0,1],[1,0,10,15],[0,0,233,6],[0,0,399,3],[0,0,429,3],[0,0,459,4],[0,0,583,3],[0,0,643,3],[0,0,682,3],[0,0,748,6],[0,0,923,3],[0,0,933,3],[0,0,967,5],[0,0,1034,4],[0,0,1102,6],[0,0,1265,3],[0,0,1294,3]]
-)(a=>str(""+a));
+)(a=>str(fmt0(a)));
let fmt = x => fmt1(x).map(c=>c===0?" ":c).join("");
if(typeof module!=='undefined'){module.exports=bqn;}