diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-04 22:07:22 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-04 22:11:48 -0500 |
| commit | 47dd81da7a2ceefa031db39f41c817eb82385fdb (patch) | |
| tree | d7676c09a7a5f905bc1ee03e74b9527f05d96c46 /src | |
| parent | 40fe2e7e128bc3aaa84303b28f3e4ebf54c247b5 (diff) | |
Fix Join on enclosed atom
Diffstat (limited to 'src')
| -rw-r--r-- | src/r.bqn | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -193,11 +193,12 @@ Merge←{ 𝕩⊑⟜Deshape˜⌜c⥊↕1×´c }⍟(0<≠∘⥊)⍟IsArray -Join←(1==)◶⟨1,1-1×´(1==)⌜⟩◶{ +Join1←{ # List of lists i←j←¯1 ⋄ e←⟨⟩ ⋄ a←𝕩 {{e↩a⊑˜i↩𝕩⋄j↩¯1}⍟(1-i⊸=)𝕩⋄(j↩j+1)⊑e}⌜Indices≠⌜𝕩 -}‿{ +} +JoinM←{ # Multidimensional n←≠z←⥊𝕩 ⋄ s←≢⌜z ⋄ d←≠0⊑s ⋄ r←=𝕩 "∾𝕩: Elements of 𝕩 must all have the same rank" ! 1×´(d=≠)⌜s @@ -223,7 +224,10 @@ Join←(1==)◶⟨1,1-1×´(1==)⌜⟩◶{ "∾𝕩: 𝕩 element trailing shapes must match" ! 1×´(×´t=¨Dr)⌜s ti←t⥊↕tp←×´t⋄(𝕨tp⊸×⊸+⌜ti)G𝕩⊣⌜ti } j -}⍟{"∾𝕩: 𝕩 must be an array" ! IsArray 𝕩 ⋄ 0<≠⥊𝕩} +} +Join←(2⌊=)◶⟨ + Merge, (1×´(1==)⌜)◶JoinM‿Join1, JoinM +⟩⍟{"∾𝕩: 𝕩 must be an array" ! IsArray 𝕩 ⋄ 0<≠⥊𝕩} _takeDrop←{ ⟨gl,Noop,_inds⟩←𝕗 |
