From 7cf17cdad62054cc986da18f8bc1f6b26882b236 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 4 Jul 2025 21:00:29 +0300 Subject: [PATCH] =?UTF-8?q?native=20depth2=E2=8A=8F=F0=9D=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/select.c | 230 ++++++++++++++++++++++++++++++++++++++++-- test/cases/cells.bqn | 2 +- test/cases/prims.bqn | 82 +++++++++++---- 3 files changed, 283 insertions(+), 31 deletions(-) diff --git a/src/builtins/select.c b/src/builtins/select.c index 79500e1f..21b509ff 100644 --- a/src/builtins/select.c +++ b/src/builtins/select.c @@ -29,7 +29,10 @@ // Generic cell size 𝕩: // Computes a function that copies the necessary amount of bytes/bits // Specializes over i8/i16/i32 𝕨 -// SHOULD implement nested 𝕨 +// Nested 𝕨: +// Recognizes a trailing element of a+↕b +// Converts remaining indices to single select indices via +⌜ +// COULD have specialized select that skips OOB/negative checks // Under Select - F⌾(i⊸⊏) 𝕩 // Specialized for rank-1 numeric 𝕩 @@ -172,8 +175,218 @@ static NOINLINE B select_list_cell(usz wi, B x) { // guarantees returning new ar return rb; } +static NOINLINE void select_depth2_bad(B w, B x) { + usz wia = IA(w); + if (IA(x)==0 && wia>0) { + u8 we; + w = squeeze_numTry(w, &we, SQ_NUM); + if (elNum(we)) { + thrF("π•¨βŠπ•©: Indexing out-of-bounds (%BβˆŠπ•¨, %s≑≠𝕩)", IGetU(w,0), *SH(x)); + } + } + if (RNK(w) > 1) thrF("π•¨βŠπ•©: Compound 𝕨 must have rank at most 1 (%H ≑ ≒𝕨)", w); + SGetU(w) + bool depth1 = depth(w)==1; + for (ux i = 0; i < wia; i++) { + B wc = GetU(w,i); + if (depth1) { + if (isAtm(wc) && !isNum(wc)) thrF("π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained %S)", genericDesc(wc)); + } else { + if (isAtm(wc)) thrF("π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and %S)", genericDesc(wc)); + } + } +} +static NOINLINE NORETURN void select_depth2_bad_inds(B cw, ux axis, B x) { + assert(axis < RNK(x) && isArr(cw)); + SGetU(cw) + usz ia = IA(cw); + ux len = SH(x)[axis]; + for (ux i = 0; i < ia; i++) { + f64 c = o2fG(GetU(cw,i)); + if (!q_fi64(c)) thrF("π•¨βŠπ•©: Bad index: %f along axis %z", c, axis); + WRAP(c, len, thrF("π•¨βŠπ•©: Indexing out-of-bounds along axis %z (%f ∊ %zβŠ‘π•¨, %H≑≒𝕩)", axis, c, axis, x)); + } + fatal("select_depth2_bad_inds should've errored"); +} + +B add_c2(B,B,B); +B mul_c2(B,B,B); +B lt_c2(B,B,B); +typedef struct { + B inds; // array (rank≀1) of elNum arrays + ux prod; // Γ—Β΄β₯Šβ‰ βˆ˜β₯ŠΒ¨inds + ux left; // (=x) - ≠𝕨 + ux rank; // =w⊏x + bool lastMaybeRange; // whether Β―1βŠ‘r may be an a+↕b +} Depth2Inds; +Depth2Inds select_depth2_parse_inds(B w, B x) { // consumes w; checks that w of w⊏x is valid, and, if so, returns a depth-2 array of number arrays (i.e. `squeeze_numTryΒ¨ ((β‰ w)↑≒x) | w`) + assert(isArr(w) && isArr(x)); + usz wia = IA(w); + assert(wia > 0); + if (RNK(w) > 1) { select_depth2_bad(w,x); fatal("should've errored"); } + SGetU(w) + if (wia > RNK(x)) { select_depth2_bad(w,x); thrF("π•¨βŠπ•©: Compound 𝕨 must not be longer than 𝕩 (%s ≑ ≠𝕨, %H ≑ ≒𝕩)", wia, x); } + + Depth2Inds r; + HArr_p inds = m_harr0v(wia); + r.inds = inds.b; + r.prod = 1; + r.rank = r.left = RNK(x) - wia; + usz* xsh = SH(x); + i64 bounds[2]; + ux lastIA; + for (ux i = 0; i < wia; i++) { + B c = GetU(w, i); + if (!isArr(c)) { select_depth2_bad(w,x); thrF("π•¨βŠπ•©: Elements of compound 𝕨 must be arrays (encountered %S)", genericDesc(c)); } + r.rank+= RNK(c); + + u8 ce; + c = squeeze_numTry(incG(c), &ce, SQ_NUM); + lastIA = IA(c); + r.prod*= lastIA; + + if (lastIA>0) { + if (!elNum(ce)) { select_depth2_bad(w,x); thrM("π•¨βŠπ•©: Elements of compound 𝕨 must be arrays of numbers"); } + + if (!getRange_fns[ce](tyany_ptr(c), bounds, lastIA) || bounds[0] < -(i64)xsh[i] || bounds[1] >= xsh[i]) { + select_depth2_bad(w,x); + select_depth2_bad_inds(c, i, x); + } + if (bounds[0] < 0) { + c = C2(add, c, C2(mul, m_f64(xsh[i]), C2(lt, incG(c), m_f64(0)))); + } + } + inds.a[i] = c; + } + decG(w); + + if (r.rank > UR_MAX) thrM("π•¨βŠπ•©: Result rank too large"); + r.lastMaybeRange = lastIA!=0 && (bounds[0]<0 || bounds[1]+1-bounds[0] == lastIA); + return r; +} + +B tbl_c2(Md1D* d, B w, B x); +B mul_c2(B, B, B); +B ud_c1(B, B); +B shape_c1(B, B); +typedef struct { + B starts; // unspecified shape + ux span, mul, add; +} Spans; +Spans select_depth2_inds(B w, B x, bool lastMaybeRange) { // doesn't consume; assumes w is a result of select_depth2_parse_inds; (β₯Šw⊏x) ≑ β₯Š((mulΓ—β₯Šstarts)+⌜add+↕span)⊏x + ur xr = RNK(x); + usz wia = IA(w); + assert(xr>0 && wia>=2 && wia<=xr); + usz* xsh = SH(x); + + ux add = 0; + ux span = shProd(xsh, wia, xr); + ux mul = span; + + if (MAY_T(lastMaybeRange) && wia>=2) { + B l = IGetU(w, wia-1); + usz lia = IA(l); + assert(lia!=0); + if (HEURISTIC(lia <= 3)) goto lastNotRange; // TODO improve heuristic + SGetU(l) + usz l0 = o2sG(GetU(l,0)); + for (ux i = 1; i < lia; i++) if (o2sG(GetU(l,i)) != l0+i) goto lastNotRange; // TODO do in a less bad way + add = l0*mul; + span*= lia; + mul*= xsh[wia-1]; + wia--; + } + lastNotRange:; + + SGet(w) + B c = Get(w, 0); + for (ux i = 1; i < wia; i++) { + c = C2(mul, c, m_f64(xsh[i])); + c = M1C2(tbl, add, c, Get(w, i)); + } + return (Spans) {c, span, mul, add}; +} + #define WRAP_SELECT_ONE(VAL, LEN, FMT, ARG) WRAP(VAL, LEN, thrF("π•¨βŠπ•©: Indexing out-of-bounds (" FMT "βˆŠπ•¨, %s≑≠𝕩)", ARG, LEN)) +static NOINLINE B select_depth2_select(Spans ws, B x) { // consumes ws.starts + B wst = ws.starts; + ux span = ws.span; + B r0; + + if (span != 1) { + u8 xe = TI(x,elType); + ux sia = IA(wst); + UntaggedArr r = m_arrp_copyFill(x, sia*span); + SGetU(wst) + ux ro = 0; + if (xe != el_B) { + void* xp = tyany_ptr(x); + u8 ewb = elwBitLog(xe); + CFRes f = cf_get(span, 1<=2); // invalid cases thrown out above + w = wi.inds; + ux rr = wi.rank; + + B r0; + if (wi.prod==0) { + r0 = taga(emptyArr(x, rr)); + } else { + assert(IA(x)!=0); + Spans ws = select_depth2_inds(w, x, wi.lastMaybeRange); + r0 = select_depth2_select(ws, x); + } + + if (rr >= 2) { + ShArr* rsh = m_shArr(rr); + arr_shReplace(a(r0), rr, rsh); + + usz* rshc = rsh->a; + SGetU(w) + for (ux i = 0; i < wia; i++) { + B wc = GetU(w, i); + ur wcr = RNK(wc); + shcpy(rshc, SH(wc), wcr); + rshc+= wcr; + } + shcpy(rshc, SH(x)+wia, wi.left); + assert(rshc+wi.left == rsh->a+rr); + } else { + arr_shErase(a(r0), rr); // may re-write the rank of bi_emptyHVec/bi_emptyIVec/bi_emptyCVec/bi_emptySVec. Β―\_(ツ)_/Β― + } + + decG(w); decG(x); + return r0; +} + B select_c2(B t, B w, B x) { if (isAtm(x)) thrM("π•¨βŠπ•©: 𝕩 cannot be an atom"); ur xr = RNK(x); @@ -193,7 +406,7 @@ B select_c2(B t, B w, B x) { usz wia = IA(w); Arr* r; ur wr = RNK(w); - i32 rr = xr+wr-1; + i32 rr = xr+wr-1; // only for depth-1 w if (wia <= 1) { if (wia == 0) { emptyRes: @@ -236,14 +449,14 @@ B select_c2(B t, B w, B x) { if (elNum(w0e)) return C2(select, w0, x); w0 = squeeze_numTry(w0, &w0e, SQ_MSGREQ(SQ_NUM)); if (elNum(w0e)) return C2(select, w0, x); - w = m_vec1(w0); + w = m_vec1(w0); // erroneous, speed doesn't matter } - goto base; + goto depth2; } B xf = getFillR(x); usz xn = *SH(x); - if (xn==0) goto def_xf_base; // empty x, non-empty w; error + if (xn==0) goto error_dec_xf; // empty x, non-empty w; error usz csz = arr_csz(x); u8 xl = cellWidthLog(x); usz ria = wia * csz; @@ -380,16 +593,15 @@ B select_c2(B t, B w, B x) { w = squeeze_numTry(w, &we, SQ_MSGREQ(SQ_NUM)); if (RANDOMIZE_HEURISTICS && we==el_f64) goto generic_l; // avoid infinite loop if (elNum(we)) goto retry; - goto def_xf_base; + goto error_dec_xf; // erroneous input } } #undef CASE #undef CASEW - def_xf_base:; + error_dec_xf:; dec(xf); - base:; - return c2rt(select, w, x); + depth2: return select_depth2_impl(wia, w, x); generic_l: { if (xia==0) goto emptyRes; diff --git a/test/cases/cells.bqn b/test/cases/cells.bqn index 2bbdc497..4a5eaf83 100644 --- a/test/cases/cells.bqn +++ b/test/cases/cells.bqn @@ -38,7 +38,7 @@ !"𝕨/𝕩: 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 -!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such arrays" % 0β€Ώ@β€ΏΒ―1βŠβŽ‰1 5β€Ώ2β₯Š0.5 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained character)" % 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" diff --git a/test/cases/prims.bqn b/test/cases/prims.bqn index db6ed766..cd25e761 100644 --- a/test/cases/prims.bqn +++ b/test/cases/prims.bqn @@ -165,19 +165,18 @@ w←1β€Ώ1β₯Š1 β‹„ x←2β₯Š1 β‹„ wβ€Ώx <¨↩ β‹„ {! (∾⟨"𝕨",β€’Repr𝕩, ) 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⟩ -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ 0β€Ώ0 ⊏_evar ↕0 -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ 0β€Ώ0 ⊏_evar 0β€Ώ2β₯Š1 -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ [0β€Ώ0,0β€Ώ0] ⊏_evar ↕0 -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ [0β€Ώ0,0β€Ώ0] ⊏_evar 0β€Ώ0β₯Š1 -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ ⟨0β€Ώ0⟩ ⊏_evar 0β€Ώ2β₯Š1 -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ ⟨0β€Ώ0⟩ ⊏_evar ↕0 -!"π•¨βŠπ•©: Indices out of range" % %USE evar β‹„ ⟨0β€Ώ0,0β€Ώ0⟩ ⊏_evar 2β€Ώ0β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ 0β€Ώ0 ⊏_evar ↕0 +!"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ 0β€Ώ0 ⊏_evar 0β€Ώ2β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ [0β€Ώ0,0β€Ώ0] ⊏_evar ↕0 +!"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ [0β€Ώ0,0β€Ώ0] ⊏_evar 0β€Ώ0β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ ⟨0β€Ώ0⟩ ⊏_evar 0β€Ώ2β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ ⟨0β€Ώ0⟩ ⊏_evar ↕0 +!"π•¨βŠπ•©: Indexing out-of-bounds along axis 1 (0 ∊ 1βŠ‘π•¨, 2β€Ώ0≑≒𝕩)" % %USE evar β‹„ ⟨0β€Ώ0,0β€Ώ0⟩ ⊏_evar 2β€Ώ0β₯Š1 !"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ ⟨0⟩ ⊏_evar ↕0 !"π•¨βŠπ•©: Indexing out-of-bounds (0βˆŠπ•¨, 0≑≠𝕩)" % %USE evar β‹„ βŸ¨β‹ˆ0⟩ ⊏_evar ↕0 !"π•¨βŠπ•©: 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 !"Expected integer, got Β―26.5" % %USE evar β‹„ Β―26.5⊸⊏_evar ↕5 !"π•¨βŠπ•©: Indexing out-of-bounds (Β―26βˆŠπ•¨, 5≑≠𝕩)" % %USE evar β‹„ 1β€ΏΒ―26 ⊏_evar ↕5 @@ -190,24 +189,65 @@ w←1β€Ώ1β₯Š1 β‹„ x←2β₯Š1 β‹„ wβ€Ώx <¨↩ β‹„ {! (∾⟨"𝕨",β€’Repr𝕩, !"π•¨βŠπ•©: 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 (3βˆŠπ•¨, 2≑≠𝕩)" % %USE evar β‹„ (βŒ½β†•4) β‹ˆβŠΈβŠ_evar "ab" -!"Expected integer, got namespace" % %USE eqerr β‹„ ⟨{⇐}, <{⇐}⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ -!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such arrays" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ βŸ¨β‹ˆβ‹ˆ{⇐}, <<<4, β‹ˆβ‹ˆβ‹ˆ4, 1.5β€Ώ{β‹ˆ}⟩ ⊏_evar _eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ -!"π•¨βŠπ•©: Compound 𝕨 must have rank at most 1" % %USE eqerr β‹„ βŸ¨β‰β‹ˆβ†•5⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ -!"Expected integer, got namespace" % %USE eqerr β‹„ βŸ¨β‰β‹ˆ{⇐}, β‹ˆ{⇐}⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ -%USE eqvar β‹„ (βŒ½β†•4) ⊏_eqvar 10×↕10 %% 30β€Ώ20β€Ώ10β€Ώ0 -%USE eqvar β‹„ (4β₯Š0) ⊏_eqvar 40β€Ώ30β€Ώ20 %% 4β₯Š40 -%USE eqvar β‹„ 1β€Ώ0β€Ώ0 ⊏_eqvar "ab"⌾(0β€Ώ1⊸⊏) ↕2 %% "baa" -%USE eqvar β‹„ (βŒ½β†•4) β‹ˆβŠΈβŠ_eqvar "abcdefgh" %% "dcba" -(<↕3) ⊏ "hello" %% "hel" -(<<4) ⊏ "hello" %% <'o' -!"π•¨βŠπ•©: Indexing out-of-bounds (1βˆŠπ•¨, 1≑≠𝕩)" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ ⊏_evarΒ΄ _eqerr ⟨⟨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" % %USE eqerr β‹„ ⟨0, ⟨⟩⟩ ⊏_eqerr ⟨<"a", <5, <{⇐}⟩ !"π•¨βŠπ•©: 𝕩 cannot be an atom" % %USE eqerr β‹„ ⟨0, ⟨⟩⟩ ⊏_eqerr ⟨5, {⇐}⟩ !"Expected integer, got 1.5" % ⟨1.5⟩ ⊏ "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 +%USE eqvar β‹„ {1β€ΏΒ―1 {rβ†π•¨βŠπ•© β‹„ ! 𝕩 β‰₯β—‹β€’internal.ElType r β‹„ r}_eqvar 𝕩}Β¨ βŸ¨β†•2, ↕4, "hello", ⟨"ab", "cd", "ef"⟩, β†•β‹ˆ4⟩ +%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 + +!"Expected integer, got character" % %USE eqerr β‹„ ⟨@, <@⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"Expected integer, got namespace" % %USE eqerr β‹„ ⟨{⇐}, <{⇐}⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"Expected integer, got namespace" % %USE eqerr β‹„ βŸ¨β‰β‹ˆ{⇐}, β‹ˆ{⇐}⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +%USE eqvar β‹„ (βŒ½β†•4) ⊏_eqvar 10×↕10 %% 30β€Ώ20β€Ώ10β€Ώ0 +%USE eqvar β‹„ (4β₯Š0) ⊏_eqvar 40β€Ώ30β€Ώ20 %% 4β₯Š40 +%USE eqvar β‹„ 1β€Ώ0β€Ώ0 ⊏_eqvar "ab"⌾(0β€Ώ1⊸⊏) ↕2 %% "baa" +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained character)" % %USE evar β‹„ ⟨ 1,Β―26,@⟩ ⊏_evar ↕5 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and number)" % %USE evar β‹„ βŸ¨β‹ˆ1,Β―26,@⟩ ⊏_evar ↕5 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and number)" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ (β‹ˆβŸœβŒ½ ⟨1,<1⟩) ⊏_evar _eqerr ⟨10β€Ώ10β₯Šβ†•100⟩ +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained function)" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ ⟨1.5β€Ώ{β‹ˆ}⟩ ⊏_evar _eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"π•¨βŠπ•©: Elements of compound 𝕨 must be arrays of numbers" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ ⟨<<<4⟩ ⊏_evar _eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"π•¨βŠπ•©: Elements of compound 𝕨 must be arrays of numbers" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ βŸ¨β‹ˆβ‹ˆ{⇐}⟩ ⊏_evar _eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"π•¨βŠπ•©: Elements of compound 𝕨 must be arrays of numbers" % %USE eqerr β‹„ evar ← {%USE evar β‹„ evar} β‹„ βŸ¨β‹ˆβ‹ˆβ‹ˆ4⟩ ⊏_evar _eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained character)" % ⟨@,@,@⟩ ⊏ 3β€Ώ3β₯Š1 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and number)" % βŸ¨β†•2,1⟩ ⊏ 10β€Ώ10β₯Š2 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and number)" % βŸ¨β†•2,1,@⟩ ⊏ 3β€Ώ3β₯Š1 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and character)" % βŸ¨β†•2,@,1⟩ ⊏ 3β€Ώ3β₯Š1 +!"π•¨βŠπ•©: 𝕨 must be an array of numbers or list of such (𝕨 contained both an array and number)" % βŸ¨β‹ˆ99, 1⟩ ⊏ 10β€Ώ10β₯Š2 +!"π•¨βŠπ•©: Compound 𝕨 must have rank at most 1 (1β€Ώ1 ≑ ≒𝕨)" % %USE eqerr β‹„ βŸ¨β‰β‹ˆβ†•5⟩ ⊏_eqerr βŸ¨β†•10, 10β€Ώ10β₯Šβ†•100⟩ +!"π•¨βŠπ•©: Compound 𝕨 must have rank at most 1 (2β€Ώ2 ≑ ≒𝕨)" % [⟨1,↕2⟩, ⟨3,4⟩] ⊏ 10β€Ώ10β₯Š2 +!"π•¨βŠπ•©: Compound 𝕨 must not be longer than 𝕩 (2 ≑ ≠𝕨, ⟨10⟩ ≑ ≒𝕩)" % ⟨⟨⟩,⟨⟩⟩ ⊏ ↕10 +!"π•¨βŠπ•©: Compound 𝕨 must not be longer than 𝕩 (2 ≑ ≠𝕨, ⟨10⟩ ≑ ≒𝕩)" % βŸ¨β†•2,↕2⟩ ⊏ ↕10 +!"π•¨βŠπ•©: Compound 𝕨 must not be longer than 𝕩 (2 ≑ ≠𝕨, ⟨4⟩ ≑ ≒𝕩)" % βŸ¨β‹ˆβ‹ˆ2,β‹ˆβ‹ˆ2⟩ ⊏ ↕4 +!"π•¨βŠπ•©: Indexing out-of-bounds (4βˆŠπ•¨, 4≑≠𝕩)" % βŸ¨β‹ˆ4⟩ ⊏ 4β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds (Β―5βˆŠπ•¨, 4≑≠𝕩)" % βŸ¨β‹ˆΒ―5⟩ ⊏ 4β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds along axis 0 (4 ∊ 0βŠ‘π•¨, 4β€Ώ5≑≒𝕩)" % βŸ¨β‹ˆ4,β‹ˆ0⟩ ⊏ 4β€Ώ5β₯Š1 +!"π•¨βŠπ•©: Indexing out-of-bounds along axis 1 (Β―6 ∊ 1βŠ‘π•¨, 4β€Ώ5≑≒𝕩)" % βŸ¨β‹ˆ0,β‹ˆΒ―6⟩ ⊏ 4β€Ώ5β₯Š1 +!"π•¨βŠπ•©: Bad index: 1.5 along axis 0" % βŸ¨β‹ˆ1.5,β‹ˆΒ―6⟩ ⊏ 4β€Ώ5β₯Š1 +⟨1β€ΏΒ―1, 2β€Ώ2β₯Š3β€Ώ2β€ΏΒ―3β€ΏΒ―4⟩ ⊏ 2β€Ώ4β€Ώ3β₯Šβ†•24 %% 2β€Ώ2β€Ώ2β€Ώ3β₯Š21β€Ώ22β€Ώ23β€Ώ18β€Ώ19β€Ώ20β€Ώ15β€Ώ16β€Ώ17β€Ώ12β€Ώ13β€Ώ14β€Ώ21β€Ώ22β€Ώ23β€Ώ18β€Ώ19β€Ώ20β€Ώ15β€Ώ16β€Ώ17β€Ώ12β€Ώ13β€Ώ14 +⟨⟨⟩⟩⊏2β€Ώ2β₯Šβ†•4 %% 0β€Ώ2β₯Š0 +⟨⟨⟩,⟨⟩⟩⊏2β€Ώ2β₯Šβ†•4 %% 0β€Ώ0β₯Š0 +⟨⟨⟩,"",<2⟩⊏2β€Ώ2β€Ώ3β₯Šβ†•12 %% 0β€Ώ0β₯Š0 +⟨3β€Ώ4β₯Š1β€Ώ0β€Ώ1⟩ ⊏ 2β€Ώ3β₯Šβ†•6 %% (3β€Ώ4β€Ώ3β₯Šβ†•3) + 3β€Ώ4β₯Š3β€Ώ0β€Ώ3 +⟨⟨⟩, 0β€Ώ3β₯Š1, 4β€Ώ0β€Ώ2β₯Š2⟩ ⊏ 2β€Ώ2β€Ώ2β€Ώ3β€Ώ4β₯Š3 %% 0β€Ώ0β€Ώ3β€Ώ4β€Ώ0β€Ώ2β€Ώ3β€Ώ4β₯Š0 +⟨⟨⟩, 0β€Ώ3β₯Š1, 4β€Ώ0β€Ώ2β₯Š2, <0⟩ ⊏ 1β€Ώ1β€Ώ2β€Ώ3β€Ώ4β₯Š3 %% 0β€Ώ0β€Ώ3β€Ώ4β€Ώ0β€Ώ2β€Ώ4β₯Š0 +⟨2β€Ώ3, 2β€Ώ2β₯Š4β€Ώ1β€Ώ2β€ΏΒ―3, <2⟩ ⊏ 5β€Ώ7β€Ώ3β€Ώ3β€Ώ2β₯Šβ†•999 %% 2β€Ώ2β€Ώ2β€Ώ3β€Ώ2 β₯Š ⟨336, 282, 300, 336, 462, 408, 426, 462⟩ +⌜ ↕6 +⟨<0,<1,<0⟩ ⊏ 2β€Ώ3β€Ώ2β€Ώ5β₯Šβ†•99 %% 10β€Ώ11β€Ώ12β€Ώ13β€Ώ14 +⟨<0,<1,<0,4β€Ώ3β€Ώ2⟩ ⊏ 2β€Ώ3β€Ώ2β€Ώ5β₯Šβ†•99 %% 14β€Ώ13β€Ώ12 +⟨<1,<2,<0,<4⟩ ⊏ 2β€Ώ3β€Ώ2β€Ώ5β₯Šβ†•99 %% <54 +!"π•¨βŠπ•©: Indexing out-of-bounds along axis 3 (4 ∊ 3βŠ‘π•¨, 2β€Ώ2β€Ώ2β€Ώ3β€Ώ4≑≒𝕩)" % ⟨⟨⟩, 0β€Ώ3β₯Š1, 4β€Ώ0β€Ώ2β₯Š2, <4, ⟨⟩⟩ ⊏ 2β€Ώ2β€Ώ2β€Ώ3β€Ώ4β₯Š3 +({(𝕩β₯Š1)β₯Š0}Β¨ 200β€Ώ55) ⊏ 2β€Ώ2 β₯Š0 %% ( 255β₯Š1)β₯Š0 +({(𝕩β₯Š1)β₯Š0}Β¨ 200β€Ώ54) ⊏ 2β€Ώ2β€Ώ4β₯Š0 %% (4∾˜254β₯Š1)β₯Š0 +!"π•¨βŠπ•©: Result rank too large" % ({(𝕩β₯Š1)β₯Š0}Β¨ 201β€Ώ55) ⊏ 2β€Ώ2β₯Š0 +!"π•¨βŠπ•©: Result rank too large" % ({(𝕩β₯Š1)β₯Š0}Β¨ 201β€Ώ54) ⊏ 2β€Ώ2β€Ώ4β₯Š0 +%USE eqvar β‹„ (βŒ½β†•4) β‹ˆβŠΈβŠ_eqvar "abcdefgh" %% "dcba" +%USE eqvar β‹„ ⟨4+↕5, 2+↕4⟩ ⊏_eqvar 10β€Ώ10β₯Šβ†•100 %% 5β€Ώ4β₯Š42β€Ώ43β€Ώ44β€Ώ45β€Ώ52β€Ώ53β€Ώ54β€Ώ55β€Ώ62β€Ώ63β€Ώ64β€Ώ65β€Ώ72β€Ώ73β€Ώ74β€Ώ75β€Ώ82β€Ώ83β€Ώ84β€Ώ85 +%USE eqvar β‹„ ⟨4+↕5, 2+↕4⟩ ⊏_eqvar 10β€Ώ10β₯Šβ†•100 %% 5β€Ώ4β₯Š42β€Ώ43β€Ώ44β€Ώ45β€Ώ52β€Ώ53β€Ώ54β€Ώ55β€Ώ62β€Ώ63β€Ώ64β€Ώ65β€Ώ72β€Ώ73β€Ώ74β€Ώ75β€Ώ82β€Ώ83β€Ώ84β€Ώ85 +%USE eqvar β‹„ ⟨4+↕2, 2+↕5⟩ ⊏_eqvar 10β€Ώ10β€Ώ3β₯Šβ†•300 %% 2β€Ώ5β€Ώ3β₯Š126β€Ώ127β€Ώ128β€Ώ129β€Ώ130β€Ώ131β€Ώ132β€Ώ133β€Ώ134β€Ώ135β€Ώ136β€Ώ137β€Ώ138β€Ώ139β€Ώ140β€Ώ156β€Ώ157β€Ώ158β€Ώ159β€Ώ160β€Ώ161β€Ώ162β€Ώ163β€Ώ164β€Ώ165β€Ώ166β€Ώ167β€Ώ168β€Ώ169β€Ώ170 +(<↕3) ⊏ "hello" %% "hel" +(<<4) ⊏ "hello" %% <'o' # π•¨βŠ‘π•© !"π•¨βŠ‘π•©: 𝕨 contained a non-integer" % ⟨0.1βŸ©βŠ‘β†•3