aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/r.bqn15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/r.bqn b/src/r.bqn
index a276ec68..d072d318 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -176,7 +176,7 @@ _under_←{
Fail←{𝕊‿0}
# 𝕎 is parent traversal; 𝕩 is current components of ind and val
Trav←(IsArray 0⊑⊢)◶⟨Pair, Conform´∘⊢◶Fail‿{
- Parent←𝕎 ⋄ n←≠⊑a←⥊¨𝕩 ⋄ j←¯1
+ Parent←𝕎 ⋄ n←≠0⊑a←⥊¨𝕩 ⋄ j←¯1
Child←Trav⟜(⊑¨⟜a)
{ j+↩1 ⋄ f←n⊸≤◶⟨𝕊˙⊸Child,Parent˙⟩j ⋄ F 0 }
}⟩
@@ -189,11 +189,16 @@ _under_←{
Set1←𝕨⊸{
𝕩↩<⍟(1-IsArray)𝕩
l←1×´s←≢𝕩
- gi←0⊸⊑⌜𝕨⋄nv←1⊸⊑⌜𝕨
- g←Cmp0 _grade_ 0 gi
- P←(≠g)⊸≤◶⟨(⊑⟜g)⊑gi˙,l⟩
+ i←0⊸⊑⌜𝕨
+ g←Cmp0 _grade_ 0 i
+ v←(1⊑⊑⟜𝕨)⌜g
+ P←(≠g)⊸≤◶⟨(⊑⟜g)⊑i˙,l⟩
e←P j←0
- s⥊{e=𝕩}◶⟨⊑⟜(⥊𝕩),{𝕩⋄r←(j⊑g)⊑nv⋄e↩P j↩1+j⋄r}⟩⌜↕l
+ s⥊{e=𝕩}◶⟨⊑⟜(⥊𝕩),{𝕩
+ r←j⊑v⋄e↩{𝕊∘{𝕩
+ "⌾: Incompatible result elements in structural Under"!r Match j⊑v
+ }⍟(e=⊢)P j↩1+j}0⋄r
+ }⟩⌜↕l
}
_at_ ← {(↕≠𝕩) 𝔽⍟((𝔾𝕩)=⊣)¨ 𝕩}
Set ← 0⊸{ (𝕨≥≠root)◶⟨≢⥊(1+𝕨)⊸𝕊_at_(𝕨⊑root˙)∘⥊, Set1⟩ 𝕩 }