From bb8ea349f336c5fbdc1ffc8c3809aca7d00aadd2 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 30 Apr 2022 22:02:39 -0400 Subject: Try to reduce formatted size of array elements if necessary --- docs/bqn.js | 8 ++++---- src/f.bqn | 43 ++++++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/docs/bqn.js b/docs/bqn.js index 3660cd5b..cb9dff6a 100644 --- a/docs/bqn.js +++ b/docs/bqn.js @@ -500,10 +500,10 @@ let placeholder = ["array","function","1-modifier","2-modifier"].map(s => str("* let repop = x => x.ns ? str("{"+listkeys(x).join("‿")+"⇐}") : gl[x.prim] || placeholder[type(x)-2]; let [fmt1,repr] = run( - [1,1,7,34,0,1,33,0,3,33,0,4,33,0,5,33,0,6,12,4,48,6,0,71,0,16,0,19,0,19,21,0,42,0,72,27,11,2,0,46,0,10,0,42,0,61,27,27,32,0,6,11,2,0,46,0,61,0,43,0,8,27,27,33,0,7,48,6,1,2,33,0,8,48,6,0,11,0,8,0,53,21,0,48,1,3,27,33,0,9,48,6,1,4,33,0,10,48,6,1,5,33,0,11,48,6,1,6,1,7,11,2,0,46,1,8,0,52,11,2,0,46,0,10,0,43,0,10,0,42,0,52,27,0,41,0,7,27,27,27,27,33,0,12,48,6,0,81,0,20,0,80,17,1,9,1,10,11,2,0,46,0,10,0,11,0,49,21,0,7,0,11,0,10,0,53,21,21,27,11,2,0,46,0,15,0,15,0,49,0,49,11,2,21,27,33,0,13,48,6,1,11,33,0,14,48,6,1,12,33,0,15,48,6,1,13,1,14,1,15,11,3,0,46,0,32,0,61,26,0,8,0,18,21,0,40,0,37,0,0,26,0,12,0,0,0,8,0,42,0,49,27,21,0,10,21,27,27,33,0,16,48,6,32,0,7,0,20,20,34,0,16,32,0,15,11,2,0,46,0,36,32,0,3,26,0,12,0,58,21,0,18,0,40,0,37,0,7,26,27,20,27,32,0,15,11,3,0,46,0,14,0,3,0,53,21,27,33,0,17,48,6,1,16,33,0,18,48,6,0,88,33,0,19,48,6,0,17,0,40,0,30,27,32,0,5,20,32,0,19,11,2,0,46,0,53,0,43,0,11,27,27,32,0,18,32,0,17,0,40,34,0,19,0,29,11,2,0,46,0,10,0,11,0,52,21,27,27,27,0,30,0,52,21,0,20,20,33,0,20,48,6,0,17,0,17,34,0,17,20,34,0,20,11,2,0,46,0,16,0,12,0,58,21,27,32,0,3,21,33,0,21,48,6,1,17,33,0,22,48,6,32,0,21,0,43,34,0,22,27,0,45,32,0,21,27,33,0,23,48,6,1,18,33,0,24,48,6,0,73,0,17,0,16,0,19,0,17,0,28,0,11,0,0,0,52,21,21,21,0,19,0,16,21,0,70,21,0,35,32,0,7,0,19,0,82,21,26,0,19,0,25,0,75,21,0,19,0,74,21,0,19,0,23,0,52,21,11,2,0,46,0,10,0,8,0,52,21,27,20,0,35,32,0,24,0,19,0,90,21,26,0,19,20,0,25,0,75,21,0,19,0,74,21,11,3,0,46,0,36,32,0,3,26,0,33,0,29,26,0,53,0,18,0,59,17,0,26,0,53,0,52,0,49,11,3,17,21,0,37,0,4,26,20,27,11,2,0,46,0,10,0,8,0,49,21,27,33,0,25,48,6,0,30,0,40,32,0,24,27,0,19,0,91,21,32,0,25,0,18,34,0,25,0,41,0,19,0,42,0,92,0,43,0,19,27,27,27,0,15,21,11,3,0,46,0,11,0,3,0,53,21,27,33,0,26,48,6,34,0,7,34,0,26,11,2,0,46,32,0,3,0,11,0,49,21,27,33,0,27,48,6,0,32,0,49,26,0,31,0,93,21,34,0,18,34,0,24,27,0,30,0,52,21,33,0,28,48,6,0,17,0,17,34,0,27,20,34,0,28,11,2,0,46,0,16,0,12,0,58,21,27,32,0,3,21,33,0,29,48,6,34,0,23,0,40,0,34,0,60,0,0,0,61,17,0,43,0,19,27,26,27,0,18,20,0,23,0,50,21,32,0,29,11,2,7,0,52,0,35,0,22,26,34,0,1,0,1,16,17,0,27,0,44,0,39,0,33,0,36,0,2,26,26,26,27,16,0,37,0,50,0,51,11,2,0,47,0,0,27,26,34,0,2,19,0,18,16,0,30,0,42,0,50,27,0,44,0,49,27,16,7,32,0,1,0,15,16,0,23,0,50,17,33,0,3,48,0,4,0,52,17,32,1,8,16,33,0,4,48,6,1,19,33,0,5,48,6,32,0,1,0,18,34,0,1,0,15,16,0,22,0,50,17,0,19,34,0,3,0,37,0,2,26,16,17,17,0,22,0,42,0,37,0,0,26,27,34,0,5,11,2,0,46,0,17,0,40,0,10,27,0,8,0,49,21,27,34,0,4,17,7,32,0,1,0,18,16,0,35,0,32,0,62,26,0,18,0,15,0,30,0,50,21,0,43,0,20,27,21,0,19,0,17,21,26,34,0,1,0,15,16,32,1,8,0,52,17,17,0,19,16,7,0,62,0,18,32,0,1,0,10,16,34,0,2,11,2,17,33,0,3,48,6,32,0,3,34,0,1,34,0,3,11,3,0,20,16,0,19,16,7,0,75,0,19,34,0,1,0,29,16,0,23,0,52,17,0,23,0,50,17,17,0,19,0,74,17,0,20,16,7,32,0,1,0,15,16,0,30,0,50,17,33,0,3,48,6,0,76,32,0,2,0,17,0,3,0,52,21,0,33,0,29,26,0,77,21,0,18,20,32,1,6,11,2,0,46,0,8,0,42,0,54,27,27,16,11,2,0,19,16,0,22,32,0,3,17,0,20,16,34,0,1,0,30,0,44,0,78,0,30,0,52,0,1,34,0,2,17,0,3,0,55,17,0,4,0,49,17,17,27,16,0,79,0,22,0,42,0,1,27,34,0,3,17,0,20,16,11,3,0,19,16,7,34,0,1,0,29,16,0,36,0,11,26,0,73,17,0,38,0,1,26,16,0,39,0,0,26,16,0,11,0,53,17,0,37,0,7,26,16,7,34,0,1,0,35,0,62,26,16,32,1,11,0,52,17,32,1,12,0,53,17,0,30,0,42,0,49,0,50,11,2,27,0,44,0,63,27,16,7,34,0,1,0,15,16,0,73,0,35,32,1,6,26,0,35,0,19,0,42,0,82,27,26,20,0,19,20,0,30,0,44,0,64,27,20,11,2,0,46,0,10,0,8,0,52,21,27,16,0,20,16,7,32,0,1,0,35,0,15,26,16,33,0,3,48,6,32,0,3,0,35,0,30,26,0,52,17,0,18,0,32,0,52,26,0,1,0,11,21,0,48,0,38,0,4,26,27,11,2,0,46,0,11,0,8,0,49,21,27,16,33,0,4,48,6,34,0,3,0,35,0,30,26,16,0,11,0,8,0,49,21,0,48,0,52,0,47,0,38,0,4,26,27,27,16,33,0,5,48,6,34,0,1,0,35,0,22,26,0,52,0,22,32,0,4,0,10,16,0,2,32,0,2,19,0,1,16,17,0,6,34,0,4,17,0,2,34,0,2,19,0,36,0,20,26,32,0,5,17,17,0,11,0,1,0,53,21,0,4,0,49,21,0,48,0,20,27,16,0,53,0,47,0,19,0,40,0,8,27,27,16,33,0,6,48,6,34,0,6,32,1,10,0,9,0,40,32,1,9,27,11,2,0,46,34,0,5,0,18,16,0,14,0,42,0,27,0,42,0,52,27,27,16,27,16,32,1,11,0,53,17,7,32,0,1,0,35,32,1,21,26,16,32,1,14,0,52,0,16,34,0,2,19,17,32,1,12,34,0,1,0,11,16,17,7,32,0,1,0,11,16,33,0,3,48,6,32,0,1,0,23,0,49,17,0,35,0,8,26,16,0,9,16,33,0,1,49,6,32,0,1,0,15,16,0,23,0,50,17,33,0,4,48,0,10,16,0,1,16,0,11,0,42,0,49,27,0,48,0,51,27,16,33,0,5,48,6,32,0,3,0,8,0,49,17,0,33,0,30,26,0,83,17,33,0,6,48,6,1,20,33,0,7,48,6,32,0,1,0,28,0,42,0,17,0,11,32,0,6,21,0,0,0,52,21,27,34,0,7,11,2,0,46,32,0,3,0,10,0,52,17,27,16,33,0,1,49,6,32,0,6,0,22,0,42,0,1,27,32,0,4,17,32,0,5,0,47,0,19,27,34,0,1,17,34,0,5,0,47,0,19,27,0,67,0,22,32,0,4,0,19,0,52,17,0,30,0,50,17,17,0,18,34,0,4,17,0,30,0,44,34,0,6,27,16,17,0,20,16,32,0,3,0,10,0,52,17,0,48,32,1,9,32,1,11,0,52,21,32,1,12,34,0,3,21,27,16,7,34,0,1,32,1,15,32,1,13,11,2,0,46,0,15,0,11,0,49,21,0,37,0,7,26,20,27,16,7,34,0,1,32,1,15,0,50,17,7,0,17,0,17,34,0,4,20,0,21,0,49,21,34,0,0,11,2,0,46,0,16,0,12,0,58,21,27,32,1,3,21,33,0,6,48,6,32,0,1,32,1,4,16,33,0,7,48,0,30,16,33,0,8,48,6,0,68,0,1,0,84,17,0,30,32,0,8,17,33,0,9,48,6,0,86,0,43,0,19,27,0,19,0,85,21,33,0,10,48,6,0,17,0,35,34,0,6,0,43,0,30,0,42,0,52,27,0,16,0,12,32,0,9,0,3,0,53,17,21,0,48,0,17,0,40,34,0,10,27,27,0,30,0,43,0,0,27,21,27,26,0,10,0,40,0,24,27,0,11,0,49,21,0,1,20,0,52,0,9,32,0,9,17,0,48,0,27,27,20,21,0,19,20,33,0,11,48,6,32,0,7,0,23,0,52,17,0,32,34,0,1,26,32,1,5,0,40,0,18,27,20,0,17,34,0,5,34,0,2,23,34,0,11,11,3,0,46,34,0,8,0,5,16,0,3,0,53,17,27,16,33,0,12,48,6,32,0,12,32,0,9,0,12,0,53,17,0,48,0,32,34,0,7,26,0,30,0,50,21,32,1,3,20,0,9,0,58,21,0,48,0,87,0,43,0,19,27,27,27,16,33,0,12,49,6,34,0,9,34,0,12,11,2,7,0,89,33,0,3,48,6,32,0,2,0,49,0,10,0,13,0,53,21,11,2,0,46,0,11,0,13,0,52,21,27,18,0,31,34,0,3,19,6,0,51,0,51,11,2,0,26,34,0,2,19,0,27,16,33,0,4,48,6,34,0,1,33,0,5,48,0,15,16,33,0,6,48,0,8,32,0,4,17,33,0,7,48,6,32,0,5,32,0,7,0,37,0,7,26,16,0,48,1,21,27,34,0,4,17,7,34,0,1,32,1,29,16,7,34,0,1,0,19,0,42,0,29,0,40,0,35,0,62,26,27,27,16,0,29,34,0,2,0,0,0,52,19,0,19,0,49,19,0,28,18,0,2,0,42,0,8,0,42,0,26,27,27,18,19,7,0,57,0,0,0,61,17,0,8,32,0,1,17,0,2,0,61,0,1,0,66,17,17,0,0,0,56,0,0,0,61,17,0,17,0,1,0,65,21,0,2,0,11,21,32,0,1,17,17,0,0,34,0,1,17,7,32,1,6,0,3,34,0,2,19,0,33,0,1,26,32,1,7,17,33,0,3,48,6,32,1,7,0,35,0,52,0,43,0,18,27,0,43,0,19,27,26,32,0,3,17,0,37,0,36,0,21,26,26,16,33,0,4,48,6,32,0,4,0,35,0,69,26,16,0,30,0,44,32,1,5,0,22,34,0,3,17,27,16,0,35,0,18,26,34,0,4,17,0,19,16,7] - ,[runtime[0],runtime[1],runtime[2],runtime[6],runtime[7],runtime[8],runtime[9],runtime[11],runtime[12],runtime[13],runtime[14],runtime[15],runtime[16],runtime[17],runtime[18],runtime[19],runtime[20],runtime[21],runtime[22],runtime[23],runtime[24],runtime[25],runtime[26],runtime[27],runtime[28],runtime[29],runtime[30],runtime[31],runtime[33],runtime[36],runtime[37],runtime[43],runtime[44],runtime[45],runtime[46],runtime[47],runtime[48],runtime[50],runtime[51],runtime[52],runtime[53],runtime[54],runtime[55],runtime[56],runtime[57],runtime[58],runtime[59],runtime[60],runtime[62],0,-1,Infinity,1,2,5,4,127,32,3,7,10,'\0',' ','┐','↕','␡','␀','·','0','…','\"',str("@"),str("\'"),str("⟨⟩"),str("⟨"),str("⟩"),str("┌"),str("·─"),str("·╵╎┆┊"),str("┘"),str("┌┐"),str("└┘"),str("‿"),str("\'\""),str("00321111"),str("("),str(")"),str("{𝔽}"),str("*array*"),str("•Fmt: 𝕨 must be a list of up to two numbers (width, height)"),str(","),str("<"),str("⥊"),str("Can\'t represent block")] - ,[[0,1,0],[0,0,1],[0,0,2],[0,0,3],[0,0,4],[0,0,[[],[5]]],[0,0,6],[0,0,[[],[7]]],[0,0,8],[0,0,9],[0,0,10],[0,0,11],[0,0,12],[0,0,13],[0,0,14],[0,0,15],[2,0,16],[0,0,17],[0,0,18],[0,0,19],[0,0,20],[0,0,21]] - ,[[0,0],[3,30],[796,3],[862,6],[962,3],[1013,4],[1052,3],[1082,4],[1205,3],[1243,3],[1282,3],[1335,7],[1565,3],[1598,8],[1841,3],[1870,3],[1880,13],[2175,8],[2281,3],[2289,3],[2341,3],[2397,5]] + [1,1,7,34,0,1,33,0,3,33,0,4,33,0,5,33,0,6,12,4,48,6,0,71,0,16,0,19,0,19,21,0,42,0,72,27,11,2,0,46,0,10,0,42,0,61,27,27,32,0,6,11,2,0,46,0,61,0,43,0,8,27,27,33,0,7,48,6,1,2,33,0,8,48,6,0,11,0,8,0,53,21,0,48,1,3,27,33,0,9,48,6,1,4,33,0,10,48,6,1,5,33,0,11,48,6,1,6,1,7,11,2,0,46,1,8,0,52,11,2,0,46,0,10,0,43,0,10,0,42,0,52,27,0,41,0,7,27,27,27,27,33,0,12,48,6,0,81,0,20,0,80,17,1,9,1,10,11,2,0,46,0,10,0,11,0,49,21,0,7,0,11,0,10,0,53,21,21,27,11,2,0,46,0,15,0,15,0,49,0,49,11,2,21,27,33,0,13,48,6,1,11,33,0,14,48,6,1,12,33,0,15,48,6,32,0,15,0,52,26,33,0,16,48,6,1,13,1,14,1,15,11,3,0,46,0,17,0,40,0,32,0,61,26,0,8,0,18,21,0,40,0,37,0,0,26,0,12,0,0,0,8,0,42,0,49,27,21,0,10,21,27,27,27,33,0,17,48,6,0,17,0,40,32,0,7,27,0,20,20,34,0,17,32,0,16,11,2,0,46,0,17,0,40,0,36,32,0,3,26,27,0,12,0,58,21,0,18,0,40,0,37,0,7,26,27,20,27,32,0,16,11,3,0,46,0,17,0,40,0,14,27,0,3,0,53,21,27,33,0,18,48,6,1,16,33,0,19,48,6,0,88,33,0,20,48,6,0,17,0,40,0,30,27,32,0,5,20,32,0,20,11,2,0,46,0,53,0,43,0,11,27,27,32,0,19,32,0,18,0,40,34,0,20,0,29,11,2,0,46,0,10,0,11,0,52,21,27,27,27,0,30,0,52,21,0,20,20,33,0,21,48,6,1,17,33,0,22,48,6,1,18,33,0,23,48,6,1,19,33,0,24,48,6,1,20,33,0,25,48,6,0,73,0,17,0,16,0,19,0,17,0,28,0,11,0,0,0,52,21,21,21,0,19,0,16,21,0,70,21,0,35,32,0,7,0,19,0,82,21,26,0,19,0,25,0,75,21,0,19,0,74,21,0,19,0,23,0,52,21,11,2,0,46,0,10,0,8,0,52,21,27,20,0,35,32,0,25,0,19,0,90,21,26,0,19,20,0,25,0,75,21,0,19,0,74,21,11,3,0,46,0,36,32,0,3,26,0,33,0,29,26,0,53,0,18,0,59,17,0,26,0,53,0,52,0,49,11,3,17,21,0,37,0,4,26,20,27,11,2,0,46,0,10,0,8,0,49,21,27,33,0,26,48,6,0,30,0,40,32,0,25,27,0,19,0,91,21,32,0,26,0,18,34,0,26,0,41,0,19,0,42,0,92,0,43,0,19,27,27,27,0,15,21,11,3,0,46,0,11,0,3,0,53,21,27,33,0,27,48,6,34,0,7,34,0,27,11,2,0,46,32,0,3,0,11,0,49,21,27,33,0,28,48,6,0,32,0,49,26,0,31,0,93,21,34,0,19,34,0,25,27,0,30,0,52,21,33,0,29,48,6,0,17,0,17,34,0,28,20,34,0,29,11,2,0,46,0,16,0,12,0,58,21,27,32,0,3,21,33,0,30,48,6,34,0,24,0,40,0,34,0,60,0,0,0,61,17,0,43,0,19,27,26,27,0,18,20,0,23,0,50,21,32,0,30,11,2,7,0,52,0,35,0,22,26,34,0,1,0,1,16,17,0,27,0,44,0,39,0,33,0,36,0,2,26,26,26,27,16,0,37,0,50,0,51,11,2,0,47,0,0,27,26,34,0,2,19,0,18,16,0,30,0,42,0,50,27,0,44,0,49,27,16,7,32,0,1,0,15,16,0,23,0,50,17,33,0,3,48,0,4,0,52,17,32,1,8,16,33,0,4,48,6,1,21,33,0,5,48,6,32,0,1,0,18,34,0,1,0,15,16,0,22,0,50,17,0,19,34,0,3,0,37,0,2,26,16,17,17,0,22,0,42,0,37,0,0,26,27,34,0,5,11,2,0,46,0,17,0,40,0,10,27,0,8,0,49,21,27,34,0,4,17,7,32,0,1,0,18,16,0,35,0,32,0,62,26,0,18,0,15,0,30,0,50,21,0,43,0,20,27,21,0,19,0,17,21,26,34,0,1,0,15,16,32,1,8,0,52,17,17,0,19,16,7,0,62,0,18,32,0,1,0,10,16,34,0,2,11,2,17,33,0,3,48,6,32,0,3,34,0,1,34,0,3,11,3,0,20,16,0,19,16,7,0,75,0,19,34,0,1,0,29,16,0,23,0,52,17,0,23,0,50,17,17,0,19,0,74,17,0,20,16,7,32,0,1,0,15,16,0,30,0,50,17,33,0,3,48,6,0,76,32,0,2,0,17,0,3,0,52,21,0,33,0,29,26,0,77,21,0,18,20,32,1,6,11,2,0,46,0,8,0,42,0,54,27,27,16,11,2,0,19,16,0,22,32,0,3,17,0,20,16,34,0,1,0,30,0,44,0,78,0,30,0,52,0,1,34,0,2,17,0,3,0,55,17,0,4,0,49,17,17,27,16,0,79,0,22,0,42,0,1,27,34,0,3,17,0,20,16,11,3,0,19,16,7,34,0,1,0,29,16,0,36,0,11,26,0,73,17,0,38,0,1,26,16,0,39,0,0,26,16,0,11,0,53,17,0,37,0,7,26,16,7,34,0,1,0,35,0,62,26,16,32,1,11,0,52,17,32,1,12,0,53,17,0,30,0,42,0,49,0,50,11,2,27,0,44,0,63,27,16,7,34,0,1,0,15,16,0,73,0,35,32,1,6,26,0,35,0,19,0,42,0,82,27,26,20,0,19,20,0,30,0,44,0,64,27,20,11,2,0,46,0,10,0,8,0,52,21,27,16,0,20,16,7,32,0,1,0,35,0,15,26,16,33,0,5,48,6,32,0,5,0,35,0,30,26,0,52,17,0,18,0,32,0,52,26,0,1,0,11,21,0,48,0,38,0,4,26,27,11,2,0,46,0,11,0,8,0,49,21,27,16,33,0,6,48,6,34,0,5,0,35,0,30,26,16,0,11,0,8,0,49,21,0,48,0,52,0,47,0,38,0,4,26,27,27,16,33,0,7,48,6,34,0,1,0,35,0,22,26,0,52,0,22,32,0,6,0,10,16,0,2,32,0,4,17,0,1,16,17,0,6,34,0,6,17,0,2,34,0,4,17,0,36,0,21,26,32,0,7,17,17,0,11,0,1,0,53,21,0,4,0,49,21,0,48,0,20,27,16,0,53,0,47,0,19,0,40,0,8,27,27,16,33,0,8,48,6,34,0,8,32,1,10,0,9,0,40,32,1,9,27,11,2,0,46,34,0,7,0,18,16,0,14,0,42,0,27,0,42,0,52,27,27,16,27,16,32,1,11,0,53,17,7,32,0,1,0,11,16,33,0,5,48,6,32,1,14,34,0,4,26,32,1,12,32,0,5,21,33,0,6,48,6,34,0,1,0,35,32,1,22,26,0,42,0,8,27,32,0,6,20,1,22,11,2,0,46,0,51,0,43,0,8,27,0,37,0,7,26,20,27,34,0,2,19,7,32,0,1,0,11,16,33,0,3,48,6,32,0,1,0,23,0,49,17,0,35,0,8,26,16,0,9,16,33,0,1,49,6,32,0,1,0,15,16,0,23,0,50,17,33,0,4,48,0,10,16,0,1,16,0,11,0,42,0,49,27,0,48,0,51,27,16,33,0,5,48,6,32,0,3,0,8,0,49,17,0,33,0,30,26,0,83,17,33,0,6,48,6,1,23,33,0,7,48,6,32,0,1,0,28,0,42,0,17,0,11,32,0,6,21,0,0,0,52,21,27,34,0,7,11,2,0,46,32,0,3,0,10,0,52,17,27,16,33,0,1,49,6,32,0,6,0,22,0,42,0,1,27,32,0,4,17,32,0,5,0,47,0,19,27,34,0,1,17,34,0,5,0,47,0,19,27,0,68,0,22,32,0,4,0,19,0,52,17,0,30,0,50,17,17,0,18,34,0,4,17,0,30,0,44,34,0,6,27,16,17,0,20,16,32,0,3,0,10,0,52,17,0,48,32,1,9,32,1,11,0,52,21,32,1,12,34,0,3,21,27,16,7,34,0,1,32,1,16,0,42,34,0,2,27,32,1,13,11,2,0,46,0,15,0,11,0,49,21,0,37,0,7,26,20,27,16,7,34,0,1,32,1,15,0,50,26,34,0,2,19,7,0,17,0,17,34,0,4,20,0,21,0,49,21,34,0,0,11,2,0,46,0,16,0,12,0,58,21,27,32,1,3,21,33,0,6,48,6,32,0,1,32,1,4,16,33,0,7,48,0,30,16,33,0,8,48,6,0,69,0,1,0,84,17,0,30,32,0,8,17,33,0,9,48,6,0,86,0,43,0,19,27,0,19,0,85,21,33,0,10,48,6,0,17,0,35,34,0,6,0,43,0,30,0,42,0,52,27,0,16,0,12,32,0,9,0,3,0,53,17,21,0,48,0,17,0,40,34,0,10,27,27,0,30,0,43,0,0,27,21,27,26,0,10,0,40,0,24,27,0,11,0,49,21,0,1,20,0,52,0,9,32,0,9,17,0,48,0,27,27,20,21,0,19,20,33,0,11,48,6,32,0,7,0,23,0,52,17,0,32,34,0,1,26,32,1,5,0,40,0,18,27,20,0,17,34,0,5,34,0,2,23,34,0,11,11,3,0,46,34,0,8,0,5,16,0,3,0,53,17,27,16,33,0,12,48,6,32,0,12,32,0,9,0,12,0,53,17,0,48,0,32,34,0,7,26,0,30,0,50,21,32,1,3,20,0,9,0,58,21,0,48,0,87,0,43,0,19,27,27,27,16,33,0,12,49,6,34,0,9,34,0,12,11,2,7,32,0,1,32,1,3,16,33,0,3,48,6,34,0,1,32,1,18,32,1,21,0,42,32,0,3,27,11,2,0,46,34,0,3,0,12,0,58,17,27,34,0,2,19,7,34,0,1,33,0,3,48,0,15,16,33,0,4,48,0,8,32,0,2,19,33,0,5,48,6,32,0,3,32,0,5,0,37,0,7,26,16,0,48,1,24,27,34,0,2,19,7,0,89,33,0,3,48,6,32,0,2,0,49,0,10,0,13,0,53,21,11,2,0,46,0,11,0,13,0,52,21,27,18,0,31,34,0,3,19,6,34,0,1,32,1,22,32,1,23,0,16,21,0,51,0,51,11,2,0,26,0,45,0,17,27,34,0,2,19,0,27,16,17,7,34,0,1,32,1,30,16,7,34,0,1,0,19,0,42,0,29,0,40,0,35,0,62,26,27,27,16,0,29,34,0,2,0,0,0,52,19,0,19,0,49,19,0,28,18,0,2,0,42,0,8,0,42,0,26,27,27,18,19,7,0,52,0,9,32,1,5,17,0,53,11,2,33,0,3,48,6,32,0,1,0,15,16,0,30,0,40,0,24,27,0,2,0,53,21,0,36,0,21,26,0,23,0,40,0,35,0,24,26,0,2,0,27,0,44,0,17,0,39,0,2,0,0,0,52,21,26,0,52,21,27,21,0,37,0,36,0,0,26,26,0,49,21,27,21,0,50,17,33,0,4,48,6,0,32,0,65,0,18,0,52,0,52,11,2,17,26,33,0,5,48,6,34,0,1,0,35,32,2,22,32,0,5,11,2,0,46,0,49,0,43,0,12,27,0,37,0,7,26,20,27,0,15,0,43,0,8,27,0,37,0,7,26,20,0,48,0,17,0,40,34,0,5,27,27,0,16,21,0,42,0,1,0,42,34,0,3,0,1,34,0,2,19,27,27,26,34,0,4,17,33,0,6,48,6,34,0,6,32,1,6,16,7,0,57,0,0,0,61,17,0,8,32,0,1,17,0,2,0,61,0,1,0,67,17,17,0,0,0,56,0,0,0,61,17,0,17,0,1,0,66,21,0,2,0,11,21,32,0,1,17,17,0,0,34,0,1,17,7,32,1,4,0,3,34,0,2,19,0,33,0,1,26,32,1,5,17,33,0,3,48,6,32,1,5,0,35,0,52,0,43,0,18,27,0,43,0,19,27,26,32,0,3,17,0,37,0,36,0,21,26,26,16,33,0,4,48,6,32,0,4,0,35,0,65,26,16,0,30,0,44,32,1,3,0,22,34,0,3,17,27,16,0,35,0,18,26,34,0,4,17,0,19,16,7] + ,[runtime[0],runtime[1],runtime[2],runtime[6],runtime[7],runtime[8],runtime[9],runtime[11],runtime[12],runtime[13],runtime[14],runtime[15],runtime[16],runtime[17],runtime[18],runtime[19],runtime[20],runtime[21],runtime[22],runtime[23],runtime[24],runtime[25],runtime[26],runtime[27],runtime[28],runtime[29],runtime[30],runtime[31],runtime[33],runtime[36],runtime[37],runtime[43],runtime[44],runtime[45],runtime[46],runtime[47],runtime[48],runtime[50],runtime[51],runtime[52],runtime[53],runtime[54],runtime[55],runtime[56],runtime[57],runtime[58],runtime[59],runtime[60],runtime[62],0,-1,Infinity,1,2,5,4,127,32,3,7,10,'\0',' ','┐','↕','…','␡','␀','·','0','\"',str("@"),str("\'"),str("⟨⟩"),str("⟨"),str("⟩"),str("┌"),str("·─"),str("·╵╎┆┊"),str("┘"),str("┌┐"),str("└┘"),str("‿"),str("\'\""),str("00321111"),str("("),str(")"),str("{𝔽}"),str("*array*"),str("•Fmt: 𝕨 must be a list of up to two numbers (width, height)"),str(","),str("<"),str("⥊"),str("Can\'t represent block")] + ,[[0,1,0],[0,0,1],[0,0,2],[0,0,3],[0,0,4],[0,0,[[],[5]]],[0,0,6],[0,0,[[],[7]]],[0,0,8],[0,0,9],[0,0,10],[1,0,11],[1,0,12],[0,0,13],[0,0,[[],[14]]],[0,0,15],[2,0,16],[0,0,17],[0,0,18],[0,0,19],[0,0,20],[0,0,21],[0,0,22],[0,0,23],[0,0,24]] + ,[[0,0],[3,31],[789,3],[855,6],[955,3],[1006,4],[1045,3],[1075,4],[1198,3],[1236,3],[1275,3],[1328,9],[1558,7],[1631,8],[1874,3],[1909,3],[1923,13],[2218,4],[2263,6],[2310,4],[2383,3],[2391,3],[2443,7],[2646,3],[2702,5]] )(list([type, decompose, repop, fmtnum])); let fmt = x => unstr(fmt1(x)); diff --git a/src/f.bqn b/src/f.bqn index 859c5fff..c00b43a5 100644 --- a/src/f.bqn +++ b/src/f.bqn @@ -46,19 +46,28 @@ ≍(1<≠)◶⟨"⟨⟩",'↕'⌾⊑·∾·"‿"⊸∾¨FN¨⟩≢𝕩 }) - PaddingJoin ← { + _paddingJoin ← { # 𝕗 is 1 to left align and ¯1 to right align s ← ≢¨ 𝕩 w ← (0<=)◶⟨⥊,⌈˝⍟(=-1˙)⟩1⊑¨s h ← ⌈˝⎉1⍟(0<=) ⊑¨s - o ← <∘∾⎉2 ≍⍟(0⌈2-=) (h ≍⌜ 𝕨×w¬(-𝕨×≠w)↑1) ↑¨ 𝕩 + o ← <∘∾⎉2 ≍⍟(0⌈2-=) (h ⋈⌜ 𝕗×w¬(-𝕗×≠w)↑1) ↑¨ 𝕩 2 PadH (1⊸⌽⊸≡⥊h)◶⟨PadVMixed,PadV∘>⟩ o } - FmtMixed ← { - (=𝕩) Enframe (𝕨⊣1) PaddingJoin Fmt¨𝕩 + _fmtMixedP ← { + r ← =𝕩 + Join ← r Enframe 𝕗 _paddingJoin + 𝕨 (∨´<⟜∞)◶(Join <⊸(Fmt¨))‿{ + p ← ⟨r>1,2⟩ # Outer padding + o ← ¯1((0+⌜´(1(1+×)`⊢)⌾⌽×↕¨)∘↓⋈⌜2×↕∘⊑)≢𝕩 # Offset + E ← (1‿1⥊'…')˙ + f ← o (𝕨-p)⊸-⊸(⊣ E∘⊢⍟(∨´<⟜≢) (∨´≤⟜0)◶Fmt‿E)¨ 𝕩 + Join f + } 𝕩 } + FmtMixed ← 1 _fmtMixedP - FmtSimple ← (≠(0⊸<+≤)+´)∘(⥊<@˙)◶{ # Depth 1 + FmtSimple ← (≠(0⊸<+≤)+´)∘(⥊<@˙)∘⊢◶{ # Depth 1 # All characters r ← =𝕩 ⋄ 𝕩 ↩ ><¨0↓𝕩 # Ensure rank>0 and ' ' for fill k ← ∞⍟(0⊸=) -≠ c ← ¯1↓≢𝕩 @@ -70,14 +79,18 @@ (r Enframe 1 PadH PadV)⍟(1≠r) ≍ (q⌾⊑c⥊(¯1⊑1∾c)↑'·') ∾⎉k 𝕩 ∾⎉k c-⊸↑q }‿{ # Not homogeneous, or empty - (∨´0=≢)◶FmtMixed‿FmtEmpty 𝕩 + (∨´0=≢)◶⟨𝕨⊸FmtMixed,FmtEmpty⟩ 𝕩 }‿{ # All numbers - ¯1 FmtMixed 𝕩 + 𝕨 ¯1 _fmtMixedP 𝕩 } # Format data type - FmtDat ← (2⌊≡)◶⟨≍ReprAtom,(∨´∘⥊3≤Type⌜)◶FmtSimple‿FmtMixed,FmtMixed⟩ + FmtDat ← (2⌊≡∘⊢)◶⟨ + ≍ ReprAtom∘⊢ + (∨´∘⥊3≤Type⌜∘⊢)◶FmtSimple‿FmtMixed + FmtMixed + ⟩ # Format part of a compound operation; return precedence‿string _dispOp_ ← { @@ -94,15 +107,19 @@ FmtOp ← ≍1⊑ (1=≠)◶⟨arr,⊏⟩∘FmtDat _dispOp_ (=⟜2◶⟨FF⊑∘⊢,arr⟩) # Format any value to character matrix - Fmt ← Type (3≤⊣)◶⟨FmtDat⊢,FmtOp⟩ ⊢ + Fmt ← { + t ← Type𝕩 + 𝕨 (3≤t)◶⟨FmtDat,t⊸FmtOp⟩ 𝕩 + } Trunc ← { + c ← 𝕨