Merge pull request #132 from tankorsmash/update-error-messages
Use 𝕨 and 𝕩 inside error messages
This commit is contained in:
commit
4af2fdafca
@ -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) { \
|
||||
if (isArr(w)|isArr(x)) { B r; \
|
||||
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); \
|
||||
u8 we = TI(w,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) \
|
||||
} \
|
||||
thrM(SYMB ": Unexpected argument types"); \
|
||||
thrM("𝕨" SYMB "𝕩: Unexpected argument types"); \
|
||||
}
|
||||
GC2f("÷", div , w.f/(x.f+0),
|
||||
, /*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) { \
|
||||
ur wr=RNK(w); usz* xsh=SH(x); \
|
||||
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 (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; \
|
||||
@ -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);
|
||||
for (usz i = 0; i < wia; 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;
|
||||
}
|
||||
@ -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);
|
||||
for (usz i = 0; i < xia; i++) {
|
||||
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;
|
||||
}
|
||||
@ -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) { \
|
||||
if (isF64(w) & isF64(x)) return m_f64(EXPR); \
|
||||
MORE; AR_I_TO_ARR(NAME) \
|
||||
thrM(CHR ": Unexpected argument types"); \
|
||||
thrM("𝕨"CHR "𝕩: Unexpected argument types"); \
|
||||
}
|
||||
|
||||
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 (isF64(w) & isC32(x)) { u64 r = (u64)(o2cG(x)+o2i64(w)); 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); }
|
||||
});
|
||||
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);
|
||||
})
|
||||
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) { \
|
||||
if (isF64(w) & isF64(x)) return m_f64(EXPR); \
|
||||
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("⋆", 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) { \
|
||||
if (isNum(w) && isNum(x)) return m_f64(I(x.f, w.f)); \
|
||||
P2(n) \
|
||||
thrM("•math." N ": Unexpected argument types"); \
|
||||
thrM("𝕨 •math." N " 𝕩: Unexpected argument types"); \
|
||||
}
|
||||
MATH(atan2,"Atan2",bqn_atan2)
|
||||
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) {
|
||||
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)));
|
||||
}
|
||||
P2(gcd)
|
||||
thrM("•math.GCD: Unexpected argument types");
|
||||
thrM("𝕨 •math.GCD 𝕩: Unexpected argument types");
|
||||
}
|
||||
B lcm_c2(B t, B w, B 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)));
|
||||
}
|
||||
P2(lcm)
|
||||
thrM("•math.LCM: Unexpected argument types");
|
||||
thrM("𝕨 •math.LCM 𝕩: Unexpected argument types");
|
||||
}
|
||||
|
||||
#undef P2
|
||||
|
||||
@ -23,7 +23,7 @@ B bit_negate(B x) { // consumes
|
||||
|
||||
B add_c1(B t, B 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;
|
||||
decG(eachm_fn(m_f64(0), incG(x), add_c1));
|
||||
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) { \
|
||||
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); \
|
||||
if (elNum(xe)) { \
|
||||
if (xe<=TMIN) return RMIN; \
|
||||
@ -112,8 +112,8 @@ GC1i("¬", not, 1-v, el_bit, bit_negate(x), NOT_BODY)
|
||||
thrM(MSG); \
|
||||
}
|
||||
|
||||
GC1f( div, 1/(xv+0), "÷: Argument contained non-number")
|
||||
GC1f(root, sqrt(xv), "√: Argument contained non-number")
|
||||
GC1f( div, 1/(xv+0), "÷𝕩: 𝕩 contained non-number")
|
||||
GC1f(root, sqrt(xv), "√𝕩: 𝕩 contained non-number")
|
||||
#undef GC1i
|
||||
#undef LOOP_BODY
|
||||
#undef SIGN_EXPR
|
||||
@ -142,13 +142,13 @@ NOINLINE f64 logfact_inv(f64 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); } }
|
||||
B pow_c1(B t, B x) { if (isF64(x)) return m_f64( exp(x.f)); P1( pow); thrM("⋆: Argument 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 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("⋆⁼𝕩: 𝕩 contained non-number"); }
|
||||
#undef P1
|
||||
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(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); }
|
||||
MATH(cbrt,Cbrt) MATH(log2,Log2) MATH(log10,Log10) MATH(log1p,Log1p) MATH(expm1,Expm1)
|
||||
|
||||
@ -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);
|
||||
case n_couple: {
|
||||
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);
|
||||
shcpy(rsh->a, xsh, k);
|
||||
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) {
|
||||
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;
|
||||
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;
|
||||
case n_pick: if (isF64(w) && xcr==1 && TI(x,arrD1)) {
|
||||
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;
|
||||
case n_shifta: case n_shiftb: if (isAtm(w)) {
|
||||
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;
|
||||
for (usz i = 0; i < k; 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];
|
||||
}
|
||||
usz ext = shProd(zsh, k, zk);
|
||||
|
||||
@ -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); \
|
||||
decG(w);decG(x); return r; \
|
||||
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(">", "<", gt, )
|
||||
|
||||
@ -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 (RARE(we==el_B || xe==el_B)) return eequalSlow(w, x, ia);
|
||||
return equalTyped(w, x, we, xe, ia);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,8 @@ static B* ud_rec(B* p, usz d, usz r, i32* pos, usz* sh) {
|
||||
NOINLINE B list_range(B x) {
|
||||
SGetU(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 (xia>UR_MAX) thrF("↕: Result rank too large (%s≡≠𝕩)", xia);
|
||||
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==0) { decG(x); return m_funit(emptyIVec()); }
|
||||
usz sh[xia]; // stack allocation of rank items
|
||||
i32 pos[xia];
|
||||
@ -73,7 +73,7 @@ NOINLINE B list_range(B x) {
|
||||
good|= c==0;
|
||||
bad|= (c > I32_MAX) | mulOn(ria, c);
|
||||
}
|
||||
if (bad && !good) thrM("↕: Result too large");
|
||||
if (bad && !good) thrM("↕𝕩: Result too large");
|
||||
decG(x);
|
||||
|
||||
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) {
|
||||
usz wia=1;
|
||||
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);
|
||||
if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); }
|
||||
}
|
||||
ur xr;
|
||||
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 (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");
|
||||
ur wr = wia;
|
||||
ur rr = xr + wr;
|
||||
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++) {
|
||||
usz l = xsh[i] + 1;
|
||||
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;
|
||||
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
|
||||
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;
|
||||
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);
|
||||
MAKE_MUT_INIT(r, ria, TI(x,elType));
|
||||
MUTG_INIT(r);
|
||||
@ -233,7 +233,7 @@ extern GLOBAL B rt_find;
|
||||
B find_c2(B t, B w, B x) {
|
||||
ur wr = isAtm(w) ? 0 : RNK(w);
|
||||
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);
|
||||
B r;
|
||||
if (xr==1 && (xe=TI(x,elType))!=el_B && xe!=el_bit && (isAtm(w) || (we=TI(w,elType))!=el_B)) {
|
||||
|
||||
@ -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 };
|
||||
|
||||
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);
|
||||
if (ia==0) { decG(x); return m_f64(0); }
|
||||
u8 xe = TI(x,elType);
|
||||
if (!elNum(xe)) {
|
||||
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;
|
||||
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 };
|
||||
|
||||
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);
|
||||
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);
|
||||
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); }
|
||||
@ -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;
|
||||
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);
|
||||
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); }
|
||||
@ -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;
|
||||
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);
|
||||
if (len==0) {
|
||||
if (isFun(f)) {
|
||||
@ -400,11 +400,11 @@ B insert_c1(Md1D* d, B x) { B f = d->f;
|
||||
}
|
||||
decG(x); return taga(r);
|
||||
} else if (RTID(f) == n_join) {
|
||||
if (xr <= 1) thrM("˝: Identity does not exist");
|
||||
if (xr <= 1) thrM("𝔽˝𝕩: Identity does not exist");
|
||||
goto join;
|
||||
}
|
||||
}
|
||||
thrM("˝: Identity not found");
|
||||
thrM("𝔽˝𝕩: Identity not found");
|
||||
}
|
||||
if (len==1) return C1(select, x);
|
||||
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;
|
||||
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);
|
||||
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); }
|
||||
|
||||
@ -204,7 +204,7 @@ extern i8 (*const simd_count_i8)(u16*, u16*, void*, u64, i8);
|
||||
|
||||
#define SORT_C1 CAT(GRADE_UD(and,or),c1)
|
||||
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);
|
||||
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);
|
||||
@ -278,7 +278,7 @@ extern B grade_bool(B x, usz ia, bool up); // slash.c
|
||||
|
||||
#define GRADE_CHR GRADE_UD("⍋","⍒")
|
||||
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);
|
||||
usz ia = IA(x);
|
||||
B r;
|
||||
@ -292,7 +292,7 @@ B GRADE_CAT(c1)(B t, B x) {
|
||||
|
||||
u8 xe = TI(x,elType);
|
||||
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);
|
||||
if (xe==el_i8 && ia>8) {
|
||||
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);
|
||||
|
||||
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);
|
||||
ur wr = RNK(w);
|
||||
|
||||
if (wr > 1) {
|
||||
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;
|
||||
x = toKCells(x, nxr);
|
||||
w = toCells(w);
|
||||
@ -466,11 +466,11 @@ B GRADE_CAT(c2)(B t, B w, B x) {
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
#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();
|
||||
|
||||
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;
|
||||
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);
|
||||
if (isArr(w) && RNK(w)==1 && xr>=1) {
|
||||
u8 we = TI(w,elType);
|
||||
@ -273,7 +273,7 @@ B group_c2(B t, B w, B x) {
|
||||
usz wia = IA(w);
|
||||
usz* xsh = SH(x);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,9 +85,9 @@ FOR_VARIATION(F)
|
||||
STATIC_GLOBAL B listVariations_def;
|
||||
|
||||
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);
|
||||
SGetU(w)
|
||||
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));
|
||||
if (c=='i') c_incr=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);
|
||||
|
||||
@ -164,13 +164,13 @@ static bool u8_get(u8** cv, u8* cE, const char* x) {
|
||||
|
||||
STATIC_GLOBAL B variation_refs;
|
||||
B variation_c2(B t, B w, B x) {
|
||||
if (!isArr(w)) thrM("•internal.Variation: Non-array 𝕨");
|
||||
if (!isArr(x)) thrM("•internal.Variation: Non-array 𝕩");
|
||||
if (!isArr(w)) thrM("𝕨•internal.Variation𝕩: Non-array 𝕨");
|
||||
if (!isArr(x)) thrM("𝕨•internal.Variation𝕩: Non-array 𝕩");
|
||||
usz xia = IA(x);
|
||||
C8Arr* wc = toC8Arr(w);
|
||||
u8* wp = c8arrv_ptr(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;
|
||||
if (*wp == 'A' || *wp == 'S') {
|
||||
bool slice = *wp == 'S';
|
||||
@ -192,7 +192,7 @@ B variation_c2(B t, B w, B x) {
|
||||
NOGC_E;
|
||||
|
||||
res = taga(r);
|
||||
} else thrF("•internal.Variation: Bad type \"%R\"", taga(wc));
|
||||
} else thrF("𝕨•internal.Variation𝕩: Bad type \"%R\"", taga(wc));
|
||||
|
||||
if (slice) {
|
||||
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));
|
||||
}
|
||||
if (wp!=wpE) thrM("•internal.Variation: Bad 𝕨");
|
||||
} else thrM("•internal.Variation: Bad start of 𝕨");
|
||||
if (wp!=wpE) thrM("𝕨•internal.Variation𝕩: Bad 𝕨");
|
||||
} else thrM("𝕨•internal.Variation𝕩: Bad start of 𝕨");
|
||||
decG(x);
|
||||
ptr_dec(wc);
|
||||
return res;
|
||||
@ -257,7 +257,7 @@ static B unshare(B x) {
|
||||
for (usz i = 0; i < xia; i++) rp[i] = unshare(xp[i]);
|
||||
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 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;
|
||||
B r = m_i32arrv(&rp, 3);
|
||||
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) {
|
||||
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);
|
||||
decG(x);
|
||||
return r;
|
||||
|
||||
@ -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 xr = RNK(x); usz xia = IA(x);
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
FC1 fc1 = c1fn(f);
|
||||
u64 sns = nsTime();
|
||||
|
||||
@ -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 fr = c1iX(f, x);
|
||||
if (isNum(fr)) {
|
||||
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 𝕘"));
|
||||
if (isAtm(g)||RNK(g)!=1) thrM("𝔽◶𝕘𝕩: 𝕘 must have rank 1 when index is a number");
|
||||
usz fri = WRAP(o2i64(fr), IA(g), thrM("𝔽◶𝕘𝕩: Index out of bounds of 𝕘"));
|
||||
return c1(IGetU(g, fri), x);
|
||||
} else {
|
||||
B fn = C2(pick, fr, inc(g));
|
||||
@ -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 fr = c2iWX(d->f, w, x);
|
||||
if (isNum(fr)) {
|
||||
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 𝕘"));
|
||||
if (isAtm(g)||RNK(g)!=1) thrM("𝕨𝔽◶𝕘𝕩: 𝕘 must have rank 1 when index is a number");
|
||||
usz fri = WRAP(o2i64(fr), IA(g), thrM("𝕨𝔽◶𝕘𝕩: Index out of bounds of 𝕘"));
|
||||
return c2(IGetU(g, fri), w, x);
|
||||
} else {
|
||||
B fn = C2(pick, fr, inc(g));
|
||||
|
||||
@ -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
|
||||
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);
|
||||
usz ia = IA(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;
|
||||
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);
|
||||
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 (RARE(!isFun(f))) {
|
||||
if (isMd(f)) thrM("Calling a modifier");
|
||||
|
||||
@ -154,11 +154,11 @@ static NOINLINE B2 splitCells(B n, B p, u8 mode) { // 0:∊ 1:⊐ 2:⊒
|
||||
#define SYMB (mode==0? "∊" : mode==1? "⊐" : "⊒")
|
||||
#define ARG_N (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);
|
||||
if (isAtm(n)) n = m_unit(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 nco = nr-pcr;
|
||||
if (nco>0 && eqShPart(SH(n)+nco, SH(p)+1, pcr)) {
|
||||
|
||||
@ -126,10 +126,10 @@ FORCE_INLINE void cf_call(CFRes f, void* r, ux rs, void* x, ux xs) {
|
||||
|
||||
extern GLOBAL B rt_select;
|
||||
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);
|
||||
if (xr==0) thrM("⊏: Argument cannot be rank 0");
|
||||
if (SH(x)[0]==0) thrF("⊏: Argument shape cannot start with 0 (%H ≡ ≢𝕩)", x);
|
||||
if (xr==0) thrM("⊏𝕩: 𝕩 cannot be rank 0");
|
||||
if (SH(x)[0]==0) thrF("⊏𝕩: 𝕩 shape cannot start with 0 (%H ≡ ≢𝕩)", x);
|
||||
usz ia = shProd(SH(x), 1, xr);
|
||||
Arr* r = TI(x,slice)(incG(x), 0, ia);
|
||||
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) {
|
||||
if (isAtm(x)) thrM("⊏: 𝕩 cannot be an atom");
|
||||
if (isAtm(x)) thrM("𝕨⊏𝕩: 𝕩 cannot be an atom");
|
||||
ur xr = RNK(x);
|
||||
if (xr==0) thrM("⊏: 𝕩 cannot be a unit");
|
||||
if (xr==0) thrM("𝕨⊏𝕩: 𝕩 cannot be a unit");
|
||||
if (isAtm(w)) {
|
||||
watom:;
|
||||
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) {
|
||||
B xf = getFillR(x);
|
||||
B xv = IGet(x, wi);
|
||||
@ -220,7 +220,7 @@ B select_c2(B t, B w, B x) {
|
||||
|
||||
#else
|
||||
#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*/ \
|
||||
if (sizeof(W) >= 4) { \
|
||||
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; \
|
||||
M_HARR(ra, wia); B* xp = arr_bptr(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))])); } \
|
||||
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)) )); } \
|
||||
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)) )); } \
|
||||
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) {
|
||||
u64* wp=bitany_ptr(w);
|
||||
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;
|
||||
} else {
|
||||
x1 = GetU(x,1);
|
||||
@ -387,14 +387,14 @@ B select_c2(B t, B w, B x) {
|
||||
bad1:;
|
||||
mut_pfree(rm, i*csz);
|
||||
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:
|
||||
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);
|
||||
shcpy(sh->a, SH(w), wr);
|
||||
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 == 1) {
|
||||
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;
|
||||
}
|
||||
u8 ie = TI(inds,elType);
|
||||
|
||||
@ -155,7 +155,7 @@ extern u64 (*const simd_deduplicate_u8)(void*,uint64_t,void*,void*);
|
||||
|
||||
#define PRUP ptr_roundUpToEl
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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);
|
||||
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 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);
|
||||
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);
|
||||
if (csz==0) goto zeroRes;
|
||||
@ -516,7 +516,7 @@ B indexOf_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);
|
||||
if (n<=1) return x;
|
||||
u8 xe = TI(x,elType);
|
||||
|
||||
@ -209,8 +209,8 @@ B shape_c2(B t, B w, B x) {
|
||||
sh = NULL;
|
||||
} else {
|
||||
if (RARE(isAtm(w))) w = m_unit(w);
|
||||
if (RNK(w)>1) thrM("⥊: 𝕨 must have rank at most 1");
|
||||
if (IA(w)>UR_MAX) thrM("⥊: Result rank too large");
|
||||
if (RNK(w)>1) thrM("𝕨⥊𝕩: 𝕨 must have rank at most 1");
|
||||
if (IA(w)>UR_MAX) thrM("𝕨⥊𝕩: Result rank too large");
|
||||
nr = IA(w);
|
||||
sh = nr<=1? NULL : m_shArr(nr);
|
||||
SGetU(w)
|
||||
@ -225,24 +225,24 @@ B shape_c2(B t, B w, B x) {
|
||||
bad|= mulOn(nia, v);
|
||||
good|= v==0;
|
||||
} else {
|
||||
if (isArr(c) || !isVal(c)) thrM("⥊: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
|
||||
if (unkPos!=-1) thrM("⥊: 𝕨 contained multiple computed axes");
|
||||
if (isArr(c) || !isVal(c)) thrM("𝕨⥊𝕩: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
|
||||
if (unkPos!=-1) thrM("𝕨⥊𝕩: 𝕨 contained multiple computed axes");
|
||||
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);
|
||||
good|= xia==0 | unkInd==n_floor;
|
||||
}
|
||||
}
|
||||
if (bad && !good) thrM("⥊: 𝕨 too large");
|
||||
if (bad && !good) thrM("𝕨⥊𝕩: 𝕨 too large");
|
||||
if (unkPos!=-1) {
|
||||
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 (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");
|
||||
i64 div = xia/nia;
|
||||
i64 mod = xia%nia;
|
||||
usz item;
|
||||
bool fill = false;
|
||||
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;
|
||||
} else if (unkInd == n_floor) {
|
||||
item = div;
|
||||
@ -269,7 +269,7 @@ B shape_c2(B t, B w, B x) {
|
||||
return truncReshape(x, xia, nia, nr, sh);
|
||||
} else {
|
||||
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);
|
||||
goto unit;
|
||||
}
|
||||
@ -351,7 +351,7 @@ B shape_c2(B t, B w, B x) {
|
||||
B pick_c1(B t, B x) {
|
||||
if (isAtm(x)) return x;
|
||||
if (RARE(IA(x)==0)) {
|
||||
thrM("⊑: Argument cannot be empty");
|
||||
thrM("⊑𝕩: 𝕩 cannot be empty");
|
||||
// B r = getFillE(x);
|
||||
// dec(x);
|
||||
// return r;
|
||||
@ -362,10 +362,10 @@ B pick_c1(B t, B x) {
|
||||
static NOINLINE void checkIndexList(B w, ur xr) {
|
||||
SGetU(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 (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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ static NOINLINE void checkIndexList(B w, ur xr) {
|
||||
|
||||
static i64 pick_convFloat(f64 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
|
||||
@ -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_B: {
|
||||
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);
|
||||
}
|
||||
SGetU(w)
|
||||
@ -403,7 +403,7 @@ static B recPick(B w, B x) { // doesn't consume
|
||||
if (ia!=xr) goto wrl;
|
||||
PICK_IDX(c, ({
|
||||
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);
|
||||
}), ia, goto oob);
|
||||
return IGet(x,c);
|
||||
@ -411,7 +411,7 @@ static B recPick(B w, B x) { // doesn't consume
|
||||
M_HARR(r, ia);
|
||||
for (usz i=0; i<ia; 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));
|
||||
}
|
||||
return any_squeeze(HARR_FC(r, w));
|
||||
@ -420,9 +420,9 @@ static B recPick(B w, B x) { // doesn't consume
|
||||
}
|
||||
#undef PICK
|
||||
|
||||
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
|
||||
oob: checkIndexList(w, xr); thrF("⊑: Indexing out-of-bounds (index %B in array of shape %H)", w, x);
|
||||
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
|
||||
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) {
|
||||
@ -431,18 +431,18 @@ B pick_c2(B t, B w, B x) {
|
||||
x = m_unit(x);
|
||||
}
|
||||
if (isNum(w)) {
|
||||
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));
|
||||
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));
|
||||
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);
|
||||
decG(w); decG(x);
|
||||
return r;
|
||||
}
|
||||
|
||||
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);
|
||||
usz* xsh = SH(x);
|
||||
u64 cam = *xsh;
|
||||
@ -480,9 +480,9 @@ NOINLINE B takedrop_highrank(bool take, B w, B x) {
|
||||
#define SYMB (take? "↑" : "↓")
|
||||
if (!isArr(w)) goto nonint;
|
||||
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);
|
||||
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;
|
||||
if (wia<=1) {
|
||||
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);
|
||||
if (anyFill && noFill(xf)) {
|
||||
#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
|
||||
xf = m_f64(0);
|
||||
#endif
|
||||
@ -636,7 +636,7 @@ NOINLINE B takedrop_highrank(bool take, B w, B x) {
|
||||
decW_ret: decG(w);
|
||||
return r;
|
||||
|
||||
nonint: thrF("%U: 𝕨 must consist of integers", SYMB);
|
||||
nonint: thrF("𝕨%U𝕩: 𝕨 must consist of integers", SYMB);
|
||||
#undef SYMB
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ B drop_c2(B t, B w, 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);
|
||||
usz xia = IA(x);
|
||||
@ -724,10 +724,10 @@ B join_c1(B t, B x) {
|
||||
if (isAtm(xf)) {
|
||||
decA(xf); decG(x);
|
||||
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);
|
||||
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);
|
||||
usz* sh = arr_shAlloc((Arr*)r.c, ir);
|
||||
if (sh) {
|
||||
@ -763,20 +763,20 @@ B join_c1(B t, B x) {
|
||||
B c = GetU(x, i);
|
||||
ur cr = isAtm(c) ? 0 : RNK(c);
|
||||
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++;
|
||||
} else {
|
||||
usz* csh = SH(c);
|
||||
ur cd = rm - cr;
|
||||
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
|
||||
assert(rd==0 && rr>0);
|
||||
esh--;
|
||||
usz l = *esh;
|
||||
for (usz j=1; j<i; 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;
|
||||
}
|
||||
@ -784,11 +784,11 @@ B join_c1(B t, B x) {
|
||||
rd = 1;
|
||||
}
|
||||
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 (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);
|
||||
M_APD_TOT(r, cam*csz);
|
||||
@ -827,7 +827,7 @@ B join_c1(B t, B x) {
|
||||
usz n = xsh[a];
|
||||
usz *ll = lp+lp[a];
|
||||
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];
|
||||
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];
|
||||
ur r1 = r1s;
|
||||
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++) {
|
||||
ur rd = r1 - ll[i];
|
||||
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;
|
||||
} else {
|
||||
B c = GetU(x, i*step);
|
||||
@ -870,8 +870,8 @@ B join_c1(B t, B x) {
|
||||
bool rd = ll[i]==-1;
|
||||
tsh[lr] = ll[i];
|
||||
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 (!eqShPart(rd?tsh0:tsh, sh, cr)) thrF("∾: Incompatible item shapes (contained arrays with shapes %H and %H along axis %i)", base, c, a);
|
||||
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 (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;
|
||||
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;
|
||||
usz wia0 = IA(w);
|
||||
@ -993,7 +993,7 @@ B join_c2(B t, B w, B x) {
|
||||
for (i32 i = 1; i < c; i++) {
|
||||
usz s = xsh[i+xr-c];
|
||||
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);
|
||||
mm_free((Value*)shObjS(rsh));
|
||||
arr_shVec(a(r));
|
||||
@ -1014,7 +1014,7 @@ B join_c2(B t, B w, B x) {
|
||||
B couple_c1(B t, B x) {
|
||||
if (isAtm(x)) return m_vec1(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);
|
||||
if (xr==0) {
|
||||
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)) w = m_unit(w);
|
||||
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);
|
||||
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);
|
||||
mut_copyG(r, 0, w, 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) {
|
||||
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);
|
||||
if (ia==0) return x;
|
||||
B xf = getFillE(x);
|
||||
@ -1070,7 +1070,7 @@ B shiftb_c1(B t, B x) {
|
||||
return qWithFill(mut_fcd(r, x), xf);
|
||||
}
|
||||
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);
|
||||
shift_check(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) {
|
||||
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);
|
||||
if (ia==0) return x;
|
||||
B xf = getFillE(x);
|
||||
@ -1100,7 +1100,7 @@ B shifta_c1(B t, B x) {
|
||||
return qWithFill(mut_fcd(r, x), xf);
|
||||
}
|
||||
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);
|
||||
shift_check(w, x);
|
||||
B f = fill_both(w, x);
|
||||
@ -1126,7 +1126,7 @@ static u64 bit_reverse(u64 x) {
|
||||
return c;
|
||||
}
|
||||
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);
|
||||
if (n<=1) return 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) {
|
||||
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);
|
||||
if (xia==0) { o2i64(w); return x; }
|
||||
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;
|
||||
PICK_IDX(c, ({
|
||||
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);
|
||||
}), xr, goto oob);
|
||||
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) {
|
||||
|
||||
@ -569,7 +569,7 @@ static B compress(B w, B x, usz wia, u8 xl, u8 xt) {
|
||||
|
||||
extern GLOBAL B rt_slash;
|
||||
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);
|
||||
if (s>=USZ_MAX) thrOOM();
|
||||
if (s==0) { decG(x); return emptyIVec(); }
|
||||
@ -627,7 +627,7 @@ B slash_c2(B t, B w, B x) {
|
||||
if (isArr(w)) {
|
||||
if (depth(w)>1) goto base;
|
||||
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; }
|
||||
wia = IA(w);
|
||||
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:
|
||||
if (!q_i32(w)) goto base;
|
||||
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);
|
||||
usz xlen = *SH(x);
|
||||
u8 xl = cellWidthLog(x);
|
||||
@ -645,7 +645,7 @@ B slash_c2(B t, B w, B x) {
|
||||
|
||||
B r;
|
||||
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;
|
||||
u8 we = TI(w,elType);
|
||||
@ -867,7 +867,7 @@ static B finish_sorted_count(B r, usz* ov, usz* oc, usz on) {
|
||||
#endif
|
||||
|
||||
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);
|
||||
usz xia = IA(x);
|
||||
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); \
|
||||
for (usz i=0; i<RIA; i++) rp[i]=0;
|
||||
#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++; \
|
||||
u##N max=xp[a-1]; \
|
||||
usz rmax=xia; \
|
||||
@ -902,7 +902,7 @@ B slash_im(B t, B x) {
|
||||
break; \
|
||||
} \
|
||||
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; \
|
||||
if (xia < ria/8) { \
|
||||
u8 maxcount = 0; \
|
||||
@ -939,7 +939,7 @@ B slash_im(B t, B x) {
|
||||
usz os = xia>>15; \
|
||||
TALLOC(u16, ov, os+1); \
|
||||
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; \
|
||||
if (ria < sa) r = C2(take, m_f64(ria), r); \
|
||||
r = finish_small_count(r, ov); \
|
||||
@ -951,7 +951,7 @@ B slash_im(B t, B x) {
|
||||
case el_i32: {
|
||||
i32* xp = i32any_ptr(x);
|
||||
TRY_SMALL_OUT(32)
|
||||
if (xia>I32_MAX) thrM("/⁼: Argument too large");
|
||||
if (xia>I32_MAX) thrM("/⁼𝕩: 𝕩 too large");
|
||||
INIT_RES(32,ria)
|
||||
simd_count_i32_i32(rp, xp, xia);
|
||||
r = num_squeeze(r); break;
|
||||
@ -963,7 +963,7 @@ B slash_im(B t, B x) {
|
||||
i##N* xp = i##N##any_ptr(x); \
|
||||
u##N max=xp[0]; \
|
||||
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; \
|
||||
TALLOC(usz, t, ria); \
|
||||
for (usz j=0; j<ria; j++) t[j]=0; \
|
||||
@ -978,14 +978,14 @@ B slash_im(B t, B x) {
|
||||
case el_f64: {
|
||||
f64* xp = f64any_ptr(x);
|
||||
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 (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 (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("/⁼𝕩: 𝕩 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();
|
||||
if (i==xia) {
|
||||
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);
|
||||
} 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;
|
||||
for (usz i = 0; i < xia; i++) rp[(usz)xp[i]]++;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ B repr_c1(B t, B x) {
|
||||
#if FORMATTER
|
||||
return bqn_repr(x);
|
||||
#else
|
||||
thrM("•Repr: Cannot represent non-numbers with -DFORMATTER=0");
|
||||
thrM("•Repr 𝕩: Cannot represent non-numbers with -DFORMATTER=0");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -110,26 +110,26 @@ B fmt_c1(B t, B x) {
|
||||
#if FORMATTER
|
||||
return bqn_fmt(x);
|
||||
#else
|
||||
thrM("•Fmt isn't supported with -DFORMATTER=0");
|
||||
thrM("•Fmt 𝕩: •Fmt isn't supported with -DFORMATTER=0");
|
||||
#endif
|
||||
}
|
||||
|
||||
#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
|
||||
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) {
|
||||
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);
|
||||
if (RNK(x)!=1) thrM("•ParseFloat: Input must have rank 1");
|
||||
if (ia==0) thrM("•ParseFloat: Input was empty");
|
||||
if (ia >= (1<<20)) thrM("•ParseFloat: Input too long"); // assumption by ryu_s2d_n
|
||||
if (RNK(x)!=1) thrM("•ParseFloat 𝕩: Input must have rank 1");
|
||||
if (ia==0) thrM("•ParseFloat 𝕩: Input was empty");
|
||||
if (ia >= (1<<20)) thrM("•ParseFloat 𝕩: Input too long"); // assumption by ryu_s2d_n
|
||||
u8* data = c8any_ptr(x);
|
||||
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);
|
||||
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));
|
||||
usz ria = tmp[wia-1]+o2sG(GetU(w,wia-1));
|
||||
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++) {
|
||||
i64 c = o2i64(GetU(x,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 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");
|
||||
return x;
|
||||
}
|
||||
@ -283,7 +283,7 @@ NOINLINE B vfyStr(B x, char* name, char* arg) {
|
||||
|
||||
GLOBAL B cdPath;
|
||||
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)
|
||||
HArr_p r = m_harr0v(3);
|
||||
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;
|
||||
B rand_range_c1(B t, B 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;
|
||||
u64 rnd = wyrand(&seed);
|
||||
RAND_END;
|
||||
@ -349,7 +349,7 @@ B rand_range_c2(B t, B w, B x) {
|
||||
usz am = 1;
|
||||
i64 max = o2i64(x);
|
||||
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);
|
||||
usz wia = IA(w);
|
||||
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);
|
||||
PLAINLOOP for (usz i = 0; i < am; i++) rp[i] = wy2u01(wyrand(&seed));
|
||||
} else {
|
||||
if (max!=1) thrM("(rand).Range: 𝕩 cannot be negative");
|
||||
if (max!=1) thrM("𝕨 (rand).Range 𝕩: 𝕩 cannot be negative");
|
||||
r = allZeroesFl(am);
|
||||
}
|
||||
} 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);
|
||||
PLAINLOOP for (usz i = 0; i < am; i++) rp[i] = wy2u0k(wyrand(&seed), max);
|
||||
} else {
|
||||
@ -416,7 +416,7 @@ B rand_range_c2(B t, B w, B x) {
|
||||
if (wia<2) {
|
||||
arr_rnk01(r, wia);
|
||||
} 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);
|
||||
SGetU(w);
|
||||
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) {
|
||||
i32 xi = o2i(x);
|
||||
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]));
|
||||
}
|
||||
|
||||
@ -516,10 +516,10 @@ B rand_deal_c1(B t, B x) {
|
||||
B rand_deal_c2(B t, B w, B x) {
|
||||
i32 wi = o2i(w);
|
||||
i32 xi = o2i(x);
|
||||
if (RARE(xi<0)) thrM("(rand).Deal: 𝕩 cannot be negative");
|
||||
if (RARE(wi<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 (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);
|
||||
B r;
|
||||
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) {
|
||||
i32 wi = o2i(w);
|
||||
i32 xi = o2i(x);
|
||||
if (RARE(wi<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<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 (wi==0) return emptyIVec();
|
||||
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);
|
||||
}
|
||||
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();
|
||||
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;
|
||||
@ -675,12 +675,12 @@ STATIC_GLOBAL NFnDesc* bqnDesc;
|
||||
STATIC_GLOBAL NFnDesc* rebqnDesc;
|
||||
STATIC_GLOBAL NFnDesc* rebqnResDesc;
|
||||
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 prim = ns_getC(x, "primitives");
|
||||
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;
|
||||
if (replVal==3) thrM("•ReBQN: Invalid repl value");
|
||||
if (replVal==3) thrM("•ReBQN 𝕩: Invalid repl value");
|
||||
B scVal;
|
||||
if (replVal==0) {
|
||||
scVal = bi_N;
|
||||
@ -708,13 +708,13 @@ B repl_c1(B t, B x) {
|
||||
#if USE_SETJMP
|
||||
GLOBAL B lastErrMsg;
|
||||
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);
|
||||
if (q_N(lastErrMsg)) thrM("•CurrentError: Not currently within any ⎊");
|
||||
if (q_N(lastErrMsg)) thrM("•CurrentError 𝕩: Not currently within any ⎊");
|
||||
return inc(lastErrMsg);
|
||||
}
|
||||
#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
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
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();
|
||||
w = taga(toHArr(w)); x = taga(toHArr(x));
|
||||
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"));
|
||||
}
|
||||
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");
|
||||
path_wChars(incG(p), x);
|
||||
decG(x);
|
||||
@ -802,7 +802,7 @@ B fbytes_c1(B d, B x) {
|
||||
return r;
|
||||
}
|
||||
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");
|
||||
path_wBytes(incG(p), 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"));
|
||||
}
|
||||
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();
|
||||
usz ia = IA(x);
|
||||
SGet(x)
|
||||
for (u64 i = 0; i < ia; 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);
|
||||
//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'));
|
||||
@ -850,7 +850,7 @@ B import_c1(B d, B x) {
|
||||
B tag_none = tagu64(100000000, C32_TAG);
|
||||
B tag_running = tagu64(100000001, C32_TAG);
|
||||
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) {
|
||||
// print_fmt("cached: %R @ %i/%i\n", path, prevIdx, IA(importKeyList));
|
||||
decG(path);
|
||||
@ -892,7 +892,7 @@ B list_c1(B d, B x) {
|
||||
B createdir_c1(B d, B x) {
|
||||
B p = path_rel(nfn_objU(d), x, "•file.CreateDir");
|
||||
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) {
|
||||
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);
|
||||
B p = path_rel(d, w, "•file.Rename");
|
||||
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) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -927,11 +927,11 @@ B fexists_c1(B d, 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -951,7 +951,7 @@ B monoTime_c1(B t, B x) {
|
||||
}
|
||||
B delay_c1(B t, B 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;
|
||||
u64 s = (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) {
|
||||
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);
|
||||
TALLOC(char, chrs, ia);
|
||||
SGetU(x)
|
||||
@ -993,11 +993,11 @@ B fromUtf8_c1(B t, B x) {
|
||||
B c = GetU(x,i);
|
||||
if (isC32(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;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1008,7 +1008,7 @@ B fromUtf8_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);
|
||||
u8* rp; B r = m_c8arrv(&rp, len);
|
||||
toUTF8(x, (char*)rp);
|
||||
@ -1315,8 +1315,8 @@ B tCharN_c1(B t, B x) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
B tRawMode_c1(B t, B x) { thrM("•term.RawMode not available"); }
|
||||
B tCharN_c1(B t, B x) { thrM("•term.CharN 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 𝕩: •term.CharN not available"); }
|
||||
#endif
|
||||
|
||||
B tCharB_c1(B t, B x) {
|
||||
@ -1330,12 +1330,12 @@ B tFlush_c1(B t, B x) {
|
||||
return 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);
|
||||
return 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);
|
||||
return x;
|
||||
}
|
||||
@ -1374,7 +1374,7 @@ static NOINLINE B name_normalize(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;
|
||||
ux am = desc->varAm;
|
||||
ux eam = 0;
|
||||
@ -1389,7 +1389,7 @@ B nKeys_c1(B t, B x) {
|
||||
return r.b;
|
||||
}
|
||||
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", "𝕩");
|
||||
x = name_normalize(x);
|
||||
B r = ns_getNU(w, x, true);
|
||||
@ -1397,7 +1397,7 @@ B nGet_c2(B t, B w, B x) {
|
||||
return inc(r);
|
||||
}
|
||||
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", "𝕩");
|
||||
x = name_normalize(x);
|
||||
B r = ns_getNU(w, x, false);
|
||||
|
||||
@ -269,26 +269,26 @@ static void shSet(Arr* ra, ur rr, ShArr* sh) {
|
||||
B transp_c2(B t, B w, B x) {
|
||||
usz wia=1;
|
||||
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);
|
||||
if (wia==0) { decG(w); return isArr(x)? x : m_unit(x); }
|
||||
}
|
||||
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
|
||||
TALLOC(u8, alloc, xr*(sizeof(ur) + 3*sizeof(usz)) + sizeof(usz)); // ur* p, usz* rsh, usz* st, usz* ri
|
||||
ur* p = (ur*)alloc;
|
||||
if (isAtm(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); }
|
||||
p[0] = a;
|
||||
} else {
|
||||
SGetU(w)
|
||||
for (usz i=0; i<wia; 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;
|
||||
}
|
||||
decG(w);
|
||||
@ -314,7 +314,7 @@ B transp_c2(B t, B w, B x) {
|
||||
|
||||
// Fill in remaining axes and check for missing ones
|
||||
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) {
|
||||
p[i] = j;
|
||||
rsh[j] = xsh[i];
|
||||
@ -461,7 +461,7 @@ B transp_c2(B t, B w, 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);
|
||||
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
|
||||
static B invert_transp_w(B w, ur xr) {
|
||||
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);
|
||||
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);
|
||||
PLAINLOOP for (usz i=0; i<a; i++) wp[i] = i+1;
|
||||
} 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);
|
||||
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)
|
||||
TALLOC(ur, p, xr);
|
||||
for (usz i=0; i<xr; i++) p[i]=xr;
|
||||
usz max = 0;
|
||||
for (usz i=0; i<wia; 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
|
||||
max = a>max? a : max;
|
||||
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) {
|
||||
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));
|
||||
if (q_N(w)) thrM("⍉⁼: Duplicate axes");
|
||||
if (q_N(w)) thrM("𝕨⍉⁼𝕩: Duplicate axes");
|
||||
return C2(transp, w, x);
|
||||
}
|
||||
|
||||
|
||||
@ -452,7 +452,7 @@ B bqn_merge(B x, u32 type) {
|
||||
if (isAtm(xf)) { dec(xf); return x; }
|
||||
i32 xfr = RNK(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);
|
||||
if (rsh) {
|
||||
shcpy (rsh , SH(x), xr);
|
||||
|
||||
@ -502,4 +502,4 @@ B nativeComp_c2(B t, B w, B x) {
|
||||
void nativeCompiler_init() {
|
||||
native_comp = m_nfn(registerNFn(m_c8vec_0("(native compiler)"), c1_bad, nativeComp_c2), bi_N);
|
||||
gc_add(native_comp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) { }
|
||||
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) {
|
||||
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);
|
||||
|
||||
@ -20,57 +20,57 @@
|
||||
!"˘: Result rank too large" % (0∾254⥊2)⊸⥊∘1˘ 0‿2⥊1
|
||||
!"⎉: Result rank too large" % (0∾254⥊2)⊸⥊∘1⎉¯1 0‿2⥊1
|
||||
!"⎉: Result rank too large" % (1⥊˜ 0∾204⥊2)⎉50 1⥊˜ 0∾100⥊2
|
||||
!"⎉: Result rank too large (204 ≡ =𝕩, 200 ≡ =𝔽v)" % {𝕊:(200⥊1)⥊1}⎉1 (205⥊1)⥊1
|
||||
!"𝔽⎉𝕘: Result rank too large (204 ≡ =𝕩, 200 ≡ =𝔽v)" % {𝕊:(200⥊1)⥊1}⎉1 (205⥊1)⥊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" ⊢˘ "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"
|
||||
! ∧´{𝕊: ! (∾≡{𝕨∾𝕩}´) (<•rand.Range∘≠⊸⊑ ⟨"ab",1‿2,⟨⟩,↕0,""⟩) ∾˜ (4•rand.Range≠)⊸⊏ ⟨1, {⇐}, 'a', <'a', <{⇐}, "ab", ↕0, ""⟩}¨↕10000
|
||||
|
||||
# error cases that could be affected by special code
|
||||
!"∧: Argument cannot have rank 0" % ∧˘↕2
|
||||
!"∨: Argument cannot have rank 0" % ∨˘"a"
|
||||
!"∧𝕩: 𝕩 cannot have rank 0" % ∧˘↕2
|
||||
!"∨𝕩: 𝕩 cannot have rank 0" % ∨˘"a"
|
||||
!"Expected non-negative integer, got ¯3" % 2‿¯3/⎉1 6‿2⥊0
|
||||
!"/: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 1‿2‿3⊸/˘≍4‿5‿6‿7
|
||||
!"/: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (2‿3‿1⥊↕4) /˘ ↕2
|
||||
!"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 1‿2‿3⊸/˘≍4‿5‿6‿7
|
||||
!"𝕨/𝕩: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (2‿3‿1⥊↕4) /˘ ↕2
|
||||
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % (<↕0)/˘○(5⊸⥊)<"ab"
|
||||
!"⊏: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % 1‿24⊏⎉1↕4‿4
|
||||
!"⊏: Indexing out-of-bounds (4∊𝕨, 4≡≠𝕩)" % ⊏⎉1˜6‿4⥊↕24
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % 1‿24⊏⎉1↕4‿4
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (4∊𝕨, 4≡≠𝕩)" % ⊏⎉1˜6‿4⥊↕24
|
||||
!"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % 0‿@‿¯1⊏⎉1 5‿2⥊0.5
|
||||
!"Expected integer, got ¯5.25" % ¯5.25⊏˘∘‿4⥊↕24
|
||||
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % 0‿0‿1 ⊏˘○(≍˘) 10000×↕3
|
||||
!"⊏: 𝕩 cannot be a unit" % 0⊏˘5⥊<"a"
|
||||
!"⊏: 𝕩 cannot be a unit" % (3‿0⥊⟨⟩)⊏˘↕3
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % 0‿0‿1 ⊏˘○(≍˘) 10000×↕3
|
||||
!"𝕨⊏𝕩: 𝕩 cannot be a unit" % 0⊏˘5⥊<"a"
|
||||
!"𝕨⊏𝕩: 𝕩 cannot be a unit" % (3‿0⥊⟨⟩)⊏˘↕3
|
||||
!"Expected integer, got 0.1" % 0.1⊑˘3‿5⥊↕15
|
||||
!"⊑: 𝕩 must be a list when 𝕨 is a number (3‿4 ≡ ≢𝕩)" % 5⊑˘↕2‿3‿4
|
||||
!">: Result rank too large (80 ≡ =𝕩, 205 ≡ =⊑𝕩)" % >⎉80 (200⥊1)⥊<(205⥊1)⥊1
|
||||
!"⎉: Result rank too large (195 ≡ =𝕩, 210 ≡ =𝔽v)" % >⎉5 (200⥊1)⥊<(205⥊1)⥊1
|
||||
!"∾: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc"∾"def")∾˘○(3/≍)≍"a"
|
||||
!"∾: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 1∾˘↕3‿3‿3
|
||||
!"∾: Lengths not matchable (4‿2 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (3‿4‿2⥊4)∾˘3‿3‿3⥊5
|
||||
!"≍: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (↕3‿4)≍⎉2 2‿3‿3⥊↕18
|
||||
!"≍: Result rank too large (255≡=𝕩)" % ≍⎉∞ 0⥊˜255⥊1
|
||||
!"𝕨⊑𝕩: 𝕩 must be a list when 𝕨 is a number (3‿4 ≡ ≢𝕩)" % 5⊑˘↕2‿3‿4
|
||||
!">𝕩: Result rank too large (80 ≡ =𝕩, 205 ≡ =⊑𝕩)" % >⎉80 (200⥊1)⥊<(205⥊1)⥊1
|
||||
!"𝔽⎉𝕘: Result rank too large (195 ≡ =𝕩, 210 ≡ =𝔽v)" % >⎉5 (200⥊1)⥊<(205⥊1)⥊1
|
||||
!"𝕨∾𝕩: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc"∾"def")∾˘○(3/≍)≍"a"
|
||||
!"𝕨∾𝕩: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 1∾˘↕3‿3‿3
|
||||
!"𝕨∾𝕩: Lengths not matchable (4‿2 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (3‿4‿2⥊4)∾˘3‿3‿3⥊5
|
||||
!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (↕3‿4)≍⎉2 2‿3‿3⥊↕18
|
||||
!"≍𝕩: Result rank too large (255≡=𝕩)" % ≍⎉∞ 0⥊˜255⥊1
|
||||
!"shift: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc"∾"def")«˘○(3/≍)≍"a"
|
||||
!"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (0≡=𝕨, 2≡=𝕩)" % 1«˘↕2‿2‿2
|
||||
!"»: Argument cannot be a scalar" % »⎉0 2‿3‿1⥊↕6
|
||||
!"⌽: Argument cannot be a unit" % ⌽˘↕10
|
||||
!"»𝕩: 𝕩 cannot be a scalar" % »⎉0 2‿3‿1⥊↕6
|
||||
!"⌽𝕩: 𝕩 cannot be a unit" % ⌽˘↕10
|
||||
!"Expected integer, got 1.5" % 1.5↑˘↕2‿3‿2
|
||||
!"↑: 𝕨 must have rank at most 1 (1‿2 ≡ ≢𝕨)" % (≍1‿2)⊸↑˘↕2‿3‿2
|
||||
!"↓: 𝕨 must have rank at most 1 (4‿2 ≡ ≢𝕨)" % (4‿2⥊↕8)↓˘○≍@
|
||||
!"𝕨↑𝕩: 𝕨 must have rank at most 1 (1‿2 ≡ ≢𝕨)" % (≍1‿2)⊸↑˘↕2‿3‿2
|
||||
!"𝕨↓𝕩: 𝕨 must have rank at most 1 (4‿2 ≡ ≢𝕨)" % (4‿2⥊↕8)↓˘○≍@
|
||||
!"Integer out of range: 1e20" % 1e20⌽˘3‿10⥊10
|
||||
!"Expected number" % 3‿4‿@⌽˘↕3‿4
|
||||
!"Expected integer, got 0.5" % 0.5⊸⌽˘4‿3⥊↕12
|
||||
!"↑: Argument must have rank at least 1" % ↑˘↕2
|
||||
!"↓: Argument must have rank at least 1" % ↓⎉0 2‿1⥊0
|
||||
!"⊐: 𝕩 cannot have rank 0" % ⊐˘"abcd"
|
||||
!"⊒: Argument cannot have rank 0" % ⊒˘"abcd"
|
||||
!"∊: Argument cannot have rank 0" % ∊˘"abcd"
|
||||
!"⍋: 𝕨 must be sorted" % 0‿2‿1⊸⍋˘ 3‿4⥊↕12
|
||||
!"`: Shape of 𝕨 must match the cell of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (2‿2⥊1)+`˘2‿2‿3⥊0.4
|
||||
!"`: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`˘↕3‿3‿3
|
||||
!"´: Argument must be a list (3‿3 ≡ ≢𝕩)" % +´˘2‿3‿3⥊↕18
|
||||
!"´: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 1+´˘2‿3‿3⥊↕18
|
||||
!"˝: 𝕩 must have rank at least 1" % +˝˘˘10‿10⥊↕100
|
||||
!"˝: 𝕩 must have rank at least 1" % ∾˝⎉¯2 2‿3⥊9
|
||||
!"↑𝕩: 𝕩 must have rank at least 1" % ↑˘↕2
|
||||
!"↓𝕩: 𝕩 must have rank at least 1" % ↓⎉0 2‿1⥊0
|
||||
!"⊐𝕩: 𝕩 cannot have rank 0" % ⊐˘"abcd"
|
||||
!"⊒𝕩: 𝕩 cannot have rank 0" % ⊒˘"abcd"
|
||||
!"∊𝕩: 𝕩 cannot have rank 0" % ∊˘"abcd"
|
||||
!"𝕨⍋𝕩: 𝕨 must be sorted" % 0‿2‿1⊸⍋˘ 3‿4⥊↕12
|
||||
!"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (2‿2⥊1)+`˘2‿2‿3⥊0.4
|
||||
!"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`˘↕3‿3‿3
|
||||
!"𝔽´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % +´˘2‿3‿3⥊↕18
|
||||
!"𝕨𝔽´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 1+´˘2‿3‿3⥊↕18
|
||||
!"𝔽˝𝕩: 𝕩 must have rank at least 1" % +˝˘˘10‿10⥊↕100
|
||||
!"𝔽˝𝕩: 𝕩 must have rank at least 1" % ∾˝⎉¯2 2‿3⥊9
|
||||
|
||||
{∾˝˘ ⥊⟜(↕×´) 2+↕𝕩}¨ 2‿3‿4‿5 %% ⥊⟜(↕×´)¨ ⟨2‿3,2‿12,2‿12‿5,2‿12‿5‿6⟩
|
||||
{∾˝˘ (2+↕𝕩)⥊<"hi"}¨ 2‿3‿4‿5 %% ⥊⟜(<"hi")¨ ⟨2‿3,2‿12,2‿12‿5,2‿12‿5‿6⟩
|
||||
@ -89,15 +89,15 @@
|
||||
%USE eqvar ⋄ ¯1‿¯2‿¯3 {𝕨⊸⊏˘𝕩}_eqvar 8‿80⥊↕557 %% 8‿3⥊79‿78‿77‿159‿158‿157‿239‿238‿237‿319‿318‿317‿399‿398‿397‿479‿478‿477‿2‿1‿0‿82‿81‿80
|
||||
1‿2‿0‿1‿¯1⊸⊏⎉1 2‿3‿4⥊↕24 %% 2‿3‿5⥊1‿2‿0‿1‿3‿5‿6‿4‿5‿7‿9‿10‿8‿9‿11‿13‿14‿12‿13‿15‿17‿18‿16‿17‿19‿21‿22‿20‿21‿23
|
||||
1‿2‿0‿1‿¯1⊸⊏⎉2 2‿3‿4⥊↕24 %% 2‿5‿4⥊4‿5‿6‿7‿8‿9‿10‿11‿0‿1‿2‿3‿4‿5‿6‿7‿8‿9‿10‿11‿16‿17‿18‿19‿20‿21‿22‿23‿12‿13‿14‿15‿16‿17‿18‿19‿20‿21‿22‿23
|
||||
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 0‿¯1‿1‿¯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 10‿128⥊1
|
||||
!"⊏: Indexing out-of-bounds (128∊𝕨, 128≡≠𝕩)" % %USE evar ⋄ 10‿128 {𝕨⊸⊏˘𝕩}_evar 10‿128⥊1
|
||||
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 1‿0‿0‿1 {𝕨⊸⊏˘𝕩}_evar 10‿1⥊1
|
||||
!"⊏: Indexing out-of-bounds (1000∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ (3⥊1000) {𝕨⊸⊏˘𝕩}_evar 100‿3⥊1
|
||||
!"⊏: Indexing out-of-bounds (1000∊𝕨, 4≡≠𝕩)" % %USE evar ⋄ (4⥊1000) {𝕨⊸⊏˘𝕩}_evar 100‿4⥊1
|
||||
!"⊏: Indexing out-of-bounds (1000∊𝕨, 8≡≠𝕩)" % %USE evar ⋄ (8⥊1000) {𝕨⊸⊏˘𝕩}_evar 100‿8⥊1
|
||||
!"⊏: Indexing out-of-bounds (100∊𝕨, 8≡≠𝕩)" % %USE evar ⋄ (<100) {𝕨⊸⊏˘𝕩}_evar 100‿8⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 0‿¯1‿1‿¯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 10‿128⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (128∊𝕨, 128≡≠𝕩)" % %USE evar ⋄ 10‿128 {𝕨⊸⊏˘𝕩}_evar 10‿128⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 1‿0‿0‿1 {𝕨⊸⊏˘𝕩}_evar 10‿1⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (1000∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ (3⥊1000) {𝕨⊸⊏˘𝕩}_evar 100‿3⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (1000∊𝕨, 4≡≠𝕩)" % %USE evar ⋄ (4⥊1000) {𝕨⊸⊏˘𝕩}_evar 100‿4⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (1000∊𝕨, 8≡≠𝕩)" % %USE evar ⋄ (8⥊1000) {𝕨⊸⊏˘𝕩}_evar 100‿8⥊1
|
||||
!"𝕨⊏𝕩: Indexing out-of-bounds (100∊𝕨, 8≡≠𝕩)" % %USE evar ⋄ (<100) {𝕨⊸⊏˘𝕩}_evar 100‿8⥊1
|
||||
!"Integer out of range: 9e99" % %USE evar ⋄ (<9e99) {𝕨⊸⊏˘𝕩}_evar 100‿8⥊1
|
||||
⟨1‿2⟩⊸⊏˘ 10‿8⥊↕100 %% (8×↕10) +⌜ 1‿2
|
||||
⟨1‿2⟩⊸⊏˘ 10‿4‿2⥊↕100 %% (8×↕10) +⌜ [2‿3,4‿5]
|
||||
@ -131,15 +131,15 @@
|
||||
%USE eqvar ⋄ ≍˘⟜'!' _eqvar 100⥊7↑1 %% ∾⟜'!'○•internal.Keep˘ 0=7|↕100
|
||||
%USE eqvar ⋄ ≍˘_eqvar˜ 3‿3⥊↕9 %% 3‿2‿3⥊0‿1‿2‿0‿1‿2‿3‿4‿5‿3‿4‿5‿6‿7‿8‿6‿7‿8
|
||||
%USE eqvar ⋄ (2‿3‿4‿5‿1⥊↕11) ≍⎉2 _eqvar 2‿3‿4‿5‿1⥊↕7 %% (2‿3‿4‿5‿1⥊↕11) ≍○•internal.PureKeep⎉2 2‿3‿4‿5‿1⥊↕7
|
||||
!"˘: Argument frames don't agree (3‿4 ≡ ≢𝕨, 5‿4 ≡ ≢𝕩, common frame of 1 axes)" % (3‿4⥊2) ≍˘ 5‿4⥊2
|
||||
!"≍: 𝕨 and 𝕩 must have equal shapes (⟨4⟩ ≡ ≢𝕨, ⟨5⟩ ≡ ≢𝕩)" % (3‿4⥊2) ≍˘ 3‿5⥊2
|
||||
!"≍: 𝕨 and 𝕩 must have equal shapes (2‿2‿2 ≡ ≢𝕨, 2‿3‿2 ≡ ≢𝕩)" % (3‿2‿2‿2⥊2) ≍˘ 3‿2‿3‿2⥊2
|
||||
!"≍: 𝕨 and 𝕩 must have equal shapes (4‿1 ≡ ≢𝕨, ⟨4⟩ ≡ ≢𝕩)" % (3‿4‿1⥊0) ≍˘ 3‿4⥊0
|
||||
!"𝕨˘𝕩: Argument frames don't agree (3‿4 ≡ ≢𝕨, 5‿4 ≡ ≢𝕩, common frame of 1 axes)" % (3‿4⥊2) ≍˘ 5‿4⥊2
|
||||
!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (⟨4⟩ ≡ ≢𝕨, ⟨5⟩ ≡ ≢𝕩)" % (3‿4⥊2) ≍˘ 3‿5⥊2
|
||||
!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (2‿2‿2 ≡ ≢𝕨, 2‿3‿2 ≡ ≢𝕩)" % (3‿2‿2‿2⥊2) ≍˘ 3‿2‿3‿2⥊2
|
||||
!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (4‿1 ≡ ≢𝕨, ⟨4⟩ ≡ ≢𝕩)" % (3‿4‿1⥊0) ≍˘ 3‿4⥊0
|
||||
(<"ab") ≍˘ 2⥊"cd" %% 2‿2⥊⟨"ab", 'c', "ab", 'd'⟩
|
||||
(<"ab") ≍˘˜ 2⥊"cd" %% 2‿2⥊⟨'c', "ab", 'd', "ab"⟩
|
||||
"ab" ≍⎉1 4‿2⥊"cd" %% 4‿2‿2⥊"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
|
||||
|
||||
@ -38,12 +38,12 @@ a←(•ParseFloat¨ "1.2"‿"-0"‿"0")∾-⊸⋈0÷0 ⋄ ! (0‿3‿3‿3⊏a)
|
||||
{b←•internal.Unshare a←"Ai8"•internal.Variation ∾⟨16⥊0‿0‿0‿0‿0‿0‿0‿¯128, 8⥊0, 8↑2⟩ ⋄ c←8‿64•bit._cast a ⋄ ! 1‿0‿0‿1≡∊c ⋄ •internal.Keep •Hash c ⋄ ! a≡b} # make sure sign bit doesn't mutate away
|
||||
|
||||
# error messages
|
||||
!"∊: 𝕩 cannot have rank 0" % 1‿2‿3∊0
|
||||
!"⊐: 𝕨 cannot have rank 0" % 0⊐1‿2‿3
|
||||
!"⊒: 𝕨 cannot have rank 0" % 0⊒1‿2‿3
|
||||
!"∊: Rank of 𝕨 must be at least the cell rank of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿2‿2 ≡ ≢𝕩)" % 1‿2∊2‿2‿2⥊1‿2
|
||||
!"⊐: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (2‿2‿2⥊1‿2)⊐1‿2
|
||||
!"⊒: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (2‿2‿2⥊1‿2)⊒1‿2
|
||||
!"𝕨∊𝕩: 𝕩 cannot have rank 0" % 1‿2‿3∊0
|
||||
!"𝕨⊐𝕩: 𝕨 cannot have rank 0" % 0⊐1‿2‿3
|
||||
!"𝕨⊒𝕩: 𝕨 cannot have rank 0" % 0⊒1‿2‿3
|
||||
!"𝕨∊𝕩: Rank of 𝕨 must be at least the cell rank of 𝕩 (⟨2⟩ ≡ ≢𝕨, 2‿2‿2 ≡ ≢𝕩)" % 1‿2∊2‿2‿2⥊1‿2
|
||||
!"𝕨⊐𝕩: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (2‿2‿2⥊1‿2)⊐1‿2
|
||||
!"𝕨⊒𝕩: Rank of 𝕩 must be at least the cell rank of 𝕨 (2‿2‿2 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % (2‿2‿2⥊1‿2)⊒1‿2
|
||||
|
||||
# hashmap
|
||||
("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@ %% 0‿2‿3‿1
|
||||
(((•HashMap˜↕4).Delete 1).Set´ 1‿"one").Values@ %% 0‿2‿3‿"one"
|
||||
({𝕩.Set´"xy"}⍟4•HashMap˜↕0).Count@ %% 1
|
||||
!"•HashMap: Arguments must be lists (⟨⟩≡≢𝕨, ⟨3⟩≡≢𝕩)" % 'a' •HashMap "str"
|
||||
!"•HashMap: 𝕨 and 𝕩 must have the same length (4≡≠𝕨, 3≡≠𝕩)" % "stri" •HashMap "str"
|
||||
!"𝕨 •HashMap 𝕩: Arguments must be lists (⟨⟩≡≢𝕨, ⟨3⟩≡≢𝕩)" % 'a' •HashMap "str"
|
||||
!"𝕨 •HashMap 𝕩: 𝕨 and 𝕩 must have the same length (4≡≠𝕨, 3≡≠𝕩)" % "stri" •HashMap "str"
|
||||
!"•HashMap: 𝕨 contained duplicate keys" % "strs" •HashMap "stri"
|
||||
!"(hashmap).Get: key not found" % ("abc"‿"de"‿"fgh" •HashMap ⥊¨↕3).Get "fg"
|
||||
!"(hashmap).Delete: key not found" % ("abc"‿"de"‿"fgh" •HashMap ⥊¨↕3).Delete 'a'
|
||||
m ← 1‿2 •HashMap v←•internal.Unshare 'a'‿4 ⋄ 1 m.Set 9 ⋄ ⟨v, m.Keys@, m.Values@⟩ %% ⟨'a'‿4, 1‿2, 9‿4⟩
|
||||
m ← 1‿2 •HashMap •internal.Unshare 'a'‿4 ⋄ v←m.Values@ ⋄ 1 m.Set 9 ⋄ ⟨v, m.Keys@, m.Values@⟩ %% ⟨'a'‿4, 1‿2, 9‿4⟩
|
||||
m ← 1‿2 •HashMap •internal.Unshare 'a'‿4 ⋄ v←m.Values@ ⋄ 1 m.Set 9 ⋄ ⟨v, m.Keys@, m.Values@⟩ %% ⟨'a'‿4, 1‿2, 9‿4⟩
|
||||
|
||||
@ -17,11 +17,11 @@
|
||||
! (⊑¨r1‿r3) ≡ ⍷⊑¨r1‿r2‿r3‿r4
|
||||
)
|
||||
|
||||
!"•Import: cyclic import of "".../cyclic.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic.bqn"
|
||||
!"•Import: cyclic import of "".../cyclic.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic.bqn"
|
||||
!"•Import: cyclic import of "".../cyclic.bqn""" % %USE file ⋄ ⟨⟩•Import⎊CleanPath File "cyclic.bqn"
|
||||
!"•Import: cyclic import of "".../cyclic_A.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic_A.bqn"
|
||||
!"•Import: cyclic import of "".../cyclic_B.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic_B.bqn"
|
||||
!"•Import: cyclic import of "".../cyclic_A.bqn""" % %USE file ⋄ ⟨⟩•Import⎊CleanPath File "cyclic_B.bqn"
|
||||
!"•Import: cyclic import of "".../cyclic_B.bqn""" % %USE file ⋄ ⟨⟩•Import⎊CleanPath File "cyclic_A.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file ⋄ ⟨⟩•Import⎊CleanPath File "cyclic.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic_A.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file ⋄ •Import⎊CleanPath File "cyclic_B.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file ⋄ ⟨⟩•Import⎊CleanPath File "cyclic_B.bqn"
|
||||
!"•Import 𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file ⋄ ⟨⟩•Import⎊CleanPath File "cyclic_A.bqn"
|
||||
%USE file ⋄ 3 •Import File "notCyclic.bqn" %% 30
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -113,18 +113,18 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
|
||||
!"•file.Parent: Path must be non-empty" % •file.Parent ""
|
||||
!"•file.Name: Path must be non-empty" % •file.Name ""
|
||||
|
||||
!"•file.Lines: 𝕩 must be a list" % "testfile.bqn" •FLines 2‿2⥊<"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 𝕩: 𝕩 must be a list" % "testfile.bqn" •FLines 2‿2⥊<"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"
|
||||
!"Expected character" % "testfile.bqn" •FLines ⋈"ab"‿"cd"
|
||||
!"Expected character" % "testfile.bqn" •FLines ⋈1‿2
|
||||
!"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"
|
||||
!"•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"•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 𝕩 •FBytes •ToUTF8 "abc"∾(@+10)∾"def𝕩"}"testfile2.bqn"
|
||||
@ -141,11 +141,11 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
|
||||
! 97‿98‿99‿10‿100‿101‿102‿240‿157‿149‿169 ≡ @-˜ •file.MapBytes "testfile.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" %% 1‿0‿0‿1
|
||||
¯22↑•file.Createdir "testdirNested" %% "/testDir/testdirNested"
|
||||
¯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 "." %% 1‿1‿0‿1‿1
|
||||
"testfile.bqn"‿"testfile2.bqn"‿"testfile3.bqn"‿"testfile3B.bqn"‿"testdirNested" ∊ •file.List •file.path %% 1‿1‿0‿1‿1
|
||||
|
||||
@ -171,8 +171,8 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
|
||||
!"•file.Lines: Path must be a list of characters" % 1‿2 •FLines "abc"‿"def"
|
||||
!"•file.Type: Path must be a list of characters" % •file.Type 1‿2
|
||||
!"•file.Exists: Path must be a list of characters" % •file.Exists 1‿2
|
||||
!"•file.Name: Argument must be a string" % •file.Name 1‿2
|
||||
!"•file.Parent: Argument must be a string" % •file.Parent 1‿2
|
||||
!"•file.Name 𝕩: Argument must be a string" % •file.Name 1‿2
|
||||
!"•file.Parent 𝕩: Argument must be a string" % •file.Parent 1‿2
|
||||
!"•file.MapBytes: Path must be a list of characters" % •file.MapBytes 1‿2
|
||||
!"•file.CreateDir: Path must be a list of characters" % •file.CreateDir 1‿2
|
||||
!"•file.RealPath: Path must be a list of characters" % •file.RealPath 1‿2
|
||||
@ -189,7 +189,7 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
|
||||
|
||||
# some of •term
|
||||
!"Expected character" % •term.OutRaw 2⥊{⇐}
|
||||
!"•term.ErrRaw: 𝕩 must be a list" % •term.ErrRaw 2‿2⥊0
|
||||
!"•term.ErrRaw 𝕩: 𝕩 must be a list" % •term.ErrRaw 2‿2⥊0
|
||||
|
||||
|
||||
|
||||
@ -235,13 +235,17 @@ v←1 ⋄ ! •BQN∘•Repr⊸≡ ⟨+,1‿2,+¨,(+V)(V+V),2‿2⥊↕4⟩
|
||||
# •Delay
|
||||
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
|
||||
a←1 ⋄ a ⊣ {𝕊: a+↩𝕩}•_timed 10 %% 11
|
||||
a←3 ⋄ 12 {𝕊: a+↩𝕩}•_timed 10 ⋄ a %% 123
|
||||
|
||||
# •math
|
||||
! ∧´0=⌊|1e10×{(+´𝕩)-•math.Sum 𝕩}¨ ↑1000•rand.Range 0
|
||||
!"•math.Sum: Argument must be a list (⟨⟩ ≡ ≢𝕩)" % •math.Sum 2
|
||||
!"•math.Sum: Argument must be a list (2‿2 ≡ ≢𝕩)" % •math.Sum 2‿2⥊1
|
||||
!"•math.Sum: Argument elements must be numbers" % •math.Sum 1‿'a'
|
||||
!"•math.Sum 𝕩: 𝕩 must be a list (⟨⟩ ≡ ≢𝕩)" % •math.Sum 2
|
||||
!"•math.Sum 𝕩: 𝕩 must be a list (2‿2 ≡ ≢𝕩)" % •math.Sum 2‿2⥊1
|
||||
!"•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˜⁼⟩ %% 110714‿96959‿22360‿2027‿49331
|
||||
⌊1e5×{=˜◶99‿⊢¨ 𝕏 0.1‿3}¨ ⟨•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⟩ %% ⟨147062‿9900000,9900000‿176274,10016‿9900000,9983‿181844,9966‿124904,10033‿9900000,46415‿144224,99500‿¯99000,100500‿1006766,11246‿99997,88753‿2,10517‿1908553,95135‿600000,¯100000‿47712,9531‿138629,¯332193‿158496,¯4988‿179175,9983‿14112,10016‿1001787,10033‿¯14255,9966‿99505⟩
|
||||
{𝕩 ! 1‿2 (𝕏 ≡ 𝕏¨) 3‿4}¨ ⟨•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.LCM: Inputs other than natural numbers not yet supported" % 3 •math.LCM 1.5
|
||||
!"•math.LCM: Unexpected argument types" % "foo" •math.LCM 3
|
||||
!"•math.GCD: Unexpected argument types" % 3 •math.GCD {+}
|
||||
!"•math.Sin: Argument contained non-number" % •math.Sin "foo"
|
||||
!"•math.Log10: Argument contained non-number" % •math.Log10 "foo"
|
||||
!"•math.Atan2: Unexpected argument types" % 1 •math.Atan2 'a'
|
||||
!"•math.Atan2⁼: Unexpected argument types" % 1 •math.Atan2⁼ {⇐}
|
||||
!"•math.Atan2˜⁼: Unexpected argument types" % {⇐} •math.Atan2˜⁼ 'b'
|
||||
!"𝕨 •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 𝕩: Unexpected argument types" % "foo" •math.LCM 3
|
||||
!"𝕨 •math.GCD 𝕩: Unexpected argument types" % 3 •math.GCD {+}
|
||||
!"•math.Sin 𝕩: 𝕩 contained non-number" % •math.Sin "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⁼ {⇐}
|
||||
!"𝕨 •math.Atan2˜⁼ 𝕩: Unexpected argument types" % {⇐} •math.Atan2˜⁼ 'b'
|
||||
|
||||
# •rand / •MakeRand
|
||||
0 (•MakeRand 0).Range¨↕2 %% ⟨⟩‿⟨⟩
|
||||
@ -277,7 +281,7 @@ E←•internal.EEqual ⋄ {! (𝕏 4⥊0) E 𝕏 1↓¯1×π∾4⥊0}¨ (⊢∾
|
||||
(•MakeRand 0).Deal 0 %% ⟨⟩
|
||||
0 (•MakeRand 0).Subset 0 %% ⟨⟩
|
||||
{!(∧•rand.Deal 𝕩)≡↕𝕩}¨ ⥊ ¯1‿0‿1+⌜2⋆↕22 # %SLOW
|
||||
!"(rand).Range: Result rank too large (256≡≢𝕨)" % (256⥊1) •rand.Range 0
|
||||
!"𝕨 (rand).Range 𝕩: Result rank too large (256≡≢𝕨)" % (256⥊1) •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⟩}¨ 2‿2⥊↕2 ⋄ !∘≢¨´ ⊏a
|
||||
r←•MakeRand 1 ⋄ ! 1¨⊸≡ ∊{𝕊: 800 r.Subset 1000}¨ ↕4
|
||||
r←•MakeRand 1 ⋄ ! 1¨⊸≡ ∊{𝕊: 50 r.Subset 10000}¨ ↕4
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
(↕10)⊸+⌾((2÷˜≠)⊸⌽) 10×↕10 %% 5‿16‿27‿38‿49‿50‿61‿72‿83‿94
|
||||
⌽⌾((¯1+=)⊸⍉) 3‿3⥊↕9 %% 3‿3⥊2‿1‿0‿5‿4‿3‿8‿7‿6
|
||||
!"Expected integer, got function" % 1⊸+⌾((¯1+≠)˙⊑⊢)"ab"
|
||||
!"⊑: 𝕨 must be a numeric array" % ⊢⌾((≠⊑⟨@,@,¯1+≠⟩˙)⊸⊑)"ab"
|
||||
!"◶: 𝕘 must have rank 1 when index is a number" % ⊢⌾(≠◶⟨@,@,¯1+≠⟩⊸⊑)"ab"
|
||||
!"𝕨⊑𝕩: 𝕨 must be a numeric array" % ⊢⌾((≠⊑⟨@,@,¯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⟩)" % 10‿20‿30⌾(⟨1‿2,2‿1⟩⊸⊑) 4‿4⥊↕16
|
||||
!"𝔽⌾(a⊸⊑)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨2⟩, got ⟨3⟩)" % 1⊸∾⌾(⟨1‿2,2‿1⟩⊸⊑) 4‿4⥊↕16
|
||||
!"𝔽⌾(n⊸⊑)𝕩: reading out-of-bounds (n≡¯10, 3≡≠𝕩)" % 1⊸+⌾(¯10⊸⊑) ↕3
|
||||
!"⊑: 𝕨 contained list with mixed-type elements" % 'a'⌾(1‿'a'⊸⊑) 4‿5⥊↕9
|
||||
!"⊑: Indexing out-of-bounds (index 1‿5 in array of shape 4‿5)" % 'a'⌾(1‿5⊸⊑) 4‿5⥊↕9
|
||||
!"𝕨⊑𝕩: 𝕨 contained list with mixed-type elements" % 'a'⌾(1‿'a'⊸⊑) 4‿5⥊↕9
|
||||
!"𝕨⊑𝕩: Indexing out-of-bounds (index 1‿5 in array of shape 4‿5)" % 'a'⌾(1‿5⊸⊑) 4‿5⥊↕9
|
||||
⟨10,20‿30⟩⌾(⟨1‿2,⟨1‿3,2‿1⟩⟩⊸⊑) 4‿5⥊↕9 %% 4‿5⥊0‿1‿2‿3‿4‿5‿6‿10‿20‿0‿1‿30‿3‿4‿5‿6‿7‿8‿0‿1
|
||||
!"⊑: Picking item at wrong rank (index 1‿1‿1 in array of shape 10‿10)" % 1¨⌾(1‿1‿1⊸⊑) 10‿10⥊1
|
||||
!"⊑: Picking item at wrong rank (index ⟨1⟩ in array of shape 10‿10)" % 1¨⌾(⟨1⟩⊸⊑) 10‿10⥊1
|
||||
!"𝕨⊑𝕩: Picking item at wrong rank (index 1‿1‿1 in array of shape 10‿10)" % 1¨⌾(1‿1‿1⊸⊑) 10‿10⥊1
|
||||
!"𝕨⊑𝕩: Picking item at wrong rank (index ⟨1⟩ in array of shape 10‿10)" % 1¨⌾(⟨1⟩⊸⊑) 10‿10⥊1
|
||||
a←10‿10‿10⥊↕1000 ⋄ ! a ≡ a⌾((↕≢a)⊸⊑) a
|
||||
≠{𝕊: a←(1+•rand.Range 200)•rand.Range 2 ⋄ i←•rand.Range≠a ⋄ ! a ≡ (i⊑a)⌾(i⊸⊑) 2⌾(i⊸⊑) a}¨↕10000
|
||||
100⊸+⌾(5⊸⊑) ⥊↕4‿4 %% (100×5=↕16) + ⥊↕4‿4
|
||||
@ -44,8 +44,8 @@ a←10‿10‿10⥊↕1000 ⋄ ! a ≡ a⌾((↕≢a)⊸⊑) a
|
||||
|
||||
# ⊏
|
||||
n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡ r⌾(i⊸⊏) a
|
||||
!"⊏: 𝕩 cannot be a unit" % 0‿0⌾(0‿0⊸⊏) <0
|
||||
!"⊏: 𝕩 cannot be a unit" % %USE evar ⋄ (↕0) {⊢⌾(𝕨⊸⊏)𝕩}_evar <0
|
||||
!"𝕨⊏𝕩: 𝕩 cannot be a unit" % 0‿0⌾(0‿0⊸⊏) <0
|
||||
!"𝕨⊏𝕩: 𝕩 cannot be a unit" % %USE evar ⋄ (↕0) {⊢⌾(𝕨⊸⊏)𝕩}_evar <0
|
||||
!"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (¯11∊a, ⟨10⟩≡≢𝕩)" % %USE evar ⋄ 5‿¯11 {0‿1⌾(𝕨⊸⊏)𝕩}_evar 10⥊1‿0‿1
|
||||
!"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (10∊a, ⟨10⟩≡≢𝕩)" % %USE evar ⋄ 9‿10 {0‿1⌾(𝕨⊸⊏)𝕩}_evar 10⥊1‿0‿1
|
||||
!"𝔽⌾(a⊸⊏)𝕩: Indexing out-of-bounds (10∊a, ⟨10⟩≡≢𝕩)" % %USE evar ⋄ "ab" {𝕨⌾(9‿10⊸⊏)𝕩}_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⊸∾⌾(1‿0‿1⊸/) ↕10
|
||||
!"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 10)" % 1⊸∾⌾(1‿0‿1⊸/) ↕10
|
||||
10⊸+⌾(⟨1,0‿1⟩⊸/)↕2‿2 %% 2‿2⥊⟨0‿0,10‿11,1‿0,11‿11⟩
|
||||
!"𝔽⌾(a⊸/): Incompatible result elements" % 1‿2⌾(2‿0⊸/)↕2
|
||||
1⊸+⌾((↕10)⊸/) ↕10 %% ×⊸+ ↕10
|
||||
@ -146,7 +146,7 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡
|
||||
%USE eqvar ⋄ 1‿0‿0‿0‿1‿1 { ≥˙¨⌾(𝕨⊸/)𝕩}_eqvar 0‿1‿0‿1‿0‿1 %% ≥‿1‿0‿1‿≥‿≥
|
||||
%USE eqvar ⋄ 1‿0‿0‿0‿1‿1 { 3¨⌾(𝕨⊸/)𝕩}_eqvar "hellow" %% 3‿'e'‿'l'‿'l'‿3‿3
|
||||
%USE eqvar ⋄ 1‿0‿0‿0‿1‿1 { +˙¨⌾(𝕨⊸/)𝕩}_eqvar -‿÷‿×‿=‿<‿> %% +‿÷‿×‿=‿+‿+
|
||||
!"/: Lengths of components of 𝕨 must match 𝕩 (6 ≠ 7)" % 0¨⌾(1‿0‿0‿0‿1‿1⊸/) 0‿1‿0‿1‿0‿1‿0
|
||||
!"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (6 ≠ 7)" % 0¨⌾(1‿0‿0‿0‿1‿1⊸/) 0‿1‿0‿1‿0‿1‿0
|
||||
4↑ (⋈⋈3)⌾(0‿1‿0⊸/) ↕⋈3 %!PROPER_FILLS %% ⟨⋈0,⋈3,⋈2,0⟩
|
||||
4↑ ⊢⌾(0‿1‿0⊸/) ↕⋈3 %!PROPER_FILLS %% ⟨⋈0,⋈1,⋈2,0⟩
|
||||
4↑ ⊢⌾(0‿0‿0⊸/) ↕⋈3 %!PROPER_FILLS %% ⟨⋈0,⋈1,⋈2,0⟩
|
||||
|
||||
@ -18,8 +18,13 @@
|
||||
!"≍⁼: Argument must have a leading axis of 1" % ≍⁼ "foo"
|
||||
!"≍⁼: Argument must have a leading axis of 1" % ≍⁼ 3‿1‿1⥊<"foo"
|
||||
|
||||
!"⌽: Argument cannot be a unit" % ⌽⁼ 0
|
||||
!"⌽𝕩: 𝕩 cannot be a unit" % ⌽⁼ 0
|
||||
⌽⁼ ↕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 𝕩" % 0‿0 ⍉⁼ ↕3
|
||||
!"𝕨⍉⁼𝕩: Axis 9 does not exist (1≡=𝕩)" % 9 ⍉⁼ ↕3
|
||||
!"𝕨⍉⁼𝕩: Axis 9 does not exist (3≡=𝕩)" % 9 ⍉⁼ 3‿3‿3⥊3
|
||||
!"𝕨⍉⁼𝕩: 𝕨 must have rank at most 1" % (1‿1⥊0) ⍉⁼ ↕3
|
||||
⍉⁼ <3 %% <3
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
!"Out of memory" % a←(2⋆20) ⥊ 1e9 ⋄ ≠•internal.Keep {𝕊: a}˘ a
|
||||
!"⥊: 𝕨 too large" % a←(2⋆20) ⥊ 1e9 ⋄ ≠•internal.Keep a˘ a
|
||||
!"𝕨⥊𝕩: 𝕨 too large" % a←(2⋆20) ⥊ 1e9 ⋄ ≠•internal.Keep a˘ a
|
||||
!"Out of memory" % ≠•internal.Keep (2⋆25)/(2⋆10)⥊10
|
||||
!"Out of memory" % k←16384 ⋄ n←k÷˜2⋆32 ⋄ ≠•internal.Keep (n⥊k) / n⥊1
|
||||
!"Out of memory" % k←64 ⋄ n←k÷˜2⋆32 ⋄ ≠•internal.Keep (n⥊k) / n⥊1 # %SLOW
|
||||
|
||||
Loading…
Reference in New Issue
Block a user