diff --git a/src/builtins/arithd.c b/src/builtins/arithd.c index 6ab0561e..d1e606bd 100644 --- a/src/builtins/arithd.c +++ b/src/builtins/arithd.c @@ -21,8 +21,8 @@ if (isF64(w) & isF64(x)) return m_f64(EXPR); \ EXTRA \ if (isArr(w)|isArr(x)) { B ow=w; B ox=x; \ - if (isArr(w)&isArr(x) && rnk(w)==rnk(x)) { \ - if (!eqShPart(SH(w), SH(x), rnk(w))) thrF(SYMB ": Expected equal shape prefix (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); \ + if (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); \ usz ia = IA(x); \ u8 we = TI(w,elType); \ u8 xe = TI(x,elType); \ @@ -158,8 +158,8 @@ NOINLINE B NAME##_c2_arr(B t, B w, B x) { \ EXTRA2 \ if (isArr(w)|isArr(x)) { \ - if (isArr(w)&isArr(x) && rnk(w)==rnk(x)) { \ - if (!eqShPart(SH(w), SH(x), rnk(w))) thrF(SYMB ": Expected equal shape prefix (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); \ + if (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); \ usz ia = IA(x); \ u8 we = TI(w,elType); \ u8 xe = TI(x,elType); \ diff --git a/src/builtins/arithm.c b/src/builtins/arithm.c index 5d74b01d..63da6363 100644 --- a/src/builtins/arithm.c +++ b/src/builtins/arithm.c @@ -71,7 +71,7 @@ B atan_c1(B t, B x) { if (isF64(x)) return m_f64( atan(x.f)); P1( atan); thrM(" #undef P1 B lt_c1(B t, B x) { return m_atomUnit(x); } -B eq_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(0); } B r = m_i32(rnk(x) ); decG(x); return r; } +B eq_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(0); } B r = m_i32(RNK(x)); decG(x); return r; } B ne_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(1); } B r = m_f64(*SH(x)); decG(x); return r; } diff --git a/src/builtins/cmp.c b/src/builtins/cmp.c index 708033d8..e3ee9172 100644 --- a/src/builtins/cmp.c +++ b/src/builtins/cmp.c @@ -19,7 +19,7 @@ if (we==el_B) goto end; \ if (isArr(x)) { u8 xe = TI(x,elType); \ if (xe==el_B) goto end; \ - if (rnk(w)==rnk(x)) { if (!eqShape(w, x)) thrF(CHR": Expected equal shape prefix (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); \ + if (RNK(w)==RNK(x)) { if (!eqShape(w, x)) thrF(CHR": Expected equal shape prefix (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); \ if (we!=xe) { B tw=w,tx=x; \ we = aMakeEq(&tw, &tx, we, xe); \ if (we==el_MAX) goto end; \ diff --git a/src/builtins/fns.c b/src/builtins/fns.c index 98dbcef4..4912d416 100644 --- a/src/builtins/fns.c +++ b/src/builtins/fns.c @@ -44,7 +44,7 @@ B ud_c1(B t, 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 (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); usz sh[xia]; usz ria = 1; @@ -91,7 +91,7 @@ B fne_c1(B t, B x) { dec(x); return emptyIVec(); } - ur xr = rnk(x); + ur xr = RNK(x); usz* sh = SH(x); usz or = 0; for (i32 i = 0; i < xr; i++) or|= sh[i]; @@ -126,7 +126,7 @@ B indexOf_c1(B t, B x) { if (isAtm(x)) thrM("⊐: 𝕩 cannot have rank 0"); usz xia = IA(x); if (xia==0) { decG(x); return emptyIVec(); } - if (rnk(x)==1 && TI(x,elType)==el_i32) { + if (RNK(x)==1 && TI(x,elType)==el_i32) { i32* xp = i32any_ptr(x); i32 min=I32_MAX, max=I32_MIN; for (usz i = 0; i < xia; i++) { @@ -150,7 +150,7 @@ B indexOf_c1(B t, B x) { return r; } } - // if (rnk(x)==1) { // relies on equal hashes implying equal objects, which has like a 2⋆¯64 chance of being false per item + // if (RNK(x)==1) { // relies on equal hashes implying equal objects, which has like a 2⋆¯64 chance of being false per item // // u64 s = nsTime(); // i32* rp; B r = m_i32arrv(&rp, xia); // u64 size = xia*2; @@ -169,7 +169,7 @@ B indexOf_c1(B t, B x) { // // u64 e = nsTime(); q1+= e-s; // return r; // } - if (rnk(x)==1) { + if (RNK(x)==1) { // u64 s = nsTime(); i32* rp; B r = m_i32arrv(&rp, xia); H_b2i* map = m_b2i(64); @@ -187,9 +187,9 @@ B indexOf_c1(B t, B x) { return c1(rt_indexOf, x); } B indexOf_c2(B t, B w, B x) { - if (!isArr(w) || rnk(w)==0) thrM("⊐: 𝕨 must have rank at least 1"); - if (rnk(w)==1) { - if (!isArr(x) || rnk(x)==0) { + if (!isArr(w) || RNK(w)==0) thrM("⊐: 𝕨 must have rank at least 1"); + if (RNK(w)==1) { + if (!isArr(x) || RNK(x)==0) { usz wia = IA(w); B el = isArr(x)? IGetU(x,0) : x; i32 res = wia; @@ -236,8 +236,8 @@ B enclosed_0; B enclosed_1; extern B rt_memberOf; B memberOf_c1(B t, B x) { - if (isAtm(x) || rnk(x)==0) thrM("∊: Argument cannot have rank 0"); - if (rnk(x)!=1) x = toCells(x); + if (isAtm(x) || RNK(x)==0) thrM("∊: Argument cannot have rank 0"); + if (RNK(x)!=1) x = toCells(x); usz xia = IA(x); u64* rp; B r = m_bitarrv(&rp, xia); @@ -248,9 +248,9 @@ B memberOf_c1(B t, B x) { return r; } B memberOf_c2(B t, B w, B x) { - if (isAtm(x) || rnk(x)!=1) goto bad; + if (isAtm(x) || RNK(x)!=1) goto bad; if (isAtm(w)) goto single; - ur wr = rnk(w); + ur wr = RNK(w); if (wr==0) { B w0 = IGet(w, 0); dec(w); @@ -294,10 +294,10 @@ B memberOf_c2(B t, B w, B x) { extern B rt_find; 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("⍷: Argument cannot have rank 0"); usz xia = IA(x); B xf = getFillQ(x); - if (rnk(x)!=1) return c1(rt_find, x); + if (RNK(x)!=1) return c1(rt_find, x); B r = emptyHVec(); H_Sb* set = m_Sb(64); @@ -315,8 +315,8 @@ B find_c2(B t, B w, B x) { extern B rt_count; B count_c1(B t, B x) { - if (isAtm(x) || rnk(x)==0) thrM("βŠ’: Argument cannot have rank 0"); - if (rnk(x)>1) x = toCells(x); + if (isAtm(x) || RNK(x)==0) thrM("βŠ’: Argument cannot have rank 0"); + if (RNK(x)>1) x = toCells(x); usz xia = IA(x); i32* rp; B r = m_i32arrv(&rp, xia); H_b2i* map = m_b2i(64); diff --git a/src/builtins/grade.h b/src/builtins/grade.h index c5b5b0fb..d0e6a3d4 100644 --- a/src/builtins/grade.h +++ b/src/builtins/grade.h @@ -11,8 +11,8 @@ #include "sortTemplate.h" B GRADE_CAT(c1)(B t, B x) { - if (isAtm(x) || rnk(x)==0) thrM(GRADE_CHR": Argument cannot be a unit"); - if (rnk(x)>1) x = toCells(x); + if (isAtm(x) || RNK(x)==0) thrM(GRADE_CHR": Argument cannot be a unit"); + if (RNK(x)>1) x = toCells(x); usz ia = IA(x); if (ia>I32_MAX) thrM(GRADE_CHR": Argument too large"); if (ia==0) { decG(x); return emptyIVec(); } @@ -95,10 +95,10 @@ B GRADE_CAT(c1)(B t, B x) { return r; } 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_atomUnit(x); - ur wr = rnk(w); - ur xr = rnk(x); + ur wr = RNK(w); + ur xr = RNK(x); if (wr > 1) { if (wr > xr+1) thrM(GRADE_CHR": =𝕨 cannot be greater than =𝕩"); diff --git a/src/builtins/internal.c b/src/builtins/internal.c index 8a2a538d..00703e82 100644 --- a/src/builtins/internal.c +++ b/src/builtins/internal.c @@ -87,7 +87,7 @@ static B listVariations_def; B listVariations_c2(B t, B w, B x) { 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; diff --git a/src/builtins/md1.c b/src/builtins/md1.c index b7b527ef..832dd434 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -51,8 +51,8 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f; if (EACH_FILLS) xf = getFillQ(x); if (isAtm(w)) w = m_atomUnit(w); if (isAtm(x)) x = m_atomUnit(x); - ur wr = rnk(w); usz wia = IA(w); - ur xr = rnk(x); usz xia = IA(x); + 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; for (usz wi = 0; wi < wia; wi++) HARR_ADD(r, wi, fc2(f, Get(w,wi), incG(x))); r = bqn_merge(HARR_FV(r)); } else goto generic; - if (rnk(r)>1) { - srnk(r, 0); // otherwise the following arr_shAlloc failing will result in r->sh dangling + if (RNK(r)>1) { + SRNK(r, 0); // otherwise the following arr_shAlloc failing will result in r->sh dangling ptr_dec(shObj(r)); } rsh = arr_shAlloc(a(r), rr); @@ -148,8 +148,8 @@ static u64 vg_rand(u64 x) { return x; } #endif B scan_c1(Md1D* d, B x) { B f = d->f; - if (isAtm(x) || rnk(x)==0) thrM("`: Argument cannot have rank 0"); - ur xr = rnk(x); + if (isAtm(x) || RNK(x)==0) thrM("`: Argument cannot have rank 0"); + ur xr = RNK(x); usz ia = IA(x); if (ia==0) return x; B xf = getFillQ(x); @@ -230,8 +230,8 @@ B scan_c1(Md1D* d, B x) { B f = d->f; return withFill(r.b, xf); } B scan_c2(Md1D* d, B w, B x) { B f = d->f; - if (isAtm(x) || rnk(x)==0) thrM("`: 𝕩 cannot have rank 0"); - ur xr = rnk(x); usz* xsh = SH(x); usz ia = IA(x); + if (isAtm(x) || RNK(x)==0) thrM("`: 𝕩 cannot have rank 0"); + ur xr = RNK(x); usz* xsh = SH(x); usz ia = IA(x); B wf = getFillQ(w); u8 xe = TI(x,elType); if (xr==1 && q_i32(w) && xeflags) { @@ -275,7 +275,7 @@ B scan_c2(Md1D* d, B w, B x) { B f = d->f; BBB2B fc2 = c2fn(f); if (isArr(w)) { - ur wr = rnk(w); usz* wsh = SH(w); SGet(w) + ur wr = RNK(w); usz* wsh = SH(w); SGet(w) if (wr+1!=xr || !eqShPart(wsh, xsh+1, wr)) thrF("`: Shape of 𝕨 must match the cell of 𝕩 (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); if (ia==0) return x; usz csz = arr_csz(x); @@ -293,7 +293,7 @@ B scan_c2(Md1D* d, B w, B x) { B f = d->f; } B fold_c1(Md1D* d, B x) { B f = d->f; - if (isAtm(x) || rnk(x)!=1) thrF("Β΄: Argument must be a list (%H ≑ ≒𝕩)", x); + if (isAtm(x) || RNK(x)!=1) thrF("Β΄: Argument must be a list (%H ≑ ≒𝕩)", x); usz ia = IA(x); if (ia==0) { decG(x); @@ -362,7 +362,7 @@ B fold_c1(Md1D* d, B x) { B f = d->f; return c; } 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); u8 xe = TI(x,elType); if (q_i32(w) && isFun(f) && v(f)->flags && xe1) { \ X##_csh = m_shArr(X##_cr); \ @@ -482,7 +482,7 @@ static B to_fill_cell_1(B x) { // consumes x return to_fill_cell_k(x, 1, "˘: Empty argument too large (%H ≑ ≒𝕩)"); } static B merge_fill_result_1(B rc) { - u64 rr = isArr(rc)? rnk(rc)+1ULL : 1; + u64 rr = isArr(rc)? RNK(rc)+1ULL : 1; if (rr>UR_MAX) thrM("˘: Result rank too large"); B rf = getFillQ(rc); Arr* r = m_fillarrp(0); @@ -506,12 +506,12 @@ B cell2_empty(B f, B w, B x, ur wr, ur xr) { } B cell_c1(Md1D* d, B x) { B f = d->f; - if (isAtm(x) || rnk(x)==0) { + if (isAtm(x) || RNK(x)==0) { B r = c1(f, x); return isAtm(r)? m_atomUnit(r) : r; } - if (Q_BI(f,lt) && IA(x)!=0 && rnk(x)>1) return toCells(x); + if (Q_BI(f,lt) && IA(x)!=0 && RNK(x)>1) return toCells(x); usz cam = SH(x)[0]; if (cam==0) { @@ -531,8 +531,8 @@ B cell_c1(Md1D* d, B x) { B f = d->f; } B cell_c2(Md1D* d, B w, B x) { B f = d->f; - bool wr = isAtm(w)? 0 : rnk(w); - bool xr = isAtm(x)? 0 : rnk(x); + bool wr = isAtm(w)? 0 : RNK(w); + bool xr = isAtm(x)? 0 : RNK(x); B r; if (wr==0 && xr==0) return isAtm(r = c2(f, w, x))? m_atomUnit(r) : r; if (wr==0) { @@ -566,10 +566,10 @@ B cell_c2(Md1D* d, B w, B x) { B f = d->f; extern B rt_insert; B insert_c1(Md1D* d, B x) { B f = d->f; - if (isAtm(x) || rnk(x)==0) thrM("˝: 𝕩 must have rank at least 1"); + if (isAtm(x) || RNK(x)==0) thrM("˝: 𝕩 must have rank at least 1"); usz xia = IA(x); if (xia==0) return m1c1(rt_insert, f, x); - if (rnk(x)==1 && isFun(f) && isPervasiveDy(f)) { + if (RNK(x)==1 && isFun(f) && isPervasiveDy(f)) { return m_atomUnit(fold_c1(d, x)); } @@ -584,7 +584,7 @@ B insert_c1(Md1D* d, B x) { B f = d->f; return r; } B insert_c2(Md1D* d, B w, B x) { B f = d->f; - if (isAtm(x) || rnk(x)==0) thrM("˝: 𝕩 must have rank at least 1"); + if (isAtm(x) || RNK(x)==0) thrM("˝: 𝕩 must have rank at least 1"); usz xia = IA(x); B r = w; if (xia!=0) { diff --git a/src/builtins/md2.c b/src/builtins/md2.c index ee83104d..27053bcc 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -133,7 +133,7 @@ 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"); + if (isAtm(g)||RNK(g)!=1) thrM("β—Ά: π•˜ must have rank 1"); usz fri = WRAP(o2i64(fr), IA(g), thrM("β—Ά: 𝔽 out of bounds of π•˜")); return c1(IGetU(g, fri), x); } else { @@ -146,7 +146,7 @@ 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"); + if (isAtm(g)||RNK(g)!=1) thrM("β—Ά: π•˜ must have rank 1"); usz fri = WRAP(o2i64(fr), IA(g), thrM("β—Ά: 𝔽 out of bounds of π•˜")); return c2(IGetU(g, fri), w, x); } else { @@ -220,7 +220,7 @@ static ur cell_rank(f64 r, f64 k) { // βŽ‰k over arg rank r B to_fill_cell_k(B x, ur k, char* err) { // consumes x B xf = getFillQ(x); if (noFill(xf)) xf = m_f64(0); - ur cr = rnk(x)-k; + ur cr = RNK(x)-k; usz* sh = SH(x)+k; usz csz = 1; for (usz i=0; iUR_MAX) thrM("βŽ‰: Result rank too large"); B rf = getFillQ(rc); Arr* r = m_fillarrp(0); @@ -259,7 +259,7 @@ static B rank2_empty(B f, B w, ur wk, B x, ur xk) { B fa = wk>xk?w:x; ur k = wk>xk?wk:xk; usz* sh = SH(fa); - usz s0=0; ShArr* s=NULL; ur sho=rnk(fa)>1; + usz s0=0; ShArr* s=NULL; ur sho=RNK(fa)>1; if (!sho) { s0=sh[0]; sh=&s0; } else { s=ptr_inc(shObj(fa)); } if (!isPureFn(f) || !CATCH_ERRORS) { dec(w); dec(x); goto empty; } B r; @@ -288,14 +288,14 @@ B rank_c1(Md2D* d, B x) { B f = d->f; B g = d->g; } if (gf) dec(g); - if (isAtm(x) || rnk(x)==0) { + if (isAtm(x) || RNK(x)==0) { B r = c1(f, x); return isAtm(r)? m_atomUnit(r) : r; } - i32 xr = rnk(x); + i32 xr = RNK(x); ur cr = cell_rank(xr, kf); i32 k = xr - cr; - if (Q_BI(f,lt) && IA(x)!=0 && rnk(x)>1) return toKCells(x, k); + if (Q_BI(f,lt) && IA(x)!=0 && RNK(x)>1) return toKCells(x, k); usz* xsh = SH(x); usz cam = shProd(xsh, 0, k); @@ -352,8 +352,8 @@ B rank_c2(Md2D* d, B w, B x) { B f = d->f; B g = d->g; xf = GetU(g, gia-1).f; } - ur wr = isAtm(w) ? 0 : rnk(w); ur wc = cell_rank(wr, wf); - ur xr = isAtm(x) ? 0 : rnk(x); ur xc = cell_rank(xr, xf); + ur wr = isAtm(w) ? 0 : RNK(w); ur wc = cell_rank(wr, wf); + ur xr = isAtm(x) ? 0 : RNK(x); ur xc = cell_rank(xr, xf); B r; if (wr == wc) { diff --git a/src/builtins/select.c b/src/builtins/select.c index f90fedc6..3ed59bd8 100644 --- a/src/builtins/select.c +++ b/src/builtins/select.c @@ -13,7 +13,7 @@ extern B rt_select; B select_c1(B t, B x) { if (isAtm(x)) thrM("⊏: Argument cannot be an atom"); - ur xr = rnk(x); + 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); usz ia = shProd(SH(x), 1, xr); @@ -25,7 +25,7 @@ B select_c1(B t, B x) { } B select_c2(B t, B w, B x) { if (isAtm(x)) thrM("⊏: 𝕩 cannot be an atom"); - ur xr = rnk(x); + ur xr = RNK(x); if (isAtm(w)) { if (xr==0) thrM("⊏: 𝕩 cannot be a unit"); usz csz = arr_csz(x); @@ -45,7 +45,7 @@ B select_c2(B t, B w, B x) { if (xr==1) { if (wia==0) { decG(x); - if (rnk(w)==1) { + if (RNK(w)==1) { if (isNum(xf)) { r = emptyIVec(); goto ret; } if (isC32(xf)) { r = emptyCVec(); goto ret; } } @@ -126,7 +126,7 @@ B select_c2(B t, B w, B x) { } else { SLOW2("π•¨βŠπ•©", w, x); SGetU(w) - ur wr = rnk(w); + ur wr = RNK(w); i32 rr = wr+xr-1; if (xr==0) thrM("⊏: 𝕩 cannot be a unit"); if (rr>UR_MAX) thrF("⊏: Result rank too large (%i≑=𝕨, %i≑=𝕩)", wr, xr); @@ -163,7 +163,7 @@ B select_c2(B t, B w, B x) { B select_ucw(B t, B o, B w, B x) { - if (isAtm(x) || rnk(x)!=1 || isAtm(w)) return def_fn_ucw(t, o, w, x); + if (isAtm(x) || RNK(x)!=1 || isAtm(w)) return def_fn_ucw(t, o, w, x); usz xia = IA(x); usz wia = IA(w); SGetU(w) diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 4dde93ce..5a5e8f57 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -84,7 +84,7 @@ B pair_c2(B t, B w, B x) { return m_vec2Base(w, x, true); } B shape_c1(B t, B x) { if (isAtm(x)) return m_vec1(x); - if (rnk(x)==1) return x; + if (RNK(x)==1) return x; usz ia = IA(x); if (ia==1 && TI(x,elType)1) thrM("β₯Š: 𝕨 must have rank at most 1"); + if (RNK(w)>1) thrM("β₯Š: 𝕨 must have rank at most 1"); if (IA(w)>UR_MAX) thrM("β₯Š: Result rank too large"); nr = IA(w); sh = nr<=1? NULL : m_shArr(nr); @@ -262,13 +262,13 @@ static NOINLINE void checkNumeric(B w) { static B recPick(B w, B x) { // doesn't consume assert(isArr(w) && isArr(x)); usz ia = IA(w); - ur xr = rnk(x); + ur xr = RNK(x); usz* xsh = SH(x); switch(TI(w,elType)) { default: UD; - case el_i8: { i8* wp = i8any_ptr (w); if(rnk(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { c = c*xsh[i] + WRAP(wp[i], xsh[i], goto oob); }; return IGet(x,c); } - case el_i16: { i16* wp = i16any_ptr(w); if(rnk(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { c = c*xsh[i] + WRAP(wp[i], xsh[i], goto oob); }; return IGet(x,c); } - case el_i32: { i32* wp = i32any_ptr(w); if(rnk(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { c = c*xsh[i] + WRAP(wp[i], xsh[i], goto oob); }; return IGet(x,c); } - case el_f64: { f64* wp = f64any_ptr(w); if(rnk(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { i64 ws = (i64)wp[i]; if (wp[i]!=ws) thrM(ws==I64_MIN? "βŠ‘: 𝕨 contained value too large" : "βŠ‘: 𝕨 contained a non-integer"); + case el_i8: { i8* wp = i8any_ptr (w); if(RNK(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { c = c*xsh[i] + WRAP(wp[i], xsh[i], goto oob); }; return IGet(x,c); } + case el_i16: { i16* wp = i16any_ptr(w); if(RNK(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { c = c*xsh[i] + WRAP(wp[i], xsh[i], goto oob); }; return IGet(x,c); } + case el_i32: { i32* wp = i32any_ptr(w); if(RNK(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { c = c*xsh[i] + WRAP(wp[i], xsh[i], goto oob); }; return IGet(x,c); } + case el_f64: { f64* wp = f64any_ptr(w); if(RNK(w)!=1)goto wrr; if (ia!=xr)goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { i64 ws = (i64)wp[i]; if (wp[i]!=ws) thrM(ws==I64_MIN? "βŠ‘: 𝕨 contained value too large" : "βŠ‘: 𝕨 contained a non-integer"); c = c*xsh[i] + WRAP(ws, xsh[i], goto oob); }; return IGet(x,c); } case el_c8: case el_c16: case el_c32: case el_bit: case el_B: { @@ -278,7 +278,7 @@ static B recPick(B w, B x) { // doesn't consume } SGetU(w) if (isNum(GetU(w,0))) { - if(rnk(w)!=1) goto wrr; + if(RNK(w)!=1) goto wrr; if (ia!=xr) goto wrl; usz c=0; for (usz i = 0; i < ia; i++) { @@ -307,12 +307,12 @@ static B recPick(B w, B x) { // doesn't consume B pick_c2(B t, B w, B x) { if (RARE(isAtm(x))) { - if (isAtm(w) || rnk(w)!=1 || IA(w)!=0) return c2(rt_pick, w, x); // ugh this is such a lame case that'd need a whole another recursive fn to implement + if (isAtm(w) || RNK(w)!=1 || IA(w)!=0) return c2(rt_pick, w, x); // ugh this is such a lame case that'd need a whole another recursive fn to implement dec(w); return x; } if (isNum(w)) { - if (rnk(x)!=1) thrF("βŠ‘: 𝕩 must be a list when 𝕨 is a number (%H ≑ ≒𝕩)", x); + if (RNK(x)!=1) thrF("βŠ‘: 𝕩 must be a list when 𝕨 is a number (%H ≑ ≒𝕩)", x); usz p = WRAP(o2i64(w), IA(x), thrF("βŠ‘: indexing out-of-bounds (𝕨≑%R, %s≑≠𝕩)", w, iaW)); B r = IGet(x, p); decG(x); @@ -427,7 +427,7 @@ B pick_c2(B t, B w, B x) { extern 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("/: Argument must have rank 1 (%H ≑ ≒𝕩)", x); u64 s = usum(x); if (s>=USZ_MAX) thrOOM(); usz xia = IA(x); @@ -498,7 +498,7 @@ B slash_c1(B t, B x) { } B slash_c2(B t, B w, B x) { - if (isArr(x) && rnk(x)==1 && isArr(w) && rnk(w)==1 && depth(w)==1) { + if (isArr(x) && RNK(x)==1 && isArr(w) && RNK(w)==1 && depth(w)==1) { usz wia = IA(w); usz xia = IA(x); if (RARE(wia!=xia)) { @@ -642,7 +642,7 @@ B slash_c2(B t, B w, B x) { decG(w); decG(x); return withFill(HARR_FV(r), xf); } - if (isArr(x) && rnk(x)==1 && q_i32(w)) { + if (isArr(x) && RNK(x)==1 && q_i32(w)) { usz xia = IA(x); i32 wv = o2i(w); if (wv<=0) { @@ -675,7 +675,7 @@ B slash_c2(B t, B w, B x) { B slash_im(B t, B x) { - if (!isArr(x) || rnk(x)!=1) thrM("/⁼: Argument must be an array"); + if (!isArr(x) || RNK(x)!=1) thrM("/⁼: Argument must be an array"); u8 xe = TI(x,elType); usz xia = IA(x); if (xia==0) { decG(x); return emptyIVec(); } @@ -767,8 +767,8 @@ static B slicev(B x, usz s, usz ia) { } FORCE_INLINE B affixes(B x, i32 post) { - if (!isArr(x) || rnk(x)==0) thrM(post? "↓: Argument must have rank at least 1" : "↑: Argument must have rank at least 1"); - ur xr = rnk(x); + if (!isArr(x) || RNK(x)==0) thrM(post? "↓: Argument must have rank at least 1" : "↑: Argument must have rank at least 1"); + ur xr = RNK(x); usz* xsh = SH(x); u64 cam = *xsh; u64 ria = cam+1; @@ -804,7 +804,7 @@ B take_c2(B t, B w, B x) { if (isNum(w)) { if (!isArr(x)) x = m_atomUnit(x); i64 wv = o2i64(w); - ur xr = rnk(x); + ur xr = RNK(x); usz csz = 1; usz* xsh; if (xr>1) { @@ -844,7 +844,7 @@ B take_c2(B t, B w, B x) { return c2(rt_take, w, x); } B drop_c2(B t, B w, B x) { - if (isNum(w) && isArr(x) && rnk(x)==1) { + if (isNum(w) && isArr(x) && RNK(x)==1) { i64 v = o2i64(w); usz ia = IA(x); if (v<0) return -v>ia? slicev(x, 0, 0) : slicev(x, 0, v+ia); @@ -856,7 +856,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"); - ur xr = rnk(x); + ur xr = RNK(x); usz xia = IA(x); if (xia==0) { B xf = getFillE(x); @@ -865,7 +865,7 @@ B join_c1(B t, B x) { if (!PROPER_FILLS && xr==1) return emptyHVec(); thrM("∾: Empty array 𝕩 cannot have an atom fill element"); } - ur ir = rnk(xf); + 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); rd=rm; cam++; @@ -953,7 +953,7 @@ B join_c1(B t, B x) { SGetU(x) B x0 = GetU(x,0); B rf; if(SFNS_FILLS) rf = getFillQ(x0); - ur r0 = isAtm(x0) ? 0 : rnk(x0); + ur r0 = isAtm(x0) ? 0 : RNK(x0); usz xia = IA(x); usz* xsh = SH(x); @@ -981,7 +981,7 @@ B join_c1(B t, B x) { ll[0] = r0; for (usz i=1; ir1s) r1s=ll[i]; ur r1 = r1s; @@ -1001,7 +1001,7 @@ B join_c1(B t, B x) { // Check shapes for (usz j=0; jxr?wr:xr; @@ -1106,10 +1106,10 @@ B join_c2(B t, B w, B x) { bool reusedW; B r = arr_join_inline(w, x, false, &reusedW); if (c==1) { - if (rnk(r)==0) srnk(r,1); + if (RNK(r)==0) SRNK(r,1); } else { assert(c>1); - ur rnk0 = rnk(r); + ur rnk0 = RNK(r); ShArr* sh0 = shObj(r); usz wia; usz* wsh; @@ -1120,7 +1120,7 @@ B join_c2(B t, B w, B x) { wsh = SH(w); // when wr>1, shape object won't be disturbed by arr_join_inline } usz* xsh = SH(x); - srnk(r, 0); // otherwise shape allocation failing may break things + SRNK(r, 0); // otherwise shape allocation failing may break things usz* rsh = arr_shAlloc(a(r), c); #if PRINT_JOIN_REUSE printf(reusedW? "reuse:1;" : "reuse:0;"); @@ -1148,7 +1148,7 @@ B join_c2(B t, B w, B x) { B couple_c1(B t, B x) { if (isAtm(x)) return m_vec1(x); - usz rr = rnk(x); + usz rr = RNK(x); usz ia = IA(x); Arr* r = TI(x,slice)(incG(x),0, ia); usz* sh = arr_shAlloc(r, rr+1); @@ -1162,7 +1162,7 @@ B couple_c2(B t, B w, B x) { if (isAtm(x)) x = m_atomUnit(x); if (!eqShape(w, x)) thrF("≍: 𝕨 and 𝕩 must have equal shapes (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); usz ia = IA(w); - ur wr = rnk(w); + ur wr = RNK(w); MAKE_MUT(r, ia*2); mut_init(r, el_or(TI(w,elType), TI(x,elType))); MUTG_INIT(r); mut_copyG(r, 0, w, 0, ia); @@ -1178,14 +1178,14 @@ B couple_c2(B t, B w, B x) { static inline void shift_check(B w, B x) { - ur wr = rnk(w); usz* wsh = SH(w); - ur xr = rnk(x); usz* xsh = SH(x); + ur wr = RNK(w); usz* wsh = SH(w); + ur xr = RNK(x); usz* xsh = SH(x); if (wr+1!=xr & wr!=xr) thrF("shift: =𝕨 must be =𝕩 or Β―1+=𝕩 (%i≑=𝕨, %i≑=𝕩)", wr, xr); for (i32 i = 1; i < xr; i++) if (wsh[i+wr-xr] != xsh[i]) thrF("shift: Lengths not matchable (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, 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("Β»: Argument cannot be a scalar"); usz ia = IA(x); if (ia==0) return x; B xf = getFillE(x); @@ -1198,7 +1198,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_atomUnit(w); shift_check(w, x); B f = fill_both(w, x); @@ -1214,7 +1214,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("Β«: Argument cannot be a scalar"); usz ia = IA(x); if (ia==0) return x; B xf = getFillE(x); @@ -1226,7 +1226,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_atomUnit(w); shift_check(w, x); B f = fill_both(w, x); @@ -1250,7 +1250,7 @@ B group_c1(B t, B x) { return c1(rt_group, x); } B group_c2(B t, B w, B x) { - if (isArr(w)&isArr(x) && rnk(w)==1 && rnk(x)==1 && depth(w)==1) { + if (isArr(w)&isArr(x) && RNK(w)==1 && RNK(x)==1 && depth(w)==1) { usz wia = IA(w); usz xia = IA(x); if (wia-xia > 1) thrF("βŠ”: ≠𝕨 must be either ≠𝕩 or one bigger (%s≑≠𝕨, %s≑≠𝕩)", wia, xia); @@ -1369,11 +1369,11 @@ B group_c2(B t, B w, B x) { extern B rt_reverse; 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("⌽: Argument cannot be a unit"); usz xia = IA(x); if (xia==0) return x; u8 xe = TI(x,elType); - if (rnk(x)==1) { + if (RNK(x)==1) { B r; switch(xe) { default: UD; case el_bit: { u64* xp = bitarr_ptr(x); u64* rp; r = m_bitarrv(&rp, xia); for (usz i = 0; i < xia; i++) bitp_set(rp, i, bitp_get(xp, xia-i-1)); break; } @@ -1412,7 +1412,7 @@ B reverse_c1(B t, B x) { } B reverse_c2(B t, B w, B x) { if (isArr(w)) return c2(rt_reverse, 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) return x; B xf = getFillQ(x); @@ -1432,7 +1432,7 @@ B reverse_c2(B t, B w, B x) { extern B rt_transp; B transp_c1(B t, B x) { if (RARE(isAtm(x))) return m_atomUnit(x); - ur xr = rnk(x); + ur xr = RNK(x); if (xr<=1) return x; usz ia = IA(x); @@ -1494,7 +1494,7 @@ B pick_uc1(B t, B o, B x) { // TODO do in-place like pick_ucw; maybe just call i } B pick_ucw(B t, B o, B w, B x) { - if (isArr(w) || isAtm(x) || rnk(x)!=1) return def_fn_ucw(t, o, w, x); + if (isArr(w) || isAtm(x) || RNK(x)!=1) return def_fn_ucw(t, o, w, x); usz xia = IA(x); usz wi = WRAP(o2i64(w), xia, thrF("π”½βŒΎ(nβŠΈβŠ‘)𝕩: reading out-of-bounds (n≑%R, %s≑≠𝕩)", w, xia)); B arg = IGet(x, wi); @@ -1526,14 +1526,14 @@ B pick_ucw(B t, B o, B w, B x) { } B slash_ucw(B t, B o, B w, B x) { - if (isAtm(w) || isAtm(x) || rnk(w)!=1 || rnk(x)!=1 || IA(w)!=IA(x)) return def_fn_ucw(t, o, w, x); + if (isAtm(w) || isAtm(x) || RNK(w)!=1 || RNK(x)!=1 || IA(w)!=IA(x)) return def_fn_ucw(t, o, w, x); usz ia = IA(x); SGetU(w) if (TI(w,elType)>el_i32) for (usz i = 0; i < ia; i++) if (!q_i32(GetU(w,i))) return def_fn_ucw(t, o, w, x); B arg = slash_c2(t, inc(w), inc(x)); usz argIA = IA(arg); B rep = c1(o, arg); - if (isAtm(rep) || rnk(rep)!=1 || IA(rep) != argIA) thrF("π”½βŒΎ(a⊸/)𝕩: Result of 𝔽 must have the same shape as a/𝕩 (expected ⟨%s⟩, got %H)", argIA, rep); + if (isAtm(rep) || RNK(rep)!=1 || IA(rep) != argIA) thrF("π”½βŒΎ(a⊸/)𝕩: Result of 𝔽 must have the same shape as a/𝕩 (expected ⟨%s⟩, got %H)", argIA, rep); MAKE_MUT(r, ia); mut_init(r, el_or(TI(x,elType), TI(rep,elType))); SGet(x) SGet(rep) @@ -1586,7 +1586,7 @@ static B takedrop_ucw(i64 wi, B o, u64 am, B x, size_t xr) { B rep = c1(o, taga(arg)); if (isAtm(rep)) thrM("π”½βŒΎ(nβŠΈβ†‘): 𝔽 returned an atom"); usz* repsh = SH(rep); - if (rnk(rep)==0 || !eqShPart(repsh+1, SH(x)+1, xr-1) || repsh[0]!=am) thrM("π”½βŒΎ(nβŠΈβ†‘)𝕩: 𝔽 returned an array with a different shape than n↑𝕩"); + if (RNK(rep)==0 || !eqShPart(repsh+1, SH(x)+1, xr-1) || repsh[0]!=am) thrM("π”½βŒΎ(nβŠΈβ†‘)𝕩: 𝔽 returned an array with a different shape than n↑𝕩"); MAKE_MUT(r, xia); mut_init(r, el_or(TI(x,elType), TI(rep,elType))); MUTG_INIT(r); @@ -1607,7 +1607,7 @@ B take_ucw(B t, B o, B w, B x) { i64 wi = o2i64(w); u64 am = wi<0? -wi : wi; if (isAtm(x)) x = m_vec1(x); - ur xr = rnk(x); if (xr==0) xr = 1; + ur xr = RNK(x); if (xr==0) xr = 1; if (am>SH(x)[0]) thrF("π”½βŒΎ(nβŠΈβ†‘)𝕩: Cannot modify fill with Under (%l ≑ 𝕨, %H ≑ ≒𝕩)", wi, x); return takedrop_ucw(wi, o, am, x, xr); } @@ -1617,24 +1617,24 @@ B drop_ucw(B t, B o, B w, B x) { i64 wi = o2i64(w); u64 am = wi<0? -wi : wi; if (isAtm(x)) x = m_vec1(x); - ur xr = rnk(x); if (xr==0) xr = 1; + ur xr = RNK(x); if (xr==0) xr = 1; usz cam = SH(x)[0]; if (am>cam) am = cam; return takedrop_ucw(-wi, o, cam-am, x, xr); } static B shape_uc1_t(B r, usz ia) { - if (!isArr(r) || rnk(r)!=1 || IA(r)!=ia) thrM("π”½βŒΎβ₯Š: 𝔽 changed the shape of the argument"); + if (!isArr(r) || RNK(r)!=1 || IA(r)!=ia) thrM("π”½βŒΎβ₯Š: 𝔽 changed the shape of the argument"); return r; } B shape_uc1(B t, B o, B x) { - if (!isArr(x) || rnk(x)==0) { + if (!isArr(x) || RNK(x)==0) { usz xia = isArr(x)? IA(x) : 1; return shape_c2(t, emptyIVec(), shape_uc1_t(c1(o, shape_c1(t, x)), xia)); } usz xia = IA(x); - if (rnk(x)==1) return shape_uc1_t(c1(o, x), xia); - ur xr = rnk(x); + if (RNK(x)==1) return shape_uc1_t(c1(o, x), xia); + ur xr = RNK(x); ShArr* sh = ptr_inc(shObj(x)); return truncReshape(shape_uc1_t(c1(o, shape_c1(t, x)), xia), xia, xia, xr, sh); } @@ -1645,7 +1645,7 @@ B transp_uc1(B t, B o, B x) { return transp_c1(t, c1(o, transp_c1(t, x))); } B reverse_uc1(B t, B o, B x) { return reverse_c1(t, c1(o, reverse_c1(t, x))); } NOINLINE B enclose_im(B t, B x) { - if (isAtm(x) || rnk(x)!=0) thrM("<⁼: Argument wasn't a rank 0 array"); + if (isAtm(x) || RNK(x)!=0) thrM("<⁼: Argument wasn't a rank 0 array"); B r = IGet(x, 0); dec(x); return r; diff --git a/src/builtins/sort.c b/src/builtins/sort.c index 159f6bad..b5b17ca5 100644 --- a/src/builtins/sort.c +++ b/src/builtins/sort.c @@ -28,8 +28,8 @@ typedef struct I32I32p { i32 k; i32 v; } I32I32p; #include "sortTemplate.h" B and_c1(B t, B x) { - if (isAtm(x) || rnk(x)==0) thrM("∧: Argument cannot have rank 0"); - if (rnk(x)!=1) return bqn_merge(and_c1(t, toCells(x))); + if (isAtm(x) || RNK(x)==0) thrM("∧: Argument cannot have rank 0"); + if (RNK(x)!=1) return bqn_merge(and_c1(t, toCells(x))); usz xia = IA(x); u8 xe = TI(x,elType); if (xe<=el_i32) { @@ -62,8 +62,8 @@ B and_c1(B t, B x) { #include "sortTemplate.h" B or_c1(B t, B x) { - if (isAtm(x) || rnk(x)==0) thrM("∨: Argument cannot have rank 0"); - if (rnk(x)!=1) return bqn_merge(or_c1(t, toCells(x))); + if (isAtm(x) || RNK(x)==0) thrM("∨: Argument cannot have rank 0"); + if (RNK(x)!=1) return bqn_merge(or_c1(t, toCells(x))); usz xia = IA(x); u8 xe = TI(x,elType); if (xe<=el_i32) { diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 4e9b8c3b..d8606ca3 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -15,7 +15,7 @@ static bool eqStr(B w, u32* x) { - if (isAtm(w) || rnk(w)!=1) return false; + if (isAtm(w) || RNK(w)!=1) return false; SGetU(w) u64 i = 0; while (x[i]) { @@ -198,14 +198,14 @@ B casrt_c2(B t, B w, B x) { dec(w); thr(s); } - if (isArr(w0) && rnk(w0)==1 && IA(w0)>=1) { + if (isArr(w0) && RNK(w0)==1 && IA(w0)>=1) { B s = IGet(w,1); AFMT("\n"); usz pos = o2s(IGetU(w0,0)); s = vm_fmtPoint(comp_currSrc, s, comp_currPath, pos, pos+1); dec(w); thr(s); } - if (isArr(w0) && rnk(w0)==2 && IA(w0)>=2) { + if (isArr(w0) && RNK(w0)==2 && IA(w0)>=2) { B s = IGet(w,1); AFMT("\n"); SGetU(w0) s = vm_fmtPoint(comp_currSrc, s, comp_currPath, o2s(GetU(w0,0)), o2s(GetU(w0,1))+1); @@ -222,7 +222,7 @@ B casrt_c1(B t, B x) { B sys_c1(B t, B x); B out_c1(B t, B x) { - if (isArr(x) && rnk(x)>1) thrF("β€’Out: Argument cannot have rank %i", rnk(x)); + if (isArr(x) && RNK(x)>1) thrF("β€’Out: Argument cannot have rank %i", RNK(x)); printRaw(x); putchar('\n'); return x; } @@ -240,7 +240,7 @@ B show_c1(B t, B x) { } B vfyStr(B x, char* name, char* arg) { - if (isAtm(x) || rnk(x)!=1) thrF("%U: %U must be a character vector", name, arg); + if (isAtm(x) || RNK(x)!=1) thrF("%U: %U must be a character vector", name, arg); if (!elChr(TI(x,elType))) { usz ia = IA(x); SGetU(x) @@ -251,7 +251,7 @@ B vfyStr(B x, char* name, char* arg) { B cdPath; static B args_path(B* fullpath, B w, char* name) { // consumes w, returns args, writes to fullpath - if (!isArr(w) || rnk(w)!=1 || IA(w)>3) thrF("%U: 𝕨 must be a vector 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 vector with at most 3 items, but had shape %H", name, w); usz ia = IA(w); SGet(w) B path = ia>0? vfyStr(Get(w,0),name,"path" ) : inc(cdPath); @@ -320,7 +320,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); for (u64 i = 0; i < wia; i++) mulOn(am, o2s(GetU(w, i))); @@ -765,7 +765,7 @@ B fexists_c1(B d, B x) { } B fName_c1(B t, B x) { - if (!isArr(x) || rnk(x)!=1) thrM("β€’file.Name: Argument must be a character vector"); + if (!isArr(x) || RNK(x)!=1) thrM("β€’file.Name: Argument must be a character vector"); return path_name(x); } @@ -862,14 +862,14 @@ B sh_c2(B t, B w, B x) { u64 iLen = q_N(inObj)? 0 : utf8lenB(inObj); // allocate args - if (isAtm(x) || rnk(x)>1) thrM("β€’SH: 𝕩 must be a vector of strings"); + if (isAtm(x) || RNK(x)>1) thrM("β€’SH: 𝕩 must be a vector of strings"); usz xia = IA(x); if (xia==0) thrM("β€’SH: 𝕩 must have at least one item"); TALLOC(char*, argv, xia+1); 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 vector of strings"); + if (isAtm(c) || RNK(c)!=1) thrM("β€’SH: 𝕩 must be a vector of strings"); u64 len = utf8lenB(c); TALLOC(char, cstr, len+1); toUTF8(c, cstr); @@ -1046,7 +1046,7 @@ static CastType getCastType(B e, B v) { s = o2s(e); c = q_N(v) ? 0 : isCharType(v(v)->type); } 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)); @@ -1092,7 +1092,7 @@ static u8 typeOfCast(CastType t) { } 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 xt = getCastType(el0, x); CastType zt = getCastType(el1, bi_N); @@ -1131,13 +1131,13 @@ 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); } diff --git a/src/core/harr.c b/src/core/harr.c index d846e110..f32acfdd 100644 --- a/src/core/harr.c +++ b/src/core/harr.c @@ -4,19 +4,19 @@ B toCells(B x) { - assert(isArr(x) && rnk(x)>1); + assert(isArr(x) && RNK(x)>1); usz cam = SH(x)[0]; usz csz = arr_csz(x); BSS2A slice = TI(x,slice); M_HARR(r, cam) usz p = 0; - if (rnk(x)==2) { + if (RNK(x)==2) { for (usz i = 0; i < cam; i++) { HARR_ADD(r, i, taga(arr_shVec(slice(incG(x), p, csz)))); p+= csz; } } else { - usz cr = rnk(x)-1; + usz cr = RNK(x)-1; ShArr* csh = m_shArr(cr); usz* xsh = SH(x); shcpy(csh->a, xsh+1, cr); @@ -31,8 +31,8 @@ B toCells(B x) { return HARR_FV(r); } B toKCells(B x, ur k) { - assert(isArr(x) && k<=rnk(x) && k>=0); - ur xr = rnk(x); usz* xsh = SH(x); + assert(isArr(x) && k<=RNK(x) && k>=0); + ur xr = RNK(x); usz* xsh = SH(x); ur cr = xr-k; usz cam = shProd(xsh, 0, k); usz csz = shProd(xsh, k, xr); @@ -68,7 +68,7 @@ NOINLINE void harr_pfree(B x, usz am) { // am - item after last written assert(v(x)->type==t_harr); B* p = harr_ptr(x); for (usz i = 0; i < am; i++) dec(p[i]); - if (rnk(x)>1) ptr_dec(shObj(x)); + if (RNK(x)>1) ptr_dec(shObj(x)); mm_free(v(x)); } diff --git a/src/core/harr.h b/src/core/harr.h index 94c6a4ef..c601485c 100644 --- a/src/core/harr.h +++ b/src/core/harr.h @@ -46,7 +46,7 @@ static HArr_p m_harr_impl(usz ia) { static B harr_fv_impl(HArr_p p) { VTY(p.b, t_harrPartial); p.c->type = t_harr; p.c->sh = &p.c->ia; - srnk(p.b, 1); + SRNK(p.b, 1); gsPop(); return p.b; } diff --git a/src/core/heap.c b/src/core/heap.c index 592904de..95e03601 100644 --- a/src/core/heap.c +++ b/src/core/heap.c @@ -20,13 +20,13 @@ void heapVerify_checkFn(Value* v) { void heapVerify_callVisit(Value* v) { - if (TIv(v,isArr) && prnk(v)>1) heapVerify_visitP(shObjP(v)); + if (TIv(v,isArr) && PRNK(v)>1) heapVerify_visitP(shObjP(v)); TIv(v,visit)(v); } void heap_getReferents(Value* v) { heap_curr = v; - if (TIv(v,isArr) && prnk(v)>1) heapVerify_visitP(shObjP(v)); + if (TIv(v,isArr) && PRNK(v)>1) heapVerify_visitP(shObjP(v)); TIv(v,visit)(v); } void heapVerify() { diff --git a/src/core/stuff.c b/src/core/stuff.c index 2e3e0aca..89764663 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -93,7 +93,7 @@ NOINLINE TStack* ts_e(TStack* o, u32 elsz, u64 am) { u64 size = o->size; void fprint(FILE* f, B x); void farr_print(FILE* f, B x) { // should accept refc=0 arguments for debugging purposes - ur r = rnk(x); + ur r = RNK(x); SGetU(x) usz ia = IA(x); if (r!=1) { @@ -220,7 +220,7 @@ i32 num_fmt(char buf[30], f64 x) { return len; } -static B appendRaw(B s, B x) { assert(isArr(x) && rnk(x)==1); // consumes x +static B appendRaw(B s, B x) { assert(isArr(x) && RNK(x)==1); // consumes x if (TI(x,elType)==el_c32) AJOIN(x); else { B sq = chr_squeezeChk(x); @@ -258,7 +258,7 @@ NOINLINE B do_fmt(B s, char* p, va_list a) { sh = va_arg(a, usz*); } else { B o = va_arg(a, B); - r = isArr(o)? rnk(o) : 0; + r = isArr(o)? RNK(o) : 0; sh = isArr(o)? SH(o) : NULL; } if (r==0) AU("⟨⟩"); @@ -372,8 +372,8 @@ NOINLINE i32 compareF(B w, B x) { if (isAtm(w) & isAtm(x)) thrM("Invalid comparison"); bool wa=isAtm(w); usz wia; ur wr; usz* wsh; AS2B wgetU; Arr* wArr; bool xa=isAtm(x); usz xia; ur xr; usz* xsh; AS2B xgetU; Arr* xArr; - if(wa) { wia=1; wr=0; wsh=NULL; } else { wia=IA(w); wr=rnk(w); wsh=SH(w); wgetU=TI(w,getU); wArr = a(w); } - if(xa) { xia=1; xr=0; xsh=NULL; } else { xia=IA(x); xr=rnk(x); xsh=SH(x); xgetU=TI(x,getU); xArr = a(x); } + if(wa) { wia=1; wr=0; wsh=NULL; } else { wia=IA(w); wr=RNK(w); wsh=SH(w); wgetU=TI(w,getU); wArr = a(w); } + if(xa) { xia=1; xr=0; xsh=NULL; } else { xia=IA(x); xr=RNK(x); xsh=SH(x); xgetU=TI(x,getU); xArr = a(x); } if (wia==0 || xia==0) return CMP(wia, xia); i32 rc = CMP(wr+(wa?0:1), xr+(xa?0:1)); @@ -452,8 +452,8 @@ NOINLINE bool equal(B w, B x) { // doesn't consume bool xa = isAtm(x); if (wa!=xa) return false; if (wa) return atomEqual(w, x); - ur wr = rnk(w); - ur xr = rnk(x); + ur wr = RNK(w); + ur xr = RNK(x); if (wr!=xr) return false; usz ia = IA(x); if (LIKELY(wr==1)) { @@ -613,11 +613,11 @@ bool isPureFn(B x) { // doesn't consume B bqn_merge(B x) { assert(isArr(x)); usz xia = IA(x); - ur xr = rnk(x); + ur xr = RNK(x); if (xia==0) { B xf = getFillE(x); if (isAtm(xf)) { dec(xf); return x; } - i32 xfr = rnk(xf); + i32 xfr = RNK(xf); B xff = getFillQ(xf); Arr* r = m_fillarrp(0); fillarr_setFill(r, xff); @@ -634,7 +634,7 @@ B bqn_merge(B x) { SGetU(x) B x0 = GetU(x, 0); usz* elSh = isArr(x0)? SH(x0) : NULL; - ur elR = isArr(x0)? rnk(x0) : 0; + ur elR = isArr(x0)? RNK(x0) : 0; usz elIA = isArr(x0)? IA(x0) : 1; B fill = getFillQ(x0); if (xr+elR > UR_MAX) thrM(">: Result rank too large"); @@ -643,7 +643,7 @@ B bqn_merge(B x) { usz rp = 0; for (usz i = 0; i < xia; i++) { B c = GetU(x, i); - if (isArr(c)? (elR!=rnk(c) || !eqShPart(elSh, SH(c), elR)) : elR!=0) { mut_pfree(r, rp); thrF(">: Elements didn't have equal shapes (contained shapes %H and %H)", x0, c); } + if (isArr(c)? (elR!=RNK(c) || !eqShPart(elSh, SH(c), elR)) : elR!=0) { mut_pfree(r, rp); thrF(">: Elements didn't have equal shapes (contained shapes %H and %H)", x0, c); } if (isArr(c)) mut_copy(r, rp, c, 0, elIA); else mut_set(r, rp, inc(c)); if (!noFill(fill)) fill = fill_or(fill, getFillQ(c)); @@ -805,9 +805,9 @@ void g_pst(void) { vm_pstLive(); fflush(stdout); fflush(stderr); } } if (TIv(x,isArr)) { Arr* a = (Arr*)x; - if (prnk(x)<=1) assert(a->sh == &a->ia); + if (PRNK(x)<=1) assert(a->sh == &a->ia); else { - assert(shProd(PSH(a), 0, prnk(x)) == a->ia); + assert(shProd(PSH(a), 0, PRNK(x)) == a->ia); VALIDATE(tag(shObjP(x),OBJ_TAG)); } } diff --git a/src/core/stuff.h b/src/core/stuff.h index 2f99b95b..6e4da477 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -27,7 +27,7 @@ static ShArr* shObjS(usz* x) { return RFLD(x, ShArr, a); } static ShArr* shObj (B x) { return RFLD(SH(x), ShArr, a); } static ShArr* shObjP(Value* x) { return RFLD(PSH((Arr*)x), ShArr, a); } static void decShObj(ShArr* x) { tptr_dec(x, mm_free); } -static void decSh(Value* x) { if (RARE(prnk(x)>1)) decShObj(shObjP(x)); } +static void decSh(Value* x) { if (RARE(PRNK(x)>1)) decShObj(shObjP(x)); } // some array stuff @@ -48,35 +48,35 @@ static ShArr* m_shArr(ur r) { } static Arr* arr_shVec(Arr* x) { - sprnk(x, 1); + SPRNK(x, 1); x->sh = &x->ia; return x; } static usz* arr_shAlloc(Arr* x, ur r) { // sets rank, allocates & returns shape (or null if r<2); assumes x has rank≀1 (which will be the case for new allocations) - assert(prnk(x)<=1); + assert(PRNK(x)<=1); if (r>1) { usz* sh = x->sh = m_shArr(r)->a; // if m_shArr fails, the assumed rank≀1 guarantees the uninitialized x->sh won't break - sprnk(x,r); + SPRNK(x,r); return sh; } - sprnk(x,r); + SPRNK(x,r); x->sh = &x->ia; return NULL; } static void arr_shSetI(Arr* x, ur r, ShArr* sh) { // set rank and assign and increment shape if needed - sprnk(x,r); + SPRNK(x,r); if (r>1) { x->sh = ptr_inc(sh)->a; } else { x->sh = &x->ia; } } static void arr_shSetU(Arr* x, ur r, ShArr* sh) { // set rank and assign shape - sprnk(x,r); + SPRNK(x,r); if (r>1) { x->sh = sh->a; } else { x->sh = &x->ia; } } static void arr_shCopy(Arr* n, B o) { // copy shape & rank from o to n assert(isArr(o)); assert(IA(o)==n->ia); - ur r = sprnk(n,rnk(o)); + ur r = SPRNK(n,RNK(o)); if (r<=1) { n->sh = &n->ia; } else { @@ -95,7 +95,7 @@ static usz shProd(usz* sh, usz s, usz e) { return r; } static usz arr_csz(B x) { - ur xr = rnk(x); + ur xr = RNK(x); if (xr<=1) return 1; return shProd(SH(x), 1, xr); } @@ -105,8 +105,8 @@ static bool eqShPart(usz* w, usz* x, usz len) { return true; } static bool eqShape(B w, B x) { assert(isArr(w)); assert(isArr(x)); - ur wr = rnk(w); usz* wsh = SH(w); - ur xr = rnk(x); usz* xsh = SH(x); + ur wr = RNK(w); usz* wsh = SH(w); + ur xr = RNK(x); usz* xsh = SH(x); if (wr!=xr) return false; if (wsh==xsh) return true; return eqShPart(wsh, xsh, wr); diff --git a/src/ffi.c b/src/ffi.c index 1c99c75b..11bd0bbc 100644 --- a/src/ffi.c +++ b/src/ffi.c @@ -65,9 +65,9 @@ BQNV bqn_evalCStr(const char* str) { size_t bqn_bound(BQNV a) { return IA(getB(a)); } -size_t bqn_rank(BQNV a) { return rnk(getB(a)); } +size_t bqn_rank(BQNV a) { return RNK(getB(a)); } void bqn_shape(BQNV a, size_t* buf) { B b = getB(a); - ur r = rnk(b); + ur r = RNK(b); usz* sh = SH(b); for (usz i = 0; i < r; i++) buf[i] = sh[i]; } diff --git a/src/h.h b/src/h.h index aa7b646f..7499761a 100644 --- a/src/h.h +++ b/src/h.h @@ -371,16 +371,18 @@ void freeThrown(void); #define c(T,X) ((T*)((X).u&0xFFFFFFFFFFFFull)) #define v(X) c(Value, X) #define a(X) c(Arr , X) -#define prnk(X ) (X->extra) -#define sprnk(X,R) (X->extra=(R)) -#define rnk(X ) prnk(v(X)) -#define srnk(X,R) sprnk(v(X),R) -#define IA(X) (a(X)->ia) -#define PIA(X) ((X)->ia) -#define SH(X) (a(X)->sh) -#define PSH(X) ((X)->sh) -#define TY(X) (v(X)->type) -#define PTY(X) ((X)->type) + +#define SPRNK(X,R) (X->extra=(R)) +#define SRNK(X,R) SPRNK(v(X),R) + +#define PRNK(X) ((X)->extra) +#define PIA(X) ((X)->ia) +#define PSH(X) ((X)->sh) +#define PTY(X) ((X)->type) +#define IA(X) PIA(a(X)) +#define SH(X) PSH(a(X)) +#define TY(X) PTY(v(X)) +#define RNK(X) PRNK(v(X)) #define VTY(X,T) assert(isVal(X) && TY(X)==(T)) diff --git a/src/load.c b/src/load.c index 7194b554..728c711c 100644 --- a/src/load.c +++ b/src/load.c @@ -218,13 +218,13 @@ void init_comp(B* set, B prim) { set[1] = inc(load_rtObj); set[2] = inc(load_glyphs); } else { - if (!isArr(prim) || rnk(prim)!=1) thrM("β€’ReBQN: 𝕩.primitives must be a list"); + if (!isArr(prim) || RNK(prim)!=1) thrM("β€’ReBQN: 𝕩.primitives must be a list"); usz pia = IA(prim); usz np[3] = {0}; // number of functions, 1-modifiers, and 2-modifiers SGetU(prim); for (usz i = 0; i < pia; i++) { // check and count B p = GetU(prim, i); - if (!isArr(p) || rnk(p)!=1 || IA(p)!=2) thrM("β€’ReBQN: 𝕩.primitives must consist of glyph-primitive pairs"); + if (!isArr(p) || RNK(p)!=1 || IA(p)!=2) thrM("β€’ReBQN: 𝕩.primitives must consist of glyph-primitive pairs"); if (!isC32(IGet(p, 0))) thrM("β€’ReBQN 𝕩.primitives: Glyphs must be characters"); B v = IGetU(p, 1); i32 t = isFun(v)? 0 : isMd1(v)? 1 : isMd2(v)? 2 : 3; diff --git a/src/singeli/c/cmp.c b/src/singeli/c/cmp.c index 036f58da..4e144aad 100644 --- a/src/singeli/c/cmp.c +++ b/src/singeli/c/cmp.c @@ -44,7 +44,7 @@ FN_LUT(avx2, le, AS); if (we==el_B) goto end; \ if (isArr(x)) { u8 xe = TI(x,elType); \ if (xe==el_B) goto end; \ - if (rnk(w)==rnk(x)) { if (!eqShape(w, x)) thrF(CHR": Expected equal shape prefix (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); \ + if (RNK(w)==RNK(x)) { if (!eqShape(w, x)) thrF(CHR": Expected equal shape prefix (%H ≑ ≒𝕨, %H ≑ ≒𝕩)", w, x); \ if (we!=xe) { B tw=w,tx=x; \ we = aMakeEq(&tw, &tx, we, xe); \ if (we==el_MAX) goto end; \ diff --git a/src/utils/each.c b/src/utils/each.c index 826b73b6..00c89dd2 100644 --- a/src/utils/each.c +++ b/src/utils/each.c @@ -7,8 +7,8 @@ static inline B hmv(HArr_p p, usz n) { B r = p.a[n]; p.a[n] = m_f64(0); return r B eachd_fn(B fo, B w, B x, BBB2B f) { if (isAtm(w)) w = m_atomUnit(w); if (isAtm(x)) x = m_atomUnit(x); - ur wr = rnk(w); SGet(w); - ur xr = rnk(x); SGet(x); + ur wr = RNK(w); SGet(w); + ur xr = RNK(x); SGet(x); bool wg = wr>xr; ur rM = wg? wr : xr; ur rm = wg? xr : wr; diff --git a/src/utils/file.c b/src/utils/file.c index 57c04c54..221bc5f9 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -96,10 +96,10 @@ static NOINLINE void guaranteeStr(B x) { // assumes x is an array B path_rel(B base, B rel) { // consumes rel; assumes base is a char vector or bi_N assert(isArr(base) || q_N(base)); - if (!isArr(rel) || rnk(rel)!=1) thrM("Paths must be character vectors"); + if (!isArr(rel) || RNK(rel)!=1) thrM("Paths must be character vectors"); SGetU(rel) usz ria = IA(rel); - if (rnk(rel)!=1) thrM("Paths must be character vectors"); + if (RNK(rel)!=1) thrM("Paths must be character vectors"); guaranteeStr(rel); if (ria>0 && o2cu(GetU(rel, 0))=='/') return rel; if (q_N(base)) thrM("Using relative path with no absolute base path known"); diff --git a/src/utils/hash.c b/src/utils/hash.c index d736fbd5..a2c5bbb6 100644 --- a/src/utils/hash.c +++ b/src/utils/hash.c @@ -6,7 +6,7 @@ NOINLINE u64 bqn_hashArr(B x, const u64 secret[4]) { // TODO manual separation o usz xia = IA(x); if (xia==0) return ~secret[3]; // otherwise squeeze will care about fills x = any_squeeze(incG(x)); - u8 xr = rnk(x); + u8 xr = RNK(x); u8 xe = TI(x,elType); u64 shHash; if (xr<=1) shHash = wyhash64(xia, xe); diff --git a/src/utils/mut.c b/src/utils/mut.c index f6f3d732..f987827c 100644 --- a/src/utils/mut.c +++ b/src/utils/mut.c @@ -8,7 +8,7 @@ NOINLINE void mut_to(Mut* m, u8 n) { mut_init(m, n); } else { m->fns = &mutFns[n]; - sprnk(m->val, 1); + SPRNK(m->val, 1); m->val->sh = &m->val->ia; #ifdef USE_VALGRIND VALGRIND_MAKE_MEM_DEFINED(m->val, mm_size((Value*)m->val)); // it's incomplete, but it's a typed array so garbage is acceptable diff --git a/src/utils/mut.h b/src/utils/mut.h index 4a51f833..5a540d5b 100644 --- a/src/utils/mut.h +++ b/src/utils/mut.h @@ -67,7 +67,7 @@ void mut_to(Mut* m, u8 n); static B mut_fv(Mut* m) { assert(m->fns->elType!=el_MAX); Arr* a = m->val; a->sh = &a->ia; - sprnk(a, 1); + SPRNK(a, 1); return taga(a); } static B mut_fc(Mut* m, B x) { assert(m->fns->elType!=el_MAX); diff --git a/src/vm.c b/src/vm.c index 3ddfeaf5..c531907d 100644 --- a/src/vm.c +++ b/src/vm.c @@ -463,10 +463,10 @@ NOINLINE Block* compile(B bcq, B objs, B allBlocks, B allBodies, B indices, B to for (usz i = 0; i < objAm; i++) objArr->a[i] = squeeze_deep(objArr->a[i]); if (!q_N(src) && !q_N(indices)) { - if (isAtm(indices) || rnk(indices)!=1 || IA(indices)!=2) thrM("VM compiler: Bad indices"); + if (isAtm(indices) || RNK(indices)!=1 || IA(indices)!=2) thrM("VM compiler: Bad indices"); for (i32 i = 0; i < 2; i++) { B ind = IGetU(indices,i); - if (isAtm(ind) || rnk(ind)!=1 || IA(ind)!=bcIA) thrM("VM compiler: Bad indices"); + if (isAtm(ind) || RNK(ind)!=1 || IA(ind)!=bcIA) thrM("VM compiler: Bad indices"); SGetU(ind) for (usz j = 0; j < bcIA; j++) o2i(GetU(ind,j)); } @@ -484,7 +484,7 @@ NOINLINE Block* compile(B bcq, B objs, B allBlocks, B allBodies, B indices, B to FORCE_INLINE bool v_merge(Scope* pscs[], B s, B x, bool upd, bool hdr) { assert(TY(s) == t_arrMerge); B o = c(WrappedObj,s)->obj; - if (!isArr(x) || rnk(x)==0) thrF("[…]%U𝕩: 𝕩 cannot have rank 0", upd? "↩" : "←"); + if (!isArr(x) || RNK(x)==0) thrF("[…]%U𝕩: 𝕩 cannot have rank 0", upd? "↩" : "←"); B* op = harr_ptr(o); usz oia = IA(o); @@ -494,7 +494,7 @@ FORCE_INLINE bool v_merge(Scope* pscs[], B s, B x, bool upd, bool hdr) { else thrF("[…]%U𝕩: Target length & leading axis of 𝕩 didn't match", upd? "↩" : "←"); } if (oia == 0) { /*no need to do anything*/ } - else if (rnk(x)==1) { + else if (RNK(x)==1) { SGet(x) for (usz i = 0; i < oia; i++) { B cx = m_unit(Get(x,i));