Merge pull request #132 from tankorsmash/update-error-messages

Use 𝕨 and 𝕩 inside error messages
This commit is contained in:
dzaima 2025-02-08 00:10:51 +02:00 committed by GitHub
commit 4af2fdafca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 477 additions and 449 deletions

View File

@ -141,7 +141,7 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
#define GC2f(SYMB, NAME, EXPR, DECOR, INT_SA, INT_AS, INT_AA, FLT_SAI, ANY_AS) B NAME##_c2_arr(B t, B w, B x) { \ #define GC2f(SYMB, NAME, EXPR, DECOR, INT_SA, INT_AS, INT_AA, FLT_SAI, ANY_AS) B NAME##_c2_arr(B t, B w, B x) { \
if (isArr(w)|isArr(x)) { B r; \ if (isArr(w)|isArr(x)) { B r; \
if (isArr(w)&isArr(x) && RNK(w)==RNK(x)) { \ if (isArr(w)&isArr(x) && RNK(w)==RNK(x)) { \
if (!eqShPart(SH(w), SH(x), RNK(w))) thrF(SYMB ": Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); \ if (!eqShPart(SH(w), SH(x), RNK(w))) thrF("𝕨" SYMB "𝕩: Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); \
usz ia = IA(x); \ usz ia = IA(x); \
u8 we = TI(w,elType); \ u8 we = TI(w,elType); \
u8 xe = TI(x,elType); \ u8 xe = TI(x,elType); \
@ -168,7 +168,7 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
} \ } \
P2(NAME) \ P2(NAME) \
} \ } \
thrM(SYMB ": Unexpected argument types"); \ thrM("𝕨" SYMB "𝕩: Unexpected argument types"); \
} }
GC2f("÷", div , w.f/(x.f+0), GC2f("÷", div , w.f/(x.f+0),
, /*INT_SA*/ , /*INT_SA*/
@ -284,7 +284,7 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
#define AR_I_AA(CHR, NAME, EXPR, BIT, EXTRA) NOINLINE B NAME##_AA(B t, B w, B x) { \ #define AR_I_AA(CHR, NAME, EXPR, BIT, EXTRA) NOINLINE B NAME##_AA(B t, B w, B x) { \
ur wr=RNK(w); usz* xsh=SH(x); \ ur wr=RNK(w); usz* xsh=SH(x); \
ur xr=RNK(x); usz* wsh=SH(w); ur mr=wr<xr?wr:xr; \ ur xr=RNK(x); usz* wsh=SH(w); ur mr=wr<xr?wr:xr; \
if (!eqShPart(wsh, xsh, mr)) thrF(CHR ": Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); \ if (!eqShPart(wsh, xsh, mr)) thrF("𝕨"CHR "𝕩: Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); \
if (wr!=xr) { \ if (wr!=xr) { \
if (TI(w,elType)!=el_B && TI(x,elType)!=el_B && IA(w)!=0 && IA(x)!=0) return leading_axis_arith(NAME##_c2, w, x, wsh, xsh, mr); \ if (TI(w,elType)!=el_B && TI(x,elType)!=el_B && IA(w)!=0 && IA(x)!=0) return leading_axis_arith(NAME##_c2, w, x, wsh, xsh, mr); \
else goto bad; \ else goto bad; \
@ -334,7 +334,7 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
i32* xp = i32any_ptr(x); i32* xp = i32any_ptr(x);
for (usz i = 0; i < wia; i++) { for (usz i = 0; i < wia; i++) {
rp[i] = (u32)((i32)wp[i] - (i32)xp[i]); rp[i] = (u32)((i32)wp[i] - (i32)xp[i]);
if (rp[i]>CHR_MAX) thrM("-: Invalid character"); // safe - see add if (rp[i]>CHR_MAX) thrM("𝕨-𝕩: Invalid character"); // safe - see add
} }
goto dec_ret; goto dec_ret;
} }
@ -369,7 +369,7 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
u32* rp; r = m_c32arrc(&rp, x); u32* rp; r = m_c32arrc(&rp, x);
for (usz i = 0; i < xia; i++) { for (usz i = 0; i < xia; i++) {
rp[i] = (u32)(xp[i]+(i32)wv); rp[i] = (u32)(xp[i]+(i32)wv);
if (rp[i]>CHR_MAX) thrM("+: Invalid character"); // safe to only check this as wv already must be below CHR_MAX, which is less than U32_MAX/2 if (rp[i]>CHR_MAX) thrM("𝕨+𝕩: Invalid character"); // safe to only check this as wv already must be below CHR_MAX, which is less than U32_MAX/2
} }
goto dec_ret; goto dec_ret;
} }
@ -407,15 +407,15 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
#define AR_I_SCALAR(CHR, NAME, EXPR, MORE) B NAME##_c2(B t, B w, B x) { \ #define AR_I_SCALAR(CHR, NAME, EXPR, MORE) B NAME##_c2(B t, B w, B x) { \
if (isF64(w) & isF64(x)) return m_f64(EXPR); \ if (isF64(w) & isF64(x)) return m_f64(EXPR); \
MORE; AR_I_TO_ARR(NAME) \ MORE; AR_I_TO_ARR(NAME) \
thrM(CHR ": Unexpected argument types"); \ thrM("𝕨"CHR "𝕩: Unexpected argument types"); \
} }
AR_I_SCALAR("+", add, w.f+x.f, { AR_I_SCALAR("+", add, w.f+x.f, {
if (isC32(w) & isF64(x)) { u64 r = (u64)(o2cG(w)+o2i64(x)); if(r>CHR_MAX)thrM("+: Invalid character"); return m_c32((u32)r); } if (isC32(w) & isF64(x)) { u64 r = (u64)(o2cG(w)+o2i64(x)); if(r>CHR_MAX)thrM("𝕨+𝕩: Invalid character"); return m_c32((u32)r); }
if (isF64(w) & isC32(x)) { u64 r = (u64)(o2cG(x)+o2i64(w)); if(r>CHR_MAX)thrM("+: Invalid character"); return m_c32((u32)r); } if (isF64(w) & isC32(x)) { u64 r = (u64)(o2cG(x)+o2i64(w)); if(r>CHR_MAX)thrM("𝕨+𝕩: Invalid character"); return m_c32((u32)r); }
}); });
AR_I_SCALAR("-", sub, w.f-x.f, { AR_I_SCALAR("-", sub, w.f-x.f, {
if (isC32(w) & isF64(x)) { u64 r = (u64)((i32)o2cG(w)-o2i64(x)); if(r>CHR_MAX)thrM("-: Invalid character"); return m_c32((u32)r); } if (isC32(w) & isF64(x)) { u64 r = (u64)((i32)o2cG(w)-o2i64(x)); if(r>CHR_MAX)thrM("𝕨-𝕩: Invalid character"); return m_c32((u32)r); }
if (isC32(w) & isC32(x)) return m_f64((i32)(u32)w.u - (i32)(u32)x.u); if (isC32(w) & isC32(x)) return m_f64((i32)(u32)w.u - (i32)(u32)x.u);
}) })
AR_I_SCALAR("×", mul, w.f*x.f, {}) AR_I_SCALAR("×", mul, w.f*x.f, {})
@ -431,7 +431,7 @@ B not_c2(B t, B w, B x) {
#define AR_F_SCALAR(CHR, NAME, EXPR) B NAME##_c2(B t, B w, B x) { \ #define AR_F_SCALAR(CHR, NAME, EXPR) B NAME##_c2(B t, B w, B x) { \
if (isF64(w) & isF64(x)) return m_f64(EXPR); \ if (isF64(w) & isF64(x)) return m_f64(EXPR); \
AR_F_TO_ARR(NAME) \ AR_F_TO_ARR(NAME) \
thrM(CHR ": Unexpected argument types"); \ thrM("𝕨"CHR "𝕩: Unexpected argument types"); \
} }
AR_F_SCALAR("÷", div , w.f/(x.f+0)) AR_F_SCALAR("÷", div , w.f/(x.f+0))
AR_F_SCALAR("", pow , pow(w.f+0, x.f)) AR_F_SCALAR("", pow , pow(w.f+0, x.f))
@ -478,7 +478,7 @@ static f64 bqn_atan2iw(f64 x, f64 w) { return w / (tan(x)+0); }
#define MATH(n,N,I) B n##_c2(B t, B w, B x) { \ #define MATH(n,N,I) B n##_c2(B t, B w, B x) { \
if (isNum(w) && isNum(x)) return m_f64(I(x.f, w.f)); \ if (isNum(w) && isNum(x)) return m_f64(I(x.f, w.f)); \
P2(n) \ P2(n) \
thrM("•math." N ": Unexpected argument types"); \ thrM("𝕨 •math." N " 𝕩: Unexpected argument types"); \
} }
MATH(atan2,"Atan2",bqn_atan2) MATH(atan2,"Atan2",bqn_atan2)
MATH(atan2ix,"Atan2⁼",bqn_atan2ix) MATH(atan2ix,"Atan2⁼",bqn_atan2ix)
@ -510,19 +510,19 @@ static u64 lcm_u64(u64 a, u64 b) {
} }
B gcd_c2(B t, B w, B x) { B gcd_c2(B t, B w, B x) {
if (isNum(w) && isNum(x)) { if (isNum(w) && isNum(x)) {
if (!q_u64(w) || !q_u64(x)) thrM("•math.GCD: Inputs other than natural numbers not yet supported"); if (!q_u64(w) || !q_u64(x)) thrM("𝕨 •math.GCD 𝕩: Inputs other than natural numbers not yet supported");
return m_f64(gcd_u64(o2u64G(w), o2u64G(x))); return m_f64(gcd_u64(o2u64G(w), o2u64G(x)));
} }
P2(gcd) P2(gcd)
thrM("•math.GCD: Unexpected argument types"); thrM("𝕨 •math.GCD 𝕩: Unexpected argument types");
} }
B lcm_c2(B t, B w, B x) { B lcm_c2(B t, B w, B x) {
if (isNum(w) && isNum(x)) { if (isNum(w) && isNum(x)) {
if (!q_u64(w) || !q_u64(x)) thrM("•math.LCM: Inputs other than natural numbers not yet supported"); if (!q_u64(w) || !q_u64(x)) thrM("𝕨 •math.LCM 𝕩: Inputs other than natural numbers not yet supported");
return m_f64(lcm_u64(o2u64G(w), o2u64G(x))); return m_f64(lcm_u64(o2u64G(w), o2u64G(x)));
} }
P2(lcm) P2(lcm)
thrM("•math.LCM: Unexpected argument types"); thrM("𝕨 •math.LCM 𝕩: Unexpected argument types");
} }
#undef P2 #undef P2

View File

@ -23,7 +23,7 @@ B bit_negate(B x) { // consumes
B add_c1(B t, B x) { B add_c1(B t, B x) {
if (isF64(x)) return x; if (isF64(x)) return x;
if (!isArr(x)) thrM("+: Argument must consist of numbers"); if (!isArr(x)) thrM("+𝕩: Argument must consist of numbers");
if (elNum(TI(x,elType))) return x; if (elNum(TI(x,elType))) return x;
decG(eachm_fn(m_f64(0), incG(x), add_c1)); decG(eachm_fn(m_f64(0), incG(x), add_c1));
return x; return x;
@ -35,7 +35,7 @@ B add_c1(B t, B x) {
#define GC1i(SYMB,NAME,FEXPR,TMIN,RMIN,MAIN) B NAME##_c1(B t, B x) { \ #define GC1i(SYMB,NAME,FEXPR,TMIN,RMIN,MAIN) B NAME##_c1(B t, B x) { \
if (isF64(x)) { f64 v = x.f; return m_f64(FEXPR); } \ if (isF64(x)) { f64 v = x.f; return m_f64(FEXPR); } \
if (RARE(!isArr(x))) thrM(SYMB ": Argument contained non-number"); \ if (RARE(!isArr(x))) thrM(SYMB "𝕩: 𝕩 contained non-number"); \
u8 xe = TI(x,elType); \ u8 xe = TI(x,elType); \
if (elNum(xe)) { \ if (elNum(xe)) { \
if (xe<=TMIN) return RMIN; \ if (xe<=TMIN) return RMIN; \
@ -112,8 +112,8 @@ GC1i("¬", not, 1-v, el_bit, bit_negate(x), NOT_BODY)
thrM(MSG); \ thrM(MSG); \
} }
GC1f( div, 1/(xv+0), "÷: Argument contained non-number") GC1f( div, 1/(xv+0), "÷𝕩: 𝕩 contained non-number")
GC1f(root, sqrt(xv), ": Argument contained non-number") GC1f(root, sqrt(xv), "𝕩: 𝕩 contained non-number")
#undef GC1i #undef GC1i
#undef LOOP_BODY #undef LOOP_BODY
#undef SIGN_EXPR #undef SIGN_EXPR
@ -142,13 +142,13 @@ NOINLINE f64 logfact_inv(f64 y) {
f64 fact_inv(f64 y) { return logfact_inv(log(y)); } f64 fact_inv(f64 y) { return logfact_inv(log(y)); }
#define P1(N) { if(isArr(x)) { SLOW1("arithm " #N, x); return arith_recm(N##_c1, x); } } #define P1(N) { if(isArr(x)) { SLOW1("arithm " #N, x); return arith_recm(N##_c1, x); } }
B pow_c1(B t, B x) { if (isF64(x)) return m_f64( exp(x.f)); P1( pow); thrM(": Argument contained non-number"); } B pow_c1(B t, B x) { if (isF64(x)) return m_f64( exp(x.f)); P1( pow); thrM("𝕩: 𝕩 contained non-number"); }
B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM("⋆⁼: Argument contained non-number"); } B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM("⋆⁼𝕩: 𝕩 contained non-number"); }
#undef P1 #undef P1
static NOINLINE B arith_recm_slow(f64 (*fn)(f64), FC1 rec, B x, char* s) { static NOINLINE B arith_recm_slow(f64 (*fn)(f64), FC1 rec, B x, char* s) {
if (isF64(x)) return m_f64(fn(x.f)); if (isF64(x)) return m_f64(fn(x.f));
if(isArr(x)) return arith_recm(rec, x); if(isArr(x)) return arith_recm(rec, x);
thrF("•math.%S: Argument contained non-number", s); thrF("•math.%S 𝕩: 𝕩 contained non-number", s);
} }
#define MATH(n,N) B n##_c1(B t, B x) { return arith_recm_slow(n, n##_c1, x, #N); } #define MATH(n,N) B n##_c1(B t, B x) { return arith_recm_slow(n, n##_c1, x, #N); }
MATH(cbrt,Cbrt) MATH(log2,Log2) MATH(log10,Log10) MATH(log1p,Log1p) MATH(expm1,Expm1) MATH(cbrt,Cbrt) MATH(log2,Log2) MATH(log10,Log10) MATH(log1p,Log1p) MATH(expm1,Expm1)

View File

@ -433,7 +433,7 @@ B for_cells_c1(B f, u32 xr, u32 cr, u32 k, B x, u32 chr) { // F⎉cr x; array x,
return select_cells(0, x, cam, k, true); return select_cells(0, x, cam, k, true);
case n_couple: { case n_couple: {
Arr* r = cpyWithShape(x); xsh=PSH(r); Arr* r = cpyWithShape(x); xsh=PSH(r);
if (xr==UR_MAX) thrF("≍%c: Result rank too large (%i≡=𝕩)", chr, xr); if (xr==UR_MAX) thrF("≍%U 𝕩: Result rank too large (%i≡=𝕩)", chr==U'˘'? "˘" : "⎉𝕘", xr);
ShArr* rsh = m_shArr(xr+1); ShArr* rsh = m_shArr(xr+1);
shcpy(rsh->a, xsh, k); shcpy(rsh->a, xsh, k);
rsh->a[k] = 1; rsh->a[k] = 1;
@ -722,7 +722,7 @@ NOINLINE B for_cells_SA(B f, B w, B x, ur xcr, ur xr, u32 chr) { // w⊸F⎉xcr
} }
if (isF64(w) && xcr>=1) { if (isF64(w) && xcr>=1) {
usz l = xsh[xk]; usz l = xsh[xk];
return select_cells(WRAP(o2i64(w), l, thrF("⊏: Indexing out-of-bounds (𝕨≡%R, %s≡≠𝕩)", w, l)), x, cam, xk, false); return select_cells(WRAP(o2i64(w), l, thrF("𝕨𝕩: Indexing out-of-bounds (𝕨≡%R, %s≡≠𝕩)", w, l)), x, cam, xk, false);
} }
break; break;
case n_couple: if (RNK(x)==1) { case n_couple: if (RNK(x)==1) {
@ -732,7 +732,7 @@ NOINLINE B for_cells_SA(B f, B w, B x, ur xcr, ur xr, u32 chr) { // w⊸F⎉xcr
} break; } break;
case n_pick: if (isF64(w) && xcr==1 && TI(x,arrD1)) { case n_pick: if (isF64(w) && xcr==1 && TI(x,arrD1)) {
usz l = xsh[xk]; usz l = xsh[xk];
return select_cells(WRAP(o2i64(w), l, thrF("⊑: Indexing out-of-bounds (𝕨≡%R, %s≡≠𝕩)", w, l)), x, cam, xk, true); return select_cells(WRAP(o2i64(w), l, thrF("𝕨𝕩: Indexing out-of-bounds (𝕨≡%R, %s≡≠𝕩)", w, l)), x, cam, xk, true);
} break; } break;
case n_shifta: case n_shiftb: if (isAtm(w)) { case n_shifta: case n_shiftb: if (isAtm(w)) {
if (IA(x)==0) return x; if (IA(x)==0) return x;
@ -811,7 +811,7 @@ NOINLINE B for_cells_AA(B f, B w, B x, ur wcr, ur xcr, u32 chr) { // w F⎉wcr
usz cam0 = 1; usz cam0 = 1;
for (usz i = 0; i < k; i++) { for (usz i = 0; i < k; i++) {
usz wl = wsh[i], xl = xsh[i]; usz wl = wsh[i], xl = xsh[i];
if (wl != xl) thrF("%c: Argument frames don't agree (%H ≡ ≢𝕨, %H ≡ ≢𝕩, common frame of %i axes)", chr, w, x, k); if (wl != xl) thrF("𝕨%c𝕩: Argument frames don't agree (%H ≡ ≢𝕨, %H ≡ ≢𝕩, common frame of %i axes)", chr, w, x, k);
cam0*= wsh[i]; cam0*= wsh[i];
} }
usz ext = shProd(zsh, k, zk); usz ext = shProd(zsh, k, zk);

View File

@ -154,7 +154,7 @@ B leading_axis_arith(FC2 fc2, B w, B x, usz* wsh, usz* xsh, ur mr);
if (ria) cmp_fns_##NAME##AA[we](rp, tyany_ptr(w), tyany_ptr(x), ria); \ if (ria) cmp_fns_##NAME##AA[we](rp, tyany_ptr(w), tyany_ptr(x), ria); \
decG(w);decG(x); return r; \ decG(w);decG(x); return r; \
base: return NAME##_rec(swapped,w,x); \ base: return NAME##_rec(swapped,w,x); \
badShape: thrF("%U: Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", swapped?CR:CN, swapped?x:w, swapped?w:x); \ badShape: thrF("𝕨%U𝕩: Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", swapped?CR:CN, swapped?x:w, swapped?w:x); \
} }
CMP_AA_D("", "", ge, ) CMP_AA_D("", "", ge, )
CMP_AA_D(">", "<", gt, ) CMP_AA_D(">", "<", gt, )

View File

@ -236,4 +236,4 @@ bool eequal(B w, B x) { // doesn't consume
if (we==el_f64 && xe==el_f64) return eequalFloat(f64any_ptr(w), f64any_ptr(x), ia); if (we==el_f64 && xe==el_f64) return eequalFloat(f64any_ptr(w), f64any_ptr(x), ia);
if (RARE(we==el_B || xe==el_B)) return eequalSlow(w, x, ia); if (RARE(we==el_B || xe==el_B)) return eequalSlow(w, x, ia);
return equalTyped(w, x, we, xe, ia); return equalTyped(w, x, we, xe, ia);
} }

View File

@ -60,8 +60,8 @@ static B* ud_rec(B* p, usz d, usz r, i32* pos, usz* sh) {
NOINLINE B list_range(B x) { NOINLINE B list_range(B x) {
SGetU(x) SGetU(x)
usz xia = IA(x); usz xia = IA(x);
if (RNK(x)!=1) thrF(": Argument must be either an integer or integer list (had rank %i)", RNK(x)); if (RNK(x)!=1) thrF("𝕩: 𝕩 must be either an integer or integer list (had rank %i)", RNK(x));
if (xia>UR_MAX) thrF(": Result rank too large (%s≡≠𝕩)", xia); if (xia>UR_MAX) thrF("𝕩: Result rank too large (%s≡≠𝕩)", xia);
if (xia==0) { decG(x); return m_funit(emptyIVec()); } if (xia==0) { decG(x); return m_funit(emptyIVec()); }
usz sh[xia]; // stack allocation of rank items usz sh[xia]; // stack allocation of rank items
i32 pos[xia]; i32 pos[xia];
@ -73,7 +73,7 @@ NOINLINE B list_range(B x) {
good|= c==0; good|= c==0;
bad|= (c > I32_MAX) | mulOn(ria, c); bad|= (c > I32_MAX) | mulOn(ria, c);
} }
if (bad && !good) thrM(": Result too large"); if (bad && !good) thrM("𝕩: Result too large");
decG(x); decG(x);
Arr* r = m_fillarr0p(ria); Arr* r = m_fillarr0p(ria);
@ -110,13 +110,13 @@ B slash_c2(B t, B w, B x);
B ud_c2(B t, B w, B x) { B ud_c2(B t, B w, B x) {
usz wia=1; usz wia=1;
if (isArr(w)) { if (isArr(w)) {
if (RNK(w)>1) thrM("↕: 𝕨 must have rank at most 1"); if (RNK(w)>1) thrM("𝕨𝕩: 𝕨 must have rank at most 1");
wia = IA(w); wia = IA(w);
if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); } if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); }
} }
ur xr; ur xr;
if (isAtm(x) || (xr=RNK(x))<wia) thrM("↕: Length of 𝕨 must be at most rank of 𝕩"); if (isAtm(x) || (xr=RNK(x))<wia) thrM("𝕨𝕩: Length of 𝕨 must be at most rank of 𝕩");
if (xr+wia > UR_MAX) thrM("↕: Result rank too large"); if (xr+wia > UR_MAX) thrM("𝕨𝕩: Result rank too large");
ur wr = wia; ur wr = wia;
ur rr = xr + wr; ur rr = xr + wr;
ShArr* sh = m_shArr(rr); ShArr* sh = m_shArr(rr);
@ -135,7 +135,7 @@ B ud_c2(B t, B w, B x) {
for (usz i=0; i<wr; i++) { for (usz i=0; i<wr; i++) {
usz l = xsh[i] + 1; usz l = xsh[i] + 1;
usz m = wsh[i]; usz m = wsh[i];
if (l<m) thrM("↕: Window length 𝕨 must be at most axis length plus one"); if (l<m) thrM("𝕨𝕩: Window length 𝕨 must be at most axis length plus one");
empty|= m==0 | m==l; empty|= m==0 | m==l;
rsh[i] = l - m; rsh[i] = l - m;
} }
@ -153,9 +153,9 @@ B ud_c2(B t, B w, B x) {
ur fr=2*wr; // Frame rank in result ur fr=2*wr; // Frame rank in result
usz cia=1; // Cell length usz cia=1; // Cell length
for (usz i=fr; i<rr; i++) if (mulOn(cia, rsh[i])) thrM("↕: result shape too large"); for (usz i=fr; i<rr; i++) if (mulOn(cia, rsh[i])) thrM("𝕨𝕩: result shape too large");
usz ria=cia; usz ria=cia;
for (usz i=0; i<fr; i++) if (mulOn(ria, rsh[i])) thrM("↕: result shape too large"); for (usz i=0; i<fr; i++) if (mulOn(ria, rsh[i])) thrM("𝕨𝕩: result shape too large");
TALLOC(usz, ri, fr-1); TALLOC(usz, ri, fr-1);
MAKE_MUT_INIT(r, ria, TI(x,elType)); MAKE_MUT_INIT(r, ria, TI(x,elType));
MUTG_INIT(r); MUTG_INIT(r);
@ -233,7 +233,7 @@ extern GLOBAL B rt_find;
B find_c2(B t, B w, B x) { B find_c2(B t, B w, B x) {
ur wr = isAtm(w) ? 0 : RNK(w); ur wr = isAtm(w) ? 0 : RNK(w);
ur xr = isAtm(x) ? 0 : RNK(x); ur xr = isAtm(x) ? 0 : RNK(x);
if (wr > xr) thrF("⍷: Rank of 𝕨 must be at most rank of 𝕩 (%i≡=𝕨, %i≡=𝕩)", wr, xr); if (wr > xr) thrF("𝕨𝕩: Rank of 𝕨 must be at most rank of 𝕩 (%i≡=𝕨, %i≡=𝕩)", wr, xr);
u8 xe, we ONLY_GCC(= 0); u8 xe, we ONLY_GCC(= 0);
B r; B r;
if (xr==1 && (xe=TI(x,elType))!=el_B && xe!=el_bit && (isAtm(w) || (we=TI(w,elType))!=el_B)) { if (xr==1 && (xe=TI(x,elType))!=el_B && xe!=el_bit && (isAtm(w) || (we=TI(w,elType))!=el_B)) {

View File

@ -103,13 +103,13 @@ static i64 (*const sum_small_fns[])(void*, usz) = { sum_small_i8, sum_small_i16,
static f64 (*const sum_fns[])(void*, usz, f64) = { sum_i8, sum_i16, sum_i32, sum_f64 }; static f64 (*const sum_fns[])(void*, usz, f64) = { sum_i8, sum_i16, sum_i32, sum_f64 };
B sum_c1(B t, B x) { B sum_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrF("•math.Sum: Argument must be a list (%H ≡ ≢𝕩)", x); if (isAtm(x) || RNK(x)!=1) thrF("•math.Sum 𝕩: 𝕩 must be a list (%H ≡ ≢𝕩)", x);
usz ia = IA(x); usz ia = IA(x);
if (ia==0) { decG(x); return m_f64(0); } if (ia==0) { decG(x); return m_f64(0); }
u8 xe = TI(x,elType); u8 xe = TI(x,elType);
if (!elNum(xe)) { if (!elNum(xe)) {
x = any_squeeze(x); xe = TI(x,elType); x = any_squeeze(x); xe = TI(x,elType);
if (!elNum(xe)) thrF("•math.Sum: Argument elements must be numbers", x); if (!elNum(xe)) thrF("•math.Sum 𝕩: 𝕩 elements must be numbers", x);
} }
f64 r; f64 r;
void* xv = tyany_ptr(x); void* xv = tyany_ptr(x);
@ -180,7 +180,7 @@ static f64 (*const min_fns[])(void*, usz) = { min_i8, min_i16, min_i32, min_f64
static f64 (*const max_fns[])(void*, usz) = { max_i8, max_i16, max_i32, max_f64 }; static f64 (*const max_fns[])(void*, usz) = { max_i8, max_i16, max_i32, max_f64 };
B fold_c1(Md1D* d, B x) { B f = d->f; B fold_c1(Md1D* d, B x) { B f = d->f;
if (isAtm(x) || RNK(x)!=1) thrF("´: Argument must be a list (%H ≡ ≢𝕩)", x); if (isAtm(x) || RNK(x)!=1) thrF("𝔽´𝕩: 𝕩 must be a list (%H ≡ ≢𝕩)", x);
usz ia = IA(x); usz ia = IA(x);
if (ia<=2) { if (ia<=2) {
if (ia==2) { if (ia==2) {
@ -197,7 +197,7 @@ B fold_c1(Md1D* d, B x) { B f = d->f;
B r = TI(f,identity)(f); B r = TI(f,identity)(f);
if (!q_N(r)) return r; if (!q_N(r)) return r;
} }
thrM("´: Identity not found"); thrM("𝔽´𝕩: Identity not found");
} }
} }
if (RARE(!isFun(f))) { decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); } if (RARE(!isFun(f))) { decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); }
@ -268,7 +268,7 @@ B fold_c1(Md1D* d, B x) { B f = d->f;
} }
B fold_c2(Md1D* d, B w, B x) { B f = d->f; B fold_c2(Md1D* d, B w, B x) { B f = d->f;
if (isAtm(x) || RNK(x)!=1) thrF("´: 𝕩 must be a list (%H ≡ ≢𝕩)", x); if (isAtm(x) || RNK(x)!=1) thrF("𝕨𝔽´𝕩: 𝕩 must be a list (%H ≡ ≢𝕩)", x);
usz ia = IA(x); usz ia = IA(x);
if (RARE(ia==0)) { decG(x); return w; } if (RARE(ia==0)) { decG(x); return w; }
if (RARE(!isFun(f))) { dec(w); decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); } if (RARE(!isFun(f))) { dec(w); decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); }
@ -385,7 +385,7 @@ extern B insert_base(B f, B x, bool has_w, B w); // from cells.c
B insert_c1(Md1D* d, B x) { B f = d->f; B insert_c1(Md1D* d, B x) { B f = d->f;
ur xr; ur xr;
if (isAtm(x) || (xr=RNK(x))==0) thrM("˝: 𝕩 must have rank at least 1"); if (isAtm(x) || (xr=RNK(x))==0) thrM("𝔽˝𝕩: 𝕩 must have rank at least 1");
usz len = *SH(x); usz len = *SH(x);
if (len==0) { if (len==0) {
if (isFun(f)) { if (isFun(f)) {
@ -400,11 +400,11 @@ B insert_c1(Md1D* d, B x) { B f = d->f;
} }
decG(x); return taga(r); decG(x); return taga(r);
} else if (RTID(f) == n_join) { } else if (RTID(f) == n_join) {
if (xr <= 1) thrM("˝: Identity does not exist"); if (xr <= 1) thrM("𝔽˝𝕩: Identity does not exist");
goto join; goto join;
} }
} }
thrM("˝: Identity not found"); thrM("𝔽˝𝕩: Identity not found");
} }
if (len==1) return C1(select, x); if (len==1) return C1(select, x);
if (RARE(!isFun(f))) { decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); } if (RARE(!isFun(f))) { decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); }
@ -444,7 +444,7 @@ B insert_c1(Md1D* d, B x) { B f = d->f;
} }
B insert_c2(Md1D* d, B w, B x) { B f = d->f; B insert_c2(Md1D* d, B w, B x) { B f = d->f;
ur xr; ur xr;
if (isAtm(x) || (xr=RNK(x))==0) thrM("˝: 𝕩 must have rank at least 1"); if (isAtm(x) || (xr=RNK(x))==0) thrM("𝕨˝𝕩: 𝕩 must have rank at least 1");
usz len = *SH(x); usz len = *SH(x);
if (len==0) { decG(x); return w; } if (len==0) { decG(x); return w; }
if (RARE(!isFun(f))) { dec(w); decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); } if (RARE(!isFun(f))) { dec(w); decG(x); if (isMd(f)) thrM("Calling a modifier"); return inc(f); }

View File

@ -204,7 +204,7 @@ extern i8 (*const simd_count_i8)(u16*, u16*, void*, u64, i8);
#define SORT_C1 CAT(GRADE_UD(and,or),c1) #define SORT_C1 CAT(GRADE_UD(and,or),c1)
B SORT_C1(B t, B x) { B SORT_C1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(GRADE_UD("","")": Argument cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM(GRADE_UD("","")"𝕩: 𝕩 cannot have rank 0");
usz n = *SH(x); usz n = *SH(x);
if (n <= 1 || FL_HAS(x,GRADE_UD(fl_asc,fl_dsc))) return x; if (n <= 1 || FL_HAS(x,GRADE_UD(fl_asc,fl_dsc))) return x;
if (RNK(x)!=1) return IA(x)<=1? x : bqn_merge(SORT_C1(t, toCells(x)), 0); if (RNK(x)!=1) return IA(x)<=1? x : bqn_merge(SORT_C1(t, toCells(x)), 0);
@ -278,7 +278,7 @@ extern B grade_bool(B x, usz ia, bool up); // slash.c
#define GRADE_CHR GRADE_UD("⍋","⍒") #define GRADE_CHR GRADE_UD("⍋","⍒")
B GRADE_CAT(c1)(B t, B x) { B GRADE_CAT(c1)(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(GRADE_CHR": Argument cannot be a unit"); if (isAtm(x) || RNK(x)==0) thrM(GRADE_CHR"𝕩: 𝕩 cannot be a unit");
if (RNK(x)>1) x = toCells(x); if (RNK(x)>1) x = toCells(x);
usz ia = IA(x); usz ia = IA(x);
B r; B r;
@ -292,7 +292,7 @@ B GRADE_CAT(c1)(B t, B x) {
u8 xe = TI(x,elType); u8 xe = TI(x,elType);
if (xe==el_bit) return grade_bool(x, ia, GRADE_UD(1,0)); if (xe==el_bit) return grade_bool(x, ia, GRADE_UD(1,0));
if (ia>I32_MAX) thrM(GRADE_CHR": Argument too large"); if (ia>I32_MAX) thrM(GRADE_CHR"𝕩: 𝕩 too large");
i32* rp; r = m_i32arrv(&rp, ia); i32* rp; r = m_i32arrv(&rp, ia);
if (xe==el_i8 && ia>8) { if (xe==el_i8 && ia>8) {
i8* xp = i8any_ptr(x); usz n=ia; i8* xp = i8any_ptr(x); usz n=ia;
@ -421,13 +421,13 @@ extern B select_c2(B,B,B);
extern B mul_c2(B,B,B); extern B mul_c2(B,B,B);
B GRADE_CAT(c2)(B t, B w, B x) { B GRADE_CAT(c2)(B t, B w, B x) {
if (isAtm(w) || RNK(w)==0) thrM(GRADE_CHR": 𝕨 must have rank≥1"); if (isAtm(w) || RNK(w)==0) thrM("𝕨"GRADE_CHR"𝕩: 𝕨 must have rank≥1");
if (isAtm(x)) x = m_unit(x); if (isAtm(x)) x = m_unit(x);
ur wr = RNK(w); ur wr = RNK(w);
if (wr > 1) { if (wr > 1) {
ur xr = RNK(x); ur xr = RNK(x);
if (wr > xr+1) thrM(GRADE_CHR": =𝕨 cannot be greater than =𝕩"); if (wr > xr+1) thrM("𝕨"GRADE_CHR"𝕩: =𝕨 cannot be greater than =𝕩");
i32 nxr = xr-wr+1; i32 nxr = xr-wr+1;
x = toKCells(x, nxr); x = toKCells(x, nxr);
w = toCells(w); w = toCells(w);
@ -466,11 +466,11 @@ B GRADE_CAT(c2)(B t, B w, B x) {
} }
goto done; goto done;
} }
if (wia>I32_MAX-10) thrM(GRADE_CHR": 𝕨 too big"); if (wia>I32_MAX-10) thrM("𝕨"GRADE_CHR"𝕩: 𝕨 too big");
u8 fl = GRADE_UD(fl_asc,fl_dsc); u8 fl = GRADE_UD(fl_asc,fl_dsc);
if (CHECK_VALID && !FL_HAS(w,fl)) { if (CHECK_VALID && !FL_HAS(w,fl)) {
if (!CAT(isSorted,GRADE_UD(Up,Down))(w)) thrM(GRADE_CHR": 𝕨 must be sorted"GRADE_UD(," in descending order")); if (!CAT(isSorted,GRADE_UD(Up,Down))(w)) thrM("𝕨"GRADE_CHR"𝕩: 𝕨 must be sorted"GRADE_UD(," in descending order"));
FL_SET(w, fl); FL_SET(w, fl);
} }

View File

@ -77,7 +77,7 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) {
case el_bit: ria = xn? 1+bit_has(wp0,xn,1) : wia? bitp_get(wp0,0) : 0; break; case el_bit: ria = xn? 1+bit_has(wp0,xn,1) : wia? bitp_get(wp0,0) : 0; break;
} }
#undef CASE #undef CASE
if (bad) thrM("⊔: 𝕨 can't contain elements less than ¯1"); if (bad) thrM("𝕨𝕩: 𝕨 can't contain elements less than ¯1");
if (ria > (i64)(USZ_MAX)) thrOOM(); if (ria > (i64)(USZ_MAX)) thrOOM();
Arr* r = m_fillarr0p(ria); Arr* r = m_fillarr0p(ria);
@ -261,7 +261,7 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) {
extern GLOBAL B rt_group; extern GLOBAL B rt_group;
B group_c2(B t, B w, B x) { B group_c2(B t, B w, B x) {
if (isAtm(x)) thrM("⊔: 𝕩 must be an array"); if (isAtm(x)) thrM("𝕨𝕩: 𝕩 must be an array");
ur xr = RNK(x); ur xr = RNK(x);
if (isArr(w) && RNK(w)==1 && xr>=1) { if (isArr(w) && RNK(w)==1 && xr>=1) {
u8 we = TI(w,elType); u8 we = TI(w,elType);
@ -273,7 +273,7 @@ B group_c2(B t, B w, B x) {
usz wia = IA(w); usz wia = IA(w);
usz* xsh = SH(x); usz* xsh = SH(x);
usz xn = *xsh; usz xn = *xsh;
if (wia-(u64)xn > 1) thrF("⊔: ≠𝕨 must be either ≠𝕩 or one bigger (%s≡≠𝕨, %s≡≠𝕩)", wia, xn); if (wia-(u64)xn > 1) thrF("𝕨𝕩: ≠𝕨 must be either ≠𝕩 or one bigger (%s≡≠𝕨, %s≡≠𝕩)", wia, xn);
return group_simple(w, x, xr, wia, xn, xsh, we); return group_simple(w, x, xr, wia, xn, xsh, we);
} }
} }

View File

@ -85,9 +85,9 @@ FOR_VARIATION(F)
STATIC_GLOBAL B listVariations_def; STATIC_GLOBAL B listVariations_def;
B listVariations_c2(B t, B w, B x) { B listVariations_c2(B t, B w, B x) {
if (!isArr(x)) thrM("•internal.ListVariations: 𝕩 must be an array"); if (!isArr(x)) thrM("𝕨•internal.ListVariations𝕩: 𝕩 must be an array");
if (!isArr(w) || RNK(w)!=1) thrM("•internal.ListVariations: 𝕨 must be a list"); if (!isArr(w) || RNK(w)!=1) thrM("𝕨•internal.ListVariations𝕩: 𝕨 must be a list");
usz wia = IA(w); usz wia = IA(w);
SGetU(w) SGetU(w)
bool c_incr=false, c_rmFill=false; bool c_incr=false, c_rmFill=false;
@ -95,7 +95,7 @@ B listVariations_c2(B t, B w, B x) {
u32 c = o2c(GetU(w, i)); u32 c = o2c(GetU(w, i));
if (c=='i') c_incr=true; if (c=='i') c_incr=true;
else if (c=='f') c_rmFill=true; else if (c=='f') c_rmFill=true;
else thrF("internal.ListVariations: Unknown option '%c' in 𝕨", c); else thrF("𝕨internal.ListVariations𝕩: Unknown option '%c' in 𝕨", c);
} }
decG(w); decG(w);
@ -164,13 +164,13 @@ static bool u8_get(u8** cv, u8* cE, const char* x) {
STATIC_GLOBAL B variation_refs; STATIC_GLOBAL B variation_refs;
B variation_c2(B t, B w, B x) { B variation_c2(B t, B w, B x) {
if (!isArr(w)) thrM("•internal.Variation: Non-array 𝕨"); if (!isArr(w)) thrM("𝕨•internal.Variation𝕩: Non-array 𝕨");
if (!isArr(x)) thrM("•internal.Variation: Non-array 𝕩"); if (!isArr(x)) thrM("𝕨•internal.Variation𝕩: Non-array 𝕩");
usz xia = IA(x); usz xia = IA(x);
C8Arr* wc = toC8Arr(w); C8Arr* wc = toC8Arr(w);
u8* wp = c8arrv_ptr(wc); u8* wp = c8arrv_ptr(wc);
u8* wpE = wp+PIA(wc); u8* wpE = wp+PIA(wc);
if (PIA(wc)==0) thrM("•internal.Variation: Zero-length 𝕨"); if (PIA(wc)==0) thrM("𝕨•internal.Variation𝕩: Zero-length 𝕨");
B res; B res;
if (*wp == 'A' || *wp == 'S') { if (*wp == 'A' || *wp == 'S') {
bool slice = *wp == 'S'; bool slice = *wp == 'S';
@ -192,7 +192,7 @@ B variation_c2(B t, B w, B x) {
NOGC_E; NOGC_E;
res = taga(r); res = taga(r);
} else thrF("•internal.Variation: Bad type \"%R\"", taga(wc)); } else thrF("𝕨•internal.Variation𝕩: Bad type \"%R\"", taga(wc));
if (slice) { if (slice) {
Arr* slice = TI(res,slice)(incG(res), 0, IA(res)); Arr* slice = TI(res,slice)(incG(res), 0, IA(res));
@ -207,8 +207,8 @@ B variation_c2(B t, B w, B x) {
} }
variation_refs = vec_addN(variation_refs, incG(res)); variation_refs = vec_addN(variation_refs, incG(res));
} }
if (wp!=wpE) thrM("•internal.Variation: Bad 𝕨"); if (wp!=wpE) thrM("𝕨•internal.Variation𝕩: Bad 𝕨");
} else thrM("•internal.Variation: Bad start of 𝕨"); } else thrM("𝕨•internal.Variation𝕩: Bad start of 𝕨");
decG(x); decG(x);
ptr_dec(wc); ptr_dec(wc);
return res; return res;
@ -257,7 +257,7 @@ static B unshare(B x) {
for (usz i = 0; i < xia; i++) rp[i] = unshare(xp[i]); for (usz i = 0; i < xia; i++) rp[i] = unshare(xp[i]);
return unshareShape(r); return unshareShape(r);
} }
default: thrF("•internal.Unshare: Cannot unshare array with type %i=%S", TY(x), type_repr(TY(x))); default: thrF("𝕨•internal.Unshare𝕩: Cannot unshare array with type %i=%S", TY(x), type_repr(TY(x)));
} }
} }
@ -384,7 +384,7 @@ B iPureKeep_c1(B t, B x) { return x; }
B iKeep_c1(B t, B x) { return x; } B iKeep_c1(B t, B x) { return x; }
B iProperties_c2(B t, B w, B x) { B iProperties_c2(B t, B w, B x) {
if (w.u!=m_c32(0).u || x.u != m_c32(0).u) thrM("•internal.Properties: bad arg"); if (w.u!=m_c32(0).u || x.u != m_c32(0).u) thrM("𝕨•internal.Properties𝕩: bad arg");
i32* rp; i32* rp;
B r = m_i32arrv(&rp, 3); B r = m_i32arrv(&rp, 3);
rp[0] = sizeof(usz)*8; rp[0] = sizeof(usz)*8;
@ -394,7 +394,7 @@ B iProperties_c2(B t, B w, B x) {
} }
B unshare_c1(B t, B x) { B unshare_c1(B t, B x) {
if (!isArr(x)) thrM("•internal.Unshare: Argument must be an array"); if (!isArr(x)) thrM("•internal.Unshare𝕩: 𝕩 must be an array");
B r = unshare(x); B r = unshare(x);
decG(x); decG(x);
return r; return r;

View File

@ -70,7 +70,7 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
ur wr = RNK(w); usz wia = IA(w); ur wr = RNK(w); usz wia = IA(w);
ur xr = RNK(x); usz xia = IA(x); ur xr = RNK(x); usz xia = IA(x);
ur rr = wr+xr; usz ria = uszMul(wia, xia); ur rr = wr+xr; usz ria = uszMul(wia, xia);
if (rr<xr) thrF("⌜: Result rank too large (%i≡=𝕨, %i≡=𝕩)", wr, xr); if (rr<xr) thrF("𝕨𝔽𝕩: Result rank too large (%i≡=𝕨, %i≡=𝕩)", wr, xr);
B r; B r;
usz* rsh; usz* rsh;
@ -154,7 +154,7 @@ B swap_c2(Md1D* d, B w, B x) { return c2(d->f, x , w); }
B timed_c2(Md1D* d, B w, B x) { B f = d->f; B timed_c2(Md1D* d, B w, B x) { B f = d->f;
i64 am = o2i64(w); i64 am = o2i64(w);
if (am<=0) thrM("•_timed: 𝕨 must be an integer greater than 1"); if (am<=0) thrM("𝕨 𝔽•_timed 𝕩: 𝕨 must be an integer greater than 0");
incBy(x, am-1); incBy(x, am-1);
FC1 fc1 = c1fn(f); FC1 fc1 = c1fn(f);
u64 sns = nsTime(); u64 sns = nsTime();

View File

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

View File

@ -229,7 +229,7 @@ static B scan_plus(f64 r0, B x, u8 xe, usz ia) {
extern B scan_arith(B f, B w, B x, usz* xsh); // from cells.c extern B scan_arith(B f, B w, B x, usz* xsh); // from cells.c
B scan_c1(Md1D* d, B x) { B f = d->f; B scan_c1(Md1D* d, B x) { B f = d->f;
if (isAtm(x) || RNK(x)==0) thrM("`: Argument cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM("𝔽`𝕩: 𝕩 cannot have rank 0");
ur xr = RNK(x); ur xr = RNK(x);
usz ia = IA(x); usz ia = IA(x);
if (*SH(x)<=1 || ia==0) return x; if (*SH(x)<=1 || ia==0) return x;
@ -306,9 +306,9 @@ B scan_c1(Md1D* d, B x) { B f = d->f;
} }
B scan_c2(Md1D* d, B w, B x) { B f = d->f; B scan_c2(Md1D* d, B w, B x) { B f = d->f;
if (isAtm(x) || RNK(x)==0) thrM("`: 𝕩 cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM("𝕨𝔽`𝕩: 𝕩 cannot have rank 0");
ur xr = RNK(x); usz* xsh = SH(x); usz ia = IA(x); ur xr = RNK(x); usz* xsh = SH(x); usz ia = IA(x);
if (isArr(w)? !ptr_eqShape(SH(w), RNK(w), xsh+1, xr-1) : xr!=1) thrF("`: Shape of 𝕨 must match the cell of 𝕩 (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); if (isArr(w)? !ptr_eqShape(SH(w), RNK(w), xsh+1, xr-1) : xr!=1) thrF("𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x);
if (ia==0) { dec(w); return x; } if (ia==0) { dec(w); return x; }
if (RARE(!isFun(f))) { if (RARE(!isFun(f))) {
if (isMd(f)) thrM("Calling a modifier"); if (isMd(f)) thrM("Calling a modifier");

View File

@ -154,11 +154,11 @@ static NOINLINE B2 splitCells(B n, B p, u8 mode) { // 0:∊ 1:⊐ 2:⊒
#define SYMB (mode==0? "∊" : mode==1? "⊐" : "⊒") #define SYMB (mode==0? "∊" : mode==1? "⊐" : "⊒")
#define ARG_N (mode? "𝕩" : "𝕨") #define ARG_N (mode? "𝕩" : "𝕨")
#define ARG_P (mode? "𝕨" : "𝕩") #define ARG_P (mode? "𝕨" : "𝕩")
if (isAtm(p) || RNK(p)==0) thrF("%U: %U cannot have rank 0", SYMB, ARG_P); if (isAtm(p) || RNK(p)==0) thrF("𝕨%U𝕩: %U cannot have rank 0", SYMB, ARG_P);
ur pr = RNK(p); ur pr = RNK(p);
if (isAtm(n)) n = m_unit(n); if (isAtm(n)) n = m_unit(n);
ur nr = RNK(n); ur nr = RNK(n);
if (nr < pr-1) thrF("%U: Rank of %U must be at least the cell rank of %U (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", SYMB, ARG_N, ARG_P, mode?p:n, mode?n:p); if (nr < pr-1) thrF("𝕨%U𝕩: Rank of %U must be at least the cell rank of %U (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", SYMB, ARG_N, ARG_P, mode?p:n, mode?n:p);
ur pcr = pr-1; ur pcr = pr-1;
ur nco = nr-pcr; ur nco = nr-pcr;
if (nco>0 && eqShPart(SH(n)+nco, SH(p)+1, pcr)) { if (nco>0 && eqShPart(SH(n)+nco, SH(p)+1, pcr)) {

View File

@ -126,10 +126,10 @@ FORCE_INLINE void cf_call(CFRes f, void* r, ux rs, void* x, ux xs) {
extern GLOBAL B rt_select; extern GLOBAL B rt_select;
B select_c1(B t, B x) { B select_c1(B t, B x) {
if (isAtm(x)) thrM(": Argument cannot be an atom"); if (isAtm(x)) thrM("𝕩: 𝕩 cannot be an atom");
ur xr = RNK(x); ur xr = RNK(x);
if (xr==0) thrM(": Argument cannot be rank 0"); if (xr==0) thrM("𝕩: 𝕩 cannot be rank 0");
if (SH(x)[0]==0) thrF(": Argument shape cannot start with 0 (%H ≡ ≢𝕩)", x); if (SH(x)[0]==0) thrF("𝕩: 𝕩 shape cannot start with 0 (%H ≡ ≢𝕩)", x);
usz ia = shProd(SH(x), 1, xr); usz ia = shProd(SH(x), 1, xr);
Arr* r = TI(x,slice)(incG(x), 0, ia); Arr* r = TI(x,slice)(incG(x), 0, ia);
usz* sh = arr_shAlloc(r, xr-1); usz* sh = arr_shAlloc(r, xr-1);
@ -145,13 +145,13 @@ static NOINLINE NORETURN void select_properError(B w, B x) {
} }
B select_c2(B t, B w, B x) { B select_c2(B t, B w, B x) {
if (isAtm(x)) thrM("⊏: 𝕩 cannot be an atom"); if (isAtm(x)) thrM("𝕨𝕩: 𝕩 cannot be an atom");
ur xr = RNK(x); ur xr = RNK(x);
if (xr==0) thrM("⊏: 𝕩 cannot be a unit"); if (xr==0) thrM("𝕨𝕩: 𝕩 cannot be a unit");
if (isAtm(w)) { if (isAtm(w)) {
watom:; watom:;
usz xn = *SH(x); usz xn = *SH(x);
usz wi = WRAP(o2i64(w), xn, thrF("⊏: Indexing out-of-bounds (%R∊𝕨, %s≡≠𝕩)", w, xn)); usz wi = WRAP(o2i64(w), xn, thrF("𝕨𝕩: Indexing out-of-bounds (%R∊𝕨, %s≡≠𝕩)", w, xn));
if (xr==1) { if (xr==1) {
B xf = getFillR(x); B xf = getFillR(x);
B xv = IGet(x, wi); B xv = IGet(x, wi);
@ -220,7 +220,7 @@ B select_c2(B t, B w, B x) {
#else #else
#define CASE(S, E) case S: for (usz i=i0; i<i1; i++) ((E*)rp)[i] = ((E*)xp+off)[ip[i]]; break #define CASE(S, E) case S: for (usz i=i0; i<i1; i++) ((E*)rp)[i] = ((E*)xp+off)[ip[i]]; break
#define CASEW(S, E) case S: for (usz i=0; i<wia; i++) ((E*)rp)[i] = ((E*)xp)[WRAP(wp[i], xn, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn))]; break #define CASEW(S, E) case S: for (usz i=0; i<wia; i++) ((E*)rp)[i] = ((E*)xp)[WRAP(wp[i], xn, thrF("𝕨𝕩: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn))]; break
#define CPUSEL(W, NEXT) /*assumes 3≤xl≤6*/ \ #define CPUSEL(W, NEXT) /*assumes 3≤xl≤6*/ \
if (sizeof(W) >= 4) { \ if (sizeof(W) >= 4) { \
switch(xl) { default:UD; CASEW(3,u8); CASEW(4,u16); CASEW(5,u32); CASEW(6,u64); } \ switch(xl) { default:UD; CASEW(3,u8); CASEW(4,u16); CASEW(5,u32); CASEW(6,u64); } \
@ -298,8 +298,8 @@ B select_c2(B t, B w, B x) {
if (xl!=6) goto generic_l; \ if (xl!=6) goto generic_l; \
M_HARR(ra, wia); B* xp = arr_bptr(x); \ M_HARR(ra, wia); B* xp = arr_bptr(x); \
SLOWIF(xp==NULL) SLOW2("𝕨⊏𝕩", w, x); \ SLOWIF(xp==NULL) SLOW2("𝕨⊏𝕩", w, x); \
if (xp!=NULL) { for (usz i=0; i<wia; i++) HARR_ADD(ra, i, inc(xp[WRAP(wp[i], xia, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn))])); } \ if (xp!=NULL) { for (usz i=0; i<wia; i++) HARR_ADD(ra, i, inc(xp[WRAP(wp[i], xia, thrF("𝕨𝕩: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn))])); } \
else { SGet(x); for (usz i=0; i<wia; i++) HARR_ADD(ra, i, Get(x, WRAP(wp[i], xia, thrF("⊏: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn)) )); } \ else { SGet(x); for (usz i=0; i<wia; i++) HARR_ADD(ra, i, Get(x, WRAP(wp[i], xia, thrF("𝕨𝕩: Indexing out-of-bounds (%i∊𝕨, %s≡≠𝕩)", wp[i], xn)) )); } \
r = a(withFill(HARR_FV(ra), xf)); goto setsh; \ r = a(withFill(HARR_FV(ra), xf)); goto setsh; \
} }
@ -320,7 +320,7 @@ B select_c2(B t, B w, B x) {
if (xia<2) { if (xia<2) {
u64* wp=bitany_ptr(w); u64* wp=bitany_ptr(w);
usz i; for (i=0; i<wia/64; i++) if (wp[i]) break; usz i; for (i=0; i<wia/64; i++) if (wp[i]) break;
if (i<wia/64 || bitp_l0(wp,wia)!=0) thrF("⊏: Indexing out-of-bounds (1∊𝕨, %s≡≠𝕩)", xn); if (i<wia/64 || bitp_l0(wp,wia)!=0) thrF("𝕨𝕩: Indexing out-of-bounds (1∊𝕨, %s≡≠𝕩)", xn);
x1 = x0; x1 = x0;
} else { } else {
x1 = GetU(x,1); x1 = GetU(x,1);
@ -387,14 +387,14 @@ B select_c2(B t, B w, B x) {
bad1:; bad1:;
mut_pfree(rm, i*csz); mut_pfree(rm, i*csz);
if (!q_fi64(badw)) expI_f64(badw); if (!q_fi64(badw)) expI_f64(badw);
thrF("⊏: Indexing out-of-bounds (%f∊𝕨, %s≡≠𝕩)", badw, xn); thrF("𝕨𝕩: Indexing out-of-bounds (%f∊𝕨, %s≡≠𝕩)", badw, xn);
} }
setsh: setsh:
if (rr>1) { if (rr>1) {
if (rr > UR_MAX) thrF("⊏: Result rank too large (%i≡=𝕨, %i≡=𝕩)", wr, xr); if (rr > UR_MAX) thrF("𝕨𝕩: Result rank too large (%i≡=𝕨, %i≡=𝕩)", wr, xr);
ShArr* sh = m_shArr(rr); ShArr* sh = m_shArr(rr);
shcpy(sh->a, SH(w), wr); shcpy(sh->a, SH(w), wr);
shcpy(sh->a+wr, SH(x)+1, xr-1); shcpy(sh->a+wr, SH(x)+1, xr-1);
@ -915,7 +915,7 @@ B select_rows_B(B x, ux csz, ux cam, B inds) { // consumes inds,x; ⥊ inds⊸
if (in == 0) return taga(emptyArr(x, 1)); if (in == 0) return taga(emptyArr(x, 1));
if (in == 1) { if (in == 1) {
B w = IGetU(inds,0); if (!isF64(w)) goto generic; B w = IGetU(inds,0); if (!isF64(w)) goto generic;
B r = select_cells_single(WRAP(o2i64(w), csz, thrF("⊏: Indexing out-of-bounds (%R∊𝕨, %s≡≠𝕩)", w, csz)), x, cam, csz, 1, false); B r = select_cells_single(WRAP(o2i64(w), csz, thrF("𝕨𝕩: Indexing out-of-bounds (%R∊𝕨, %s≡≠𝕩)", w, csz)), x, cam, csz, 1, false);
decG(x); decG(inds); return r; decG(x); decG(inds); return r;
} }
u8 ie = TI(inds,elType); u8 ie = TI(inds,elType);

View File

@ -155,7 +155,7 @@ extern u64 (*const simd_deduplicate_u8)(void*,uint64_t,void*,void*);
#define PRUP ptr_roundUpToEl #define PRUP ptr_roundUpToEl
B memberOf_c1(B t, B x) { B memberOf_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(": Argument cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM("𝕩: 𝕩 cannot have rank 0");
u64 n = *SH(x); u64 n = *SH(x);
if (n<=1) { decG(x); return n ? taga(arr_shVec(allOnes(1))) : emptyIVec(); } if (n<=1) { decG(x); return n ? taga(arr_shVec(allOnes(1))) : emptyIVec(); }
@ -288,10 +288,10 @@ B memberOf_c1(B t, B x) {
} }
B count_c1(B t, B x) { B count_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(": Argument cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM("𝕩: 𝕩 cannot have rank 0");
u64 n = *SH(x); u64 n = *SH(x);
if (n<=1) { decG(x); return n ? taga(arr_shVec(allZeroes(1))) : emptyIVec(); } if (n<=1) { decG(x); return n ? taga(arr_shVec(allZeroes(1))) : emptyIVec(); }
if (n>(usz)I32_MAX+1) thrM(": Argument length >2⋆31 not supported"); if (n>(usz)I32_MAX+1) thrM("𝕩: 𝕩 length >2⋆31 not supported");
usz csz = arr_csz(x); usz csz = arr_csz(x);
if (csz==0) { decG(x); return C1(ud, m_f64(n)); } if (csz==0) { decG(x); return C1(ud, m_f64(n)); }
@ -401,10 +401,10 @@ static B reduceI32WidthBelow(B r, usz after) {
B find_c1(B, B); B find_c1(B, B);
B indexOf_c1(B t, B x) { B indexOf_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(": 𝕩 cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM("𝕩: 𝕩 cannot have rank 0");
u64 n = *SH(x); u64 n = *SH(x);
if (n<=1) { zeroRes: decG(x); return n? taga(arr_shVec(allZeroesFl(n))) : emptyIVec(); } if (n<=1) { zeroRes: decG(x); return n? taga(arr_shVec(allZeroesFl(n))) : emptyIVec(); }
if (n>(usz)I32_MAX+1) thrM(": Argument length >2⋆31 not supported"); if (n>(usz)I32_MAX+1) thrM("𝕩: 𝕩 length >2⋆31 not supported");
usz csz = arr_csz(x); usz csz = arr_csz(x);
if (csz==0) goto zeroRes; if (csz==0) goto zeroRes;
@ -516,7 +516,7 @@ B indexOf_c1(B t, B x) {
} }
B find_c1(B t, B x) { B find_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(": Argument cannot have rank 0"); if (isAtm(x) || RNK(x)==0) thrM("𝕩: 𝕩 cannot have rank 0");
usz n = *SH(x); usz n = *SH(x);
if (n<=1) return x; if (n<=1) return x;
u8 xe = TI(x,elType); u8 xe = TI(x,elType);

View File

@ -209,8 +209,8 @@ B shape_c2(B t, B w, B x) {
sh = NULL; sh = NULL;
} else { } else {
if (RARE(isAtm(w))) w = m_unit(w); if (RARE(isAtm(w))) w = m_unit(w);
if (RNK(w)>1) thrM("⥊: 𝕨 must have rank at most 1"); if (RNK(w)>1) thrM("𝕨𝕩: 𝕨 must have rank at most 1");
if (IA(w)>UR_MAX) thrM("⥊: Result rank too large"); if (IA(w)>UR_MAX) thrM("𝕨𝕩: Result rank too large");
nr = IA(w); nr = IA(w);
sh = nr<=1? NULL : m_shArr(nr); sh = nr<=1? NULL : m_shArr(nr);
SGetU(w) SGetU(w)
@ -225,24 +225,24 @@ B shape_c2(B t, B w, B x) {
bad|= mulOn(nia, v); bad|= mulOn(nia, v);
good|= v==0; good|= v==0;
} else { } else {
if (isArr(c) || !isVal(c)) thrM("⥊: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑"); if (isArr(c) || !isVal(c)) thrM("𝕨𝕩: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
if (unkPos!=-1) thrM("⥊: 𝕨 contained multiple computed axes"); if (unkPos!=-1) thrM("𝕨𝕩: 𝕨 contained multiple computed axes");
unkPos = i; unkPos = i;
if (!isPrim(c)) thrM("⥊: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑"); if (!isPrim(c)) thrM("𝕨𝕩: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
unkInd = RTID(c); unkInd = RTID(c);
good|= xia==0 | unkInd==n_floor; good|= xia==0 | unkInd==n_floor;
} }
} }
if (bad && !good) thrM("⥊: 𝕨 too large"); if (bad && !good) thrM("𝕨𝕩: 𝕨 too large");
if (unkPos!=-1) { if (unkPos!=-1) {
if (unkInd!=n_atop & unkInd!=n_floor & unkInd!=n_reverse & unkInd!=n_take) thrM("⥊: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑"); if (unkInd!=n_atop & unkInd!=n_floor & unkInd!=n_reverse & unkInd!=n_take) thrM("𝕨𝕩: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
if (nia==0) thrM("⥊: Can't compute axis when the rest of the shape is empty"); if (nia==0) thrM("𝕨𝕩: Can't compute axis when the rest of the shape is empty");
i64 div = xia/nia; i64 div = xia/nia;
i64 mod = xia%nia; i64 mod = xia%nia;
usz item; usz item;
bool fill = false; bool fill = false;
if (unkInd == n_atop) { if (unkInd == n_atop) {
if (mod!=0) thrM("⥊: Shape must be exact when reshaping with ∘"); if (mod!=0) thrM("𝕨𝕩: Shape must be exact when reshaping with ∘");
item = div; item = div;
} else if (unkInd == n_floor) { } else if (unkInd == n_floor) {
item = div; item = div;
@ -269,7 +269,7 @@ B shape_c2(B t, B w, B x) {
return truncReshape(x, xia, nia, nr, sh); return truncReshape(x, xia, nia, nr, sh);
} else { } else {
if (xia <= 1) { if (xia <= 1) {
if (RARE(xia == 0)) thrM("⥊: Empty 𝕩 and non-empty result"); if (RARE(xia == 0)) thrM("𝕨𝕩: Empty 𝕩 and non-empty result");
x = TO_GET(x, 0); x = TO_GET(x, 0);
goto unit; goto unit;
} }
@ -351,7 +351,7 @@ B shape_c2(B t, B w, B x) {
B pick_c1(B t, B x) { B pick_c1(B t, B x) {
if (isAtm(x)) return x; if (isAtm(x)) return x;
if (RARE(IA(x)==0)) { if (RARE(IA(x)==0)) {
thrM(": Argument cannot be empty"); thrM("𝕩: 𝕩 cannot be empty");
// B r = getFillE(x); // B r = getFillE(x);
// dec(x); // dec(x);
// return r; // return r;
@ -362,10 +362,10 @@ B pick_c1(B t, B x) {
static NOINLINE void checkIndexList(B w, ur xr) { static NOINLINE void checkIndexList(B w, ur xr) {
SGetU(w) SGetU(w)
usz ia = IA(w); usz ia = IA(w);
for (usz i = 0; i < ia; i++) if (!isNum(GetU(w,i))) thrM("⊑: 𝕨 contained list with mixed-type elements"); for (usz i = 0; i < ia; i++) if (!isNum(GetU(w,i))) thrM("𝕨𝕩: 𝕨 contained list with mixed-type elements");
if (ia>xr+xr+10) { if (ia>xr+xr+10) {
if (RNK(w)!=1) thrF("⊑: Leaf arrays in 𝕨 must have rank 1 (element in 𝕨 has shape %H)", w); if (RNK(w)!=1) thrF("𝕨𝕩: Leaf arrays in 𝕨 must have rank 1 (element in 𝕨 has shape %H)", w);
thrF("⊑: Leaf array in 𝕨 too large (has shape %H)", w); thrF("𝕨𝕩: Leaf array in 𝕨 too large (has shape %H)", w);
} }
} }
@ -378,7 +378,7 @@ static NOINLINE void checkIndexList(B w, ur xr) {
static i64 pick_convFloat(f64 f) { static i64 pick_convFloat(f64 f) {
if (LIKELY(q_fi64(f))) return (i64)f; if (LIKELY(q_fi64(f))) return (i64)f;
thrM("⊑: 𝕨 contained a non-integer"); thrM("𝕨𝕩: 𝕨 contained a non-integer");
} }
static B recPick(B w, B x) { // doesn't consume static B recPick(B w, B x) { // doesn't consume
@ -394,7 +394,7 @@ static B recPick(B w, B x) { // doesn't consume
case el_c8: case el_c16: case el_c32: case el_bit: case el_c8: case el_c16: case el_c32: case el_bit:
case el_B: { case el_B: {
if (ia==0) { if (ia==0) {
if (xr!=0) thrM("⊑: 𝕩 must be a unit if 𝕨 contains an empty array"); if (xr!=0) thrM("𝕨𝕩: 𝕩 must be a unit if 𝕨 contains an empty array");
return IGet(x,0); return IGet(x,0);
} }
SGetU(w) SGetU(w)
@ -403,7 +403,7 @@ static B recPick(B w, B x) { // doesn't consume
if (ia!=xr) goto wrl; if (ia!=xr) goto wrl;
PICK_IDX(c, ({ PICK_IDX(c, ({
B cw = GetU(w,i); B cw = GetU(w,i);
if (!isNum(cw)) thrM("⊑: 𝕨 contained list with mixed-type elements"); if (!isNum(cw)) thrM("𝕨𝕩: 𝕨 contained list with mixed-type elements");
o2i64(cw); o2i64(cw);
}), ia, goto oob); }), ia, goto oob);
return IGet(x,c); return IGet(x,c);
@ -411,7 +411,7 @@ static B recPick(B w, B x) { // doesn't consume
M_HARR(r, ia); M_HARR(r, ia);
for (usz i=0; i<ia; i++) { for (usz i=0; i<ia; i++) {
B c = GetU(w, i); B c = GetU(w, i);
if (isAtm(c)) thrM("⊑: 𝕨 contained list with mixed-type elements"); if (isAtm(c)) thrM("𝕨𝕩: 𝕨 contained list with mixed-type elements");
HARR_ADD(r, i, recPick(c, x)); HARR_ADD(r, i, recPick(c, x));
} }
return any_squeeze(HARR_FC(r, w)); return any_squeeze(HARR_FC(r, w));
@ -420,9 +420,9 @@ static B recPick(B w, B x) { // doesn't consume
} }
#undef PICK #undef PICK
wrr: checkIndexList(w, xr); thrF("⊑: Leaf arrays in 𝕨 must have rank 1 (element: %B)", w); // wrong index rank wrr: checkIndexList(w, xr); thrF("𝕨𝕩: Leaf arrays in 𝕨 must have rank 1 (element: %B)", w); // wrong index rank
wrl: checkIndexList(w, xr); thrF("⊑: Picking item at wrong rank (index %B in array of shape %H)", w, x); // wrong index length wrl: checkIndexList(w, xr); thrF("𝕨𝕩: Picking item at wrong rank (index %B in array of shape %H)", w, x); // wrong index length
oob: checkIndexList(w, xr); thrF("⊑: Indexing out-of-bounds (index %B in array of shape %H)", w, x); oob: checkIndexList(w, xr); thrF("𝕨𝕩: Indexing out-of-bounds (index %B in array of shape %H)", w, x);
} }
B pick_c2(B t, B w, B x) { B pick_c2(B t, B w, B x) {
@ -431,18 +431,18 @@ B pick_c2(B t, B w, B x) {
x = m_unit(x); x = m_unit(x);
} }
if (isNum(w)) { if (isNum(w)) {
if (RNK(x)!=1) thrF("⊑: 𝕩 must be a list when 𝕨 is a number (%H ≡ ≢𝕩)", x); if (RNK(x)!=1) thrF("𝕨𝕩: 𝕩 must be a list when 𝕨 is a number (%H ≡ ≢𝕩)", x);
usz p = WRAP(o2i64(w), IA(x), thrF("⊑: indexing out-of-bounds (𝕨≡%R, %s≡≠𝕩)", w, iaW)); usz p = WRAP(o2i64(w), IA(x), thrF("𝕨𝕩: indexing out-of-bounds (𝕨≡%R, %s≡≠𝕩)", w, iaW));
return TO_GET(x, p); return TO_GET(x, p);
} }
if (!isArr(w)) thrM("⊑: 𝕨 must be a numeric array"); if (!isArr(w)) thrM("𝕨𝕩: 𝕨 must be a numeric array");
B r = recPick(w, x); B r = recPick(w, x);
decG(w); decG(x); decG(w); decG(x);
return r; return r;
} }
FORCE_INLINE B affixes(B x, i32 post) { FORCE_INLINE B affixes(B x, i32 post) {
if (!isArr(x) || RNK(x)==0) thrM(post? ": Argument must have rank at least 1" : "↑: Argument must have rank at least 1"); if (!isArr(x) || RNK(x)==0) thrM(post? "𝕩: 𝕩 must have rank at least 1" : "↑𝕩: 𝕩 must have rank at least 1");
ur xr = RNK(x); ur xr = RNK(x);
usz* xsh = SH(x); usz* xsh = SH(x);
u64 cam = *xsh; u64 cam = *xsh;
@ -480,9 +480,9 @@ NOINLINE B takedrop_highrank(bool take, B w, B x) {
#define SYMB (take? "↑" : "↓") #define SYMB (take? "↑" : "↓")
if (!isArr(w)) goto nonint; if (!isArr(w)) goto nonint;
ur wr = RNK(w); ur wr = RNK(w);
if (wr>1) thrF("%U: 𝕨 must have rank at most 1 (%H ≡ ≢𝕨)", SYMB, w); if (wr>1) thrF("𝕨%U𝕩: 𝕨 must have rank at most 1 (%H ≡ ≢𝕨)", SYMB, w);
usz wia = IA(w); usz wia = IA(w);
if (wia >= UR_MAX) thrF("%U: Result rank too large", SYMB); if (wia >= UR_MAX) thrF("𝕨%U𝕩: Result rank too large", SYMB);
B r, w0; B r, w0;
if (wia<=1) { if (wia<=1) {
if (wia==0) { r = x; goto decW_ret; } if (wia==0) { r = x; goto decW_ret; }
@ -551,7 +551,7 @@ NOINLINE B takedrop_highrank(bool take, B w, B x) {
B xf = getFillR(x); B xf = getFillR(x);
if (anyFill && noFill(xf)) { if (anyFill && noFill(xf)) {
#if PROPER_FILLS #if PROPER_FILLS
thrM("↑: fill element required for overtaking, but 𝕩 doesn't have one"); thrM("𝕨𝕩: fill element required for overtaking, but 𝕩 doesn't have one");
#else #else
xf = m_f64(0); xf = m_f64(0);
#endif #endif
@ -636,7 +636,7 @@ NOINLINE B takedrop_highrank(bool take, B w, B x) {
decW_ret: decG(w); decW_ret: decG(w);
return r; return r;
nonint: thrF("%U: 𝕨 must consist of integers", SYMB); nonint: thrF("𝕨%U𝕩: 𝕨 must consist of integers", SYMB);
#undef SYMB #undef SYMB
} }
@ -714,7 +714,7 @@ B drop_c2(B t, B w, B x) {
B join_c1(B t, B x) { B join_c1(B t, B x) {
if (isAtm(x)) thrM(": Argument must be an array"); if (isAtm(x)) thrM("𝕩: 𝕩 must be an array");
ur xr = RNK(x); ur xr = RNK(x);
usz xia = IA(x); usz xia = IA(x);
@ -724,10 +724,10 @@ B join_c1(B t, B x) {
if (isAtm(xf)) { if (isAtm(xf)) {
decA(xf); decG(x); decA(xf); decG(x);
if (!PROPER_FILLS && xr==1) return emptyHVec(); if (!PROPER_FILLS && xr==1) return emptyHVec();
thrM(": Empty array 𝕩 cannot have an atom fill element"); thrM("𝕩: Empty array 𝕩 cannot have an atom fill element");
} }
ur ir = RNK(xf); ur ir = RNK(xf);
if (ir<xr) thrF(": Empty array 𝕩 fill rank must be at least rank of 𝕩 (shape %H and fill shape %H)", x, xf); if (ir<xr) thrF("𝕩: Empty array 𝕩 fill rank must be at least rank of 𝕩 (shape %H and fill shape %H)", x, xf);
HArr_p r = m_harrUp(0); HArr_p r = m_harrUp(0);
usz* sh = arr_shAlloc((Arr*)r.c, ir); usz* sh = arr_shAlloc((Arr*)r.c, ir);
if (sh) { if (sh) {
@ -763,20 +763,20 @@ B join_c1(B t, B x) {
B c = GetU(x, i); B c = GetU(x, i);
ur cr = isAtm(c) ? 0 : RNK(c); ur cr = isAtm(c) ? 0 : RNK(c);
if (cr == 0) { if (cr == 0) {
if (rm > 1) thrF(": Item ranks in a list can differ by at most one (contained ranks %i and %i)", 0, rm); if (rm > 1) thrF("𝕩: Item ranks in a list can differ by at most one (contained ranks %i and %i)", 0, rm);
rd=rm; cam++; rd=rm; cam++;
} else { } else {
usz* csh = SH(c); usz* csh = SH(c);
ur cd = rm - cr; ur cd = rm - cr;
if (RARE(cd > rd)) { if (RARE(cd > rd)) {
if ((ur)(cd+1-rd) > 2-rd) thrF(": Item ranks in a list can differ by at most one (contained ranks %i and %i)", rm-rd*(cr==rm), cr); if ((ur)(cd+1-rd) > 2-rd) thrF("𝕩: Item ranks in a list can differ by at most one (contained ranks %i and %i)", rm-rd*(cr==rm), cr);
if (cr > rr) { // Previous elements were cells if (cr > rr) { // Previous elements were cells
assert(rd==0 && rr>0); assert(rd==0 && rr>0);
esh--; esh--;
usz l = *esh; usz l = *esh;
for (usz j=1; j<i; j++) { for (usz j=1; j<i; j++) {
B xj = GetU(x,j); B xj = GetU(x,j);
if (l != *SH(xj)) thrF(": Item trailing shapes must be equal (contained arrays with shapes %H and %H and later higher-rank array)", x0, xj); if (l != *SH(xj)) thrF("𝕩: Item trailing shapes must be equal (contained arrays with shapes %H and %H and later higher-rank array)", x0, xj);
} }
rr=cr; cam=i; rr=cr; cam=i;
} }
@ -784,11 +784,11 @@ B join_c1(B t, B x) {
rd = 1; rd = 1;
} }
cam += cr < rm ? 1 : *csh++; cam += cr < rm ? 1 : *csh++;
if (!eqShPart(csh, esh, rm-1)) thrF(": Item trailing shapes must be equal (contained arrays with shapes %H and %H)", x0, c); if (!eqShPart(csh, esh, rm-1)) thrF("𝕩: Item trailing shapes must be equal (contained arrays with shapes %H and %H)", x0, c);
} }
if (SFNS_FILLS && !noFill(rf) && !fillEqualsGetFill(rf, c)) { dec(rf); rf = bi_noFill; } if (SFNS_FILLS && !noFill(rf) && !fillEqualsGetFill(rf, c)) { dec(rf); rf = bi_noFill; }
} }
if (rm==0) thrM(": Some item rank must be equal or greater than rank of argument"); if (rm==0) thrM("𝕩: Some item rank must be equal or greater than rank of argument");
usz csz = shProd(esh, 0, rr-1); usz csz = shProd(esh, 0, rr-1);
M_APD_TOT(r, cam*csz); M_APD_TOT(r, cam*csz);
@ -827,7 +827,7 @@ B join_c1(B t, B x) {
usz n = xsh[a]; usz n = xsh[a];
usz *ll = lp+lp[a]; usz *ll = lp+lp[a];
if (n == 1) { if (n == 1) {
if (!tr) thrM(": Ranks of argument items too small"); if (!tr) thrM("𝕩: Ranks of argument items too small");
st[a] = ll[0] = SH(x0)[r0-tr]; st[a] = ll[0] = SH(x0)[r0-tr];
tr--; continue; tr--; continue;
} }
@ -840,11 +840,11 @@ B join_c1(B t, B x) {
usz r1s=r0; for (usz i=1; i<n; i++) if (ll[i]>r1s) r1s=ll[i]; usz r1s=r0; for (usz i=1; i<n; i++) if (ll[i]>r1s) r1s=ll[i];
ur r1 = r1s; ur r1 = r1s;
ur a0 = r1==r0; // Root has axis a ur a0 = r1==r0; // Root has axis a
if (tr < a0) thrM(": Ranks of argument items too small"); if (tr < a0) thrM("𝕩: Ranks of argument items too small");
for (usz i=0; i<n; i++) { for (usz i=0; i<n; i++) {
ur rd = r1 - ll[i]; ur rd = r1 - ll[i];
if (rd) { if (rd) {
if (rd>1) thrF(": Item ranks along an axis can differ by at most one (contained ranks %i and %i along axis %i)", ll[i], r1, a); if (rd>1) thrF("𝕩: Item ranks along an axis can differ by at most one (contained ranks %i and %i along axis %i)", ll[i], r1, a);
ll[i] = -1; ll[i] = -1;
} else { } else {
B c = GetU(x, i*step); B c = GetU(x, i*step);
@ -870,8 +870,8 @@ B join_c1(B t, B x) {
bool rd = ll[i]==-1; bool rd = ll[i]==-1;
tsh[lr] = ll[i]; tsh[lr] = ll[i];
ur cr=0; usz* sh=NULL; if (!isAtm(c)) { cr=RNK(c); sh=SH(c); } ur cr=0; usz* sh=NULL; if (!isAtm(c)) { cr=RNK(c); sh=SH(c); }
if (cr != r1-rd) thrF(": Incompatible item ranks", base, c); if (cr != r1-rd) thrF("𝕩: Incompatible item ranks", base, c);
if (!eqShPart(rd?tsh0:tsh, sh, cr)) thrF(": Incompatible item shapes (contained arrays with shapes %H and %H along axis %i)", base, c, a); if (!eqShPart(rd?tsh0:tsh, sh, cr)) thrF("𝕩: Incompatible item shapes (contained arrays with shapes %H and %H along axis %i)", base, c, a);
if (SFNS_FILLS && !noFill(rf) && !fillEqualsGetFill(rf, c)) { dec(rf); rf = bi_noFill; } if (SFNS_FILLS && !noFill(rf) && !fillEqualsGetFill(rf, c)) { dec(rf); rf = bi_noFill; }
} }
} }
@ -967,7 +967,7 @@ B join_c2(B t, B w, B x) {
NOGC_E; NOGC_E;
return qWithFill(r.b, f); return qWithFill(r.b, f);
} }
if (c-wr > 1 || c-xr > 1) thrF("∾: Argument ranks must differ by 1 or less (%i≡=𝕨, %i≡=𝕩)", wr, xr); if (c-wr > 1 || c-xr > 1) thrF("𝕨𝕩: Argument ranks must differ by 1 or less (%i≡=𝕨, %i≡=𝕩)", wr, xr);
bool usedW; bool usedW;
usz wia0 = IA(w); usz wia0 = IA(w);
@ -993,7 +993,7 @@ B join_c2(B t, B w, B x) {
for (i32 i = 1; i < c; i++) { for (i32 i = 1; i < c; i++) {
usz s = xsh[i+xr-c]; usz s = xsh[i+xr-c];
if (RARE(wsh[i+wr-c] != s)) { if (RARE(wsh[i+wr-c] != s)) {
B msg = make_fmt("∾: Lengths not matchable (%2H ≡ ≢𝕨, %H ≡ ≢𝕩)", wr, wsh, x); B msg = make_fmt("𝕨𝕩: Lengths not matchable (%2H ≡ ≢𝕨, %H ≡ ≢𝕩)", wr, wsh, x);
if (rnk0>1) decShObj(sh0); if (rnk0>1) decShObj(sh0);
mm_free((Value*)shObjS(rsh)); mm_free((Value*)shObjS(rsh));
arr_shVec(a(r)); arr_shVec(a(r));
@ -1014,7 +1014,7 @@ B join_c2(B t, B w, B x) {
B couple_c1(B t, B x) { B couple_c1(B t, B x) {
if (isAtm(x)) return m_vec1(x); if (isAtm(x)) return m_vec1(x);
ur xr = RNK(x); ur xr = RNK(x);
if (xr==UR_MAX) thrF(": Result rank too large (%i≡=𝕩)", xr); if (xr==UR_MAX) thrF("𝕩: Result rank too large (%i≡=𝕩)", xr);
Arr* r = cpyWithShape(x); Arr* r = cpyWithShape(x);
if (xr==0) { if (xr==0) {
arr_shVec(r); arr_shVec(r);
@ -1030,10 +1030,10 @@ B couple_c2(B t, B w, B x) {
if (isAtm(w)&isAtm(x)) return m_vec2(w, x); if (isAtm(w)&isAtm(x)) return m_vec2(w, x);
if (isAtm(w)) w = m_unit(w); if (isAtm(w)) w = m_unit(w);
if (isAtm(x)) x = m_unit(x); if (isAtm(x)) x = m_unit(x);
if (!eqShape(w, x)) thrF("≍: 𝕨 and 𝕩 must have equal shapes (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); if (!eqShape(w, x)) thrF("𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x);
usz ia = IA(w); usz ia = IA(w);
ur wr = RNK(w); ur wr = RNK(w);
if (wr==UR_MAX) thrM("≍: Result rank too large"); if (wr==UR_MAX) thrM("𝕨𝕩: Result rank too large");
MAKE_MUT_INIT(r, ia*2, el_or(TI(w,elType), TI(x,elType))); MUTG_INIT(r); MAKE_MUT_INIT(r, ia*2, el_or(TI(w,elType), TI(x,elType))); MUTG_INIT(r);
mut_copyG(r, 0, w, 0, ia); mut_copyG(r, 0, w, 0, ia);
mut_copyG(r, ia, x, 0, ia); mut_copyG(r, ia, x, 0, ia);
@ -1055,7 +1055,7 @@ static inline void shift_check(B w, B x) {
} }
B shiftb_c1(B t, B x) { B shiftb_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM("»: Argument cannot be a scalar"); if (isAtm(x) || RNK(x)==0) thrM("»𝕩: 𝕩 cannot be a scalar");
usz ia = IA(x); usz ia = IA(x);
if (ia==0) return x; if (ia==0) return x;
B xf = getFillE(x); B xf = getFillE(x);
@ -1070,7 +1070,7 @@ B shiftb_c1(B t, B x) {
return qWithFill(mut_fcd(r, x), xf); return qWithFill(mut_fcd(r, x), xf);
} }
B shiftb_c2(B t, B w, B x) { B shiftb_c2(B t, B w, B x) {
if (isAtm(x) || RNK(x)==0) thrM("»: 𝕩 cannot be a scalar"); if (isAtm(x) || RNK(x)==0) thrM("𝕨»𝕩: 𝕩 cannot be a scalar");
if (isAtm(w)) w = m_unit(w); if (isAtm(w)) w = m_unit(w);
shift_check(w, x); shift_check(w, x);
B f = fill_both(w, x); B f = fill_both(w, x);
@ -1085,7 +1085,7 @@ B shiftb_c2(B t, B w, B x) {
} }
B shifta_c1(B t, B x) { B shifta_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM("«: Argument cannot be a scalar"); if (isAtm(x) || RNK(x)==0) thrM("«𝕩: 𝕩 cannot be a scalar");
usz ia = IA(x); usz ia = IA(x);
if (ia==0) return x; if (ia==0) return x;
B xf = getFillE(x); B xf = getFillE(x);
@ -1100,7 +1100,7 @@ B shifta_c1(B t, B x) {
return qWithFill(mut_fcd(r, x), xf); return qWithFill(mut_fcd(r, x), xf);
} }
B shifta_c2(B t, B w, B x) { B shifta_c2(B t, B w, B x) {
if (isAtm(x) || RNK(x)==0) thrM("«: 𝕩 cannot be a scalar"); if (isAtm(x) || RNK(x)==0) thrM("𝕨«𝕩: 𝕩 cannot be a scalar");
if (isAtm(w)) w = m_unit(w); if (isAtm(w)) w = m_unit(w);
shift_check(w, x); shift_check(w, x);
B f = fill_both(w, x); B f = fill_both(w, x);
@ -1126,7 +1126,7 @@ static u64 bit_reverse(u64 x) {
return c; return c;
} }
B reverse_c1(B t, B x) { B reverse_c1(B t, B x) {
if (isAtm(x) || RNK(x)==0) thrM(": Argument cannot be a unit"); if (isAtm(x) || RNK(x)==0) thrM("𝕩: 𝕩 cannot be a unit");
usz n = *SH(x); usz n = *SH(x);
if (n<=1) return x; if (n<=1) return x;
u8 xl = cellWidthLog(x); u8 xl = cellWidthLog(x);
@ -1282,7 +1282,7 @@ NOINLINE B rotate_highrank(bool inv, B w, B x) {
} }
B reverse_c2(B t, B w, B x) { B reverse_c2(B t, B w, B x) {
if (isArr(w)) return rotate_highrank(0, w, x); if (isArr(w)) return rotate_highrank(0, w, x);
if (isAtm(x) || RNK(x)==0) thrM("⌽: 𝕩 must have rank at least 1 for atom 𝕨"); if (isAtm(x) || RNK(x)==0) thrM("𝕨𝕩: 𝕩 must have rank at least 1 for atom 𝕨");
usz xia = IA(x); usz xia = IA(x);
if (xia==0) { o2i64(w); return x; } if (xia==0) { o2i64(w); return x; }
usz cam = SH(x)[0]; usz cam = SH(x)[0];
@ -1312,13 +1312,13 @@ static usz pick_oneIndex(B w, usz xr, usz* xsh) { // throws if guaranteed bad; r
if (!isNum(GetU(w,0))) return USZ_MAX; if (!isNum(GetU(w,0))) return USZ_MAX;
PICK_IDX(c, ({ PICK_IDX(c, ({
B cw = GetU(w,i); B cw = GetU(w,i);
if (!isNum(cw)) thrM("⊑: 𝕨 contained list with mixed-type elements"); if (!isNum(cw)) thrM("𝕨𝕩: 𝕨 contained list with mixed-type elements");
o2i64(cw); o2i64(cw);
}), xr, goto oob); }), xr, goto oob);
return c; return c;
} }
} }
oob: checkIndexList(w, xr); thrF("⊑: Indexing out-of-bounds (index %B in array of shape %2H)", w, xr, xsh); oob: checkIndexList(w, xr); thrF("𝕨𝕩: Indexing out-of-bounds (index %B in array of shape %2H)", w, xr, xsh);
} }
static B pick_replaceOne(B fn, usz pos, B x, usz xia) { static B pick_replaceOne(B fn, usz pos, B x, usz xia) {

View File

@ -569,7 +569,7 @@ static B compress(B w, B x, usz wia, u8 xl, u8 xt) {
extern GLOBAL B rt_slash; extern GLOBAL B rt_slash;
B slash_c1(B t, B x) { B slash_c1(B t, B x) {
if (RARE(isAtm(x)) || RARE(RNK(x)!=1)) thrF("/: Argument must have rank 1 (%H ≡ ≢𝕩)", x); if (RARE(isAtm(x)) || RARE(RNK(x)!=1)) thrF("/𝕩: 𝕩 must have rank 1 (%H ≡ ≢𝕩)", x);
u64 s = usum(x); u64 s = usum(x);
if (s>=USZ_MAX) thrOOM(); if (s>=USZ_MAX) thrOOM();
if (s==0) { decG(x); return emptyIVec(); } if (s==0) { decG(x); return emptyIVec(); }
@ -627,7 +627,7 @@ B slash_c2(B t, B w, B x) {
if (isArr(w)) { if (isArr(w)) {
if (depth(w)>1) goto base; if (depth(w)>1) goto base;
ur wr = RNK(w); ur wr = RNK(w);
if (wr>1) thrF("/: Simple 𝕨 must have rank 0 or 1 (%i≡=𝕨)", wr); if (wr>1) thrF("𝕨/𝕩: Simple 𝕨 must have rank 0 or 1 (%i≡=𝕨)", wr);
if (wr<1) { w = TO_GET(w, 0); goto atom; } if (wr<1) { w = TO_GET(w, 0); goto atom; }
wia = IA(w); wia = IA(w);
if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); } if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); }
@ -635,9 +635,9 @@ B slash_c2(B t, B w, B x) {
atom: atom:
if (!q_i32(w)) goto base; if (!q_i32(w)) goto base;
wv = o2iG(w); wv = o2iG(w);
if (wv < 0) thrM("/: 𝕨 cannot be negative"); if (wv < 0) thrM("𝕨/𝕩: 𝕨 cannot be negative");
} }
if (isAtm(x) || RNK(x)==0) thrM("/: 𝕩 must have rank at least 1 for simple 𝕨"); if (isAtm(x) || RNK(x)==0) thrM("𝕨/𝕩: 𝕩 must have rank at least 1 for simple 𝕨");
ur xr = RNK(x); ur xr = RNK(x);
usz xlen = *SH(x); usz xlen = *SH(x);
u8 xl = cellWidthLog(x); u8 xl = cellWidthLog(x);
@ -645,7 +645,7 @@ B slash_c2(B t, B w, B x) {
B r; B r;
if (wv < 0) { // Array w if (wv < 0) { // Array w
if (RARE(wia!=xlen)) thrF("/: Lengths of components of 𝕨 must match 𝕩 (%s ≠ %s)", wia, xlen); if (RARE(wia!=xlen)) thrF("𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (%s ≠ %s)", wia, xlen);
u64 s; u64 s;
u8 we = TI(w,elType); u8 we = TI(w,elType);
@ -867,7 +867,7 @@ static B finish_sorted_count(B r, usz* ov, usz* oc, usz on) {
#endif #endif
B slash_im(B t, B x) { B slash_im(B t, B x) {
if (!isArr(x) || RNK(x)!=1) thrM("/⁼: Argument must be a list"); if (!isArr(x) || RNK(x)!=1) thrM("/⁼𝕩: 𝕩 must be a list");
u8 xe = TI(x,elType); u8 xe = TI(x,elType);
usz xia = IA(x); usz xia = IA(x);
if (xia==0) { decG(x); return emptyIVec(); } if (xia==0) { decG(x); return emptyIVec(); }
@ -886,7 +886,7 @@ B slash_im(B t, B x) {
i##N* rp; r = m_i##N##arrv(&rp, RIA); \ i##N* rp; r = m_i##N##arrv(&rp, RIA); \
for (usz i=0; i<RIA; i++) rp[i]=0; for (usz i=0; i<RIA; i++) rp[i]=0;
#define TRY_SMALL_OUT(N) \ #define TRY_SMALL_OUT(N) \
if (xp[0]<0) thrM("/⁼: Argument cannot contain negative numbers"); \ if (xp[0]<0) thrM("/⁼𝕩: 𝕩 cannot contain negative numbers"); \
usz a=1; while (a<xia && xp[a]>xp[a-1]) a++; \ usz a=1; while (a<xia && xp[a]>xp[a-1]) a++; \
u##N max=xp[a-1]; \ u##N max=xp[a-1]; \
usz rmax=xia; \ usz rmax=xia; \
@ -902,7 +902,7 @@ B slash_im(B t, B x) {
break; \ break; \
} \ } \
for (usz i=a; i<xia; i++) { u##N c=xp[i]; if (c>max) max=c; } \ for (usz i=a; i<xia; i++) { u##N c=xp[i]; if (c>max) max=c; } \
if ((i##N)max<0) thrM("/⁼: Argument cannot contain negative numbers"); \ if ((i##N)max<0) thrM("/⁼𝕩: 𝕩 cannot contain negative numbers"); \
usz ria = max + 1; \ usz ria = max + 1; \
if (xia < ria/8) { \ if (xia < ria/8) { \
u8 maxcount = 0; \ u8 maxcount = 0; \
@ -939,7 +939,7 @@ B slash_im(B t, B x) {
usz os = xia>>15; \ usz os = xia>>15; \
TALLOC(u16, ov, os+1); \ TALLOC(u16, ov, os+1); \
i##N max = simd_count_i##N((u16*)rp, (u16*)ov, xp, xia, 0); \ i##N max = simd_count_i##N((u16*)rp, (u16*)ov, xp, xia, 0); \
if (max < 0) thrM("/⁼: Argument cannot contain negative numbers"); \ if (max < 0) thrM("/⁼𝕩: 𝕩 cannot contain negative numbers"); \
usz ria = (usz)max + 1; \ usz ria = (usz)max + 1; \
if (ria < sa) r = C2(take, m_f64(ria), r); \ if (ria < sa) r = C2(take, m_f64(ria), r); \
r = finish_small_count(r, ov); \ r = finish_small_count(r, ov); \
@ -951,7 +951,7 @@ B slash_im(B t, B x) {
case el_i32: { case el_i32: {
i32* xp = i32any_ptr(x); i32* xp = i32any_ptr(x);
TRY_SMALL_OUT(32) TRY_SMALL_OUT(32)
if (xia>I32_MAX) thrM("/⁼: Argument too large"); if (xia>I32_MAX) thrM("/⁼𝕩: 𝕩 too large");
INIT_RES(32,ria) INIT_RES(32,ria)
simd_count_i32_i32(rp, xp, xia); simd_count_i32_i32(rp, xp, xia);
r = num_squeeze(r); break; r = num_squeeze(r); break;
@ -963,7 +963,7 @@ B slash_im(B t, B x) {
i##N* xp = i##N##any_ptr(x); \ i##N* xp = i##N##any_ptr(x); \
u##N max=xp[0]; \ u##N max=xp[0]; \
for (usz i=1; i<xia; i++) { u##N c=xp[i]; if (c>max) max=c; } \ for (usz i=1; i<xia; i++) { u##N c=xp[i]; if (c>max) max=c; } \
if ((i##N)max<0) thrM("/⁼: Argument cannot contain negative numbers"); \ if ((i##N)max<0) thrM("/⁼𝕩: 𝕩 cannot contain negative numbers"); \
usz ria = max + 1; \ usz ria = max + 1; \
TALLOC(usz, t, ria); \ TALLOC(usz, t, ria); \
for (usz j=0; j<ria; j++) t[j]=0; \ for (usz j=0; j<ria; j++) t[j]=0; \
@ -978,14 +978,14 @@ B slash_im(B t, B x) {
case el_f64: { case el_f64: {
f64* xp = f64any_ptr(x); f64* xp = f64any_ptr(x);
usz i,j; f64 max=-1; usz i,j; f64 max=-1;
for (i = 0; i < xia; i++) { f64 c=xp[i]; if (c!=(usz)c) thrM("/⁼: Argument must consist of natural numbers"); if (c<=max) break; max=c; } for (i = 0; i < xia; i++) { f64 c=xp[i]; if (c!=(usz)c) thrM("/⁼𝕩: 𝕩 must consist of natural numbers"); if (c<=max) break; max=c; }
for (j = i; j < xia; j++) { f64 c=xp[j]; if (c!=(usz)c) thrM("/⁼: Argument must consist of natural numbers"); max=c>max?c:max; if (c<0) thrM("/⁼: Argument cannot contain negative numbers"); } for (j = i; j < xia; j++) { f64 c=xp[j]; if (c!=(usz)c) thrM("/⁼𝕩: 𝕩 must consist of natural numbers"); max=c>max?c:max; if (c<0) thrM("/⁼: Argument cannot contain negative numbers"); }
usz ria = max+1; if (ria==0) thrOOM(); usz ria = max+1; if (ria==0) thrOOM();
if (i==xia) { if (i==xia) {
u64* rp; r = m_bitarrv(&rp, ria); for (usz i=0; i<BIT_N(ria); i++) rp[i]=0; u64* rp; r = m_bitarrv(&rp, ria); for (usz i=0; i<BIT_N(ria); i++) rp[i]=0;
for (usz i = 0; i < xia; i++) bitp_set(rp, xp[i], 1); for (usz i = 0; i < xia; i++) bitp_set(rp, xp[i], 1);
} else { } else {
if (xia>I32_MAX) thrM("/⁼: Argument too large"); if (xia>I32_MAX) thrM("/⁼𝕩: 𝕩 too large");
i32* rp; r = m_i32arrv(&rp, ria); for (usz i=0; i<ria; i++) rp[i]=0; i32* rp; r = m_i32arrv(&rp, ria); for (usz i=0; i<ria; i++) rp[i]=0;
for (usz i = 0; i < xia; i++) rp[(usz)xp[i]]++; for (usz i = 0; i < xia; i++) rp[(usz)xp[i]]++;
} }

View File

@ -101,7 +101,7 @@ B repr_c1(B t, B x) {
#if FORMATTER #if FORMATTER
return bqn_repr(x); return bqn_repr(x);
#else #else
thrM("•Repr: Cannot represent non-numbers with -DFORMATTER=0"); thrM("•Repr 𝕩: Cannot represent non-numbers with -DFORMATTER=0");
#endif #endif
} }
} }
@ -110,26 +110,26 @@ B fmt_c1(B t, B x) {
#if FORMATTER #if FORMATTER
return bqn_fmt(x); return bqn_fmt(x);
#else #else
thrM("•Fmt isn't supported with -DFORMATTER=0"); thrM("•Fmt 𝕩: •Fmt isn't supported with -DFORMATTER=0");
#endif #endif
} }
#if NO_RYU #if NO_RYU
B parseFloat_c1(B t, B x) { thrM("•ParseFloat: Not supported with Ryu disabled"); } B parseFloat_c1(B t, B x) { thrM("•ParseFloat 𝕩: Not supported with Ryu disabled"); }
#else #else
B parseFloat_c1(B t, B x) { B parseFloat_c1(B t, B x) {
if (isAtm(x)) thrM("•ParseFloat: Expected a character list argument"); if (isAtm(x)) thrM("•ParseFloat 𝕩: Expected a character list argument");
if (TI(x,elType)!=el_c8) { if (TI(x,elType)!=el_c8) {
x = chr_squeeze(x); x = chr_squeeze(x);
if (TI(x,elType)!=el_c8) thrM("•ParseFloat: Expected a character list argument"); if (TI(x,elType)!=el_c8) thrM("•ParseFloat 𝕩: Expected a character list argument");
} }
usz ia = IA(x); usz ia = IA(x);
if (RNK(x)!=1) thrM("•ParseFloat: Input must have rank 1"); if (RNK(x)!=1) thrM("•ParseFloat 𝕩: Input must have rank 1");
if (ia==0) thrM("•ParseFloat: Input was empty"); if (ia==0) thrM("•ParseFloat 𝕩: Input was empty");
if (ia >= (1<<20)) thrM("•ParseFloat: Input too long"); // assumption by ryu_s2d_n if (ia >= (1<<20)) thrM("•ParseFloat 𝕩: Input too long"); // assumption by ryu_s2d_n
u8* data = c8any_ptr(x); u8* data = c8any_ptr(x);
f64 res; f64 res;
if (!ryu_s2d_n(data, ia, &res)) thrM("•ParseFloat: Malformed input"); if (!ryu_s2d_n(data, ia, &res)) thrM("•ParseFloat 𝕩: Malformed input");
decG(x); decG(x);
return m_f64(res); return m_f64(res);
} }
@ -201,7 +201,7 @@ B grOrd_c2(B t, B w, B x) { // assumes valid arguments
for (usz i = 1; i < wia; i++) tmp[i] = tmp[i-1]+o2sG(GetU(w,i-1)); for (usz i = 1; i < wia; i++) tmp[i] = tmp[i-1]+o2sG(GetU(w,i-1));
usz ria = tmp[wia-1]+o2sG(GetU(w,wia-1)); usz ria = tmp[wia-1]+o2sG(GetU(w,wia-1));
i32* rp; B r = m_i32arrv(&rp, ria); i32* rp; B r = m_i32arrv(&rp, ria);
if (xia>=I32_MAX) thrM("⊔: Too large"); if (xia>=I32_MAX) thrM("𝕨𝕩: Too large");
for (usz i = 0; i < xia; i++) { for (usz i = 0; i < xia; i++) {
i64 c = o2i64(GetU(x,i)); i64 c = o2i64(GetU(x,i));
if (c>=0) rp[tmp[c]++] = i; if (c>=0) rp[tmp[c]++] = i;
@ -259,7 +259,7 @@ B casrt_c1(B t, B x) {
B sys_c1(B t, B x); B sys_c1(B t, B x);
B out_c1(B t, B x) { B out_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•Out: Argument must be a string"); if (isAtm(x) || RNK(x)!=1) thrM("•Out 𝕩: 𝕩 must be a string");
printsB(x); printf("\n"); printsB(x); printf("\n");
return x; return x;
} }
@ -283,7 +283,7 @@ NOINLINE B vfyStr(B x, char* name, char* arg) {
GLOBAL B cdPath; GLOBAL B cdPath;
static NOINLINE B prep_state(B w, char* name) { // consumes w, returns ⟨path,name,args⟩ static NOINLINE B prep_state(B w, char* name) { // consumes w, returns ⟨path,name,args⟩
if (!isArr(w) || RNK(w)!=1 || IA(w)>3) thrF("%U: 𝕨 must be a list with at most 3 items, but had shape %H", name, w); if (!isArr(w) || RNK(w)!=1 || IA(w)>3) thrF("𝕨%U𝕩: 𝕨 must be a list with at most 3 items, but had shape %H", name, w);
usz ia = IA(w); SGet(w) usz ia = IA(w); SGet(w)
HArr_p r = m_harr0v(3); HArr_p r = m_harr0v(3);
r.a[0] = ia>0? vfyStr(Get(w,0),name,"Path" ) : inc(cdPath); r.a[0] = ia>0? vfyStr(Get(w,0),name,"Path" ) : inc(cdPath);
@ -339,7 +339,7 @@ STATIC_GLOBAL B rand_subsetName; STATIC_GLOBAL NFnDesc* rand_subsetDesc;
sc->vars[1].u = seed&0xFFFFFFFF; sc->vars[1].u = seed&0xFFFFFFFF;
B rand_range_c1(B t, B x) { B rand_range_c1(B t, B x) {
i64 xv = o2i64(x); i64 xv = o2i64(x);
if (xv<0) thrM("(rand).Range: 𝕩 cannot be negative"); if (xv<0) thrM("(rand).Range 𝕩: 𝕩 cannot be negative");
RAND_START; RAND_START;
u64 rnd = wyrand(&seed); u64 rnd = wyrand(&seed);
RAND_END; RAND_END;
@ -349,7 +349,7 @@ B rand_range_c2(B t, B w, B x) {
usz am = 1; usz am = 1;
i64 max = o2i64(x); i64 max = o2i64(x);
if (isArr(w)) { if (isArr(w)) {
if (RNK(w) > 1) thrM("(rand).Range: 𝕨 must be a valid shape"); if (RNK(w) > 1) thrM("𝕨 (rand).Range 𝕩: 𝕨 must be a valid shape");
SGetU(w); SGetU(w);
usz wia = IA(w); usz wia = IA(w);
bool bad=false, good=false; bool bad=false, good=false;
@ -370,11 +370,11 @@ B rand_range_c2(B t, B w, B x) {
f64* rp; r = m_f64arrp(&rp, am); f64* rp; r = m_f64arrp(&rp, am);
PLAINLOOP for (usz i = 0; i < am; i++) rp[i] = wy2u01(wyrand(&seed)); PLAINLOOP for (usz i = 0; i < am; i++) rp[i] = wy2u01(wyrand(&seed));
} else { } else {
if (max!=1) thrM("(rand).Range: 𝕩 cannot be negative"); if (max!=1) thrM("𝕨 (rand).Range 𝕩: 𝕩 cannot be negative");
r = allZeroesFl(am); r = allZeroesFl(am);
} }
} else if (max > (1ULL<<31)) { } else if (max > (1ULL<<31)) {
if (max >= 1LL<<53) thrM("(rand).Range: 𝕩 must be less than 2⋆53"); if (max >= 1LL<<53) thrM("𝕨 (rand).Range 𝕩: 𝕩 must be less than 2⋆53");
f64* rp; r = m_f64arrp(&rp, am); f64* rp; r = m_f64arrp(&rp, am);
PLAINLOOP for (usz i = 0; i < am; i++) rp[i] = wy2u0k(wyrand(&seed), max); PLAINLOOP for (usz i = 0; i < am; i++) rp[i] = wy2u0k(wyrand(&seed), max);
} else { } else {
@ -416,7 +416,7 @@ B rand_range_c2(B t, B w, B x) {
if (wia<2) { if (wia<2) {
arr_rnk01(r, wia); arr_rnk01(r, wia);
} else { } else {
if (wia>UR_MAX) thrF("(rand).Range: Result rank too large (%s≡≢𝕨)", wia); if (wia>UR_MAX) thrF("𝕨 (rand).Range 𝕩: Result rank too large (%s≡≢𝕨)", wia);
usz* sh = arr_shAlloc(r, wia); usz* sh = arr_shAlloc(r, wia);
SGetU(w); SGetU(w);
for (usz i = 0; i < wia; i++) sh[i] = o2sG(GetU(w, i)); for (usz i = 0; i < wia; i++) sh[i] = o2sG(GetU(w, i));
@ -437,7 +437,7 @@ void intRange32Fill(i32* xp, ux s, ux n);
B rand_deal_c1(B t, B x) { B rand_deal_c1(B t, B x) {
i32 xi = o2i(x); i32 xi = o2i(x);
if (RARE(xi<=1)) { if (RARE(xi<=1)) {
if (xi<0) thrM("(rand).Deal: Argument cannot be negative"); if (xi<0) thrM("(rand).Deal 𝕩: 𝕩 cannot be negative");
return taga(ptr_inc(bitUD[xi])); return taga(ptr_inc(bitUD[xi]));
} }
@ -516,10 +516,10 @@ B rand_deal_c1(B t, B x) {
B rand_deal_c2(B t, B w, B x) { B rand_deal_c2(B t, B w, B x) {
i32 wi = o2i(w); i32 wi = o2i(w);
i32 xi = o2i(x); i32 xi = o2i(x);
if (RARE(xi<0)) thrM("(rand).Deal: 𝕩 cannot be negative"); if (RARE(xi<0)) thrM("𝕨 (rand).Deal 𝕩: 𝕩 cannot be negative");
if (RARE(wi<0)) thrM("(rand).Deal: 𝕨 cannot be negative"); if (RARE(wi<0)) thrM("𝕨 (rand).Deal 𝕩: 𝕨 cannot be negative");
if (wi==0) return emptyIVec(); if (wi==0) return emptyIVec();
if (RARE(wi>xi)) thrM("(rand).Deal: 𝕨 cannot exceed 𝕩"); if (RARE(wi>xi)) thrM("𝕨 (rand).Deal 𝕩: 𝕨 cannot exceed 𝕩");
if (wi==xi) return rand_deal_c1(t, x); if (wi==xi) return rand_deal_c1(t, x);
B r; B r;
RAND_START; RAND_START;
@ -578,9 +578,9 @@ extern void filter_ne_i32(i32* dst, i32* src, usz len, usz sum, i32 val); // sla
B rand_subset_c2(B t, B w, B x) { B rand_subset_c2(B t, B w, B x) {
i32 wi = o2i(w); i32 wi = o2i(w);
i32 xi = o2i(x); i32 xi = o2i(x);
if (RARE(wi<0)) thrM("(rand).Subset: 𝕨 cannot be negative"); if (RARE(wi<0)) thrM("𝕨 (rand).Subset 𝕩: 𝕨 cannot be negative");
if (RARE(xi<0)) thrM("(rand).Subset: 𝕩 cannot be negative"); if (RARE(xi<0)) thrM("𝕨 (rand).Subset 𝕩: 𝕩 cannot be negative");
if (RARE(wi>xi)) thrM("(rand).Subset: 𝕨 cannot exceed 𝕩"); if (RARE(wi>xi)) thrM("𝕨 (rand).Subset 𝕩: 𝕨 cannot exceed 𝕩");
if (wi==0) return emptyIVec(); if (wi==0) return emptyIVec();
if (wi==xi) return ud_c1(t, x); // Only one complete subset; will hang without this if (wi==xi) return ud_c1(t, x); // Only one complete subset; will hang without this
@ -652,7 +652,7 @@ static NOINLINE void rand_init() {
rand_subsetName = m_c8vec_0("subset"); gc_add(rand_subsetName); rand_subsetDesc = registerNFn(m_c8vec_0("(rand).Subset"), c1_bad, rand_subset_c2); rand_subsetName = m_c8vec_0("subset"); gc_add(rand_subsetName); rand_subsetDesc = registerNFn(m_c8vec_0("(rand).Subset"), c1_bad, rand_subset_c2);
} }
B makeRand_c1(B t, B x) { B makeRand_c1(B t, B x) {
if (!isNum(x)) thrM("•MakeRand: 𝕩 must be a number"); if (!isNum(x)) thrM("•MakeRand 𝕩: 𝕩 must be a number");
if (rand_ns==NULL) rand_init(); if (rand_ns==NULL) rand_init();
B r = m_nns(rand_ns, b(x.u>>32), b(x.u&0xFFFFFFFF), m_nfn(rand_rangeDesc, bi_N), m_nfn(rand_dealDesc, bi_N), m_nfn(rand_subsetDesc, bi_N)); B r = m_nns(rand_ns, b(x.u>>32), b(x.u&0xFFFFFFFF), m_nfn(rand_rangeDesc, bi_N), m_nfn(rand_dealDesc, bi_N), m_nfn(rand_subsetDesc, bi_N));
Scope* sc = c(NS,r)->sc; Scope* sc = c(NS,r)->sc;
@ -675,12 +675,12 @@ STATIC_GLOBAL NFnDesc* bqnDesc;
STATIC_GLOBAL NFnDesc* rebqnDesc; STATIC_GLOBAL NFnDesc* rebqnDesc;
STATIC_GLOBAL NFnDesc* rebqnResDesc; STATIC_GLOBAL NFnDesc* rebqnResDesc;
B rebqn_c1(B t, B x) { B rebqn_c1(B t, B x) {
if (!isNsp(x)) thrM("•ReBQN: Argument must be a namespace"); if (!isNsp(x)) thrM("•ReBQN 𝕩: Argument must be a namespace");
B repl = ns_getC(x, "repl"); B repl = ns_getC(x, "repl");
B prim = ns_getC(x, "primitives"); B prim = ns_getC(x, "primitives");
B sys = ns_getC(x, "system"); B sys = ns_getC(x, "system");
i32 replVal = q_N(repl) || eqStr(repl,U"none")? 0 : eqStr(repl,U"strict")? 1 : eqStr(repl,U"loose")? 2 : 3; i32 replVal = q_N(repl) || eqStr(repl,U"none")? 0 : eqStr(repl,U"strict")? 1 : eqStr(repl,U"loose")? 2 : 3;
if (replVal==3) thrM("•ReBQN: Invalid repl value"); if (replVal==3) thrM("•ReBQN 𝕩: Invalid repl value");
B scVal; B scVal;
if (replVal==0) { if (replVal==0) {
scVal = bi_N; scVal = bi_N;
@ -708,13 +708,13 @@ B repl_c1(B t, B x) {
#if USE_SETJMP #if USE_SETJMP
GLOBAL B lastErrMsg; GLOBAL B lastErrMsg;
B currentError_c1(B t, B x) { B currentError_c1(B t, B x) {
if (isNsp(x)) thrM("•CurrentError: Namespace 𝕩 is reserved"); if (isNsp(x)) thrM("•CurrentError 𝕩: Namespace 𝕩 is reserved");
dec(x); dec(x);
if (q_N(lastErrMsg)) thrM("•CurrentError: Not currently within any ⎊"); if (q_N(lastErrMsg)) thrM("•CurrentError 𝕩: Not currently within any ⎊");
return inc(lastErrMsg); return inc(lastErrMsg);
} }
#else #else
B currentError_c1(B t, B x) { thrM("•CurrentError: No errors as error catching has been disabled"); } B currentError_c1(B t, B x) { thrM("•CurrentError 𝕩: No errors as error catching has been disabled"); }
#endif #endif
STATIC_GLOBAL Body* hashmap_ns; STATIC_GLOBAL Body* hashmap_ns;
@ -759,9 +759,9 @@ static NOINLINE void hashmap_init() {
hashmap_valuesDesc = registerNFn(m_c8vec_0("(hashmap).Values"), hashmap_values_c1, c2_bad); hashmap_valuesDesc = registerNFn(m_c8vec_0("(hashmap).Values"), hashmap_values_c1, c2_bad);
} }
B hashMap_c2(B t, B w, B x) { B hashMap_c2(B t, B w, B x) {
if (!isArr(w) || RNK(w)!=1 || !isArr(x) || RNK(x)!=1) thrF("•HashMap: Arguments must be lists (%H≡≢𝕨, %H≡≢𝕩)", w, x); if (!isArr(w) || RNK(w)!=1 || !isArr(x) || RNK(x)!=1) thrF("𝕨 •HashMap 𝕩: Arguments must be lists (%H≡≢𝕨, %H≡≢𝕩)", w, x);
usz n = IA(w); usz n = IA(w);
if (n != IA(x)) thrF("•HashMap: 𝕨 and 𝕩 must have the same length (%s≡≠𝕨, %s≡≠𝕩)", n, IA(x)); if (n != IA(x)) thrF("𝕨 •HashMap 𝕩: 𝕨 and 𝕩 must have the same length (%s≡≠𝕨, %s≡≠𝕩)", n, IA(x));
if (hashmap_ns==NULL) hashmap_init(); if (hashmap_ns==NULL) hashmap_init();
w = taga(toHArr(w)); x = taga(toHArr(x)); w = taga(toHArr(w)); x = taga(toHArr(x));
B h = hashmap_build(w, n); B h = hashmap_build(w, n);
@ -786,7 +786,7 @@ B fchars_c1(B d, B x) {
return path_chars(path_rel(nfn_objU(d), x, "•file.Chars")); return path_chars(path_rel(nfn_objU(d), x, "•file.Chars"));
} }
B fchars_c2(B d, B w, B x) { B fchars_c2(B d, B w, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•file.Chars: 𝕩 must be a list of characters"); if (isAtm(x) || RNK(x)!=1) thrM("𝕨 •file.Chars 𝕩: 𝕩 must be a list of characters");
B p = path_rel(nfn_objU(d), w, "•file.Chars"); B p = path_rel(nfn_objU(d), w, "•file.Chars");
path_wChars(incG(p), x); path_wChars(incG(p), x);
decG(x); decG(x);
@ -802,7 +802,7 @@ B fbytes_c1(B d, B x) {
return r; return r;
} }
B fbytes_c2(B d, B w, B x) { B fbytes_c2(B d, B w, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•file.Bytes: 𝕩 must be a list"); if (isAtm(x) || RNK(x)!=1) thrM("𝕨 •file.Bytes 𝕩: 𝕩 must be a list");
B p = path_rel(nfn_objU(d), w, "•file.Bytes"); B p = path_rel(nfn_objU(d), w, "•file.Bytes");
path_wBytes(incG(p), x); path_wBytes(incG(p), x);
decG(x); decG(x);
@ -813,13 +813,13 @@ B flines_c1(B d, B x) {
return path_lines(path_rel(nfn_objU(d), x, "•file.Lines")); return path_lines(path_rel(nfn_objU(d), x, "•file.Lines"));
} }
B flines_c2(B d, B w, B x) { B flines_c2(B d, B w, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•file.Lines: 𝕩 must be a list"); if (isAtm(x) || RNK(x)!=1) thrM("𝕨 •file.Lines 𝕩: 𝕩 must be a list");
B s = emptyCVec(); B s = emptyCVec();
usz ia = IA(x); usz ia = IA(x);
SGet(x) SGet(x)
for (u64 i = 0; i < ia; i++) { for (u64 i = 0; i < ia; i++) {
B l = Get(x, i); B l = Get(x, i);
if (isAtm(l) || RNK(l)!=1) thrM("•file.Lines: Elements of 𝕩 must be lists of characters"); if (isAtm(l) || RNK(l)!=1) thrM("𝕨 •file.Lines 𝕩: Elements of 𝕩 must be lists of characters");
s = vec_join(s, l); s = vec_join(s, l);
//if (windows) s = vec_add(s, m_c32('\r')); TODO figure out whether or not this is a thing that should be done //if (windows) s = vec_add(s, m_c32('\r')); TODO figure out whether or not this is a thing that should be done
s = vec_addN(s, m_c32('\n')); s = vec_addN(s, m_c32('\n'));
@ -850,7 +850,7 @@ B import_c1(B d, B x) {
B tag_none = tagu64(100000000, C32_TAG); B tag_none = tagu64(100000000, C32_TAG);
B tag_running = tagu64(100000001, C32_TAG); B tag_running = tagu64(100000001, C32_TAG);
B prevVal = c2(ns_getC(map, "get"), tag_none, incG(path)); B prevVal = c2(ns_getC(map, "get"), tag_none, incG(path));
if (prevVal.u == tag_running.u) thrF("•Import: cyclic import of \"%R\"", path); if (prevVal.u == tag_running.u) thrF("•Import 𝕩: cyclic import of \"%R\"", path);
if (prevVal.u != tag_none.u) { if (prevVal.u != tag_none.u) {
// print_fmt("cached: %R @ %i/%i\n", path, prevIdx, IA(importKeyList)); // print_fmt("cached: %R @ %i/%i\n", path, prevIdx, IA(importKeyList));
decG(path); decG(path);
@ -892,7 +892,7 @@ B list_c1(B d, B x) {
B createdir_c1(B d, B x) { B createdir_c1(B d, B x) {
B p = path_rel(nfn_objU(d), x, "•file.CreateDir"); B p = path_rel(nfn_objU(d), x, "•file.CreateDir");
if (dir_create(p)) return p; if (dir_create(p)) return p;
thrM("•file.CreateDir: Failed to create directory"); thrM("•file.CreateDir 𝕩: Failed to create directory");
} }
B realpath_c1(B d, B x) { B realpath_c1(B d, B x) {
return path_abs(path_rel(nfn_objU(d), x, "•file.RealPath")); return path_abs(path_rel(nfn_objU(d), x, "•file.RealPath"));
@ -902,17 +902,17 @@ B rename_c2(B d, B w, B x) {
d = nfn_objU(d); d = nfn_objU(d);
B p = path_rel(d, w, "•file.Rename"); B p = path_rel(d, w, "•file.Rename");
if (path_rename(path_rel(d, x, "•file.Rename"), p)) return p; if (path_rename(path_rel(d, x, "•file.Rename"), p)) return p;
thrM("•file.Rename: Failed to rename file"); thrM("𝕨 •file.Rename 𝕩: Failed to rename file");
} }
B remove_c1(B d, B x) { B remove_c1(B d, B x) {
if (path_remove(path_rel(nfn_objU(d), x, "•file.Remove"))) return m_i32(1); if (path_remove(path_rel(nfn_objU(d), x, "•file.Remove"))) return m_i32(1);
thrM("•file.Remove: Failed to remove file"); thrM("•file.Remove 𝕩: Failed to remove file");
} }
B ftype_c1(B d, B x) { B ftype_c1(B d, B x) {
char ty = path_type(path_rel(nfn_objU(d), x, "•file.Type")); char ty = path_type(path_rel(nfn_objU(d), x, "•file.Type"));
if (ty==0) thrM("•file.Type: Error while accessing file"); if (ty==0) thrM("•file.Type 𝕩: Error while accessing file");
return m_c32(ty); return m_c32(ty);
} }
@ -927,11 +927,11 @@ B fexists_c1(B d, B x) {
} }
B fName_c1(B t, B x) { B fName_c1(B t, B x) {
if (!isStr(x)) thrM("•file.Name: Argument must be a string"); if (!isStr(x)) thrM("•file.Name 𝕩: Argument must be a string");
return path_name(x); return path_name(x);
} }
B fParent_c1(B t, B x) { B fParent_c1(B t, B x) {
if (!isStr(x)) thrM("•file.Parent: Argument must be a string"); if (!isStr(x)) thrM("•file.Parent 𝕩: Argument must be a string");
return path_parent(x); return path_parent(x);
} }
@ -951,7 +951,7 @@ B monoTime_c1(B t, B x) {
} }
B delay_c1(B t, B x) { B delay_c1(B t, B x) {
f64 sf = o2f(x); f64 sf = o2f(x);
if (sf<0 || sf>1ULL<<63) thrF("•Delay: Bad argument: %f", sf); if (sf<0 || sf>1ULL<<63) thrF("•Delay 𝕩: Bad argument: %f", sf);
struct timespec ts,ts0; struct timespec ts,ts0;
u64 s = (u64)sf; u64 s = (u64)sf;
ts.tv_sec = (u64)sf; ts.tv_sec = (u64)sf;
@ -985,7 +985,7 @@ B getLine_c1(B t, B x) {
} }
B fromUtf8_c1(B t, B x) { B fromUtf8_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•FromUTF8: Argument must be a character or number list"); if (isAtm(x) || RNK(x)!=1) thrM("•FromUTF8 𝕩: 𝕩 must be a character or number list");
usz ia = IA(x); usz ia = IA(x);
TALLOC(char, chrs, ia); TALLOC(char, chrs, ia);
SGetU(x) SGetU(x)
@ -993,11 +993,11 @@ B fromUtf8_c1(B t, B x) {
B c = GetU(x,i); B c = GetU(x,i);
if (isC32(c)) { if (isC32(c)) {
u32 v = o2cG(c); u32 v = o2cG(c);
if (v>=256) thrF("•FromUTF8: Argument contained a character with codepoint %i", v); if (v>=256) thrF("•FromUTF8 𝕩: 𝕩 contained a character with codepoint %i", v);
chrs[i] = v; chrs[i] = v;
} else { } else {
i32 v = o2i(c); i32 v = o2i(c);
if (v<=-128 | v>=256) thrF("•FromUTF8: Argument contained the number %i", v); if (v<=-128 | v>=256) thrF("•FromUTF8 𝕩: 𝕩 contained the number %i", v);
chrs[i] = v&0xff; chrs[i] = v&0xff;
} }
} }
@ -1008,7 +1008,7 @@ B fromUtf8_c1(B t, B x) {
} }
B toUtf8_c1(B t, B x) { B toUtf8_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•ToUTF8: Argument must be a character or number list"); if (isAtm(x) || RNK(x)!=1) thrM("•ToUTF8 𝕩: 𝕩 must be a character or number list");
u64 len = utf8lenB(x); u64 len = utf8lenB(x);
u8* rp; B r = m_c8arrv(&rp, len); u8* rp; B r = m_c8arrv(&rp, len);
toUTF8(x, (char*)rp); toUTF8(x, (char*)rp);
@ -1315,8 +1315,8 @@ B tCharN_c1(B t, B x) {
} }
} }
#else #else
B tRawMode_c1(B t, B x) { thrM("•term.RawMode not available"); } B tRawMode_c1(B t, B x) { thrM("•term.RawMode 𝕩: •term.RawMode not available"); }
B tCharN_c1(B t, B x) { thrM("•term.CharN not available"); } B tCharN_c1(B t, B x) { thrM("•term.CharN 𝕩: •term.CharN not available"); }
#endif #endif
B tCharB_c1(B t, B x) { B tCharB_c1(B t, B x) {
@ -1330,12 +1330,12 @@ B tFlush_c1(B t, B x) {
return x; return x;
} }
B tOutRaw_c1(B t, B x) { B tOutRaw_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•term.OutRaw: 𝕩 must be a list"); if (isAtm(x) || RNK(x)!=1) thrM("•term.OutRaw 𝕩: 𝕩 must be a list");
file_wBytes(stdout, "stdout", x); file_wBytes(stdout, "stdout", x);
return x; return x;
} }
B tErrRaw_c1(B t, B x) { B tErrRaw_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("•term.ErrRaw: 𝕩 must be a list"); if (isAtm(x) || RNK(x)!=1) thrM("•term.ErrRaw 𝕩: 𝕩 must be a list");
file_wBytes(stderr, "stderr", x); file_wBytes(stderr, "stderr", x);
return x; return x;
} }
@ -1374,7 +1374,7 @@ static NOINLINE B name_normalize(B x) {
} }
B nKeys_c1(B t, B x) { B nKeys_c1(B t, B x) {
if (!isNsp(x)) thrM("•ns.Keys: 𝕩 must be a namespace"); if (!isNsp(x)) thrM("•ns.Keys 𝕩: 𝕩 must be a namespace");
NSDesc* desc = c(NS,x)->desc; NSDesc* desc = c(NS,x)->desc;
ux am = desc->varAm; ux am = desc->varAm;
ux eam = 0; ux eam = 0;
@ -1389,7 +1389,7 @@ B nKeys_c1(B t, B x) {
return r.b; return r.b;
} }
B nGet_c2(B t, B w, B x) { B nGet_c2(B t, B w, B x) {
if (!isNsp(w)) thrM("•ns.Get: 𝕨 must be a namespace"); if (!isNsp(w)) thrM("𝕨•ns.Get 𝕩: 𝕨 must be a namespace");
vfyStr(x, "•ns.Get", "𝕩"); vfyStr(x, "•ns.Get", "𝕩");
x = name_normalize(x); x = name_normalize(x);
B r = ns_getNU(w, x, true); B r = ns_getNU(w, x, true);
@ -1397,7 +1397,7 @@ B nGet_c2(B t, B w, B x) {
return inc(r); return inc(r);
} }
B nHas_c2(B t, B w, B x) { B nHas_c2(B t, B w, B x) {
if (!isNsp(w)) thrM("•ns.Has: 𝕨 must be a namespace"); if (!isNsp(w)) thrM("𝕨•ns.Has 𝕩: 𝕨 must be a namespace");
vfyStr(x, "•ns.Has", "𝕩"); vfyStr(x, "•ns.Has", "𝕩");
x = name_normalize(x); x = name_normalize(x);
B r = ns_getNU(w, x, false); B r = ns_getNU(w, x, false);

View File

@ -269,26 +269,26 @@ static void shSet(Arr* ra, ur rr, ShArr* sh) {
B transp_c2(B t, B w, B x) { B transp_c2(B t, B w, B x) {
usz wia=1; usz wia=1;
if (isArr(w)) { if (isArr(w)) {
if (RNK(w)>1) thrM("⍉: 𝕨 must have rank at most 1"); if (RNK(w)>1) thrM("𝕨𝕩: 𝕨 must have rank at most 1");
wia = IA(w); wia = IA(w);
if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); } if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); }
} }
ur xr; ur xr;
if (isAtm(x) || (xr=RNK(x))<wia) thrM("⍉: Length of 𝕨 must be at most rank of 𝕩"); if (isAtm(x) || (xr=RNK(x))<wia) thrM("𝕨𝕩: Length of 𝕨 must be at most rank of 𝕩");
// Axis permutation // Axis permutation
TALLOC(u8, alloc, xr*(sizeof(ur) + 3*sizeof(usz)) + sizeof(usz)); // ur* p, usz* rsh, usz* st, usz* ri TALLOC(u8, alloc, xr*(sizeof(ur) + 3*sizeof(usz)) + sizeof(usz)); // ur* p, usz* rsh, usz* st, usz* ri
ur* p = (ur*)alloc; ur* p = (ur*)alloc;
if (isAtm(w)) { if (isAtm(w)) {
usz a=o2s(w); usz a=o2s(w);
if (a>=xr) thrF("⍉: Axis %s does not exist (%i≡=𝕩)", a, xr); if (a>=xr) thrF("𝕨𝕩: Axis %s does not exist (%i≡=𝕩)", a, xr);
if (a==xr-1) { TFREE(alloc); return C1(transp, x); } if (a==xr-1) { TFREE(alloc); return C1(transp, x); }
p[0] = a; p[0] = a;
} else { } else {
SGetU(w) SGetU(w)
for (usz i=0; i<wia; i++) { for (usz i=0; i<wia; i++) {
usz a=o2s(GetU(w, i)); usz a=o2s(GetU(w, i));
if (a>=xr) thrF("⍉: Axis %s does not exist (%i≡=𝕩)", a, xr); if (a>=xr) thrF("𝕨𝕩: Axis %s does not exist (%i≡=𝕩)", a, xr);
p[i] = a; p[i] = a;
} }
decG(w); decG(w);
@ -314,7 +314,7 @@ B transp_c2(B t, B w, B x) {
// Fill in remaining axes and check for missing ones // Fill in remaining axes and check for missing ones
ur rr = xr-dup; ur rr = xr-dup;
if (max >= rr) thrF("⍉: Skipped result axis"); if (max >= rr) thrF("𝕨𝕩: Skipped result axis");
if (wia<xr) for (usz j=0, i=wia; j<rr; j++) if (rsh[j]==no_sh) { if (wia<xr) for (usz j=0, i=wia; j<rr; j++) if (rsh[j]==no_sh) {
p[i] = j; p[i] = j;
rsh[j] = xsh[i]; rsh[j] = xsh[i];
@ -461,7 +461,7 @@ B transp_c2(B t, B w, B x) {
B transp_im(B t, B x) { B transp_im(B t, B x) {
if (isAtm(x)) thrM("⍉⁼: 𝕩 must not be an atom"); if (isAtm(x)) thrM("⍉⁼𝕩: 𝕩 must not be an atom");
ur xr = RNK(x); ur xr = RNK(x);
if (xr<=1) return x; if (xr<=1) return x;
@ -493,23 +493,23 @@ B transp_uc1(B t, B o, B x) {
// Consumes w; return bi_N if w contained duplicates // Consumes w; return bi_N if w contained duplicates
static B invert_transp_w(B w, ur xr) { static B invert_transp_w(B w, ur xr) {
if (isAtm(w)) { if (isAtm(w)) {
if (xr<1) thrM("⍉⁼: Length of 𝕨 must be at most rank of 𝕩"); if (xr<1) thrM("𝕨⍉⁼𝕩: Length of 𝕨 must be at most rank of 𝕩");
usz a=o2s(w); usz a=o2s(w);
if (a>=xr) thrF("⍉⁼: Axis %s does not exist (%i≡=𝕩)", a, xr); if (a>=xr) thrF("𝕨⍉⁼𝕩: Axis %s does not exist (%i≡=𝕩)", a, xr);
i32* wp; w = m_i32arrv(&wp, a); i32* wp; w = m_i32arrv(&wp, a);
PLAINLOOP for (usz i=0; i<a; i++) wp[i] = i+1; PLAINLOOP for (usz i=0; i<a; i++) wp[i] = i+1;
} else { } else {
if (RNK(w)>1) thrM("⍉⁼: 𝕨 must have rank at most 1"); if (RNK(w)>1) thrM("𝕨⍉⁼𝕩: 𝕨 must have rank at most 1");
usz wia = IA(w); usz wia = IA(w);
if (wia==0) return w; if (wia==0) return w;
if (xr<wia) thrM("⍉⁼: Length of 𝕨 must be at most rank of 𝕩"); if (xr<wia) thrM("𝕨⍉⁼𝕩: Length of 𝕨 must be at most rank of 𝕩");
SGetU(w) SGetU(w)
TALLOC(ur, p, xr); TALLOC(ur, p, xr);
for (usz i=0; i<xr; i++) p[i]=xr; for (usz i=0; i<xr; i++) p[i]=xr;
usz max = 0; usz max = 0;
for (usz i=0; i<wia; i++) { for (usz i=0; i<wia; i++) {
usz a=o2s(GetU(w, i)); usz a=o2s(GetU(w, i));
if (a>=xr) thrF("⍉⁼: Axis %s does not exist (%i≡=𝕩)", a, xr); if (a>=xr) thrF("𝕨⍉⁼𝕩: Axis %s does not exist (%i≡=𝕩)", a, xr);
if (p[a]!=xr) { TFREE(p); decG(w); return bi_N; } // Handled by caller if (p[a]!=xr) { TFREE(p); decG(w); return bi_N; } // Handled by caller
max = a>max? a : max; max = a>max? a : max;
p[a] = i; p[a] = i;
@ -524,9 +524,9 @@ static B invert_transp_w(B w, ur xr) {
} }
B transp_ix(B t, B w, B x) { B transp_ix(B t, B w, B x) {
if (isAtm(x)) thrM("⍉⁼: 𝕩 must not be an atom"); if (isAtm(x)) thrM("𝕨⍉⁼𝕩: 𝕩 must not be an atom");
w = invert_transp_w(w, RNK(x)); w = invert_transp_w(w, RNK(x));
if (q_N(w)) thrM("⍉⁼: Duplicate axes"); if (q_N(w)) thrM("𝕨⍉⁼𝕩: Duplicate axes");
return C2(transp, w, x); return C2(transp, w, x);
} }

View File

@ -452,7 +452,7 @@ B bqn_merge(B x, u32 type) {
if (isAtm(xf)) { dec(xf); return x; } if (isAtm(xf)) { dec(xf); return x; }
i32 xfr = RNK(xf); i32 xfr = RNK(xf);
Arr* r = emptyWithFill(getFillR(xf)); Arr* r = emptyWithFill(getFillR(xf));
if (xr+xfr > UR_MAX) thrM(">: Result rank too large"); if (xr+xfr > UR_MAX) thrM(">𝕩: Result rank too large");
usz* rsh = arr_shAlloc(r, xr+xfr); usz* rsh = arr_shAlloc(r, xr+xfr);
if (rsh) { if (rsh) {
shcpy (rsh , SH(x), xr); shcpy (rsh , SH(x), xr);

View File

@ -502,4 +502,4 @@ B nativeComp_c2(B t, B w, B x) {
void nativeCompiler_init() { void nativeCompiler_init() {
native_comp = m_nfn(registerNFn(m_c8vec_0("(native compiler)"), c1_bad, nativeComp_c2), bi_N); native_comp = m_nfn(registerNFn(m_c8vec_0("(native compiler)"), c1_bad, nativeComp_c2), bi_N);
gc_add(native_comp); gc_add(native_comp);
} }

View File

@ -557,7 +557,7 @@ static B m_getU_B (void* a, usz ms) { return ((B*) a)[ms]; }
void apd_fail_apd(ApdMut* m, B x) { } void apd_fail_apd(ApdMut* m, B x) { }
NOINLINE char* apd_ty_base(u32 ty) { NOINLINE char* apd_ty_base(u32 ty) {
return ty==1? ">" : ty==2? "[…]" : ty==U'˘'? "˘" : ty==U''? "" : "??"; return ty==1? ">𝕩" : ty==2? "[…]" : ty==U'˘'? "𝔽˘" : ty==U''? "𝔽𝕘" : "??";
} }
Arr* apd_sh_err(ApdMut* m, u32 ty) { Arr* apd_sh_err(ApdMut* m, u32 ty) {
B msg = make_fmt("%U: Incompatible %S shapes (encountered shapes %2H and %H)", apd_ty_base(ty), ty>2? "result" : "element", m->cr, m->csh, m->failEl); B msg = make_fmt("%U: Incompatible %S shapes (encountered shapes %2H and %H)", apd_ty_base(ty), ty>2? "result" : "element", m->cr, m->csh, m->failEl);

View File

@ -20,57 +20,57 @@
!"˘: Result rank too large" % (02542)1˘ 021 !"˘: Result rank too large" % (02542)1˘ 021
!"⎉: Result rank too large" % (02542)1¯1 021 !"⎉: Result rank too large" % (02542)1¯1 021
!"⎉: Result rank too large" % (1˜ 02042)50 1˜ 01002 !"⎉: Result rank too large" % (1˜ 02042)50 1˜ 01002
!"⎉: Result rank too large (204 ≡ =𝕩, 200 ≡ =𝔽v)" % {𝕊:(2001)1}1 (2051)1 !"𝔽𝕘: Result rank too large (204 ≡ =𝕩, 200 ≡ =𝔽v)" % {𝕊:(2001)1}1 (2051)1
!"⎉: Argument frames don't agree (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩, common frame of 1 axes)" % "abc" 0 "ab" !"𝕨𝕩: Argument frames don't agree (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩, common frame of 1 axes)" % "abc" 0 "ab"
!"˘: Argument frames don't agree (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩, common frame of 1 axes)" % "abc" ˘ "ab" !"𝕨˘𝕩: Argument frames don't agree (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩, common frame of 1 axes)" % "abc" ˘ "ab"
! ´{𝕊: ! ({𝕨𝕩}´) (<•rand.Range "ab",12,,0,"") ˜ (4•rand.Range) 1, {}, 'a', <'a', <{}, "ab", 0, ""}¨10000 ! ´{𝕊: ! ({𝕨𝕩}´) (<•rand.Range "ab",12,,0,"") ˜ (4•rand.Range) 1, {}, 'a', <'a', <{}, "ab", 0, ""}¨10000
# error cases that could be affected by special code # error cases that could be affected by special code
!"∧: Argument cannot have rank 0" % ˘2 !"∧𝕩: 𝕩 cannot have rank 0" % ˘2
!": Argument cannot have rank 0" % ˘"a" !"𝕩: 𝕩 cannot have rank 0" % ˘"a"
!"Expected non-negative integer, got ¯3" % 2¯3/1 620 !"Expected non-negative integer, got ¯3" % 2¯3/1 620
!"/: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 123/˘4567 !"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 123/˘4567
!"/: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (2314) /˘ 2 !"𝕨/𝕩: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (2314) /˘ 2
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % (<0)/˘(5)<"ab" !"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % (<0)/˘(5)<"ab"
!"⊏: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % 124144 !"𝕨𝕩: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % 124144
!"⊏: Indexing out-of-bounds (4∊𝕨, 4≡≠𝕩)" % 1˜6424 !"𝕨𝕩: Indexing out-of-bounds (4∊𝕨, 4≡≠𝕩)" % 1˜6424
!"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % 0@¯11 520.5 !"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % 0@¯11 520.5
!"Expected integer, got ¯5.25" % ¯5.25˘424 !"Expected integer, got ¯5.25" % ¯5.25˘424
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % 001 ˘(˘) 10000×3 !"𝕨𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % 001 ˘(˘) 10000×3
!"⊏: 𝕩 cannot be a unit" % 0˘5<"a" !"𝕨𝕩: 𝕩 cannot be a unit" % 0˘5<"a"
!"⊏: 𝕩 cannot be a unit" % (30)˘3 !"𝕨𝕩: 𝕩 cannot be a unit" % (30)˘3
!"Expected integer, got 0.1" % 0.1˘3515 !"Expected integer, got 0.1" % 0.1˘3515
!"⊑: 𝕩 must be a list when 𝕨 is a number (3‿4 ≡ ≢𝕩)" % 5˘234 !"𝕨𝕩: 𝕩 must be a list when 𝕨 is a number (3‿4 ≡ ≢𝕩)" % 5˘234
!">: Result rank too large (80 ≡ =𝕩, 205 ≡ =⊑𝕩)" % >80 (2001)<(2051)1 !">𝕩: Result rank too large (80 ≡ =𝕩, 205 ≡ =⊑𝕩)" % >80 (2001)<(2051)1
!"⎉: Result rank too large (195 ≡ =𝕩, 210 ≡ =𝔽v)" % >5 (2001)<(2051)1 !"𝔽𝕘: Result rank too large (195 ≡ =𝕩, 210 ≡ =𝔽v)" % >5 (2001)<(2051)1
!"∾: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc""def")˘(3/)"a" !"𝕨𝕩: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc""def")˘(3/)"a"
!"∾: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 1˘333 !"𝕨𝕩: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 1˘333
!"∾: Lengths not matchable (4‿2 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (3424)˘3335 !"𝕨𝕩: Lengths not matchable (4‿2 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (3424)˘3335
!"≍: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (34)2 23318 !"𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (34)2 23318
!"≍: Result rank too large (255≡=𝕩)" % 0˜2551 !"≍𝕩: Result rank too large (255≡=𝕩)" % 0˜2551
!"shift: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc""def")«˘(3/)"a" !"shift: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc""def")«˘(3/)"a"
!"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (0≡=𝕨, 2≡=𝕩)" % 1«˘222 !"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (0≡=𝕨, 2≡=𝕩)" % 1«˘222
!: Argument cannot be a scalar" % »0 2316 !𝕩: 𝕩 cannot be a scalar" % »0 2316
!"⌽: Argument cannot be a unit" % ˘10 !"⌽𝕩: 𝕩 cannot be a unit" % ˘10
!"Expected integer, got 1.5" % 1.5˘232 !"Expected integer, got 1.5" % 1.5˘232
!"↑: 𝕨 must have rank at most 1 (1‿2 ≡ ≢𝕨)" % (12)˘232 !"𝕨𝕩: 𝕨 must have rank at most 1 (1‿2 ≡ ≢𝕨)" % (12)˘232
!"↓: 𝕨 must have rank at most 1 (4‿2 ≡ ≢𝕨)" % (428)˘@ !"𝕨𝕩: 𝕨 must have rank at most 1 (4‿2 ≡ ≢𝕨)" % (428)˘@
!"Integer out of range: 1e20" % 1e20˘31010 !"Integer out of range: 1e20" % 1e20˘31010
!"Expected number" % 34@˘34 !"Expected number" % 34@˘34
!"Expected integer, got 0.5" % 0.5˘4312 !"Expected integer, got 0.5" % 0.5˘4312
!"↑: Argument must have rank at least 1" % ˘2 !"↑𝕩: 𝕩 must have rank at least 1" % ˘2
!"↓: Argument must have rank at least 1" % 0 210 !"↓𝕩: 𝕩 must have rank at least 1" % 0 210
!"⊐: 𝕩 cannot have rank 0" % ˘"abcd" !"⊐𝕩: 𝕩 cannot have rank 0" % ˘"abcd"
!"⊒: Argument cannot have rank 0" % ˘"abcd" !"⊒𝕩: 𝕩 cannot have rank 0" % ˘"abcd"
!"∊: Argument cannot have rank 0" % ˘"abcd" !"∊𝕩: 𝕩 cannot have rank 0" % ˘"abcd"
!"⍋: 𝕨 must be sorted" % 021˘ 3412 !"𝕨𝕩: 𝕨 must be sorted" % 021˘ 3412
!"`: Shape of 𝕨 must match the cell of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (221)+`˘2230.4 !"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (221)+`˘2230.4
!"`: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`˘333 !"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`˘333
!"´: Argument must be a list (3‿3 ≡ ≢𝕩)" % +´˘23318 !"𝔽´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % +´˘23318
!"´: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 1+´˘23318 !"𝕨𝔽´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 1+´˘23318
!"˝: 𝕩 must have rank at least 1" % +˝˘˘1010100 !"𝔽˝𝕩: 𝕩 must have rank at least 1" % +˝˘˘1010100
!"˝: 𝕩 must have rank at least 1" % ˝¯2 239 !"𝔽˝𝕩: 𝕩 must have rank at least 1" % ˝¯2 239
{˝˘ (×´) 2+𝕩}¨ 2345 %% (×´)¨ 23,212,2125,21256 {˝˘ (×´) 2+𝕩}¨ 2345 %% (×´)¨ 23,212,2125,21256
{˝˘ (2+𝕩)<"hi"}¨ 2345 %% (<"hi")¨ 23,212,2125,21256 {˝˘ (2+𝕩)<"hi"}¨ 2345 %% (<"hi")¨ 23,212,2125,21256
@ -89,15 +89,15 @@
%USE eqvar ¯1¯2¯3 {𝕨˘𝕩}_eqvar 880557 %% 83797877159158157239238237319318317399398397479478477210828180 %USE eqvar ¯1¯2¯3 {𝕨˘𝕩}_eqvar 880557 %% 83797877159158157239238237319318317399398397479478477210828180
1201¯11 23424 %% 23512013564579108911131412131517181617192122202123 1201¯11 23424 %% 23512013564579108911131412131517181617192122202123
1201¯12 23424 %% 2544567891011012345678910111617181920212223121314151617181920212223 1201¯12 23424 %% 2544567891011012345678910111617181920212223121314151617181920212223
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar 0¯11¯1 {𝕨˘𝕩}_evar ˘5 !"𝕨𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar 0¯11¯1 {𝕨˘𝕩}_evar ˘5
!"⊏: Indexing out-of-bounds (¯2∊𝕨, 1≡≠𝕩)" % %USE evar 0¯1¯2¯1 {𝕨˘𝕩}_evar ˘5 !"𝕨𝕩: Indexing out-of-bounds (¯2∊𝕨, 1≡≠𝕩)" % %USE evar 0¯1¯2¯1 {𝕨˘𝕩}_evar ˘5
!"⊏: Indexing out-of-bounds (¯129∊𝕨, 128≡≠𝕩)" % %USE evar 10¯129 {𝕨˘𝕩}_evar 101281 !"𝕨𝕩: Indexing out-of-bounds (¯129∊𝕨, 128≡≠𝕩)" % %USE evar 10¯129 {𝕨˘𝕩}_evar 101281
!"⊏: Indexing out-of-bounds (128∊𝕨, 128≡≠𝕩)" % %USE evar 10128 {𝕨˘𝕩}_evar 101281 !"𝕨𝕩: Indexing out-of-bounds (128∊𝕨, 128≡≠𝕩)" % %USE evar 10128 {𝕨˘𝕩}_evar 101281
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar 1001 {𝕨˘𝕩}_evar 1011 !"𝕨𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar 1001 {𝕨˘𝕩}_evar 1011
!"⊏: Indexing out-of-bounds (1000∊𝕨, 3≡≠𝕩)" % %USE evar (31000) {𝕨˘𝕩}_evar 10031 !"𝕨𝕩: Indexing out-of-bounds (1000∊𝕨, 3≡≠𝕩)" % %USE evar (31000) {𝕨˘𝕩}_evar 10031
!"⊏: Indexing out-of-bounds (1000∊𝕨, 4≡≠𝕩)" % %USE evar (41000) {𝕨˘𝕩}_evar 10041 !"𝕨𝕩: Indexing out-of-bounds (1000∊𝕨, 4≡≠𝕩)" % %USE evar (41000) {𝕨˘𝕩}_evar 10041
!"⊏: Indexing out-of-bounds (1000∊𝕨, 8≡≠𝕩)" % %USE evar (81000) {𝕨˘𝕩}_evar 10081 !"𝕨𝕩: Indexing out-of-bounds (1000∊𝕨, 8≡≠𝕩)" % %USE evar (81000) {𝕨˘𝕩}_evar 10081
!"⊏: Indexing out-of-bounds (100∊𝕨, 8≡≠𝕩)" % %USE evar (<100) {𝕨˘𝕩}_evar 10081 !"𝕨𝕩: Indexing out-of-bounds (100∊𝕨, 8≡≠𝕩)" % %USE evar (<100) {𝕨˘𝕩}_evar 10081
!"Integer out of range: 9e99" % %USE evar (<9e99) {𝕨˘𝕩}_evar 10081 !"Integer out of range: 9e99" % %USE evar (<9e99) {𝕨˘𝕩}_evar 10081
12˘ 108100 %% (8×10) + 12 12˘ 108100 %% (8×10) + 12
12˘ 1042100 %% (8×10) + [23,45] 12˘ 1042100 %% (8×10) + [23,45]
@ -131,15 +131,15 @@
%USE eqvar ˘'!' _eqvar 10071 %% '!'•internal.Keep˘ 0=7|100 %USE eqvar ˘'!' _eqvar 10071 %% '!'•internal.Keep˘ 0=7|100
%USE eqvar ˘_eqvar˜ 339 %% 323012012345345678678 %USE eqvar ˘_eqvar˜ 339 %% 323012012345345678678
%USE eqvar (2345111) 2 _eqvar 234517 %% (2345111) •internal.PureKeep2 234517 %USE eqvar (2345111) 2 _eqvar 234517 %% (2345111) •internal.PureKeep2 234517
!"˘: Argument frames don't agree (3‿4 ≡ ≢𝕨, 5‿4 ≡ ≢𝕩, common frame of 1 axes)" % (342) ˘ 542 !"𝕨˘𝕩: Argument frames don't agree (3‿4 ≡ ≢𝕨, 5‿4 ≡ ≢𝕩, common frame of 1 axes)" % (342) ˘ 542
!"≍: 𝕨 and 𝕩 must have equal shapes (⟨4⟩ ≡ ≢𝕨, ⟨5⟩ ≡ ≢𝕩)" % (342) ˘ 352 !"𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (⟨4⟩ ≡ ≢𝕨, ⟨5⟩ ≡ ≢𝕩)" % (342) ˘ 352
!"≍: 𝕨 and 𝕩 must have equal shapes (2‿2‿2 ≡ ≢𝕨, 2‿3‿2 ≡ ≢𝕩)" % (32222) ˘ 32322 !"𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (2‿2‿2 ≡ ≢𝕨, 2‿3‿2 ≡ ≢𝕩)" % (32222) ˘ 32322
!"≍: 𝕨 and 𝕩 must have equal shapes (4‿1 ≡ ≢𝕨, ⟨4⟩ ≡ ≢𝕩)" % (3410) ˘ 340 !"𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (4‿1 ≡ ≢𝕨, ⟨4⟩ ≡ ≢𝕩)" % (3410) ˘ 340
(<"ab") ˘ 2"cd" %% 22"ab", 'c', "ab", 'd' (<"ab") ˘ 2"cd" %% 22"ab", 'c', "ab", 'd'
(<"ab") ˘˜ 2"cd" %% 22'c', "ab", 'd', "ab" (<"ab") ˘˜ 2"cd" %% 22'c', "ab", 'd', "ab"
"ab" 1 42"cd" %% 422"abcdabcdabcdabcd" "ab" 1 42"cd" %% 422"abcdabcdabcdabcd"
!"≍: 𝕨 and 𝕩 must have equal shapes (⟨⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % "ab"˘ "cd" !"𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (⟨⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % "ab"˘ "cd"
!"≍: 𝕨 and 𝕩 must have equal shapes (⟨2⟩ ≡ ≢𝕨, ⟨⟩ ≡ ≢𝕩)" % "ab"˘ "cd" !"𝕨𝕩: 𝕨 and 𝕩 must have equal shapes (⟨2⟩ ≡ ≢𝕨, ⟨⟩ ≡ ≢𝕩)" % "ab"˘ "cd"
( (
%USE IS_HEAPVERIFY %USE IS_HEAPVERIFY

View File

@ -38,12 +38,12 @@ a←(•ParseFloat¨ "1.2"‿"-0"‿"0")∾-⊸⋈0÷0 ⋄ ! (0‿3‿3‿3⊏a)
{b•internal.Unshare a"Ai8"•internal.Variation 160000000¯128, 80, 82 c864•bit._cast a ! 1001c •internal.Keep •Hash c ! ab} # make sure sign bit doesn't mutate away {b•internal.Unshare a"Ai8"•internal.Variation 160000000¯128, 80, 82 c864•bit._cast a ! 1001c •internal.Keep •Hash c ! ab} # make sure sign bit doesn't mutate away
# error messages # error messages
!"∊: 𝕩 cannot have rank 0" % 1230 !"𝕨𝕩: 𝕩 cannot have rank 0" % 1230
!"⊐: 𝕨 cannot have rank 0" % 0123 !"𝕨𝕩: 𝕨 cannot have rank 0" % 0123
!"⊒: 𝕨 cannot have rank 0" % 0123 !"𝕨𝕩: 𝕨 cannot have rank 0" % 0123
!"∊: Rank of 𝕨 must be at least the cell rank of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿2‿2 ≡ ≢𝕩)" % 1222212 !"𝕨𝕩: Rank of 𝕨 must be at least the cell rank of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿2‿2 ≡ ≢𝕩)" % 1222212
!"⊐: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (22212)12 !"𝕨𝕩: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (22212)12
!"⊒: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (22212)12 !"𝕨𝕩: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (22212)12
# hashmap # hashmap
("abc""de""fgh" •HashMap ¨3).Get "fgh" %% 2 ("abc""de""fgh" •HashMap ¨3).Get "fgh" %% 2
@ -54,10 +54,10 @@ a←(•ParseFloat¨ "1.2"‿"-0"‿"0")∾-⊸⋈0÷0 ⋄ ! (0‿3‿3‿3⊏a)
(((•HashMap˜4).Delete 1).Set´ 1"one").Keys@ %% 0231 (((•HashMap˜4).Delete 1).Set´ 1"one").Keys@ %% 0231
(((•HashMap˜4).Delete 1).Set´ 1"one").Values@ %% 023"one" (((•HashMap˜4).Delete 1).Set´ 1"one").Values@ %% 023"one"
({𝕩.Set´"xy"}4•HashMap˜0).Count@ %% 1 ({𝕩.Set´"xy"}4•HashMap˜0).Count@ %% 1
!"•HashMap: Arguments must be lists (⟨⟩≡≢𝕨, ⟨3⟩≡≢𝕩)" % 'a' •HashMap "str" !"𝕨 •HashMap 𝕩: Arguments must be lists (⟨⟩≡≢𝕨, ⟨3⟩≡≢𝕩)" % 'a' •HashMap "str"
!"•HashMap: 𝕨 and 𝕩 must have the same length (4≡≠𝕨, 3≡≠𝕩)" % "stri" •HashMap "str" !"𝕨 •HashMap 𝕩: 𝕨 and 𝕩 must have the same length (4≡≠𝕨, 3≡≠𝕩)" % "stri" •HashMap "str"
!"•HashMap: 𝕨 contained duplicate keys" % "strs" •HashMap "stri" !"•HashMap: 𝕨 contained duplicate keys" % "strs" •HashMap "stri"
!"(hashmap).Get: key not found" % ("abc""de""fgh" •HashMap ¨3).Get "fg" !"(hashmap).Get: key not found" % ("abc""de""fgh" •HashMap ¨3).Get "fg"
!"(hashmap).Delete: key not found" % ("abc""de""fgh" •HashMap ¨3).Delete 'a' !"(hashmap).Delete: key not found" % ("abc""de""fgh" •HashMap ¨3).Delete 'a'
m 12 •HashMap v•internal.Unshare 'a'4 1 m.Set 9 v, m.Keys@, m.Values@ %% 'a'4, 12, 94 m 12 •HashMap v•internal.Unshare 'a'4 1 m.Set 9 v, m.Keys@, m.Values@ %% 'a'4, 12, 94
m 12 •HashMap •internal.Unshare 'a'4 vm.Values@ 1 m.Set 9 v, m.Keys@, m.Values@ %% 'a'4, 12, 94 m 12 •HashMap •internal.Unshare 'a'4 vm.Values@ 1 m.Set 9 v, m.Keys@, m.Values@ %% 'a'4, 12, 94

View File

@ -17,11 +17,11 @@
! (¨r1r3) ¨r1r2r3r4 ! (¨r1r3) ¨r1r2r3r4
) )
!"•Import: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn" !"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn" !"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn" !"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn" !"•Import 𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn"
!"•Import: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn" !"•Import 𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn"
!"•Import: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn" !"•Import 𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn"
!"•Import: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn" !"•Import 𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn"
%USE file 3 •Import File "notCyclic.bqn" %% 30 %USE file 3 •Import File "notCyclic.bqn" %% 30

File diff suppressed because one or more lines are too long

View File

@ -113,18 +113,18 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
!"•file.Parent: Path must be non-empty" % •file.Parent "" !"•file.Parent: Path must be non-empty" % •file.Parent ""
!"•file.Name: Path must be non-empty" % •file.Name "" !"•file.Name: Path must be non-empty" % •file.Name ""
!"•file.Lines: 𝕩 must be a list" % "testfile.bqn" •FLines 22<"abcd" !"𝕨 •file.Lines 𝕩: 𝕩 must be a list" % "testfile.bqn" •FLines 22<"abcd"
!"•file.Lines: 𝕩 must be a list" % "testfile.bqn" •file.Lines <"abcd" !"𝕨 •file.Lines 𝕩: 𝕩 must be a list" % "testfile.bqn" •file.Lines <"abcd"
!"•file.Lines: Elements of 𝕩 must be lists of characters" % "testfile.bqn" •FLines "abcd" !"𝕨 •file.Lines 𝕩: Elements of 𝕩 must be lists of characters" % "testfile.bqn" •FLines "abcd"
!"Expected character" % "testfile.bqn" •FLines "ab""cd" !"Expected character" % "testfile.bqn" •FLines "ab""cd"
!"Expected character" % "testfile.bqn" •FLines 12 !"Expected character" % "testfile.bqn" •FLines 12
!"Expected character" % "testfile.bqn" •FChars "abcd" !"Expected character" % "testfile.bqn" •FChars "abcd"
!"•file.Chars: 𝕩 must be a list of characters" % "testfile.bqn" •FChars <'a' !"𝕨 •file.Chars 𝕩: 𝕩 must be a list of characters" % "testfile.bqn" •FChars <'a'
!"Expected character" % "testfile.bqn" •FBytes "abcd" !"Expected character" % "testfile.bqn" •FBytes "abcd"
!"•file.Bytes: 𝕩 must be a list" % "testfile.bqn" •file.Bytes <'a' !"𝕨 •file.Bytes 𝕩: 𝕩 must be a list" % "testfile.bqn" •file.Bytes <'a'
!"Expected character" % "badwrite"•FChars """" !"Expected character" % "badwrite"•FChars """"
!"Expected character" % "badwrite"•FLines "foo" !"Expected character" % "badwrite"•FLines "foo"
!"•file.Chars: 𝕩 must be a list of characters" % "badwrite"•FChars @ !"𝕨 •file.Chars 𝕩: 𝕩 must be a list of characters" % "badwrite"•FChars @
! {𝕩•file.Name 𝕩 •FChars "abc"(@+10)"def𝕩"}"testfile.bqn" ! {𝕩•file.Name 𝕩 •FChars "abc"(@+10)"def𝕩"}"testfile.bqn"
! {𝕩•file.Name 𝕩 •FBytes •ToUTF8 "abc"(@+10)"def𝕩"}"testfile2.bqn" ! {𝕩•file.Name 𝕩 •FBytes •ToUTF8 "abc"(@+10)"def𝕩"}"testfile2.bqn"
@ -141,11 +141,11 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
! 97989910100101102240157149169 @-˜ •file.MapBytes "testfile.bqn" ! 97989910100101102240157149169 @-˜ •file.MapBytes "testfile.bqn"
•file.Name "testfile3B.bqn" •file.Rename "testfile3.bqn" %% "testfile3B.bqn" •file.Name "testfile3B.bqn" •file.Rename "testfile3.bqn" %% "testfile3B.bqn"
!"•file.Rename: Failed to rename file" % "testfile3B.bqn" •file.Rename "testfile.bqn" !"𝕨 •file.Rename 𝕩: Failed to rename file" % "testfile3B.bqn" •file.Rename "testfile.bqn"
•file.Exists¨ "testfile.bqn""nontestfile.bqn""testfile3.bqn""testfile3B.bqn" %% 1001 •file.Exists¨ "testfile.bqn""nontestfile.bqn""testfile3.bqn""testfile3B.bqn" %% 1001
¯22•file.Createdir "testdirNested" %% "/testDir/testdirNested" ¯22•file.Createdir "testdirNested" %% "/testDir/testdirNested"
¯8•file.RealPath "testdirNested/.././" %% "/testDir" ¯8•file.RealPath "testdirNested/.././" %% "/testDir"
!"•file.CreateDir: Failed to create directory" % •file.Createdir "testdirNested" !"•file.CreateDir 𝕩: Failed to create directory" % •file.Createdir "testdirNested"
"testfile.bqn""testfile2.bqn""testfile3.bqn""testfile3B.bqn""testdirNested" •file.List "." %% 11011 "testfile.bqn""testfile2.bqn""testfile3.bqn""testfile3B.bqn""testdirNested" •file.List "." %% 11011
"testfile.bqn""testfile2.bqn""testfile3.bqn""testfile3B.bqn""testdirNested" •file.List •file.path %% 11011 "testfile.bqn""testfile2.bqn""testfile3.bqn""testfile3B.bqn""testdirNested" •file.List •file.path %% 11011
@ -171,8 +171,8 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
!"•file.Lines: Path must be a list of characters" % 12 •FLines "abc""def" !"•file.Lines: Path must be a list of characters" % 12 •FLines "abc""def"
!"•file.Type: Path must be a list of characters" % •file.Type 12 !"•file.Type: Path must be a list of characters" % •file.Type 12
!"•file.Exists: Path must be a list of characters" % •file.Exists 12 !"•file.Exists: Path must be a list of characters" % •file.Exists 12
!"•file.Name: Argument must be a string" % •file.Name 12 !"•file.Name 𝕩: Argument must be a string" % •file.Name 12
!"•file.Parent: Argument must be a string" % •file.Parent 12 !"•file.Parent 𝕩: Argument must be a string" % •file.Parent 12
!"•file.MapBytes: Path must be a list of characters" % •file.MapBytes 12 !"•file.MapBytes: Path must be a list of characters" % •file.MapBytes 12
!"•file.CreateDir: Path must be a list of characters" % •file.CreateDir 12 !"•file.CreateDir: Path must be a list of characters" % •file.CreateDir 12
!"•file.RealPath: Path must be a list of characters" % •file.RealPath 12 !"•file.RealPath: Path must be a list of characters" % •file.RealPath 12
@ -189,7 +189,7 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
# some of •term # some of •term
!"Expected character" % •term.OutRaw 2{} !"Expected character" % •term.OutRaw 2{}
!"•term.ErrRaw: 𝕩 must be a list" % •term.ErrRaw 220 !"•term.ErrRaw 𝕩: 𝕩 must be a list" % •term.ErrRaw 220
@ -235,13 +235,17 @@ v←1 ⋄ ! •BQN∘•Repr⊸≡ ⟨+,1‿2,+¨,(+V)(V+V),2‿2⥊↕4⟩
# •Delay # •Delay
t0•MonoTime@ ! 0.1•Delay 0.1 ! 0.1(•MonoTime@)-t0 t0•MonoTime@ ! 0.1•Delay 0.1 ! 0.1(•MonoTime@)-t0
# •_timed tested at perf.bqn # •_timed tested more at perf.bqn
!"𝕨 𝔽•_timed 𝕩: 𝕨 must be an integer greater than 0" % 0 •_timed 2
!"Expected integer, got character" % @ •_timed 2
a1 a {𝕊: a+𝕩}•_timed 10 %% 11
a3 12 {𝕊: a+𝕩}•_timed 10 a %% 123
# •math # •math
! ´0=|1e10×{(+´𝕩)-•math.Sum 𝕩}¨ 1000•rand.Range 0 ! ´0=|1e10×{(+´𝕩)-•math.Sum 𝕩}¨ 1000•rand.Range 0
!"•math.Sum: Argument must be a list (⟨⟩ ≡ ≢𝕩)" % •math.Sum 2 !"•math.Sum 𝕩: 𝕩 must be a list (⟨⟩ ≡ ≢𝕩)" % •math.Sum 2
!"•math.Sum: Argument must be a list (2‿2 ≡ ≢𝕩)" % •math.Sum 221 !"•math.Sum 𝕩: 𝕩 must be a list (2‿2 ≡ ≢𝕩)" % •math.Sum 221
!"•math.Sum: Argument elements must be numbers" % •math.Sum 1'a' !"•math.Sum 𝕩: 𝕩 elements must be numbers" % •math.Sum 1'a'
@ -261,15 +265,15 @@ E←•internal.EEqual ⋄ {! (𝕏 4⥊0) E 𝕏 1↓¯1×π∾4⥊0}¨ (⊢∾
1e5×{0.1 𝕏 0.2}¨ •math.Atan2,•math.Comb,•math.Hypot,•math.Atan2,•math.Atan2˜ %% 1107149695922360202749331 1e5×{0.1 𝕏 0.2}¨ •math.Atan2,•math.Comb,•math.Hypot,•math.Atan2,•math.Atan2˜ %% 1107149695922360202749331
1e5×{=˜99¨ 𝕏 0.13}¨ •math.Acos,•math.Acosh,•math.Asin,•math.Asinh,•math.Atan,•math.Atanh,•math.Cbrt,•math.Cos,•math.Cosh,•math.Erf,•math.ErfC,•math.Expm1,•math.Fact,•math.Log10,•math.Log1p,•math.Log2,•math.LogFact,•math.Sin,•math.Sinh,•math.Tan,•math.Tanh %% 1470629900000,9900000176274,100169900000,9983181844,9966124904,100339900000,46415144224,99500¯99000,1005001006766,1124699997,887532,105171908553,95135600000,¯10000047712,9531138629,¯332193158496,¯4988179175,998314112,100161001787,10033¯14255,996699505 1e5×{=˜99¨ 𝕏 0.13}¨ •math.Acos,•math.Acosh,•math.Asin,•math.Asinh,•math.Atan,•math.Atanh,•math.Cbrt,•math.Cos,•math.Cosh,•math.Erf,•math.ErfC,•math.Expm1,•math.Fact,•math.Log10,•math.Log1p,•math.Log2,•math.LogFact,•math.Sin,•math.Sinh,•math.Tan,•math.Tanh %% 1470629900000,9900000176274,100169900000,9983181844,9966124904,100339900000,46415144224,99500¯99000,1005001006766,1124699997,887532,105171908553,95135600000,¯10000047712,9531138629,¯332193158496,¯4988179175,998314112,100161001787,10033¯14255,996699505
{𝕩 ! 12 (𝕏 𝕏¨) 34}¨ •math.Atan2,•math.Comb,•math.Hypot,•math.Atan2,•math.Atan2˜,•math.GCD,•math.LCM {𝕩 ! 12 (𝕏 𝕏¨) 34}¨ •math.Atan2,•math.Comb,•math.Hypot,•math.Atan2,•math.Atan2˜,•math.GCD,•math.LCM
!"•math.GCD: Inputs other than natural numbers not yet supported" % 1.5 •math.GCD 3 !"𝕨 •math.GCD 𝕩: Inputs other than natural numbers not yet supported" % 1.5 •math.GCD 3
!"•math.LCM: Inputs other than natural numbers not yet supported" % 3 •math.LCM 1.5 !"𝕨 •math.LCM 𝕩: Inputs other than natural numbers not yet supported" % 3 •math.LCM 1.5
!"•math.LCM: Unexpected argument types" % "foo" •math.LCM 3 !"𝕨 •math.LCM 𝕩: Unexpected argument types" % "foo" •math.LCM 3
!"•math.GCD: Unexpected argument types" % 3 •math.GCD {+} !"𝕨 •math.GCD 𝕩: Unexpected argument types" % 3 •math.GCD {+}
!"•math.Sin: Argument contained non-number" % •math.Sin "foo" !"•math.Sin 𝕩: 𝕩 contained non-number" % •math.Sin "foo"
!"•math.Log10: Argument contained non-number" % •math.Log10 "foo" !"•math.Log10 𝕩: 𝕩 contained non-number" % •math.Log10 "foo"
!"•math.Atan2: Unexpected argument types" % 1 •math.Atan2 'a' !"𝕨 •math.Atan2 𝕩: Unexpected argument types" % 1 •math.Atan2 'a'
!"•math.Atan2⁼: Unexpected argument types" % 1 •math.Atan2 {} !"𝕨 •math.Atan2⁼ 𝕩: Unexpected argument types" % 1 •math.Atan2 {}
!"•math.Atan2˜⁼: Unexpected argument types" % {} •math.Atan2˜ 'b' !"𝕨 •math.Atan2˜ 𝕩: Unexpected argument types" % {} •math.Atan2˜ 'b'
# •rand / •MakeRand # •rand / •MakeRand
0 (•MakeRand 0).Range¨2 %% 0 (•MakeRand 0).Range¨2 %%
@ -277,7 +281,7 @@ E←•internal.EEqual ⋄ {! (𝕏 4⥊0) E 𝕏 1↓¯1×π∾4⥊0}¨ (⊢∾
(•MakeRand 0).Deal 0 %% (•MakeRand 0).Deal 0 %%
0 (•MakeRand 0).Subset 0 %% 0 (•MakeRand 0).Subset 0 %%
{!(•rand.Deal 𝕩)𝕩}¨ ¯101+222 # %SLOW {!(•rand.Deal 𝕩)𝕩}¨ ¯101+222 # %SLOW
!"(rand).Range: Result rank too large (256≡≢𝕨)" % (2561) •rand.Range 0 !"𝕨 (rand).Range 𝕩: Result rank too large (256≡≢𝕨)" % (2561) •rand.Range 0
! ˝ a{r•MakeRand 𝕩 r.Range 1e9, 100 r.Range 1e9, r.Deal 100, 100 r.Deal 200, 100 r.Deal 200, 100 r.Subset 200}¨ 222 !¨´ a ! ˝ a{r•MakeRand 𝕩 r.Range 1e9, 100 r.Range 1e9, r.Deal 100, 100 r.Deal 200, 100 r.Deal 200, 100 r.Subset 200}¨ 222 !¨´ a
r•MakeRand 1 ! 1¨ {𝕊: 800 r.Subset 1000}¨ 4 r•MakeRand 1 ! 1¨ {𝕊: 800 r.Subset 1000}¨ 4
r•MakeRand 1 ! 1¨ {𝕊: 50 r.Subset 10000}¨ 4 r•MakeRand 1 ! 1¨ {𝕊: 50 r.Subset 10000}¨ 4

View File

@ -17,8 +17,8 @@
(10)+((2÷˜)) 10×10 %% 5162738495061728394 (10)+((2÷˜)) 10×10 %% 5162738495061728394
((¯1+=)) 339 %% 33210543876 ((¯1+=)) 339 %% 33210543876
!"Expected integer, got function" % 1+((¯1+)˙)"ab" !"Expected integer, got function" % 1+((¯1+)˙)"ab"
!"⊑: 𝕨 must be a numeric array" % ((@,@,¯1+˙))"ab" !"𝕨𝕩: 𝕨 must be a numeric array" % ((@,@,¯1+˙))"ab"
!"◶: 𝕘 must have rank 1 when index is a number" % (@,@,¯1+)"ab" !"𝔽𝕘𝕩: 𝕘 must have rank 1 when index is a number" % (@,@,¯1+)"ab"
@ -27,11 +27,11 @@
!"𝔽⌾(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⟩)" % 102030(12,21) 4416
!"𝔽⌾(a⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨2⟩, got ⟨3⟩)" % 1(12,21) 4416 !"𝔽⌾(a⊸⊑)𝕩: 𝔽 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 !"𝔽⌾(n⊸⊑)𝕩: reading out-of-bounds (n≡¯10, 3≡≠𝕩)" % 1+(¯10) 3
!"⊑: 𝕨 contained list with mixed-type elements" % 'a'(1'a') 459 !"𝕨𝕩: 𝕨 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 !"𝕨𝕩: Indexing out-of-bounds (index 1‿5 in array of shape 4‿5)" % 'a'(15) 459
10,2030(12,13,21) 459 %% 4501234561020013034567801 10,2030(12,13,21) 459 %% 4501234561020013034567801
!"⊑: Picking item at wrong rank (index 1‿1‿1 in array of shape 10‿10)" % 1¨(111) 10101 !"𝕨𝕩: Picking item at wrong rank (index 1‿1‿1 in array of shape 10‿10)" % 1¨(111) 10101
!"⊑: Picking item at wrong rank (index ⟨1⟩ in array of shape 10‿10)" % 1¨(1) 10101 !"𝕨𝕩: Picking item at wrong rank (index ⟨1⟩ in array of shape 10‿10)" % 1¨(1) 10101
a1010101000 ! a a((a)) a a1010101000 ! a a((a)) a
{𝕊: a(1+•rand.Range 200)•rand.Range 2 i•rand.Rangea ! a (ia)(i) 2(i) a}¨10000 {𝕊: a(1+•rand.Range 200)•rand.Range 2 i•rand.Rangea ! a (ia)(i) 2(i) a}¨10000
100+(5) 44 %% (100×5=16) + 44 100+(5) 44 %% (100×5=16) + 44
@ -44,8 +44,8 @@ a←10‿10‿10⥊↕1000 ⋄ ! a ≡ a⌾((↕≢a)⊸⊑) a
# ⊏ # ⊏
n500 an i(-n)+2×n r(2×n)a ! (a) r(i) a n500 an i(-n)+2×n r(2×n)a ! (a) r(i) a
!"⊏: 𝕩 cannot be a unit" % 00(00) <0 !"𝕨𝕩: 𝕩 cannot be a unit" % 00(00) <0
!"⊏: 𝕩 cannot be a unit" % %USE evar (0) {(𝕨)𝕩}_evar <0 !"𝕨𝕩: 𝕩 cannot be a unit" % %USE evar (0) {(𝕨)𝕩}_evar <0
!"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (¯11∊a, ⟨10⟩≡≢𝕩)" % %USE evar 5¯11 {01(𝕨)𝕩}_evar 10101 !"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (¯11∊a, ⟨10⟩≡≢𝕩)" % %USE evar 5¯11 {01(𝕨)𝕩}_evar 10101
!"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (10∊a, ⟨10⟩≡≢𝕩)" % %USE evar 910 {01(𝕨)𝕩}_evar 10101 !"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (10∊a, ⟨10⟩≡≢𝕩)" % %USE evar 910 {01(𝕨)𝕩}_evar 10101
!"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (10∊a, ⟨10⟩≡≢𝕩)" % %USE evar "ab" {𝕨(910)𝕩}_evar 10"foo" !"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (10∊a, ⟨10⟩≡≢𝕩)" % %USE evar "ab" {𝕨(910)𝕩}_evar 10"foo"
@ -120,7 +120,7 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡
# / # /
!"/: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 10)" % 1(101/) 10 !"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 10)" % 1(101/) 10
10+(1,01/)22 %% 2200,1011,10,1111 10+(1,01/)22 %% 2200,1011,10,1111
!"𝔽⌾(a⊸/): Incompatible result elements" % 12(20/)2 !"𝔽⌾(a⊸/): Incompatible result elements" % 12(20/)2
1+((10)/) 10 %% ×+ 10 1+((10)/) 10 %% ×+ 10
@ -146,7 +146,7 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡
%USE eqvar 100011 { ˙¨(𝕨/)𝕩}_eqvar 010101 %% 101 %USE eqvar 100011 { ˙¨(𝕨/)𝕩}_eqvar 010101 %% 101
%USE eqvar 100011 { 3¨(𝕨/)𝕩}_eqvar "hellow" %% 3'e''l''l'33 %USE eqvar 100011 { 3¨(𝕨/)𝕩}_eqvar "hellow" %% 3'e''l''l'33
%USE eqvar 100011 { +˙¨(𝕨/)𝕩}_eqvar -÷×=<> %% +÷×=++ %USE eqvar 100011 { +˙¨(𝕨/)𝕩}_eqvar -÷×=<> %% +÷×=++
!"/: Lengths of components of 𝕨 must match 𝕩 (6 ≠ 7)" % 0¨(100011/) 0101010 !"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (6 ≠ 7)" % 0¨(100011/) 0101010
4 (3)(010/) 3 %!PROPER_FILLS %% 0,3,2,0 4 (3)(010/) 3 %!PROPER_FILLS %% 0,3,2,0
4 (010/) 3 %!PROPER_FILLS %% 0,1,2,0 4 (010/) 3 %!PROPER_FILLS %% 0,1,2,0
4 (000/) 3 %!PROPER_FILLS %% 0,1,2,0 4 (000/) 3 %!PROPER_FILLS %% 0,1,2,0

View File

@ -18,8 +18,13 @@
!"≍⁼: Argument must have a leading axis of 1" % "foo" !"≍⁼: Argument must have a leading axis of 1" % "foo"
!"≍⁼: Argument must have a leading axis of 1" % 311<"foo" !"≍⁼: Argument must have a leading axis of 1" % 311<"foo"
!"⌽: Argument cannot be a unit" % 0 !"⌽𝕩: 𝕩 cannot be a unit" % 0
10 %% 9-10 10 %% 9-10
!"⍉⁼: 𝕩 must not be an atom" % 3 !"⍉⁼𝕩: 𝕩 must not be an atom" % 3
!"𝕨⍉⁼𝕩: 𝕩 must not be an atom" % 0 3
!"𝕨⍉⁼𝕩: Length of 𝕨 must be at most rank of 𝕩" % 00 3
!"𝕨⍉⁼𝕩: Axis 9 does not exist (1≡=𝕩)" % 9 3
!"𝕨⍉⁼𝕩: Axis 9 does not exist (3≡=𝕩)" % 9 3333
!"𝕨⍉⁼𝕩: 𝕨 must have rank at most 1" % (110) 3
<3 %% <3 <3 %% <3

View File

@ -1,5 +1,5 @@
!"Out of memory" % a(220) 1e9 •internal.Keep {𝕊: a}˘ a !"Out of memory" % a(220) 1e9 •internal.Keep {𝕊: a}˘ a
!"⥊: 𝕨 too large" % a(220) 1e9 •internal.Keep a˘ a !"𝕨𝕩: 𝕨 too large" % a(220) 1e9 •internal.Keep a˘ a
!"Out of memory" % •internal.Keep (225)/(210)10 !"Out of memory" % •internal.Keep (225)/(210)10
!"Out of memory" % k16384 nk÷˜232 •internal.Keep (nk) / n1 !"Out of memory" % k16384 nk÷˜232 •internal.Keep (nk) / n1
!"Out of memory" % k64 nk÷˜232 •internal.Keep (nk) / n1 # %SLOW !"Out of memory" % k64 nk÷˜232 •internal.Keep (nk) / n1 # %SLOW