From 80d1681b186b4c5c769001ece351d1e60366fb52 Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Mon, 3 Feb 2025 20:39:44 -0500 Subject: [PATCH 01/12] prefer using w and x inside error messages --- src/builtins/sfns.c | 110 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 4c89deb9..2a93150e 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -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; i1) 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 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; jr1s) 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; i1) 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) { From 6be291dd6b35bfc4bad84e339c4bce7a306e6a5d Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Tue, 4 Feb 2025 18:55:14 -0500 Subject: [PATCH 02/12] add w and x for builtins/arithd.c --- src/builtins/arithd.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/builtins/arithd.c b/src/builtins/arithd.c index 0b0f5299..d8eccdbf 100644 --- a/src/builtins/arithd.c +++ b/src/builtins/arithd.c @@ -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=wrCHR_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 From dce39a1b055ec8100211ee41e5788fc84266daa8 Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Tue, 4 Feb 2025 18:57:25 -0500 Subject: [PATCH 03/12] add w and x for builtins/arithm.c --- src/builtins/arithm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/builtins/arithm.c b/src/builtins/arithm.c index cb98fc38..e352e575 100644 --- a/src/builtins/arithm.c +++ b/src/builtins/arithm.c @@ -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) From 559b3f0d6e0288d27291c7ccb6603cd51435507d Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Tue, 4 Feb 2025 19:00:15 -0500 Subject: [PATCH 04/12] add best effort guesses for w and x for builtins/cells.c --- src/builtins/cells.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/builtins/cells.c b/src/builtins/cells.c index 86efebec..58c153ca 100644 --- a/src/builtins/cells.c +++ b/src/builtins/cells.c @@ -340,7 +340,7 @@ static NOINLINE B to_fill_cell(B x, ur k, u32 chr) { // consumes x ur cr = RNK(x)-k; usz* sh = SH(x)+k; usz csz = 1; - for (usz i=0; ia, 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); From dd5d17ca8385949f42bb6fe94a53a9e6c943885c Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Wed, 5 Feb 2025 19:32:49 -0500 Subject: [PATCH 05/12] add best effort guesses for builtins/cmp,fns,fold.c I'm not sure about modifiers so I left them without arguments --- src/builtins/cmp.c | 2 +- src/builtins/fns.c | 20 ++++++++++---------- src/builtins/fold.c | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/builtins/cmp.c b/src/builtins/cmp.c index 9b2e7db2..819b76b7 100644 --- a/src/builtins/cmp.c +++ b/src/builtins/cmp.c @@ -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, ) diff --git a/src/builtins/fns.c b/src/builtins/fns.c index 567b96f9..16840c2a 100644 --- a/src/builtins/fns.c +++ b/src/builtins/fns.c @@ -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)) UR_MAX) thrM("↕: Result rank too large"); + if (isAtm(x) || (xr=RNK(x)) 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 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)) { diff --git a/src/builtins/fold.c b/src/builtins/fold.c index 90b795dc..ac736b1a 100644 --- a/src/builtins/fold.c +++ b/src/builtins/fold.c @@ -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𝕩: Argument 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𝕩: Argument 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("´𝕩: Argument 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); } From 63ee20b6fe5de8c6c0775710d7b2bef964714004 Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Wed, 5 Feb 2025 19:40:27 -0500 Subject: [PATCH 06/12] add best effort guesses for many builtin error messages --- src/builtins/compare.c | 2 +- src/builtins/fold.c | 6 +++--- src/builtins/grade.h | 14 +++++++------- src/builtins/group.c | 6 +++--- src/builtins/internal.c | 24 ++++++++++++------------ src/builtins/md1.c | 4 ++-- src/builtins/md2.c | 8 ++++---- src/builtins/scan.c | 6 +++--- src/builtins/search.c | 4 ++-- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/builtins/compare.c b/src/builtins/compare.c index 55176fe5..a9de9c58 100644 --- a/src/builtins/compare.c +++ b/src/builtins/compare.c @@ -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); -} \ No newline at end of file +} diff --git a/src/builtins/fold.c b/src/builtins/fold.c index ac736b1a..9d820177 100644 --- a/src/builtins/fold.c +++ b/src/builtins/fold.c @@ -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) { diff --git a/src/builtins/grade.h b/src/builtins/grade.h index b75d31ab..7ce94033 100644 --- a/src/builtins/grade.h +++ b/src/builtins/grade.h @@ -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); } diff --git a/src/builtins/group.c b/src/builtins/group.c index 5d462865..3c07668c 100644 --- a/src/builtins/group.c +++ b/src/builtins/group.c @@ -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); } } diff --git a/src/builtins/internal.c b/src/builtins/internal.c index d125b0ce..dee8129e 100644 --- a/src/builtins/internal.c +++ b/src/builtins/internal.c @@ -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; diff --git a/src/builtins/md1.c b/src/builtins/md1.c index 4f8eb293..e470b810 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -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 (rrf, 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 1"); incBy(x, am-1); FC1 fc1 = c1fn(f); u64 sns = nsTime(); diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 05b38d26..385152a7 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -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)); diff --git a/src/builtins/scan.c b/src/builtins/scan.c index f875c849..84930895 100644 --- a/src/builtins/scan.c +++ b/src/builtins/scan.c @@ -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"); diff --git a/src/builtins/search.c b/src/builtins/search.c index ab66a5b4..d15732e9 100644 --- a/src/builtins/search.c +++ b/src/builtins/search.c @@ -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)) { From 5790d126cd60157c5db2621e8fd8c54e19121d80 Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Wed, 5 Feb 2025 19:56:08 -0500 Subject: [PATCH 07/12] add best effort guesses for many more builtin error messages --- src/builtins/grade.h | 2 +- src/builtins/select.c | 26 +++--- src/builtins/selfsearch.c | 12 +-- src/builtins/slash.c | 28 +++---- src/builtins/sysfn.c | 162 +++++++++++++++++++------------------- src/builtins/transpose.c | 26 +++--- 6 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/builtins/grade.h b/src/builtins/grade.h index 7ce94033..0bb5b19c 100644 --- a/src/builtins/grade.h +++ b/src/builtins/grade.h @@ -427,7 +427,7 @@ B GRADE_CAT(c2)(B t, B w, B x) { 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); diff --git a/src/builtins/select.c b/src/builtins/select.c index 9c6105c9..1d836dec 100644 --- a/src/builtins/select.c +++ b/src/builtins/select.c @@ -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= 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; i1) { - 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); diff --git a/src/builtins/selfsearch.c b/src/builtins/selfsearch.c index 18c8e201..0f23edd4 100644 --- a/src/builtins/selfsearch.c +++ b/src/builtins/selfsearch.c @@ -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); diff --git a/src/builtins/slash.c b/src/builtins/slash.c index c09e00c4..e863cd74 100644 --- a/src/builtins/slash.c +++ b/src/builtins/slash.c @@ -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; ixp[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; imax) 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; imax) 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; jmax?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; iI32_MAX) thrM("/⁼: Argument too large"); + if (xia>I32_MAX) thrM("/⁼𝕩: 𝕩 too large"); i32* rp; r = m_i32arrv(&rp, ria); for (usz i=0; i= (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; } @@ -277,13 +277,13 @@ B show_c1(B t, B x) { } NOINLINE B vfyStr(B x, char* name, char* arg) { - if (!isStr(x)) thrF("%U: %U must be a string", name, arg); + if (!isStr(x)) thrF("%U𝕩: %U must be a string", name, arg); return x; } 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); @@ -1038,7 +1038,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er SGetU(x) for (u64 i = 0; i < xia; i++) { B c = GetU(x, i); - if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("•SH𝕩: 𝕩 must be a list of strings"); u64 len = utf8lenB(c); TALLOC(char, cstr, len+1); toUTF8(c, cstr); @@ -1051,7 +1051,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er int p_in[2]; int p_out[2]; int p_err[2]; - if (pipe(p_in) || pipe(p_out) || pipe(p_err)) thrM("•SH: Failed to create process: Couldn't create pipes"); // TODO these pipes will easily leak + if (pipe(p_in) || pipe(p_out) || pipe(p_err)) thrM("•SH𝕩: Failed to create process: Couldn't create pipes"); // TODO these pipes will easily leak shDbg("pipes: %d %d %d %d %d %d\n", p_in[0], p_in[1], p_out[0], p_out[1], p_err[0], p_err[1]); fcntl(p_in[1], F_SETFL, O_NONBLOCK); // make our side of pipes never block because we're working on multiple fcntl(p_out[0], F_SETFL, O_NONBLOCK); @@ -1065,7 +1065,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er // spawn the actual process pid_t pid; - if(posix_spawnp(&pid, argv[0], &a, NULL, argv, environ) != 0) thrF("•SH: Failed to create process: %S", strerror(errno)); + if(posix_spawnp(&pid, argv[0], &a, NULL, argv, environ) != 0) thrF("•SH𝕩: Failed to create process: %S", strerror(errno)); posix_spawn_file_actions_destroy(&a); // used now shClose(p_in[0]); // close the useless pipes on this side shClose(p_out[1]); @@ -1163,7 +1163,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er SGetU(x) for (u64 i = 0; i < xia; i++) { B c = GetU(x, i); - if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("•SH𝕩: 𝕩 must be a list of strings"); u64 len = utf16lenB(c); TALLOC(WCHAR, wstr, len); toUTF16(c, wstr); @@ -1214,7 +1214,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } // FREE_INPUT TSFREE(arg); if (dwResult != ERROR_SUCCESS) { - thrF("•SH: Failed to run command: %S", winErrorEx(dwResult)); + thrF("•SH𝕩: Failed to run command: %S", winErrorEx(dwResult)); } // prepare output @@ -1242,17 +1242,17 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er B inObj = bi_N; bool raw = false; if (!q_N(w)) { - if (!isNsp(w)) thrM("•SH: 𝕨 must be a namespace"); + if (!isNsp(w)) thrM("𝕨•SH𝕩: 𝕨 must be a namespace"); inObj = ns_getC(w, "stdin"); - if (!q_N(inObj) && !isArr(inObj)) thrM("•SH: Invalid stdin value"); + if (!q_N(inObj) && !isArr(inObj)) thrM("𝕨•SH𝕩: Invalid stdin value"); B rawObj = ns_getC(w, "raw"); if (!q_N(rawObj)) raw = o2b(rawObj); } u64 iLen = q_N(inObj)? 0 : (raw? IA(inObj) : utf8lenB(inObj)); - if (isAtm(x) || RNK(x)>1) thrM("•SH: 𝕩 must be a list of strings"); + if (isAtm(x) || RNK(x)>1) thrM("𝕨•SH𝕩: 𝕩 must be a list of strings"); usz xia = IA(x); - if (xia==0) thrM("•SH: 𝕩 must have at least one item"); + if (xia==0) thrM("𝕨•SH𝕩: 𝕩 must have at least one item"); B s_out, s_err; i32 code = sh_core(raw, x, xia, inObj, iLen, &s_out, &s_err); @@ -1270,7 +1270,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er return m_hvec3(m_i32(code), s_outObj, s_errObj); } #else - B sh_c2(B t, B w, B x) { thrM("•SH: CBQN was compiled without "); } + B sh_c2(B t, B w, B x) { thrM("𝕨•SH𝕩: CBQN was compiled without "); } #endif B sh_c1(B t, B x) { return sh_c2(t, bi_N, x); } @@ -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); @@ -1426,19 +1426,19 @@ static CastType getCastType(B e, bool hasVal, B val) { // returns a valid type ( usz s; bool c; if (isNum(e)) { s = o2s(e); - if (s!=1 && s!=8 && s!=16 && s!=32 && s!=64) thrF("•bit._cast: unsupported width %s", s); + if (s!=1 && s!=8 && s!=16 && s!=32 && s!=64) thrF("•bit._cast𝕩: unsupported width %s", s); c = hasVal? isCharArr(val) : 0; } else { - if (!isArr(e) || RNK(e)!=1 || IA(e)!=2) thrM("•bit._cast: 𝕗 elements must be numbers or two-element lists"); + if (!isArr(e) || RNK(e)!=1 || IA(e)!=2) thrM("•bit._cast𝕩: 𝕗 elements must be numbers or two-element lists"); SGetU(e) s = o2s(GetU(e,0)); u32 t = o2c(GetU(e,1)); c = t=='c'; - if (c ) { if (s!=8 && s!=16 && s!=32) { badWidth: thrF("•bit._cast: unsupported width %s for type '%c'", s, (char)t); } } + if (c ) { if (s!=8 && s!=16 && s!=32) { badWidth: thrF("•bit._cast𝕩: unsupported width %s for type '%c'", s, (char)t); } } else if (t=='i') { if (s!=8 && s!=16 && s!=32) goto badWidth; } else if (t=='u') { if (s!=1) goto badWidth; } else if (t=='f') { if (s!=64) goto badWidth; } - else thrM("•bit._cast: type descriptor in 𝕗 must be one of \"iufnc\""); + else thrM("•bit._cast𝕩: type descriptor in 𝕗 must be one of \"iufnc\""); } return (CastType) { s, c }; @@ -1495,14 +1495,14 @@ static B set_bit_result(B r, u8 rt, ur rr, usz rl, usz *sh) { B bitcast_impl(B el0, B el1, B x) { ur xr; - if (!isArr(x) || (xr=RNK(x))<1) thrM("•bit._cast: 𝕩 must have rank at least 1"); + if (!isArr(x) || (xr=RNK(x))<1) thrM("•bit._cast𝕩: 𝕩 must have rank at least 1"); CastType xct = getCastType(el0, true, x); CastType rct = getCastType(el1, false, m_f64(0)); usz* sh = SH(x); u64 s=xct.s*(u64)sh[xr-1], rl=s/rct.s; - if (rl*rct.s != s) thrM("•bit._cast: incompatible lengths"); - if (rl>=USZ_MAX) thrM("•bit._cast: output too large"); + if (rl*rct.s != s) thrM("•bit._cast𝕩: incompatible lengths"); + if (rl>=USZ_MAX) thrM("•bit._cast𝕩: output too large"); B r = convert(xct, x); u8 rt = typeOfCast(rct); if (rt==t_bitarr && (v(r)->refc!=1 || IS_SLICE(TY(r)))) { @@ -1522,12 +1522,12 @@ B bitcast_impl(B el0, B el1, B x) { } B bitcast_c1(Md1D* d, B x) { B f = d->f; - if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast: 𝕗 must be a 2-element list (from‿to)"); + if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast𝕩: 𝕗 must be a 2-element list (from‿to)"); SGetU(f) return bitcast_impl(GetU(f,0), GetU(f,1), x); } B bitcast_im(Md1D* d, B x) { B f = d->f; - if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast: 𝕗 must be a 2-element list (from‿to)"); + if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast𝕩: 𝕗 must be a 2-element list (from‿to)"); SGetU(f) return bitcast_impl(GetU(f,1), GetU(f,0), x); } @@ -1787,12 +1787,12 @@ B indexOf_c2(B t, B w, B x); GLOBAL bool fileInit; -B invalidFn_c1 (B t, B x) { thrM("Using an invalid function"); } -B invalidFn_c2 (B t, B w, B x) { thrM("Using an invalid function"); } -B invalidMd1_c1(Md1D* d, B x) { thrM("Using an invalid 1-modifier"); } -B invalidMd1_c2(Md1D* d, B w, B x) { thrM("Using an invalid 1-modifier"); } -B invalidMd2_c1(Md2D* d, B x) { thrM("Using an invalid 2-modifier"); } -B invalidMd2_c2(Md2D* d, B w, B x) { thrM("Using an invalid 2-modifier"); } +B invalidFn_c1 (B t, B x) { thrM("Fn𝕩: Using an invalid function"); } +B invalidFn_c2 (B t, B w, B x) { thrM("𝕨Fn𝕩: Using an invalid function"); } +B invalidMd1_c1(Md1D* d, B x) { thrM("_Mod𝕩: Using an invalid 1-modifier"); } +B invalidMd1_c2(Md1D* d, B w, B x) { thrM("𝕨_Mod𝕩: Using an invalid 1-modifier"); } +B invalidMd2_c1(Md2D* d, B x) { thrM("_Mod_𝕩: Using an invalid 2-modifier"); } +B invalidMd2_c2(Md2D* d, B w, B x) { thrM("𝕨_Mod_𝕩: Using an invalid 2-modifier"); } static NOINLINE void initSysDesc() { if (fileInit) return; diff --git a/src/builtins/transpose.c b/src/builtins/transpose.c index 239401fd..bf32ae82 100644 --- a/src/builtins/transpose.c +++ b/src/builtins/transpose.c @@ -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))=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=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) 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; i1) 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=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); } From 3362d46854e202ba375168c31664cb541c76ea2d Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Wed, 5 Feb 2025 20:02:44 -0500 Subject: [PATCH 08/12] add best effort guesses for error messages in core/stuff and opt/comp.c --- src/core/stuff.c | 22 +++++++++++----------- src/opt/comp.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/stuff.c b/src/core/stuff.c index 2f9877dd..5bd4fdca 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -41,11 +41,11 @@ NORETURN NOINLINE void fatal(char* s) { } NOINLINE B c1F(B f, B x) { dec(x); - if (isMd(f)) thrM("Calling a modifier"); + if (isMd(f)) thrM("_Mod𝕩: Calling a modifier"); return inc(VALIDATE(f)); } NOINLINE B c2F(B f, B w, B x) { dec(w); dec(x); - if (isMd(f)) thrM("Calling a modifier"); + if (isMd(f)) thrM("𝕨_Mod_𝕩: Calling a modifier"); return inc(VALIDATE(f)); } NOINLINE void value_freeF(Value* x) { value_free(x); } @@ -54,15 +54,15 @@ void noop_visit(Value* x) { } #if HEAP_VERIFY void arr_visit(Value* x) { VISIT_SHAPE(x); } #endif -NOINLINE B c1_bad(B f, B x) { thrM("This function can't be called monadically"); } -NOINLINE B c2_bad(B f, B w, B x) { thrM("This function can't be called dyadically"); } -NOINLINE B m1c1_bad(Md1D* d, B x) { thrM("This 1-modifier can't be called monadically"); } -NOINLINE B m1c2_bad(Md1D* d, B w, B x) { thrM("This 1-modifier can't be called dyadically"); } -NOINLINE B m2c1_bad(Md2D* d, B x) { thrM("This 2-modifier can't be called monadically"); } -NOINLINE B m2c2_bad(Md2D* d, B w, B x) { thrM("This 2-modifier can't be called dyadically"); } +NOINLINE B c1_bad(B f, B x) { thrM("Fn𝕩: This function can't be called monadically"); } +NOINLINE B c2_bad(B f, B w, B x) { thrM("𝕨Fn𝕩: This function can't be called dyadically"); } +NOINLINE B m1c1_bad(Md1D* d, B x) { thrM("_Mod𝕩: This 1-modifier can't be called monadically"); } +NOINLINE B m1c2_bad(Md1D* d, B w, B x) { thrM("𝕨_Mod𝕩: This 1-modifier can't be called dyadically"); } +NOINLINE B m2c1_bad(Md2D* d, B x) { thrM("_Mod_𝕩: This 2-modifier can't be called monadically"); } +NOINLINE B m2c2_bad(Md2D* d, B w, B x) { thrM("𝕨_Mod_𝕩: This 2-modifier can't be called dyadically"); } -NOINLINE B md_c1(B t, B x) { thrM("Cannot call a modifier"); } -NOINLINE B md_c2(B t, B w, B x) { thrM("Cannot call a modifier"); } +NOINLINE B md_c1(B t, B x) { thrM("_Mod𝕩: Cannot call a modifier"); } +NOINLINE B md_c2(B t, B w, B x) { thrM("𝕨_Mod_𝕩: Cannot call a modifier"); } NOINLINE B arr_c1(B t, B x) { dec(x); return inc(t); } NOINLINE B arr_c2(B t, B w, B x) { dec(w); dec(x); return inc(t); } @@ -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); diff --git a/src/opt/comp.c b/src/opt/comp.c index becc224a..c519e415 100644 --- a/src/opt/comp.c +++ b/src/opt/comp.c @@ -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); -} \ No newline at end of file +} From 308f93368e2a73619de884d7a7e2181bff02f0de Mon Sep 17 00:00:00 2001 From: tankorsmash Date: Wed, 5 Feb 2025 20:05:03 -0500 Subject: [PATCH 09/12] ran test error message updater --- test/cases/cells.bqn | 96 +++++++++++------------ test/cases/ffi.bqn | 6 +- test/cases/hash.bqn | 18 ++--- test/cases/imports.bqn | 14 ++-- test/cases/patterns.bqn | 2 +- test/cases/prims.bqn | 164 ++++++++++++++++++++-------------------- test/cases/system.bqn | 102 ++++++++++++------------- test/cases/under.bqn | 20 ++--- 8 files changed, 211 insertions(+), 211 deletions(-) diff --git a/test/cases/cells.bqn b/test/cases/cells.bqn index 610e5cbf..84914626 100644 --- a/test/cases/cells.bqn +++ b/test/cases/cells.bqn @@ -22,55 +22,55 @@ !"⎉: 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 -!"⎉: 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 +!"𝕨⊑𝕩: 𝕩 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 +!"𝕨∾𝕩: 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 diff --git a/test/cases/ffi.bqn b/test/cases/ffi.bqn index 543d02a1..fb0837bc 100644 --- a/test/cases/ffi.bqn +++ b/test/cases/ffi.bqn @@ -8,9 +8,9 @@ !"•FFI: 𝕩 must be a list" % @•FFI @ !"•FFI: 𝕩 must be a list" % @•FFI 2‿2⥊<"a" !"•FFI: Path must be a list of characters" % 1‿2 •FFI ""‿"bqn_init" -!"This function can't be called monadically" % •FFI ""‿"bqn_init" +!"Fn𝕩: This function can't be called monadically" % •FFI ""‿"bqn_init" @ •FFI⎊{𝕊: 28↑•CurrentError@} ""‿"bqn_this symbol doesn't exist" %% "FFI: Failed to find symbol: " -!"FFI: Type must be a string" % @•FFI "hello" +!"FFI𝕩: Type must be a string" % @•FFI "hello" !"FFI: Too many arguments" % @•FFI""‿"bqn_init"∾70000⥊<"i32" !"Type parser: Unexpected character '?'" % @•FFI""‿"bqn_init"‿"?" !"Type parser: expected number" % @•FFI""‿"bqn_init"‿"[" @@ -223,7 +223,7 @@ !"Expected integer, got character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Add '!'}} !"(pointer).Sub: Unexpected argument type: character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Sub '!'}} !"Expected non-negative integer, got character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Field '!'}} -!"Type parser: Pointer type must be a string" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Cast '!'}} +!"Type parser𝕩: Pointer type must be a string" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Cast '!'}} !"Expected integer, got character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Read '!'}} !"FFI: improper value for i8" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Write '!'}} diff --git a/test/cases/hash.bqn b/test/cases/hash.bqn index f0e8826c..4284a802 100644 --- a/test/cases/hash.bqn +++ b/test/cases/hash.bqn @@ -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⟩ \ No newline at end of file +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⟩ diff --git a/test/cases/imports.bqn b/test/cases/imports.bqn index 8e585074..1a5cc283 100644 --- a/test/cases/imports.bqn +++ b/test/cases/imports.bqn @@ -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 diff --git a/test/cases/patterns.bqn b/test/cases/patterns.bqn index df6d57eb..24849776 100644 --- a/test/cases/patterns.bqn +++ b/test/cases/patterns.bqn @@ -16,7 +16,7 @@ !"Calling a modifier" % 4 {˜}˝↕1 !"Calling a modifier" % 4 {∘}`↕1 !"Calling a modifier" % {∘}¨↕1 -!"Cannot call a modifier" % {˜}¨˜↕1 +!"𝕨_Mod_𝕩: Cannot call a modifier" % {˜}¨˜↕1 4 {˜}˙´↕1 %% ˜ 4 {˜}˙˝↕1 %% ˜ 4 {∘}˙`↕1 %% ⟨∘⟩ diff --git a/test/cases/prims.bqn b/test/cases/prims.bqn index d88d50f5..f35613b8 100644 --- a/test/cases/prims.bqn +++ b/test/cases/prims.bqn @@ -10,8 +10,8 @@ # total array comparison %USE k ⋄ a ← 0‿@‿'a'‿∞‿¯∞‿1‿¯1∾⍷∾{⟨𝕩⥊0, 𝕩⥊1, {1⌾((¯1¨≢𝕩)⊸⊑)𝕩}⍟(0≠×´∘≢) 𝕩⥊0⟩}¨ ∾{⥊(<⟨⟩)∾⌜´𝕩⥊<↕3}¨↕4 ⋄ r←(⊑(⍋-⍒)∘⋈)_k⌜˜ a ⋄ ! r ≡ •Cmp⌜˜a ⋄ r %% '1'-˜73‿73⥊"1000202002000002222000002000000222222222222200000200000022220000002000000210222222222222222222222222222222222222222222222222222222222222222222222222122222222222222222222222222222222222222222222222222222222222222222222222001222222222222222222222222222222222222222222222222222222222222222222222000010000200000222200000200000022222222222220000020000002222000000200000020002122022020222222020222022022222222222222202022202202222220220222022020000201002000002222000002000000222222222222200000200000022220000002000000200020210200000222200000200000022222222222220000020000002222000000200000020002222122020222222020222022022222222222222202022202202222220220222022020000000001000000000000000000000000000000000000000000000000000000000000000200020220210000222200000200000022222222222220000020000002222000000200000020002222222120222222020222022022222222222222202022202202222220220222022022000202202201002222200002202000222222222222220000220200022222020002202000200022222222212222222202222220222222222222222220222222022222222202222220220002022022020122222020022022022222222222222202002202202222220220222022020000000002000001000000000000000000000000000000000000000000000000000000000000000000200000210200000200000020020020020020000020000002002000000200000000000000020000022120000020000002202202202202000002000000220200000020000000000000002000002001000000000000200000000200000000000000020000000000000000200020220220000222210000200000022222222222220000020000002222000000200000020002222222220222222120222022022222222222222202022202202222220220222022022000202202202002222201002202000222222222222220000220200022222020002202000200022222222222222222212222220222222222222222220222222022222222202222220220002022022020222222020122022022222222222222202002202202222220220222022020000000002000002002000001000000200200000200200000000000020020000000000000200020220220000222220000210000022222222222222000020000002222202000200000020002222222220222222220222122022222222222222222022202202222222220222022022000202202200002222200002201000222222222222220000220000022222020002202000200020220220200222220200220210022222222222222020022020002222202202220200020002222222222222222222222222122222222222222222222222202222222222222222022000202202202002222202002202201222222222222220200220220022222022022202202000000000200000200000000000000010000000000000000000000000000000000000000000000000020000022020000020000002102002002002000002000000200200000020000000000000002000002222000002000000221220220220200000200000022020000002000000000000000200000200200000000000020010000020000000000000002000000000000000000000000020000022020000020000002202102002202000002000000220200000020000000000000002000002222000002000000222221220222200000200000022220000002000000000000000200000200200000200000020020010020020000000000002002000000000000000000000020000022020000020000002202202102202000002000000220200000020000000000000002000002222000002000000222222221222200000200000022220000002000000000000000200000200000000000000020000000010000000000000000000000000000000000000000020000022020000020000002202002002102000002000000200200000020000000000000002000002222000002000000222220220221200000200000022020000002000000000000000200000200200000000000020020000020010000000000002000000000000000020002022022000022222000020000002222222222222100002000000222200000020000002000222222222022222222022202202222222222222221202220220222222022022202202200020220220200222220200220200022222222222222010022020002222202000220200020002222222222222222222222222022222222222222222122222202222222220222222022000202202202022222202022202202222222222222220201220220222222022022202202000000000200000200200000200000020020020020020000010000002002000000000000020002022022000022222000022000002222222222222200002100000222220200020000002000222222222022222222022222202222222222222222202221220222222222022202202200020220220000222220000220200022222222222222000022010002222202000220200020002022022020022222020022022002222222222222202002202100222220220222020002000222222222222222222222222222222222222222222222222221222222222222222202200020220220200222220200220220222222222222222020022022012222202202220220200000000020000020000000000000002000000002000000000000000100000000000000000000000002000002202000002000000220200200220200000200000021020000002000000000000000200000222200000200000022222022022220000020000002212000000200000000000000020000020020000000000002002000002002000000000000200100000000000002000202202200002222200002000000222222222222220000200000022221000002000000200022222222202222222202220220222222222222222220222022022222212202220220220002022022000022222000020000002222222222222200002000000222220100020000002000202202202002222202002202000222222222222220200220200022222021002202000200022222222222222222222222220222222222222222222222222022222222212222220220002022022020022222020022020002222222222222202002202000222220220122020000000000002000002002000002000000200200200200200000200000020020000001000000200020220220000222220000220000022222222222222000022000002222202000210000020002222222220222222220222222022222222222222222022222202222222220222122022000202202200002222200002200000222222222222220000220000022222020002201000200020220220200222220200220220022222222222222020022022002222202202220210020002222222222222222222222222222222222222222222222222222222222222222222122000202202202002222202002202200222222222222220200220220022222022022202201" -!"∧: Argument cannot have rank 0" % ∧@ -!"∨: Argument cannot have rank 0" % ∨@ +!"∧𝕩: 𝕩 cannot have rank 0" % ∧@ +!"∨𝕩: 𝕩 cannot have rank 0" % ∨@ (=⋈≡)˜{⇐} %% 1‿1 (≠⋈≢)˜{⇐} %% 0‿0 {⇐}(=⋈≡){⇐} %% 0‿0 @@ -60,7 +60,7 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe 1 +<1 %% <2 (<1)+<1 %% <2 @-@ %% 0 -!"-: Invalid character" % @-1 +!"𝕨-𝕩: Invalid character" % @-1 {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 0}¨ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ @@ -77,12 +77,12 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe %USE var ⋄ a←4⥊0 ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ %USE var ⋄ a←4⥊@ ⋄ b←4⥊0 ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -!"-: Unexpected argument types" % 0-@ -!"÷: Unexpected argument types" % 0÷@ -!"+: Argument must consist of numbers" % +@ +!"𝕨-𝕩: Unexpected argument types" % 0-@ +!"𝕨÷𝕩: Unexpected argument types" % 0÷@ +!"+𝕩: Argument must consist of numbers" % +@ ⟨@, "abc", ⟨1,2,+⟩, {⇐}⟩ {(⊢!≡´) (": Argument contained non-number"∾˜•Repr 𝕩) ⋈ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨}⌜ -‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬ -!"This function can't be called monadically" % ≤@ -!"This function can't be called monadically" % ≥@ +!"Fn𝕩: This function can't be called monadically" % ≤@ +!"Fn𝕩: This function can't be called monadically" % ≥@ # 𝕨/𝕩 2‿3‿0‿1/4‿3⥊↕⋈12 %% ⋈¨6‿3⥊0‿1‿2‿0‿1‿2‿3‿4‿5‿3‿4‿5‿3‿4‿5‿9‿10‿11 @@ -90,7 +90,7 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe 2‿3‿0‿1/↕⋈4 %% ⋈¨6⥊0‿0‿1‿1‿1‿3 !"Expected non-negative integer, got ¯3" % 2‿¯3/↕2 !"Expected non-negative integer, got ¯3e20" % 2‿¯3e20/↕2 -!"/: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 1‿2‿3/4‿5‿6‿7 +!"𝕨/𝕩: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 1‿2‿3/4‿5‿6‿7 !"Expected non-negative integer, got ¯1000" % (4/1000‿¯1000) / 8⥊1 !"Expected non-negative integer, got ¯1000" % (4/1000‿¯1000) / 8⥊1 !"Integer out of range: 4e19" % %USE evar ⋄ 2‿4e19 /_evar ↕2 @@ -101,9 +101,9 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe !"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % (<↕0)/<"ab" !"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % ⟨↕10,↕10⟩ / 10⥊10 !"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % ⟨↕10,↕10,<0⟩ / 10‿10⥊10 -!"/: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (2‿1⥊↕4) / 4‿4⥊↕16 +!"𝕨/𝕩: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (2‿1⥊↕4) / 4‿4⥊↕16 !"𝕨/𝕩: Compound 𝕨 must have rank at most 1" % (2‿1⥊<↕4) / 4‿4⥊↕16 -!"/: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (1‿2⥊↕4) / ↕4 +!"𝕨/𝕩: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (1‿2⥊↕4) / ↕4 !"𝕨/𝕩: Compound 𝕨 must have rank at most 1" % (1‿2⥊<↕4) / ↕4 !"𝕨/𝕩: 𝕨 must consist of natural numbers" % ⟨↕4, 1‿2‿3.5‿4⟩ / 4‿4⥊↕16 !"𝕨/𝕩: 𝕨 must consist of natural numbers" % ⟨↕4, 3.5⟩ / 4‿4⥊↕16 @@ -123,8 +123,8 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe # /𝕩 !"Expected non-negative integer, got ¯1000" % / 4/1000‿¯1000 -!"/: Argument must have rank 1 (3‿3 ≡ ≢𝕩)" % /↕3‿3 -!"/: Argument must have rank 1 (⟨⟩ ≡ ≢𝕩)" % /0 +!"/𝕩: 𝕩 must have rank 1 (3‿3 ≡ ≢𝕩)" % /↕3‿3 +!"/𝕩: 𝕩 must have rank 1 (⟨⟩ ≡ ≢𝕩)" % /0 !"Expected non-negative integer, got ¯1" % %USE evar ⋄ /_evar ¯1⌾(100⊸⊑) 200⥊10 !"Sum too big" % %USE evar ⋄ /_evar 1e2⥊2⋆62 !"Integer out of range: 1e20" % %USE evar ⋄ /_evar 1e20⌾(100⊸⊑) 200⥊10 @@ -135,38 +135,38 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe •internal.ElType¨ {(100⥊↕2)⊏𝕨‿𝕩}⌜˜ ⟨0, 1, 2, 127, 128, 32767, 32768, ¯32767, ¯32768, ¯32769, ¯1+2⋆31, 2⋆31, @, @+1, @+255, @+256, @+1114111, {⇐}, 1‿2⟩ %% (8-(=⌜˜<⟜5)×8-⌈⌜˜) 0‿0‿1‿1‿2‿2‿3‿2‿2‿3‿3‿4‿5‿5‿5‿6‿7‿8‿8 0‿0‿0 ⊏ 1‿3⥊↕10 %% 3‿3⥊0‿1‿2 ≢¨ ⟨(2‿0‿3‿4‿5⥊1)⊏9‿8‿0‿7⥊0 ⋄ ⟨⟩⊏0‿8‿0‿7⥊0 ⋄ (2‿3‿0‿4⥊1)⊏↕10⟩ %% ⟨2‿0‿3‿4‿5‿8‿0‿7,0‿8‿0‿7,2‿3‿0‿4⟩ -!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % ⊏˜(200⥊1)⥊1 -!"⊏: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % %USE evar ⋄ 1‿24 ⊏_evar ↕4‿4 -!"⊏: Indexing out-of-bounds (¯24∊𝕨, 4≡≠𝕩)" % %USE evar ⋄ 1‿¯24 ⊏_evar ↕4‿4 +!"𝕨⊏𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % ⊏˜(200⥊1)⥊1 +!"𝕨⊏𝕩: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % %USE evar ⋄ 1‿24 ⊏_evar ↕4‿4 +!"𝕨⊏𝕩: Indexing out-of-bounds (¯24∊𝕨, 4≡≠𝕩)" % %USE evar ⋄ 1‿¯24 ⊏_evar ↕4‿4 !"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % %USE evar ⋄ (1‿¯26∾@) ⊏_evar @∾↕5 -!"⊏: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % %USE evar ⋄ ¯26⊸⊏_evar ↕5 +!"𝕨⊏𝕩: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % %USE evar ⋄ ¯26⊸⊏_evar ↕5 !"Expected integer, got ¯26.5" % %USE evar ⋄ ¯26.5⊸⊏_evar ↕5 -!"⊏: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % %USE evar ⋄ 1‿¯26 ⊏_evar ↕5 -!"⊏: Indexing out-of-bounds (26∊𝕨, 5≡≠𝕩)" % %USE evar ⋄ 1‿26 ⊏_evar ↕5 +!"𝕨⊏𝕩: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % %USE evar ⋄ 1‿¯26 ⊏_evar ↕5 +!"𝕨⊏𝕩: Indexing out-of-bounds (26∊𝕨, 5≡≠𝕩)" % %USE evar ⋄ 1‿26 ⊏_evar ↕5 !"Expected integer, got 1.1" % %USE evar ⋄ 0‿1.1‿2 ⊏_evar ↕10 -!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 0‿0‿1 ⊏_evar 1‿3⥊↕10000 -!"⊏: Indexing out-of-bounds (2∊𝕨, 2≡≠𝕩)" % %USE evar ⋄ (1+9=↕10) ⊏_evar ⟨1‿2,3⟩ -!"⊏: Indexing out-of-bounds (4∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ 1‿4‿2‿0‿10‿5‿6 ⊏_evar 1‿0‿1 -!"⊏: Indexing out-of-bounds (¯4∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ (-1‿4‿2‿0‿10‿5‿6) ⊏_evar 1‿0‿1 -!"⊏: Indexing out-of-bounds (4000∊𝕨, 1001≡≠𝕩)" % %USE evar ⋄ ( 1000×1‿4‿2‿0‿10‿5‿6) ⊏_evar 1001⥊1‿0‿1 -!"⊏: Indexing out-of-bounds (¯4000∊𝕨, 1001≡≠𝕩)" % %USE evar ⋄ (¯1000×1‿4‿2‿0‿10‿5‿6) ⊏_evar 1001⥊1‿0‿1 +!"𝕨⊏𝕩: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % %USE evar ⋄ 0‿0‿1 ⊏_evar 1‿3⥊↕10000 +!"𝕨⊏𝕩: Indexing out-of-bounds (2∊𝕨, 2≡≠𝕩)" % %USE evar ⋄ (1+9=↕10) ⊏_evar ⟨1‿2,3⟩ +!"𝕨⊏𝕩: Indexing out-of-bounds (4∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ 1‿4‿2‿0‿10‿5‿6 ⊏_evar 1‿0‿1 +!"𝕨⊏𝕩: Indexing out-of-bounds (¯4∊𝕨, 3≡≠𝕩)" % %USE evar ⋄ (-1‿4‿2‿0‿10‿5‿6) ⊏_evar 1‿0‿1 +!"𝕨⊏𝕩: Indexing out-of-bounds (4000∊𝕨, 1001≡≠𝕩)" % %USE evar ⋄ ( 1000×1‿4‿2‿0‿10‿5‿6) ⊏_evar 1001⥊1‿0‿1 +!"𝕨⊏𝕩: Indexing out-of-bounds (¯4000∊𝕨, 1001≡≠𝕩)" % %USE evar ⋄ (¯1000×1‿4‿2‿0‿10‿5‿6) ⊏_evar 1001⥊1‿0‿1 %USE tvar ⋄ !∘≡¨⟜⊏ ∾ {⥊𝕨 ⊏⎊(•CurrentError∘⊢) _tvar 𝕩}´¨ ⟨⟨0‿1, ⋈0⟩ ⋄ ⟨0‿1, "?"⟩ ⋄ ⟨0‿1, ≍0‿1⟩⟩ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ 𝕨⊏⎊"e"𝕩}⟨1‿2,3‿4⟩ ⋄ ! 0‿1 ≡ a %USE eqvar ⋄ {1‿¯1 {r←𝕨⊏𝕩 ⋄ ! 𝕩 ≥○•internal.ElType r ⋄ r}_eqvar 𝕩}¨ ⟨↕2, ↕4, "hello", ⟨"ab", "cd", "ef"⟩, ↕⋈4⟩ -!"⊏: 𝕩 cannot be a unit" % 0⊏<"a" -!"⊏: 𝕩 cannot be a unit" % 0⊏<5 -!"⊏: 𝕩 cannot be an atom" % 0⊏5 -!"⊏: 𝕩 cannot be a unit" % ⟨⟩⊏<"a" -!"⊏: 𝕩 cannot be a unit" % ⟨⟩⊏<5 -!"⊏: 𝕩 cannot be an atom" % ⟨⟩⊏5 +!"𝕨⊏𝕩: 𝕩 cannot be a unit" % 0⊏<"a" +!"𝕨⊏𝕩: 𝕩 cannot be a unit" % 0⊏<5 +!"𝕨⊏𝕩: 𝕩 cannot be an atom" % 0⊏5 +!"𝕨⊏𝕩: 𝕩 cannot be a unit" % ⟨⟩⊏<"a" +!"𝕨⊏𝕩: 𝕩 cannot be a unit" % ⟨⟩⊏<5 +!"𝕨⊏𝕩: 𝕩 cannot be an atom" % ⟨⟩⊏5 !"Expected integer, got 1.5" % ⟨1.5⟩ ⊏ "ab"‿"cd" -!"⊏: Indexing out-of-bounds (10∊𝕨, 2≡≠𝕩)" % ⟨10⟩ ⊏ "ab"‿"cd" +!"𝕨⊏𝕩: Indexing out-of-bounds (10∊𝕨, 2≡≠𝕩)" % ⟨10⟩ ⊏ "ab"‿"cd" {𝕩 ! ↕∘≠⊸⊏⊸≡ 20‿𝕩•rand.Range 2}¨ (↕70)∾⥊(64×1‿2‿3‿4‿5)+⌜¯1‿0‿1‿30‿60 # 𝕨⊑𝕩 -!"⊑: 𝕨 contained a non-integer" % ⟨0.1⟩⊑↕3 -!"⊑: 𝕨 contained a non-integer" % ⟨2⋆80⟩⊑↕3 -!"⊑: Leaf arrays in 𝕨 must have rank 1 (element: (1‿2⥊1‿2))" % %USE evar ⋄ (≍1‿2) {⟨𝕨⟩⊑𝕩}_evar ↕5‿5 +!"𝕨⊑𝕩: 𝕨 contained a non-integer" % ⟨0.1⟩⊑↕3 +!"𝕨⊑𝕩: 𝕨 contained a non-integer" % ⟨2⋆80⟩⊑↕3 +!"𝕨⊑𝕩: Leaf arrays in 𝕨 must have rank 1 (element: (1‿2⥊1‿2))" % %USE evar ⋄ (≍1‿2) {⟨𝕨⟩⊑𝕩}_evar ↕5‿5 %USE eqvar ⋄ 1‿2 ⊑_eqvar ↕5‿5 %% 1‿2 # >𝕩 @@ -179,8 +179,8 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ !">: Incompatible element shapes (encountered shapes ⟨0⟩ and ⟨⟩)" % > ↕¨⟨0, ⟨⟩⟩ !">: Incompatible element shapes (encountered shapes 2‿3 and ⟨⟩)" % > ↕¨⟨2‿3, ⟨⟩⟩ !">: Incompatible element shapes (encountered shapes 4‿5 and 4‿6)" % ≢>2‿3⥊⟨4‿5⥊↕20,4‿6⥊↕1⟩ -!"∾: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and ⟨3⟩ and later higher-rank array)" % ∾⟨1‿1, 1‿1‿1, ⟨1⟩, 2‿2⥊1⟩ -!"∾: Item trailing shapes must be equal (contained arrays with shapes 1‿4 and ⟨0⟩)" % ∾⟨1‿4⥊"abcd",⟨⟩⟩ +!"∾𝕩: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and ⟨3⟩ and later higher-rank array)" % ∾⟨1‿1, 1‿1‿1, ⟨1⟩, 2‿2⥊1⟩ +!"∾𝕩: Item trailing shapes must be equal (contained arrays with shapes 1‿4 and ⟨0⟩)" % ∾⟨1‿4⥊"abcd",⟨⟩⟩ >⟨<'a',1⟩ %% 'a'‿1 >⟨1,2,<3,4,<<5⟩ %% ⟨1,2,3,4,<5⟩ ≢>0‿1⥊<2‿3⥊<"ab" %% ↕4 @@ -204,11 +204,11 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ # ∾𝕩 ∾⟨"ab", 12, "de"⟩ %% ⟨'a','b',12,'d','e'⟩ -!"∾: Item trailing shapes must be equal (contained arrays with shapes 3‿3 and 3‿4)" % ∾⟨↕3‿3,↕3‿4⟩ -!"∾: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and 3‿3)" % ∾⟨1‿2,↕3‿3⟩ -!"∾: Item ranks along an axis can differ by at most one (contained ranks 1 and 3 along axis 0)" % ∾2‿1 ⥊ ⥊⟜0¨ ⟨0‿2‿3, 0⟩ -!"∾: Incompatible item shapes (contained arrays with shapes 1‿0 and 1‿0 along axis 1)" % ∾ {1‿𝕩⥊0}¨ [0‿1, 0‿0] -!"∾: Incompatible item ranks" % ∾ ⥊⟜0¨ [0‿1⋈0‿1, 0‿1⋈1] +!"∾𝕩: Item trailing shapes must be equal (contained arrays with shapes 3‿3 and 3‿4)" % ∾⟨↕3‿3,↕3‿4⟩ +!"∾𝕩: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and 3‿3)" % ∾⟨1‿2,↕3‿3⟩ +!"∾𝕩: Item ranks along an axis can differ by at most one (contained ranks 1 and 3 along axis 0)" % ∾2‿1 ⥊ ⥊⟜0¨ ⟨0‿2‿3, 0⟩ +!"∾𝕩: Incompatible item shapes (contained arrays with shapes 1‿0 and 1‿0 along axis 1)" % ∾ {1‿𝕩⥊0}¨ [0‿1, 0‿0] +!"∾𝕩: Incompatible item ranks" % ∾ ⥊⟜0¨ [0‿1⋈0‿1, 0‿1⋈1] ∾3‿3⥊<1‿0‿3⥊0 %% 3‿0‿3⥊0 ∾3‿3⥊<0‿0⥊⟨⟩ %% 0‿0⥊⟨⟩ ⊑1↑⥊∾3‿3⥊<1‿0‿3⥊<"hi" %% " " @@ -216,8 +216,8 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ ∾⟨⟩ %% ⟨⟩ # 𝕨∾𝕩 -!"∾: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc"∾"def")∾≍"a" -!"∾: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % (("abc")∾"def")∾1‿1⥊1 +!"𝕨∾𝕩: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc"∾"def")∾≍"a" +!"𝕨∾𝕩: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % (("abc")∾"def")∾1‿1⥊1 ! (∘‿2⥊"abcdefgh") ≡ ["ab","cd"]∾["ef","gh"] ! (∘‿2⥊"abcdef") ≡ ["ab","cd"]∾"ef" @@ -226,26 +226,26 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ ! (∘‿2⥊"abcdef") ≡ (a←["ab","cd"])∾"ef" ⋄ •internal.Keep a ! (∘‿2⥊"abcdef") ≡ "ab"∾a←["cd","ef"] ⋄ •internal.Keep a -!"∾: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 1∾↕3‿3 -!"∾: Argument ranks must differ by 1 or less (1≡=𝕨, 3≡=𝕩)" % 1‿2∾↕3‿3‿3 -!"∾: Argument ranks must differ by 1 or less (3≡=𝕨, 1≡=𝕩)" % 1‿2∾˜↕3‿3‿3 -!"∾: Lengths not matchable (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (↕3‿4)∾↕3‿3 +!"𝕨∾𝕩: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 1∾↕3‿3 +!"𝕨∾𝕩: Argument ranks must differ by 1 or less (1≡=𝕨, 3≡=𝕩)" % 1‿2∾↕3‿3‿3 +!"𝕨∾𝕩: Argument ranks must differ by 1 or less (3≡=𝕨, 1≡=𝕩)" % 1‿2∾˜↕3‿3‿3 +!"𝕨∾𝕩: Lengths not matchable (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (↕3‿4)∾↕3‿3 -!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % ["ab","cd"]∾["efg","hjk"] -!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, ⟨3⟩ ≡ ≢𝕩)" % ["ab","cd"]∾"efg" -!"∾: Lengths not matchable (⟨3⟩ ≡ ≢𝕨, 2‿2 ≡ ≢𝕩)" % "abz"∾["cd","ef"] -!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (a←["ab","cd"])∾["efg","hjk"] -!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, ⟨3⟩ ≡ ≢𝕩)" % (a←["ab","cd"])∾"efg" -!"∾: Lengths not matchable (⟨3⟩ ≡ ≢𝕨, 2‿2 ≡ ≢𝕩)" % "abz"∾a←["cd","ef"] +!"𝕨∾𝕩: Lengths not matchable (2‿2 ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % ["ab","cd"]∾["efg","hjk"] +!"𝕨∾𝕩: Lengths not matchable (2‿2 ≡ ≢𝕨, ⟨3⟩ ≡ ≢𝕩)" % ["ab","cd"]∾"efg" +!"𝕨∾𝕩: Lengths not matchable (⟨3⟩ ≡ ≢𝕨, 2‿2 ≡ ≢𝕩)" % "abz"∾["cd","ef"] +!"𝕨∾𝕩: Lengths not matchable (2‿2 ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (a←["ab","cd"])∾["efg","hjk"] +!"𝕨∾𝕩: Lengths not matchable (2‿2 ≡ ≢𝕨, ⟨3⟩ ≡ ≢𝕩)" % (a←["ab","cd"])∾"efg" +!"𝕨∾𝕩: Lengths not matchable (⟨3⟩ ≡ ≢𝕨, 2‿2 ≡ ≢𝕩)" % "abz"∾a←["cd","ef"] # 𝕨≍𝕩 -!"≍: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (↕3‿4)≍↕3‿3 -!"≍: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % 1‿2‿3≍1‿2 -!"≍: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨⟩ ≡ ≢𝕩)" % 1‿2‿3≍1 -!"≍: Result rank too large" % ≍˜(255⥊1)⥊1 +!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (↕3‿4)≍↕3‿3 +!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % 1‿2‿3≍1‿2 +!"𝕨≍𝕩: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨⟩ ≡ ≢𝕩)" % 1‿2‿3≍1 +!"𝕨≍𝕩: Result rank too large" % ≍˜(255⥊1)⥊1 # ≍𝕩 -!"≍: Result rank too large (255≡=𝕩)" % ≍⍟256 1 +!"≍𝕩: Result rank too large (255≡=𝕩)" % ≍⍟256 1 %USE eqvar ⋄ 1‿2‿3‿4‿5‿64 {c𝕊e: ∾_eqvar´¨ ⟨4‿c, c⟩ ⋈⌜○({𝕩⥊ %% +‿÷‿×‿=‿+‿+ -!"/: 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⟩ From e3a41327229a351d3a660705e02a61fe78013025 Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 6 Feb 2025 12:23:55 +0200 Subject: [PATCH 10/12] clean up error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit incl. correcting •_timed's message being wrong --- src/builtins/arithd.c | 8 ++-- src/builtins/cells.c | 4 +- src/builtins/fold.c | 12 +++--- src/builtins/md1.c | 4 +- src/builtins/md2.c | 8 ++-- src/builtins/scan.c | 6 +-- src/builtins/sysfn.c | 52 +++++++++++------------ src/core/stuff.c | 20 ++++----- src/utils/mut.c | 2 +- test/cases/cells.bqn | 18 ++++---- test/cases/ffi.bqn | 6 +-- test/cases/patterns.bqn | 2 +- test/cases/prims.bqn | 93 +++++++++++++++++++++++++---------------- test/cases/system.bqn | 66 +++++++++++++++-------------- test/cases/under.bqn | 2 +- 15 files changed, 163 insertions(+), 140 deletions(-) diff --git a/src/builtins/arithd.c b/src/builtins/arithd.c index d8eccdbf..36bcd3fc 100644 --- a/src/builtins/arithd.c +++ b/src/builtins/arithd.c @@ -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*/ @@ -407,7 +407,7 @@ 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, { @@ -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) diff --git a/src/builtins/cells.c b/src/builtins/cells.c index 58c153ca..cf7934a6 100644 --- a/src/builtins/cells.c +++ b/src/builtins/cells.c @@ -340,7 +340,7 @@ static NOINLINE B to_fill_cell(B x, ur k, u32 chr) { // consumes x ur cr = RNK(x)-k; usz* sh = SH(x)+k; usz csz = 1; - for (usz i=0; ia, xsh, k); rsh->a[k] = 1; diff --git a/src/builtins/fold.c b/src/builtins/fold.c index 9d820177..b67ed888 100644 --- a/src/builtins/fold.c +++ b/src/builtins/fold.c @@ -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("´𝕩: 𝕩 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); } diff --git a/src/builtins/md1.c b/src/builtins/md1.c index e470b810..d1dafeb8 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -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 (rrf, 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(); diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 385152a7..919bc8ba 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -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)); diff --git a/src/builtins/scan.c b/src/builtins/scan.c index 84930895..8b8402f6 100644 --- a/src/builtins/scan.c +++ b/src/builtins/scan.c @@ -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("`𝕩: 𝕩 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"); diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index e2f258a2..de25a396 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -277,7 +277,7 @@ B show_c1(B t, B x) { } NOINLINE B vfyStr(B x, char* name, char* arg) { - if (!isStr(x)) thrF("%U𝕩: %U must be a string", name, arg); + if (!isStr(x)) thrF("%U: %U must be a string", name, arg); return x; } @@ -1038,7 +1038,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er SGetU(x) for (u64 i = 0; i < xia; i++) { B c = GetU(x, i); - if (isAtm(c) || RNK(c)!=1) thrM("•SH𝕩: 𝕩 must be a list of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings"); u64 len = utf8lenB(c); TALLOC(char, cstr, len+1); toUTF8(c, cstr); @@ -1051,7 +1051,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er int p_in[2]; int p_out[2]; int p_err[2]; - if (pipe(p_in) || pipe(p_out) || pipe(p_err)) thrM("•SH𝕩: Failed to create process: Couldn't create pipes"); // TODO these pipes will easily leak + if (pipe(p_in) || pipe(p_out) || pipe(p_err)) thrM("•SH: Failed to create process: Couldn't create pipes"); // TODO these pipes will easily leak shDbg("pipes: %d %d %d %d %d %d\n", p_in[0], p_in[1], p_out[0], p_out[1], p_err[0], p_err[1]); fcntl(p_in[1], F_SETFL, O_NONBLOCK); // make our side of pipes never block because we're working on multiple fcntl(p_out[0], F_SETFL, O_NONBLOCK); @@ -1065,7 +1065,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er // spawn the actual process pid_t pid; - if(posix_spawnp(&pid, argv[0], &a, NULL, argv, environ) != 0) thrF("•SH𝕩: Failed to create process: %S", strerror(errno)); + if(posix_spawnp(&pid, argv[0], &a, NULL, argv, environ) != 0) thrF("•SH: Failed to create process: %S", strerror(errno)); posix_spawn_file_actions_destroy(&a); // used now shClose(p_in[0]); // close the useless pipes on this side shClose(p_out[1]); @@ -1163,7 +1163,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er SGetU(x) for (u64 i = 0; i < xia; i++) { B c = GetU(x, i); - if (isAtm(c) || RNK(c)!=1) thrM("•SH𝕩: 𝕩 must be a list of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings"); u64 len = utf16lenB(c); TALLOC(WCHAR, wstr, len); toUTF16(c, wstr); @@ -1214,7 +1214,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } // FREE_INPUT TSFREE(arg); if (dwResult != ERROR_SUCCESS) { - thrF("•SH𝕩: Failed to run command: %S", winErrorEx(dwResult)); + thrF("•SH: Failed to run command: %S", winErrorEx(dwResult)); } // prepare output @@ -1242,17 +1242,17 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er B inObj = bi_N; bool raw = false; if (!q_N(w)) { - if (!isNsp(w)) thrM("𝕨•SH𝕩: 𝕨 must be a namespace"); + if (!isNsp(w)) thrM("•SH: 𝕨 must be a namespace"); inObj = ns_getC(w, "stdin"); - if (!q_N(inObj) && !isArr(inObj)) thrM("𝕨•SH𝕩: Invalid stdin value"); + if (!q_N(inObj) && !isArr(inObj)) thrM("•SH: Invalid stdin value"); B rawObj = ns_getC(w, "raw"); if (!q_N(rawObj)) raw = o2b(rawObj); } u64 iLen = q_N(inObj)? 0 : (raw? IA(inObj) : utf8lenB(inObj)); - if (isAtm(x) || RNK(x)>1) thrM("𝕨•SH𝕩: 𝕩 must be a list of strings"); + if (isAtm(x) || RNK(x)>1) thrM("•SH: 𝕩 must be a list of strings"); usz xia = IA(x); - if (xia==0) thrM("𝕨•SH𝕩: 𝕩 must have at least one item"); + if (xia==0) thrM("•SH: 𝕩 must have at least one item"); B s_out, s_err; i32 code = sh_core(raw, x, xia, inObj, iLen, &s_out, &s_err); @@ -1270,7 +1270,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er return m_hvec3(m_i32(code), s_outObj, s_errObj); } #else - B sh_c2(B t, B w, B x) { thrM("𝕨•SH𝕩: CBQN was compiled without "); } + B sh_c2(B t, B w, B x) { thrM("•SH: CBQN was compiled without "); } #endif B sh_c1(B t, B x) { return sh_c2(t, bi_N, x); } @@ -1426,19 +1426,19 @@ static CastType getCastType(B e, bool hasVal, B val) { // returns a valid type ( usz s; bool c; if (isNum(e)) { s = o2s(e); - if (s!=1 && s!=8 && s!=16 && s!=32 && s!=64) thrF("•bit._cast𝕩: unsupported width %s", s); + if (s!=1 && s!=8 && s!=16 && s!=32 && s!=64) thrF("•bit._cast: unsupported width %s", s); c = hasVal? isCharArr(val) : 0; } else { - if (!isArr(e) || RNK(e)!=1 || IA(e)!=2) thrM("•bit._cast𝕩: 𝕗 elements must be numbers or two-element lists"); + if (!isArr(e) || RNK(e)!=1 || IA(e)!=2) thrM("•bit._cast: 𝕗 elements must be numbers or two-element lists"); SGetU(e) s = o2s(GetU(e,0)); u32 t = o2c(GetU(e,1)); c = t=='c'; - if (c ) { if (s!=8 && s!=16 && s!=32) { badWidth: thrF("•bit._cast𝕩: unsupported width %s for type '%c'", s, (char)t); } } + if (c ) { if (s!=8 && s!=16 && s!=32) { badWidth: thrF("•bit._cast: unsupported width %s for type '%c'", s, (char)t); } } else if (t=='i') { if (s!=8 && s!=16 && s!=32) goto badWidth; } else if (t=='u') { if (s!=1) goto badWidth; } else if (t=='f') { if (s!=64) goto badWidth; } - else thrM("•bit._cast𝕩: type descriptor in 𝕗 must be one of \"iufnc\""); + else thrM("•bit._cast: type descriptor in 𝕗 must be one of \"iufnc\""); } return (CastType) { s, c }; @@ -1495,14 +1495,14 @@ static B set_bit_result(B r, u8 rt, ur rr, usz rl, usz *sh) { B bitcast_impl(B el0, B el1, B x) { ur xr; - if (!isArr(x) || (xr=RNK(x))<1) thrM("•bit._cast𝕩: 𝕩 must have rank at least 1"); + if (!isArr(x) || (xr=RNK(x))<1) thrM("•bit._cast: 𝕩 must have rank at least 1"); CastType xct = getCastType(el0, true, x); CastType rct = getCastType(el1, false, m_f64(0)); usz* sh = SH(x); u64 s=xct.s*(u64)sh[xr-1], rl=s/rct.s; - if (rl*rct.s != s) thrM("•bit._cast𝕩: incompatible lengths"); - if (rl>=USZ_MAX) thrM("•bit._cast𝕩: output too large"); + if (rl*rct.s != s) thrM("•bit._cast: incompatible lengths"); + if (rl>=USZ_MAX) thrM("•bit._cast: output too large"); B r = convert(xct, x); u8 rt = typeOfCast(rct); if (rt==t_bitarr && (v(r)->refc!=1 || IS_SLICE(TY(r)))) { @@ -1522,12 +1522,12 @@ B bitcast_impl(B el0, B el1, B x) { } B bitcast_c1(Md1D* d, B x) { B f = d->f; - if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast𝕩: 𝕗 must be a 2-element list (from‿to)"); + if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast: 𝕗 must be a 2-element list (from‿to)"); SGetU(f) return bitcast_impl(GetU(f,0), GetU(f,1), x); } B bitcast_im(Md1D* d, B x) { B f = d->f; - if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast𝕩: 𝕗 must be a 2-element list (from‿to)"); + if (!isArr(f) || RNK(f)!=1 || IA(f)!=2) thrM("•bit._cast: 𝕗 must be a 2-element list (from‿to)"); SGetU(f) return bitcast_impl(GetU(f,1), GetU(f,0), x); } @@ -1787,12 +1787,12 @@ B indexOf_c2(B t, B w, B x); GLOBAL bool fileInit; -B invalidFn_c1 (B t, B x) { thrM("Fn𝕩: Using an invalid function"); } -B invalidFn_c2 (B t, B w, B x) { thrM("𝕨Fn𝕩: Using an invalid function"); } -B invalidMd1_c1(Md1D* d, B x) { thrM("_Mod𝕩: Using an invalid 1-modifier"); } -B invalidMd1_c2(Md1D* d, B w, B x) { thrM("𝕨_Mod𝕩: Using an invalid 1-modifier"); } -B invalidMd2_c1(Md2D* d, B x) { thrM("_Mod_𝕩: Using an invalid 2-modifier"); } -B invalidMd2_c2(Md2D* d, B w, B x) { thrM("𝕨_Mod_𝕩: Using an invalid 2-modifier"); } +B invalidFn_c1 (B t, B x) { thrM("Using an invalid function"); } +B invalidFn_c2 (B t, B w, B x) { thrM("Using an invalid function"); } +B invalidMd1_c1(Md1D* d, B x) { thrM("Using an invalid 1-modifier"); } +B invalidMd1_c2(Md1D* d, B w, B x) { thrM("Using an invalid 1-modifier"); } +B invalidMd2_c1(Md2D* d, B x) { thrM("Using an invalid 2-modifier"); } +B invalidMd2_c2(Md2D* d, B w, B x) { thrM("Using an invalid 2-modifier"); } static NOINLINE void initSysDesc() { if (fileInit) return; diff --git a/src/core/stuff.c b/src/core/stuff.c index 5bd4fdca..3f7ac1e6 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -41,11 +41,11 @@ NORETURN NOINLINE void fatal(char* s) { } NOINLINE B c1F(B f, B x) { dec(x); - if (isMd(f)) thrM("_Mod𝕩: Calling a modifier"); + if (isMd(f)) thrM("Calling a modifier"); return inc(VALIDATE(f)); } NOINLINE B c2F(B f, B w, B x) { dec(w); dec(x); - if (isMd(f)) thrM("𝕨_Mod_𝕩: Calling a modifier"); + if (isMd(f)) thrM("Calling a modifier"); return inc(VALIDATE(f)); } NOINLINE void value_freeF(Value* x) { value_free(x); } @@ -54,15 +54,15 @@ void noop_visit(Value* x) { } #if HEAP_VERIFY void arr_visit(Value* x) { VISIT_SHAPE(x); } #endif -NOINLINE B c1_bad(B f, B x) { thrM("Fn𝕩: This function can't be called monadically"); } -NOINLINE B c2_bad(B f, B w, B x) { thrM("𝕨Fn𝕩: This function can't be called dyadically"); } -NOINLINE B m1c1_bad(Md1D* d, B x) { thrM("_Mod𝕩: This 1-modifier can't be called monadically"); } -NOINLINE B m1c2_bad(Md1D* d, B w, B x) { thrM("𝕨_Mod𝕩: This 1-modifier can't be called dyadically"); } -NOINLINE B m2c1_bad(Md2D* d, B x) { thrM("_Mod_𝕩: This 2-modifier can't be called monadically"); } -NOINLINE B m2c2_bad(Md2D* d, B w, B x) { thrM("𝕨_Mod_𝕩: This 2-modifier can't be called dyadically"); } +NOINLINE B c1_bad(B f, B x) { thrM("This function can't be called monadically"); } +NOINLINE B c2_bad(B f, B w, B x) { thrM("This function can't be called dyadically"); } +NOINLINE B m1c1_bad(Md1D* d, B x) { thrM("This 1-modifier can't be called monadically"); } +NOINLINE B m1c2_bad(Md1D* d, B w, B x) { thrM("This 1-modifier can't be called dyadically"); } +NOINLINE B m2c1_bad(Md2D* d, B x) { thrM("This 2-modifier can't be called monadically"); } +NOINLINE B m2c2_bad(Md2D* d, B w, B x) { thrM("This 2-modifier can't be called dyadically"); } -NOINLINE B md_c1(B t, B x) { thrM("_Mod𝕩: Cannot call a modifier"); } -NOINLINE B md_c2(B t, B w, B x) { thrM("𝕨_Mod_𝕩: Cannot call a modifier"); } +NOINLINE B md_c1(B t, B x) { thrM("Cannot call a modifier"); } +NOINLINE B md_c2(B t, B w, B x) { thrM("Cannot call a modifier"); } NOINLINE B arr_c1(B t, B x) { dec(x); return inc(t); } NOINLINE B arr_c2(B t, B w, B x) { dec(w); dec(x); return inc(t); } diff --git a/src/utils/mut.c b/src/utils/mut.c index 5cf36d58..3e32f984 100644 --- a/src/utils/mut.c +++ b/src/utils/mut.c @@ -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); diff --git a/test/cases/cells.bqn b/test/cases/cells.bqn index 84914626..be864843 100644 --- a/test/cases/cells.bqn +++ b/test/cases/cells.bqn @@ -20,7 +20,7 @@ !"˘: 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" @@ -42,8 +42,8 @@ !"𝕨⊏𝕩: 𝕩 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 +!">𝕩: 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 @@ -65,12 +65,12 @@ !"⊒𝕩: 𝕩 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 +!"𝕨𝔽`𝕩: 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⟩ diff --git a/test/cases/ffi.bqn b/test/cases/ffi.bqn index fb0837bc..543d02a1 100644 --- a/test/cases/ffi.bqn +++ b/test/cases/ffi.bqn @@ -8,9 +8,9 @@ !"•FFI: 𝕩 must be a list" % @•FFI @ !"•FFI: 𝕩 must be a list" % @•FFI 2‿2⥊<"a" !"•FFI: Path must be a list of characters" % 1‿2 •FFI ""‿"bqn_init" -!"Fn𝕩: This function can't be called monadically" % •FFI ""‿"bqn_init" +!"This function can't be called monadically" % •FFI ""‿"bqn_init" @ •FFI⎊{𝕊: 28↑•CurrentError@} ""‿"bqn_this symbol doesn't exist" %% "FFI: Failed to find symbol: " -!"FFI𝕩: Type must be a string" % @•FFI "hello" +!"FFI: Type must be a string" % @•FFI "hello" !"FFI: Too many arguments" % @•FFI""‿"bqn_init"∾70000⥊<"i32" !"Type parser: Unexpected character '?'" % @•FFI""‿"bqn_init"‿"?" !"Type parser: expected number" % @•FFI""‿"bqn_init"‿"[" @@ -223,7 +223,7 @@ !"Expected integer, got character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Add '!'}} !"(pointer).Sub: Unexpected argument type: character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Sub '!'}} !"Expected non-negative integer, got character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Field '!'}} -!"Type parser𝕩: Pointer type must be a string" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Cast '!'}} +!"Type parser: Pointer type must be a string" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Cast '!'}} !"Expected integer, got character" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Read '!'}} !"FFI: improper value for i8" % %USE WallocE {{𝕊al: p←"i8" Al 1 ⋄ p.Write '!'}} diff --git a/test/cases/patterns.bqn b/test/cases/patterns.bqn index 24849776..df6d57eb 100644 --- a/test/cases/patterns.bqn +++ b/test/cases/patterns.bqn @@ -16,7 +16,7 @@ !"Calling a modifier" % 4 {˜}˝↕1 !"Calling a modifier" % 4 {∘}`↕1 !"Calling a modifier" % {∘}¨↕1 -!"𝕨_Mod_𝕩: Cannot call a modifier" % {˜}¨˜↕1 +!"Cannot call a modifier" % {˜}¨˜↕1 4 {˜}˙´↕1 %% ˜ 4 {˜}˙˝↕1 %% ˜ 4 {∘}˙`↕1 %% ⟨∘⟩ diff --git a/test/cases/prims.bqn b/test/cases/prims.bqn index f35613b8..9d951b4d 100644 --- a/test/cases/prims.bqn +++ b/test/cases/prims.bqn @@ -28,10 +28,10 @@ ! {𝕩 ≡ ⍷2/𝕩} ⟨(0÷0)⊸+, (0÷0)⊸+⟩ # comparison -w←1‿1⥊1 ⋄ x←1‿2⥊1 ⋄ {! (∾⟨•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, 1‿2 ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ -w←1‿1⥊1 ⋄ x←1‿2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, 1‿2 ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ -w←1‿1⥊1 ⋄ x←2⥊1 ⋄ {! (∾⟨•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ -w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ +w←1‿1⥊1 ⋄ x←1‿2⥊1 ⋄ {! (∾⟨"𝕨",•Repr𝕩,"𝕩: Expected equal shape prefix (1‿1 ≡ ≢𝕨, 1‿2 ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ +w←1‿1⥊1 ⋄ x←1‿2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨"𝕨",•Repr𝕩,"𝕩: Expected equal shape prefix (1‿1 ≡ ≢𝕨, 1‿2 ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ +w←1‿1⥊1 ⋄ x←2⥊1 ⋄ {! (∾⟨"𝕨",•Repr𝕩,"𝕩: Expected equal shape prefix (1‿1 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ +w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨"𝕨",•Repr𝕩,"𝕩: Expected equal shape prefix (1‿1 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)"⟩) ≡ w 𝕏⎊(•CurrentError∘@) x}¨ =‿≠‿<‿>‿≤‿≥ !"Invalid comparison" % <˜{⇐} !"Invalid comparison" % ≤˜{⇐} !"Invalid comparison" % >˜{⇐} @@ -61,28 +61,28 @@ w←1‿1⥊1 ⋄ x←2⥊1 ⋄ w‿x <¨↩ ⋄ {! (∾⟨•Repr𝕩,": Expe (<1)+<1 %% <2 @-@ %% 0 !"𝕨-𝕩: Invalid character" % @-1 -{r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -{r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -{r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 0}¨ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +{r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +{r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} @}¨ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +{r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 0}¨ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊0 ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ 0 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊0 ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ @ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨 V a}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} @}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊0 ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} @}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} 0}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} @}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊0 ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} @}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ (LV a) {r←•Repr𝕩 ⋄ (⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ (𝕨 V a) 0∘𝕏⎊{𝕊: •CurrentError@} 0}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊@ ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊0 ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ -%USE var ⋄ a←4⥊@ ⋄ b←4⥊0 ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) (r∾": Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨+, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊0 ⋄ b←4⥊@ ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ -, ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ +%USE var ⋄ a←4⥊@ ⋄ b←4⥊0 ⋄ {r←•Repr f←𝕩 ⋄ {(⊢!≡´) ("𝕨"∾r∾"𝕩: Unexpected argument types") ⋈ (𝕨 V a) 0∘F⎊{𝕊: •CurrentError@} 𝕩 V b}⌜○LV´ a‿b}⌜ ⟨ ×, ÷, ⋆, √, ⌊, ⌈, |, ∧, ∨, ÷⟩ !"𝕨-𝕩: Unexpected argument types" % 0-@ !"𝕨÷𝕩: Unexpected argument types" % 0÷@ !"+𝕩: Argument must consist of numbers" % +@ -⟨@, "abc", ⟨1,2,+⟩, {⇐}⟩ {(⊢!≡´) (": Argument contained non-number"∾˜•Repr 𝕩) ⋈ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨}⌜ -‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬ -!"Fn𝕩: This function can't be called monadically" % ≤@ -!"Fn𝕩: This function can't be called monadically" % ≥@ +⟨@, "abc", ⟨1,2,+⟩, {⇐}⟩ {(⊢!≡´) ("𝕩: 𝕩 contained non-number"∾˜•Repr 𝕩) ⋈ 0∘𝕏⎊{𝕊: •CurrentError@} 𝕨}⌜ -‿×‿÷‿⋆‿√‿⌊‿⌈‿|‿¬ +!"This function can't be called monadically" % ≤@ +!"This function can't be called monadically" % ≥@ # 𝕨/𝕩 2‿3‿0‿1/4‿3⥊↕⋈12 %% ⋈¨6‿3⥊0‿1‿2‿0‿1‿2‿3‿4‿5‿3‿4‿5‿3‿4‿5‿9‿10‿11 @@ -170,15 +170,15 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ %USE eqvar ⋄ 1‿2 ⊑_eqvar ↕5‿5 %% 1‿2 # >𝕩 -!">: Result rank too large (200 ≡ =𝕩, 205 ≡ =⊑𝕩)" % > (200⥊1)⥊<(205⥊1)⥊1 -!">: Incompatible element shapes (encountered shapes ⟨2⟩ and 4‿5)" % > ↕¨⟨2, 4‿5⟩ -!">: Incompatible element shapes (encountered shapes 2‿3 and ⟨4⟩)" % > ↕¨⟨2‿3, 4⟩ -!">: Incompatible element shapes (encountered shapes 2‿3 and 4‿5)" % > ↕¨⟨2‿3, 4‿5⟩ -!">: Incompatible element shapes (encountered shapes 2‿0 and 4‿5)" % > ↕¨⟨2‿0, 4‿5⟩ -!">: Incompatible element shapes (encountered shapes ⟨0⟩ and 4‿5)" % > ↕¨⟨0, 4‿5⟩ -!">: Incompatible element shapes (encountered shapes ⟨0⟩ and ⟨⟩)" % > ↕¨⟨0, ⟨⟩⟩ -!">: Incompatible element shapes (encountered shapes 2‿3 and ⟨⟩)" % > ↕¨⟨2‿3, ⟨⟩⟩ -!">: Incompatible element shapes (encountered shapes 4‿5 and 4‿6)" % ≢>2‿3⥊⟨4‿5⥊↕20,4‿6⥊↕1⟩ +!">𝕩: Result rank too large (200 ≡ =𝕩, 205 ≡ =⊑𝕩)" % > (200⥊1)⥊<(205⥊1)⥊1 +!">𝕩: Incompatible element shapes (encountered shapes ⟨2⟩ and 4‿5)" % > ↕¨⟨2, 4‿5⟩ +!">𝕩: Incompatible element shapes (encountered shapes 2‿3 and ⟨4⟩)" % > ↕¨⟨2‿3, 4⟩ +!">𝕩: Incompatible element shapes (encountered shapes 2‿3 and 4‿5)" % > ↕¨⟨2‿3, 4‿5⟩ +!">𝕩: Incompatible element shapes (encountered shapes 2‿0 and 4‿5)" % > ↕¨⟨2‿0, 4‿5⟩ +!">𝕩: Incompatible element shapes (encountered shapes ⟨0⟩ and 4‿5)" % > ↕¨⟨0, 4‿5⟩ +!">𝕩: Incompatible element shapes (encountered shapes ⟨0⟩ and ⟨⟩)" % > ↕¨⟨0, ⟨⟩⟩ +!">𝕩: Incompatible element shapes (encountered shapes 2‿3 and ⟨⟩)" % > ↕¨⟨2‿3, ⟨⟩⟩ +!">𝕩: Incompatible element shapes (encountered shapes 4‿5 and 4‿6)" % ≢>2‿3⥊⟨4‿5⥊↕20,4‿6⥊↕1⟩ !"∾𝕩: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and ⟨3⟩ and later higher-rank array)" % ∾⟨1‿1, 1‿1‿1, ⟨1⟩, 2‿2⥊1⟩ !"∾𝕩: Item trailing shapes must be equal (contained arrays with shapes 1‿4 and ⟨0⟩)" % ∾⟨1‿4⥊"abcd",⟨⟩⟩ >⟨<'a',1⟩ %% 'a'‿1 @@ -445,7 +445,7 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ %USE eqvar ⋄ a←¯5+↕10 ⋄ {1+⍟𝕩 ⋈10}_eqvar a %% ⋈¨ 5+↕10 %USE eqvar ⋄ a←¯5+↕10 ⋄ {1+⍟(𝕩{!𝕩≡⋈10 ⋄ 𝕗}) ⋈10}_eqvar a %% ⋈¨ 5+↕10 !∘0⍟⟨↕0, ⟨⟩, ""⟩ 0 %% ⟨⟨⟩,⟨⟩,⟨⟩⟩ -!"_Mod𝕩: Calling a modifier" % 1⊸+⍟{∘} 0 +!"Calling a modifier" % 1⊸+⍟{∘} 0 !"⍟: 𝔾 contained non-number" % 1⊸+⍟⟨1,∘,3⟩ 0 !"Expected integer, got 1.5" % 1⊸+⍟1.5 0 !"Integer out of range: 1e20" % 1⊸+⍟1e20 0 @@ -455,8 +455,10 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ !"⍟: 𝔾 contained non-integer (or integer was out of range)" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1.5, 9⟩ # ◶ -!"◶𝕩: 𝕘 must have rank 1 when index is a number" % 1◶[1‿2,3‿4] 3 -!"𝕨◶𝕩: 𝕘 must have rank 1 when index is a number" % "ab" ⊢◶[1‿2,3‿4] 3 +!"𝔽◶𝕘𝕩: 𝕘 must have rank 1 when index is a number" % 1◶[1‿2,3‿4] 3 +!"𝕨𝔽◶𝕘𝕩: 𝕘 must have rank 1 when index is a number" % "ab" ⊢◶[1‿2,3‿4] 3 +!"𝕨𝔽◶𝕘𝕩: Index out of bounds of 𝕘" % 1 2◶⊢‿- 3 +!"𝔽◶𝕘𝕩: Index out of bounds of 𝕘" % 2◶⊢‿- 3 !"𝕨⊑𝕩: Picking item at wrong rank (index 0‿0 in array of shape ⟨2⟩)" % ⊢◶+‿- 0‿0 # shouldn't reference ⊑ but whatever !"𝕨⊑𝕩: Picking item at wrong rank (index 1‿2 in array of shape ⟨3⟩)" % 1 +◶+‿-‿⊢ 0‿1 10 +◶"ab"‿"cd" ¯9 %% "cd" @@ -467,22 +469,39 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄ ≢ (1⥊˜ 0∾203⥊2)⎉50 1⥊˜ 0∾100⥊2 %% 1‿50‿1‿203/0‿2‿0‿2 !"⎉: Result rank too large" % (1⥊˜ 0∾203⥊2)⎉49 1⥊˜ 0∾100⥊2 !"˘: Result rank too large" % ((255⥊1)⥊1)˘ 1‿2 +!"˘: Empty argument too large (0‿1000000000‿1000000000‿1000000000 ≡ ≢𝕩)" % 2 •internal.PureKeep˘ 0‿1e9‿1e9‿1e9⥊0 +!"˘: Empty argument too large (0‿1000000000‿1000000000‿1000000000 ≡ ≢𝕩)" % •internal.PureKeep˘ 0‿1e9‿1e9‿1e9⥊0 +!"⎉: Empty argument too large (0‿0‿1000000000‿1000000000‿1000000000 ≡ ≢𝕩)" % 2 •internal.PureKeep⎉3 0‿0‿1e9‿1e9‿1e9⥊0 +!"⎉: Empty argument too large (0‿0‿1000000000‿1000000000‿1000000000 ≡ ≢𝕩)" % •internal.PureKeep⎉3 0‿0‿1e9‿1e9‿1e9⥊0 +!"≍˘ 𝕩: Result rank too large (255≡=𝕩)" % ≍˘ (255⥊1)⥊1 +!"≍⎉𝕘 𝕩: Result rank too large (255≡=𝕩)" % ≍⎉100 (255⥊1)⥊1 +!"𝔽˘: Incompatible result shapes (encountered shapes ⟨0⟩ and ⟨10⟩)" % {↕⊑𝕩}˘ 4‿10⥊↕100 +!"𝔽˘: Incompatible result shapes (encountered shapes ⟨0⟩ and ⟨10⟩)" % 3 {↕⊑𝕩}˘ 4‿10⥊↕100 +!"𝔽⎉𝕘: Incompatible result shapes (encountered shapes ⟨0⟩ and ⟨10⟩)" % {↕⊑𝕩}⎉1 4‿10⥊↕100 +!"𝔽⎉𝕘: Incompatible result shapes (encountered shapes ⟨0⟩ and ⟨10⟩)" % 3 {↕⊑𝕩}⎉1 4‿10⥊↕100 # ` -!"𝕨`𝕩: Shape of 𝕨 must match the cell of 𝕩 (2‿2 ≡ ≢𝕨, 3‿2‿3 ≡ ≢𝕩)" % (2‿2⥊1)+`↕3‿2‿3 -!"𝕨`𝕩: Shape of 𝕨 must match the cell of 𝕩 (2‿2 ≡ ≢𝕨, 3‿3‿2 ≡ ≢𝕩)" % (2‿2⥊1)+`↕3‿3‿2 -!"𝕨`𝕩: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`↕3‿3 +!"𝔽`𝕩: 𝕩 cannot have rank 0" % ⊢`0 +!"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (2‿2 ≡ ≢𝕨, 3‿2‿3 ≡ ≢𝕩)" % (2‿2⥊1)+`↕3‿2‿3 +!"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (2‿2 ≡ ≢𝕨, 3‿3‿2 ≡ ≢𝕩)" % (2‿2⥊1)+`↕3‿3‿2 +!"𝕨𝔽`𝕩: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`↕3‿3 # ´ -!"´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % +´↕3‿3 -!"𝕨´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 2+´↕3‿3 +!"𝔽´𝕩: 𝕩 must be a list (⟨⟩ ≡ ≢𝕩)" % +´0 +!"𝔽´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % +´↕3‿3 +!"𝕨𝔽´𝕩: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 2+´↕3‿3 +!"𝔽´𝕩: Identity not found" % •internal.Keep´⟨⟩ +⌜´↕0 %% <0 ×⌜´↕0 %% <1 +⌜⌜⌜´↕0 %% <<<0 ×⌜⌜⌜´↕0 %% <<<1 +# ˝ +!"𝔽˝𝕩: 𝕩 must have rank at least 1" % ⊢˝0 +!"𝔽˝𝕩: Identity not found" % •internal.Keep˝⟨⟩ + # ⌜ -!"𝕨⌜𝕩: Result rank too large (200≡=𝕨, 200≡=𝕩)" % +⌜˜(200⥊1)⥊1 +!"𝕨𝔽⌜𝕩: Result rank too large (200≡=𝕨, 200≡=𝕩)" % +⌜˜(200⥊1)⥊1 # ˜ 5˜˝ "ab" %% 5 diff --git a/test/cases/system.bqn b/test/cases/system.bqn index 5de71109..51a3494b 100644 --- a/test/cases/system.bqn +++ b/test/cases/system.bqn @@ -12,8 +12,8 @@ ! ≡´ t←⟨•path,"custom-name" ⟩•BQN"⟨•path‿•name‿•args ⋄ •state⟩" ⋄ ! ⟨•path, "custom-name", ⟨⟩⟩ ≡ ⊑t ! ≡´ t←⟨•path ⟩•BQN"⟨•path‿•name‿•args ⋄ •state⟩" ⋄ ! ⟨•path, "", ⟨⟩⟩ ≡ ⊑t ! ≡´ t←⟨ ⟩•BQN"⟨•path‿•name‿•args ⋄ •state⟩" ⋄ ! ⟨"", ⟨⟩⟩ ≡ 1↓⊑t -!"•BQN𝕩: Path must be a string" % ⟨1‿2⟩ •BQN "2+2" -!"•BQN𝕩: Filename must be a string" % ⟨•path, 1‿2⟩ •BQN "2+2" +!"•BQN: Path must be a string" % ⟨1‿2⟩ •BQN "2+2" +!"•BQN: Filename must be a string" % ⟨•path, 1‿2⟩ •BQN "2+2" ⟨•path, "abc/def"⟩ •BQN "•name" %% "abc/def" !"No path present for •path" % •BQN"•path" !"No arguments present for •args" % •BQN"•args" @@ -28,8 +28,8 @@ !"•file.Chars: Using relative path with no absolute base path known" % f←•BQN"•FChars" ⋄ F "a" # •ReBQN -!"REPL𝕩: Filename must be a string" % f←•ReBQN{⇐} ⋄ ⟨•path, 1‿2⟩ F "2+2" -!"REPL𝕩: Path must be a string" % f←•ReBQN{⇐} ⋄ ⟨1‿2⟩ F "2+2" +!"REPL: Filename must be a string" % f←•ReBQN{⇐} ⋄ ⟨•path, 1‿2⟩ F "2+2" +!"REPL: Path must be a string" % f←•ReBQN{⇐} ⋄ ⟨1‿2⟩ F "2+2" f←•ReBQN{⇐} ⋄ ! ⟨•path, "custom-name", "arg"⟩ ≡ ⟨•path,"custom-name", "arg"⟩ F "•state" f←•ReBQN {system⇐"all"} ⋄ F "•internal.Type ↕10" %% "i8arr" @@ -89,10 +89,10 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈, !"Field named ""abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþabcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ𝕨𝕨⍉!0123456789"" not found" % {abc⇐1 ⋄ dÊF⇐2}⊸•ns.Get "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞabcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ𝕨𝕨⍉!0123456789_" {abc⇐1 ⋄ dÊF⇐2 ⋄ n10⇐3}•ns.Has¨ ⟨"abc", "ABC", "abC", "abc___", "DêF", "__D__Ê__F__", "àbc", "def", "", ↕0, "𝕨", "012", "n10", "n1_0"⟩ %% 1‿1‿1‿1‿1‿1‿0‿0‿0‿0‿0‿0‿1‿1 ∨´{⇐}•ns.Has¨↑"abc123AEWQE___àÀ𝕨𝕩" %% 0 -!"•ns.Has𝕩: 𝕩 must be a string" % {⇐}•ns.Has ≍"" -!"•ns.Has𝕩: 𝕩 must be a string" % {⇐}•ns.Has 1‿2 -!"•ns.Get𝕩: 𝕩 must be a string" % {⇐}•ns.Get ≍"" -!"•ns.Get𝕩: 𝕩 must be a string" % {⇐}•ns.Get 1‿2 +!"•ns.Has: 𝕩 must be a string" % {⇐}•ns.Has ≍"" +!"•ns.Has: 𝕩 must be a string" % {⇐}•ns.Has 1‿2 +!"•ns.Get: 𝕩 must be a string" % {⇐}•ns.Get ≍"" +!"•ns.Get: 𝕩 must be a string" % {⇐}•ns.Get 1‿2 {m←𝕩 ⋄ ⟨{𝕩 ⋈ m•ns.Get 𝕩}¨ •ns.Keys m ⋄ {m•ns.Has⋈𝕩}¨ "abcABC"⟩}¨ ⟨{a⇐1⋄b⇐↕10} ⋄ {a⇐'a'⋄b←2‿3⋄cde⇐𝕩}"abc"⟩ %% ⟨⟨⟨⟨"a",1⟩,⟨"b",0‿1‿2‿3‿4‿5‿6‿7‿8‿9⟩⟩,1‿1‿0‿1‿1‿0⟩,⟨⟨⟨"a",'a'⟩,⟨"cde","abc"⟩⟩,1‿0‿0‿1‿0‿0⟩⟩ @@ -161,7 +161,7 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈, !"•file.At: Path must be a list of characters" % •file.At 1‿2 !"•file.At: Path must be a list of characters" % •file.At 1‿2 !"•file.At: Path must be a list of characters" % "foo" •file.At 1‿2 -!"•file.At𝕩: 𝕨 must be a string" % 1‿2 •file.At "foo" +!"•file.At: 𝕨 must be a string" % 1‿2 •file.At "foo" !"•file.List: Path must be a list of characters" % •file.List 1‿2 !"•file.Bytes: Path must be a list of characters" % •file.Bytes 1‿2 !"•file.Chars: Path must be a list of characters" % •file.Chars 1‿2 @@ -235,7 +235,11 @@ 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 @@ -267,9 +271,9 @@ E←•internal.EEqual ⋄ {! (𝕏 4⥊0) E 𝕏 1↓¯1×π∾4⥊0}¨ (⊢∾ !"𝕨•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' +!"𝕨•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 %% ⟨⟩‿⟨⟩ @@ -287,35 +291,35 @@ r←•MakeRand 1 ⋄ ! 1¨⊸≡ ∊{𝕊: r.Deal 1000}¨ ↕4 r←•MakeRand 1 ⋄ ! 1¨⊸≡ ∊{𝕊: 500 r.Deal 1000}¨ ↕4 # •bit -!"•bit._cast𝕩: 𝕩 must have rank at least 1" % 8‿1 •bit._cast 123 +!"•bit._cast: 𝕩 must have rank at least 1" % 8‿1 •bit._cast 123 (↕10) {! (𝕨⥊¯1) ≡ 1‿𝕩•bit._cast (𝕨×𝕩)⥊1}⌜ 8‿16‿32 %USE var ⋄ {t←𝕩⊏1‿8‿16‿32‿64 ⋄ 1≠⊑t? !∘≡¨⟜⊏ r←{t•bit._cast 𝕩 V a}¨ LV a← ↕128 ⋄ ⊑⊑r; @}¨ ↕4‿4 %USE var ⋄ {t←𝕩⊏1‿8‿16‿32‿64 ⋄ !∘≡¨⟜⊏ r←{t•bit._cast 𝕩 V a}¨ LV a←4=↕128 ⋄ ⊑⊑r}¨ ↕4‿4 ! 10‿1 ≡ ≢8‿16•bit._cast c←0↓2↕'a'+11 •rand.Range 26 ⋄ ! 10‿2 ≡ ≢c ! 10‿1 ≡ ≢8‿16•bit._cast c← 2↕'a'+11 •rand.Range 26 ⋄ ! 10‿2 ≡ ≢c ⊑ 8‿32•bit._cast 3↓↕7 %% 100992003 -!"•bit._cast𝕩: incompatible lengths" % 1‿8•bit._cast 1⥊0 -!"•bit._cast𝕩: incompatible lengths" % 8‿32•bit._cast 2⥊0 -!"•bit._cast𝕩: incompatible lengths" % 8‿32•bit._cast 10⥊0 +!"•bit._cast: incompatible lengths" % 1‿8•bit._cast 1⥊0 +!"•bit._cast: incompatible lengths" % 8‿32•bit._cast 2⥊0 +!"•bit._cast: incompatible lengths" % 8‿32•bit._cast 10⥊0 -!"•bit._cast𝕩: unsupported width 1073741824" % (2⥊2⋆30)•bit._cast ⋈0 -!"•bit._cast𝕩: unsupported width 1125899906842624" % (2⥊2⋆50)•bit._cast ⋈0 %USZ64 +!"•bit._cast: unsupported width 1073741824" % (2⥊2⋆30)•bit._cast ⋈0 +!"•bit._cast: unsupported width 1125899906842624" % (2⥊2⋆50)•bit._cast ⋈0 %USZ64 !"Integer out of range: 1125899906842624" % (2⥊2⋆50)•bit._cast ⋈0 %USZ32 !"Integer out of range: 1.180591620717411e21" % (2⥊2⋆70)•bit._cast ⋈0 !"Integer out of range: ∞" % (2⥊∞)•bit._cast ⋈0 -!"•bit._cast𝕩: unsupported width 12" % 1‿12•bit._cast 11⥊0 -!"•bit._cast𝕩: unsupported width 12" % 12‿32•bit._cast (12×32)⥊0 -!"•bit._cast𝕩: unsupported width 12" % 8‿12•bit._cast (8×12)⥊0 -!"•bit._cast𝕩: unsupported width 0" % 0‿32•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 0" % 8‿0•bit._cast 128⥊0 +!"•bit._cast: unsupported width 12" % 1‿12•bit._cast 11⥊0 +!"•bit._cast: unsupported width 12" % 12‿32•bit._cast (12×32)⥊0 +!"•bit._cast: unsupported width 12" % 8‿12•bit._cast (8×12)⥊0 +!"•bit._cast: unsupported width 0" % 0‿32•bit._cast 128⥊0 +!"•bit._cast: unsupported width 0" % 8‿0•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 16 for type 'f'" % ⟨16‿'f',32⟩•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 32 for type 'f'" % ⟨32,32‿'f'⟩•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 0 for type 'u'" % ⟨0‿'u',32⟩•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 8 for type 'u'" % ⟨8‿'u',32⟩•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 32 for type 'u'" % ⟨8,32‿'u'⟩•bit._cast 128⥊0 -!"•bit._cast𝕩: unsupported width 1 for type 'i'" % ⟨8, 1‿'i'⟩•bit._cast 128⥊0 +!"•bit._cast: unsupported width 16 for type 'f'" % ⟨16‿'f',32⟩•bit._cast 128⥊0 +!"•bit._cast: unsupported width 32 for type 'f'" % ⟨32,32‿'f'⟩•bit._cast 128⥊0 +!"•bit._cast: unsupported width 0 for type 'u'" % ⟨0‿'u',32⟩•bit._cast 128⥊0 +!"•bit._cast: unsupported width 8 for type 'u'" % ⟨8‿'u',32⟩•bit._cast 128⥊0 +!"•bit._cast: unsupported width 32 for type 'u'" % ⟨8,32‿'u'⟩•bit._cast 128⥊0 +!"•bit._cast: unsupported width 1 for type 'i'" % ⟨8, 1‿'i'⟩•bit._cast 128⥊0 # •platform Str ← {!=𝕩 ⋄ !×≠𝕩 ⋄ ! ∧´2=•Type¨𝕩} ⋄ Str •platform.os ⋄ Str •platform.cpu.arch ⋄ Str •platform.bqn.impl_version ⋄ Str •platform.environment @@ -362,7 +366,7 @@ Str ← {!=𝕩 ⋄ !×≠𝕩 ⋄ ! ∧´2=•Type¨𝕩} ⋄ Str •platform.o # •internal.Keep •internal.Keep ↕10 %% ↕10 -!"𝕨Fn𝕩: This function can't be called dyadically" % 1 •internal.Keep 1 +!"This function can't be called dyadically" % 1 •internal.Keep 1 # •internal.Refc •internal.Refc •internal.Unshare ↕10 %% 1 a←•internal.Unshare ↕10 ⋄ b←10⥊ Date: Thu, 6 Feb 2025 20:17:18 -0500 Subject: [PATCH 11/12] add spacing around system functions; add missing args for SH; fix wrong args for bit._cast --- src/builtins/sysfn.c | 118 +++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index de25a396..ec70be8a 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -110,26 +110,26 @@ B fmt_c1(B t, B x) { #if FORMATTER return bqn_fmt(x); #else - thrM("•Fmt𝕩: •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); } @@ -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𝕩: 𝕩 must be a string"); + if (isAtm(x) || RNK(x)!=1) thrM("•Out 𝕩: 𝕩 must be a string"); printsB(x); printf("\n"); return x; } @@ -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𝕩: 𝕩 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𝕩: 𝕩 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𝕩: 𝕩 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𝕩: 𝕩 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𝕩: 𝕩 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); @@ -1163,7 +1163,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er SGetU(x) for (u64 i = 0; i < xia; i++) { B c = GetU(x, i); - if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("•SH 𝕩: 𝕩 must be a list of strings"); u64 len = utf16lenB(c); TALLOC(WCHAR, wstr, len); toUTF16(c, wstr); @@ -1214,7 +1214,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } // FREE_INPUT TSFREE(arg); if (dwResult != ERROR_SUCCESS) { - thrF("•SH: Failed to run command: %S", winErrorEx(dwResult)); + thrF("•SH 𝕩: Failed to run command: %S", winErrorEx(dwResult)); } // prepare output @@ -1242,17 +1242,17 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er B inObj = bi_N; bool raw = false; if (!q_N(w)) { - if (!isNsp(w)) thrM("•SH: 𝕨 must be a namespace"); + if (!isNsp(w)) thrM("𝕨 •SH 𝕩: 𝕨 must be a namespace"); inObj = ns_getC(w, "stdin"); - if (!q_N(inObj) && !isArr(inObj)) thrM("•SH: Invalid stdin value"); + if (!q_N(inObj) && !isArr(inObj)) thrM("𝕨 •SH 𝕩: Invalid stdin value"); B rawObj = ns_getC(w, "raw"); if (!q_N(rawObj)) raw = o2b(rawObj); } u64 iLen = q_N(inObj)? 0 : (raw? IA(inObj) : utf8lenB(inObj)); - if (isAtm(x) || RNK(x)>1) thrM("•SH: 𝕩 must be a list of strings"); + if (isAtm(x) || RNK(x)>1) thrM("𝕨 •SH 𝕩: 𝕩 must be a list of strings"); usz xia = IA(x); - if (xia==0) thrM("•SH: 𝕩 must have at least one item"); + if (xia==0) thrM("𝕨 •SH 𝕩: 𝕩 must have at least one item"); B s_out, s_err; i32 code = sh_core(raw, x, xia, inObj, iLen, &s_out, &s_err); @@ -1270,7 +1270,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er return m_hvec3(m_i32(code), s_outObj, s_errObj); } #else - B sh_c2(B t, B w, B x) { thrM("•SH: CBQN was compiled without "); } + B sh_c2(B t, B w, B x) { thrM("𝕨 •SH 𝕩: CBQN was compiled without "); } #endif B sh_c1(B t, B x) { return sh_c2(t, bi_N, x); } @@ -1315,8 +1315,8 @@ B tCharN_c1(B t, B x) { } } #else -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"); } +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); From 74483f3859c05766404b3033c5967d985aa27f02 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 7 Feb 2025 07:31:44 +0200 Subject: [PATCH 12/12] =?UTF-8?q?more=20spaces=20between=20=F0=9D=95=A8/?= =?UTF-8?q?=F0=9D=95=A9=20and=20names,=20re-remove=20=E2=80=A2SH=20args?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sh_c1 calls sh_c2, so the arity isn't function-specific --- src/builtins/arithd.c | 10 ++++----- src/builtins/arithm.c | 2 +- src/builtins/fold.c | 4 ++-- src/builtins/md1.c | 2 +- src/builtins/sysfn.c | 16 +++++++------- test/cases/hash.bqn | 4 ++-- test/cases/imports.bqn | 14 ++++++------ test/cases/system.bqn | 50 +++++++++++++++++++++--------------------- test/cases/undo.bqn | 9 ++++++-- test/cases/usz32.bqn | 2 +- 10 files changed, 59 insertions(+), 54 deletions(-) diff --git a/src/builtins/arithd.c b/src/builtins/arithd.c index 36bcd3fc..5acb78ba 100644 --- a/src/builtins/arithd.c +++ b/src/builtins/arithd.c @@ -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 diff --git a/src/builtins/arithm.c b/src/builtins/arithm.c index e352e575..13e04185 100644 --- a/src/builtins/arithm.c +++ b/src/builtins/arithm.c @@ -148,7 +148,7 @@ B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM(" 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𝕩: 𝕩 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) diff --git a/src/builtins/fold.c b/src/builtins/fold.c index b67ed888..bb9312ca 100644 --- a/src/builtins/fold.c +++ b/src/builtins/fold.c @@ -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𝕩: 𝕩 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𝕩: 𝕩 elements must be numbers", x); + if (!elNum(xe)) thrF("•math.Sum 𝕩: 𝕩 elements must be numbers", x); } f64 r; void* xv = tyany_ptr(x); diff --git a/src/builtins/md1.c b/src/builtins/md1.c index d1dafeb8..dfbd2db4 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -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 0"); + if (am<=0) thrM("𝕨 𝔽•_timed 𝕩: 𝕨 must be an integer greater than 0"); incBy(x, am-1); FC1 fc1 = c1fn(f); u64 sns = nsTime(); diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index ec70be8a..ea74c76e 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -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 } } @@ -1163,7 +1163,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er SGetU(x) for (u64 i = 0; i < xia; i++) { B c = GetU(x, i); - if (isAtm(c) || RNK(c)!=1) thrM("•SH 𝕩: 𝕩 must be a list of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings"); u64 len = utf16lenB(c); TALLOC(WCHAR, wstr, len); toUTF16(c, wstr); @@ -1214,7 +1214,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } // FREE_INPUT TSFREE(arg); if (dwResult != ERROR_SUCCESS) { - thrF("•SH 𝕩: Failed to run command: %S", winErrorEx(dwResult)); + thrF("•SH: Failed to run command: %S", winErrorEx(dwResult)); } // prepare output @@ -1242,17 +1242,17 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er B inObj = bi_N; bool raw = false; if (!q_N(w)) { - if (!isNsp(w)) thrM("𝕨 •SH 𝕩: 𝕨 must be a namespace"); + if (!isNsp(w)) thrM("•SH: 𝕨 must be a namespace"); inObj = ns_getC(w, "stdin"); - if (!q_N(inObj) && !isArr(inObj)) thrM("𝕨 •SH 𝕩: Invalid stdin value"); + if (!q_N(inObj) && !isArr(inObj)) thrM("•SH: Invalid stdin value"); B rawObj = ns_getC(w, "raw"); if (!q_N(rawObj)) raw = o2b(rawObj); } u64 iLen = q_N(inObj)? 0 : (raw? IA(inObj) : utf8lenB(inObj)); - if (isAtm(x) || RNK(x)>1) thrM("𝕨 •SH 𝕩: 𝕩 must be a list of strings"); + if (isAtm(x) || RNK(x)>1) thrM("•SH: 𝕩 must be a list of strings"); usz xia = IA(x); - if (xia==0) thrM("𝕨 •SH 𝕩: 𝕩 must have at least one item"); + if (xia==0) thrM("•SH: 𝕩 must have at least one item"); B s_out, s_err; i32 code = sh_core(raw, x, xia, inObj, iLen, &s_out, &s_err); @@ -1270,7 +1270,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er return m_hvec3(m_i32(code), s_outObj, s_errObj); } #else - B sh_c2(B t, B w, B x) { thrM("𝕨 •SH 𝕩: CBQN was compiled without "); } + B sh_c2(B t, B w, B x) { thrM("•SH: CBQN was compiled without "); } #endif B sh_c1(B t, B x) { return sh_c2(t, bi_N, x); } diff --git a/test/cases/hash.bqn b/test/cases/hash.bqn index 4284a802..339c2670 100644 --- a/test/cases/hash.bqn +++ b/test/cases/hash.bqn @@ -54,8 +54,8 @@ 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' diff --git a/test/cases/imports.bqn b/test/cases/imports.bqn index 1a5cc283..87d1c380 100644 --- a/test/cases/imports.bqn +++ b/test/cases/imports.bqn @@ -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 diff --git a/test/cases/system.bqn b/test/cases/system.bqn index 51a3494b..f16a4f18 100644 --- a/test/cases/system.bqn +++ b/test/cases/system.bqn @@ -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 @@ -236,16 +236,16 @@ v←1 ⋄ ! •BQN∘•Repr⊸≡ ⟨+,1‿2,+¨,(+V)(V+V),2‿2⥊↕4⟩ t0←•MonoTime@ ⋄ ! 0.1≤•Delay 0.1 ⋄ ! 0.1≤(•MonoTime@)-t0 # •_timed tested more at perf.bqn -!"𝕨𝔽•_timed𝕩: 𝕨 must be an integer greater than 0" % 0 ⊢•_timed 2 +!"𝕨 𝔽•_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𝕩: 𝕩 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' +!"•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' @@ -265,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𝕩: 𝕩 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' +!"𝕨 •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 %% ⟨⟩‿⟨⟩ @@ -281,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 diff --git a/test/cases/undo.bqn b/test/cases/undo.bqn index 041c1c9f..17059e17 100644 --- a/test/cases/undo.bqn +++ b/test/cases/undo.bqn @@ -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 diff --git a/test/cases/usz32.bqn b/test/cases/usz32.bqn index 47b75e5b..753a2e85 100644 --- a/test/cases/usz32.bqn +++ b/test/cases/usz32.bqn @@ -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