change error messages in ◶

This commit is contained in:
dzaima 2023-06-12 00:51:12 +03:00
parent 8542ba071d
commit 336f986986
2 changed files with 13 additions and 4 deletions

View File

@ -140,8 +140,8 @@ B pick_c2(B t, B w, B x);
B cond_c1(Md2D* d, B x) { B f=d->f; B g=d->g;
B fr = c1iX(f, x);
if (isNum(fr)) {
if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1");
usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: 𝔽 out of bounds of 𝕘"));
if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1 when index is a number");
usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: Index out of bounds of 𝕘"));
return c1(IGetU(g, fri), x);
} else {
B fn = C2(pick, fr, inc(g));
@ -153,8 +153,8 @@ B cond_c1(Md2D* d, B x) { B f=d->f; B g=d->g;
B cond_c2(Md2D* d, B w, B x) { B g=d->g;
B fr = c2iWX(d->f, w, x);
if (isNum(fr)) {
if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1");
usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: 𝔽 out of bounds of 𝕘"));
if (isAtm(g)||RNK(g)!=1) thrM("◶: 𝕘 must have rank 1 when index is a number");
usz fri = WRAP(o2i64(fr), IA(g), thrM("◶: Index out of bounds of 𝕘"));
return c2(IGetU(g, fri), w, x);
} else {
B fn = C2(pick, fr, inc(g));

View File

@ -281,6 +281,15 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe
%USE tvar a¯5+10 !¨ (¨ 5+10)¨ {1+𝕩 10}_tvar a
%USE tvar a¯5+10 !¨ (¨ 5+10)¨ {1+(𝕩{!𝕩10 𝕗}) 10}_tvar a
# ◶
!"◶: 𝕘 must have rank 1 when index is a number" % 1[12,34] 3
!"◶: 𝕘 must have rank 1 when index is a number" % "ab" [12,34] 3
!"⊑: Picking item at wrong rank (index 0‿0 in array of shape ⟨2⟩)" % +- 00 # shouldn't reference ⊑ but whatever
!"⊑: Picking item at wrong rank (index 1‿2 in array of shape ⟨3⟩)" % 1 ++- 01
10 +"ab""cd" ¯9 %% "cd"
1,2,0"ab""cd"1 @ %% "cd"1"ab"
# ˘ & ⎉
(1˜ 02032)50 1˜ 01002 %% 1501203/0202
!"⎉: Result rank too large" % (1˜ 02032)49 1˜ 01002