diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-04-29 23:13:43 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-04-29 23:13:43 -0400 |
| commit | 62e14d343cc6e1122a0f2c6970b89e85a2aa8af2 (patch) | |
| tree | db5265130de61e5299ecad87c15c5d2c0fb21367 /src | |
| parent | 6552ee510970d18b48be31c5a08301fbf826fe0b (diff) | |
Allow formatter 𝕨 for maximum output size, truncating with …
Diffstat (limited to 'src')
| -rw-r--r-- | src/f.bqn | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -95,6 +95,14 @@ # Format any value to character matrix Fmt ← Type (3≤⊣)◶⟨FmtDat⊢,FmtOp⟩ ⊢ + Trunc ← { + m ← "•Fmt: 𝕨 must be a list of up to two numbers (width, height)" + m ! (1≥=)◶⟨0,2≥≠⟩ 𝕨 + sh ← ⌽𝕨»∞‿∞ + c ← sh<s←≢ f ← 𝕩 + sh {l←c-˜𝕨⌊s ⋄ ls←⋈⌜´l∾⟜(⥊⟜1)¨c ⋄ ∾ ls ⥊¨ (l↑f)⌾⊑ '…'¨ ls}⍟(∨´c) f + } + FmtW ← Fmt⊘(Trunc⟜Fmt) # Represent as string RR ← {Repr𝕩} @@ -109,5 +117,5 @@ Repr ← Type (3≤⊣)◶⟨ReprDat⊢,ReprOp⟩ ⊢ # Convert Fmt from matrix to string - ⟨¯1↓·⥊ ∾⟜(@+10)˘∘Fmt, Repr⟩ + ⟨¯1↓·⥊ ∾⟜(@+10)˘∘FmtW, Repr⟩ } |
