From 0000f894faae0daf7a3ee362abc9054697b513e4 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 21 Jan 2021 16:13:18 -0500 Subject: =?UTF-8?q?Fill=20support=20for=20=E2=8C=9C=20and=20=C2=A8=20when?= =?UTF-8?q?=20=F0=9D=94=BD=20is=20monadic=20=3D=E2=89=A0=E2=89=A1=E2=89=A2?= =?UTF-8?q?=20even=20if=20the=20argument=20has=20no=20fill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/r.bqn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/r.bqn b/src/r.bqn index 75ef8c09..c9652b58 100644 --- a/src/r.bqn +++ b/src/r.bqn @@ -168,9 +168,9 @@ SelSub←{ } First ← (0<≠)◶⟨Fill,0⊸⊑⟩ Deshape +IsPure ← {d←Decompose𝕩 ⋄ 2⊸≤◶⟨≤⟜0, 1(𝕊d⊑˜1⊸+)⊸×´·↕1-˜≠∘d⟩0⊑d} _fillByPure_←{ - p ← {d←Decompose𝕩 ⋄ 2⊸≤◶⟨≤⟜0, 1(𝕊d⊑˜1⊸+)⊸×´·↕1-˜≠∘d⟩0⊑d} 𝕘 - p⊑⟨𝕗,𝕗_fillBy_𝕘⟩ + 𝕘 {(𝕨HomFil𝕩)_fillBy_𝕨}⍟(IsPure⊣) 𝕗 } ¨ ↩ {𝕨𝔽⌜⊘(𝔽_eachd)_fillByPure_𝔽○ToArray𝕩} @@ -429,6 +429,7 @@ identity ← {(0⊑𝕨)˙⊸=◶𝕩‿(1⊑𝕨)}´ ⟨ >‿0 , ≥‿1 "´: Identity not found"!0˙ ⟩ +HomFil ← {((𝕎0) Fill 𝕏)⊘𝕏}⍟(+´⟨=,≠,≡,≢⟩=⊣) Reshape←{ "𝕨⥊𝕩: 𝕨 must have rank at most 1" ! 1≥=𝕨 -- cgit v1.2.3