aboutsummaryrefslogtreecommitdiff
path: root/src/r.bqn
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-12-31 21:59:48 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-12-31 21:59:48 -0500
commitdac3a40a2a06aa0b5dbe2d17b217b2d1007a707d (patch)
treec5a1cfe63cc78518c179706fc0817e45fb765ae4 /src/r.bqn
parent785f1eef53c8fa531cfc0403ffe1d82500e9ba95 (diff)
Use shaped identities for arithmetic Insert and support ∾
Diffstat (limited to 'src/r.bqn')
-rw-r--r--src/r.bqn5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/r.bqn b/src/r.bqn
index 6c3678ed..305d7447 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -394,7 +394,9 @@ _rankOp_←{
}
_insert←{
"˝: 𝕩 must have rank at least 1" ! 1≤=𝕩
- 𝕨 𝔽´ <˘𝕩
+ F←𝔽
+ Id ← {s←1 Drop ≢𝕩 ⋄ s joinPrim˙⊸≠◶⟨(0<↕∘≠)⊸×⊸⥊⟜⟨⟩, Reshape⟜Identity⟩ f}
+ 𝕨 (0<≠)⊘1◶Id‿{𝕨F´<˘𝕩} 𝕩
}
˝ ← _insert
@@ -588,6 +590,7 @@ _repeat_←{
}
ReshapeT ← ⟨∘,⌊,⌽,↑⟩⊑∘⊐<
+JoinPrim ← ∾
⍟ ↩ _repeat_
⥊ ↩ Deshape ⊘ Reshape