From b4365e3d457d7f5179fed57c9f828bbce4994476 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 6 Sep 2020 11:05:40 -0400 Subject: Clean up control picture substitution a little --- src/fmt.bqn | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fmt.bqn b/src/fmt.bqn index 18969fb9..9344042d 100644 --- a/src/fmt.bqn +++ b/src/fmt.bqn @@ -1,11 +1,6 @@ # Format an array to a character matrix { F0←𝔽 # Function to format a scalar - # Substitute control codes for character arrays - CSub ← { - del ← @+127 - 𝕩 + (('␑'-del)×𝕩=del) + ('␀'-@)×𝕩<@+32 - } # Vertical padding for arrays of rank greater than 2 PadV ← { # Leading shape @@ -52,6 +47,9 @@ # All characters k ← ∞⍟(0⊸=) -β‰  c ← Β―1↓≒𝕩 q ← '"' + # Escape quotes in strings (rank 1) and substitute control chars + # with control pictures for other ranks. + CSub ← { 𝕩 + (𝕩(=Γ—'␑'-⊒)@+127) + ('␀'-@)×𝕩<@+32 } 𝕩 ↩ (1β‰ =)β—ΆβŸ¨(1+q=⊒)⊸/,Csub⟩ 𝕩 (r Enframe 1 PadH PadV)⍟(1β‰ r) ≍ (c↑q) βˆΎβŽ‰k 𝕩 βˆΎβŽ‰k ⌽⌾β₯Šc↑q }β€Ώ{ -- cgit v1.2.3