aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-30 08:37:57 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-30 08:40:54 -0400
commit7c1fe4206ef5ce3aa9b0a66ce395e77b0c7291ca (patch)
tree66c607260032fc5b816c9e3b3b8407c56984c85e /src
parent3f5ab730a040ce1dbf39cc79daa332b57a9f0cca (diff)
Non-pervasive Join To implementation
Diffstat (limited to 'src')
-rw-r--r--src/r1.bqn20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/r1.bqn b/src/r1.bqn
index 498784e4..57166278 100644
--- a/src/r1.bqn
+++ b/src/r1.bqn
@@ -347,6 +347,16 @@ Merge←{
(Deshape⌜𝕩)⊑˜⌜c⥊↕1×´c
}_fillMerge_∾⍟IsArray
+JoinTo←(1<⌈○=)◶(∾○⥊)‿{
+ a←1-˜𝕨⌈○=𝕩
+ s←𝕨Pair○≢𝕩
+ "𝕨∾𝕩: Rank of 𝕨 and 𝕩 must differ by at most 1" ! 1×´(a≤≠)⌜s
+ c←(≠-a˙)⊸↓⌜s
+ "𝕨∾𝕩: Cell shapes of 𝕨 and 𝕩 must match" ! MatchS´c
+ l←0+´(a<≠)◶1‿(0⊑⊢)⌜s
+ (⟨l⟩∾0⊑c)⥊𝕨∾○⥊𝕩
+}○ToArray _fillBy_ IF
+
Join1←{
# List of lists
i←j←¯1 ⋄ e←⟨⟩ ⋄ a←𝕩
@@ -640,16 +650,6 @@ _rankOp_←{
> ((0⊑k)Enc𝕨) 𝔽_each ((1-˜≠)⊸⊑k)Enc𝕩
}
-JoinTo←∨○(1<=)◶(∾○⥊)‿{
- s←𝕨Pair○≢𝕩
- a←1⌈´k←≠⌜s
- "𝕨∾𝕩: Rank of 𝕨 and 𝕩 must differ by at most 1" ! 1∧´1≥a-k
- c←(k¬a)+⟜(↕a-1)⊸⊏¨s
- "𝕨∾𝕩: Cell shapes of 𝕨 and 𝕩 must match" ! MatchS´c
- l←0+´(a=k)⊣◶1‿(0⊑⊢)¨s
- (⟨l⟩∾0⊑c)⥊𝕨∾○⥊𝕩
-} _fillBy_ IF
-
_repeat_←{
F←𝔽 ⋄ b←𝕨{𝕏⊣}˙⊘{𝕨˙{𝔽𝕏⊣}}0
n←𝕨𝔾𝕩