From 63cbe030ab90950737558daefd967c868dd8f93c Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 23 Nov 2021 20:55:50 -0500 Subject: Implement -p in bqn.bqn --- bqn.bqn | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bqn.bqn b/bqn.bqn index 086907e2..09524966 100755 --- a/bqn.bqn +++ b/bqn.bqn @@ -41,6 +41,7 @@ Fmt‿Repr ← (•Import "src/f.bqn"){𝔽} ⟨ IsPrim◶⟨tn⊑˜•Type-2˙, Glyph⟩ # Format operation/namespace •Repr # Format number ⟩ +Show ← •Out∘Fmt⊸⊢⊢ # Lookup table FindSys ← { @@ -50,11 +51,15 @@ FindSys ← { } system ← {𝕨⊸FindSys⊏𝕩˙}´⟨ "bqn"‿"type"‿"glyph"‿"decompose"‿"repr"‿"fmt"‿"out"‿"show" - BQN ‿•Type ‿ Glyph ‿ Decompose ‿ Repr ‿ Fmt ‿•Out ‿(•Out Fmt) + BQN ‿•Type ‿ Glyph ‿ Decompose ‿ Repr ‿ Fmt ‿•Out ‿ Show ⟩ #⌜ -# Evaluate: -(BQN¨ ("-e"≡⊑)◶⟨•file.Chars¨, 1⊸↓⟩)⍟(0<≠) •args +# Evaluate +{ + 0 < ≠•args ? + t ← ⊑ "-e"‿"-p" ⊐ ⊏•args + Show⍟(t=1)∘BQN¨ (t<2)◶⟨•file.Chars¨, 1⊸↓⟩ •args +;@} BQN # Return the evaluator so it can be •Include d from BQN -- cgit v1.2.3