more proper error message for 1⌾((<⋈0)⊸⊑)↕5

This commit is contained in:
dzaima 2025-05-05 18:57:31 +03:00
parent 13906efe44
commit 1ecc6b3918
3 changed files with 14 additions and 3 deletions

View File

@ -1400,7 +1400,9 @@ B pick_ucw(B t, B o, B w, B x) {
}
w = num_squeeze(mut_fcd(r, w));
B rep = isArr(o)? incG(o) : c1(o, C2(select, incG(w), C1(shape, incG(x))));
if (isAtm(rep) || !eqShape(w, rep)) thrF("𝔽⌾(a⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected %H, got %H)", w, rep);
// error messages will need to get more non-trivial for deeper mismatches
if (isAtm(rep)) thrM("𝔽⌾(nested⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected unit array, got atom)");
if (!eqShape(w, rep)) thrF("𝔽⌾(nested⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected %H, got %H)", w, rep);
return select_replace(U'', w, x, rep, wia, xia, 1);
}
decG(w);

View File

@ -174,6 +174,8 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄
!"𝕨⊑𝕩: 𝕨 contained a non-integer" % 0.13
!"𝕨⊑𝕩: 𝕨 contained a non-integer" % 2803
!"𝕨⊑𝕩: Leaf arrays in 𝕨 must have rank 1 (element: (1‿2⥊1‿2))" % %USE evar (12) {𝕨𝕩}_evar 55
!"𝕨⊑𝕩: Leaf arrays in 𝕨 must have rank 1 (element: (<2))" % (<2)3
!"𝕨⊑𝕩: Leaf arrays in 𝕨 must have rank 1 (element: (<1))" % (<1)"foo""bar""baz"
%USE eqvar 12 _eqvar 55 %% 12
# >𝕩

View File

@ -30,8 +30,15 @@
# ⊑
!"𝔽⌾(a⊸⊑): Incompatible result elements" % 1020(12,12) 459
!"𝔽⌾(a⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨2⟩, got ⟨3⟩)" % 102030(12,21) 4416
!"𝔽⌾(a⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨2⟩, got ⟨3⟩)" % 1(12,21) 4416
!"𝔽⌾(nested⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨2⟩, got ⟨3⟩)" % 102030(12,21) 4416
!"𝔽⌾(nested⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected unit array, got atom)" % 1((<2)) 10
!"𝔽⌾(nested⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected unit array, got atom)" % 1((<12)) 339
!"⁼: Inverse not found" % 1((<2)) 10
!"⁼: Inverse not found" % 1((<12)) 339
!"⁼: Inverse not found" % (<1)((<12,21)) 339
!"⁼: Inverse not found" % 34((<12,21)) 339
!"𝕨⊑𝕩: Leaf arrays in 𝕨 must have rank 1 (element: (<2))" % 1((<2)) 10
!"𝔽⌾(nested⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨2⟩, got ⟨3⟩)" % 1(12,21) 4416
!"𝔽⌾(n⊸⊑)𝕩: reading out-of-bounds (n≡¯10, 3≡≠𝕩)" % 1+(¯10) 3
!"𝕨⊑𝕩: 𝕨 contained list with mixed-type elements" % 'a'(1'a') 459
!"𝕨⊑𝕩: Indexing out-of-bounds (index 1‿5 in array of shape 4‿5)" % 'a'(15) 459