make 𝕨⊏𝕩 error messages not differ across types
This commit is contained in:
parent
e757b690dd
commit
2b323817ca
@ -202,8 +202,8 @@ B select_c2(B t, B w, B x) {
|
|||||||
for (usz bl=(1<<14)/sizeof(W), i0=0, i1=0; i0<wia; i0=i1) { \
|
for (usz bl=(1<<14)/sizeof(W), i0=0, i1=0; i0<wia; i0=i1) { \
|
||||||
i1+=bl; if (i1>wia) i1=wia; \
|
i1+=bl; if (i1>wia) i1=wia; \
|
||||||
W min=wp[i0], max=min; for (usz i=i0+1; i<i1; i++) { W e=wp[i]; if (e>max) max=e; if (e<min) min=e; } \
|
W min=wp[i0], max=min; for (usz i=i0+1; i<i1; i++) { W e=wp[i]; if (e>max) max=e; if (e<min) min=e; } \
|
||||||
if (min<-(i64)xn) thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", min, xn); \
|
if (min<-(i64)xn) select_properError(w, x); \
|
||||||
if (max>=(i64)xn) thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", max, xn); \
|
if (max>=(i64)xn) select_properError(w, x); \
|
||||||
W* ip=wp; usz off=xn; \
|
W* ip=wp; usz off=xn; \
|
||||||
if (max>=0) { off=0; if (RARE(min<0)) { \
|
if (max>=0) { off=0; if (RARE(min<0)) { \
|
||||||
if (RARE(xn > (1ULL<<(sizeof(W)*8-1)))) { w=taga(NEXT(w)); mm_free((Value*)r); return C2(select, w, x); } \
|
if (RARE(xn > (1ULL<<(sizeof(W)*8-1)))) { w=taga(NEXT(w)); mm_free((Value*)r); return C2(select, w, x); } \
|
||||||
@ -244,7 +244,7 @@ B select_c2(B t, B w, B x) {
|
|||||||
u64 b=0; \
|
u64 b=0; \
|
||||||
for (usz i = wia; ; ) { \
|
for (usz i = wia; ; ) { \
|
||||||
i--; \
|
i--; \
|
||||||
usz n = WRAP(wp[i], xn, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn)); \
|
usz n = WRAP(wp[i], xn, select_properError(w, x)); \
|
||||||
b = 2*b + ((((u8*)xp)[n/8] >> (n%8)) & 1); \
|
b = 2*b + ((((u8*)xp)[n/8] >> (n%8)) & 1); \
|
||||||
if (i%64 == 0) { rp[i/64]=b; if (!i) break; } \
|
if (i%64 == 0) { rp[i/64]=b; if (!i) break; } \
|
||||||
} \
|
} \
|
||||||
|
|||||||
@ -120,6 +120,10 @@
|
|||||||
!"Expected integer, got 1.1" % %USE evar ⋄ 0‿1.1‿2 ⊏_evar ↕10
|
!"Expected integer, got 1.1" % %USE evar ⋄ 0‿1.1‿2 ⊏_evar ↕10
|
||||||
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 0‿0‿1 ⊏_evar 1‿3⥊↕10000
|
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 0‿0‿1 ⊏_evar 1‿3⥊↕10000
|
||||||
!"⊏: Indexing out-of-bounds (2∊𝕨, 2≡≠𝕩)" % %USE evar ⋄ (1+9=↕10) ⊏_evar ⟨1‿2,3⟩
|
!"⊏: Indexing out-of-bounds (2∊𝕨, 2≡≠𝕩)" % %USE evar ⋄ (1+9=↕10) ⊏_evar ⟨1‿2,3⟩
|
||||||
|
!"⊏: Indexing out-of-bounds (4∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ 1‿4‿2‿0‿10‿5‿6 ⊏_evar 1‿0‿1
|
||||||
|
!"⊏: Indexing out-of-bounds (¯4∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ (-1‿4‿2‿0‿10‿5‿6) ⊏_evar 1‿0‿1
|
||||||
|
!"⊏: Indexing out-of-bounds (4000∊𝕨, 1001≡≠𝕩)" % %USE evar ⋄ ( 1000×1‿4‿2‿0‿10‿5‿6) ⊏_evar 1001⥊1‿0‿1
|
||||||
|
!"⊏: Indexing out-of-bounds (¯4000∊𝕨, 1001≡≠𝕩)" % %USE evar ⋄ (¯1000×1‿4‿2‿0‿10‿5‿6) ⊏_evar 1001⥊1‿0‿1
|
||||||
%USE tvar ⋄ !∘≡¨⟜⊏ ∾ {⥊𝕨 ⊏⎊(•CurrentError∘⊢) _tvar 𝕩}´¨ ⟨⟨0‿1, ⋈0⟩ ⋄ ⟨0‿1, "?"⟩ ⋄ ⟨0‿1, ≍0‿1⟩⟩
|
%USE tvar ⋄ !∘≡¨⟜⊏ ∾ {⥊𝕨 ⊏⎊(•CurrentError∘⊢) _tvar 𝕩}´¨ ⟨⟨0‿1, ⋈0⟩ ⋄ ⟨0‿1, "?"⟩ ⋄ ⟨0‿1, ≍0‿1⟩⟩
|
||||||
a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ 𝕨⊏⎊"e"𝕩}⟨1‿2,3‿4⟩ ⋄ ! 0‿1 ≡ a
|
a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ 𝕨⊏⎊"e"𝕩}⟨1‿2,3‿4⟩ ⋄ ! 0‿1 ≡ a
|
||||||
%USE eqvar ⋄ {1‿¯1 {r←𝕨⊏𝕩 ⋄ ! 𝕩 ≥○•internal.ElType r ⋄ r}_eqvar 𝕩}¨ ⟨↕2, ↕4, "hello", ⟨"ab", "cd", "ef"⟩, ↕⋈4⟩
|
%USE eqvar ⋄ {1‿¯1 {r←𝕨⊏𝕩 ⋄ ! 𝕩 ≥○•internal.ElType r ⋄ r}_eqvar 𝕩}¨ ⟨↕2, ↕4, "hello", ⟨"ab", "cd", "ef"⟩, ↕⋈4⟩
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user