•Type, •PrimInd, •Decompose

This commit is contained in:
dzaima 2021-04-10 21:42:52 +03:00
parent 67dad6cc1d
commit be994f822b
3 changed files with 5 additions and 2 deletions

View File

@ -403,7 +403,7 @@ void printRaw(B x) {
BS2B xget = TI(x).get;
for (usz i = 0; i < ia; i++) {
B c = xget(x,i);
if (c.u==0) { printf(" "); continue; }
if (c.u==0 | c.u==bi_noFill.u) { printf(" "); continue; }
if (!isC32(c)) err("bad printRaw argument: expected all character items");
printUTF8((u32)c.u);
}

View File

@ -122,7 +122,7 @@ B scan_c2(B d, B w, B x) { B f = c(Md1D,d)->f;
if (xr==0) return err("`: 𝕩 cannot be a scalar");
if (wr+1 != xr) return err("`: shape of 𝕨 must match the cell of 𝕩");
if (memcmp(wsh, xsh+1, wr)) return err("`: shape of 𝕨 must match the cell of 𝕩");
if (ia==0) { ptr_dec(r.c); return x; }
if (ia==0) { ptr_dec(r.c); return x; } // only safe as r would have 0 items too
usz csz = arr_csz(x);
for (usz i = 0; i < csz; i++) r.a[i] = c2(f, wget(w,i), xget(x,i));
for (usz i = csz; i < ia; i++) r.a[i] = c2(f, inc(r.a[i-csz]), xget(x,i));

View File

@ -150,6 +150,9 @@ B sys_c1(B t, B x) {
B c = xget(x,i);
if (eqStr(c, U"internal")) r.a[i] = inc(bi_internal);
else if (eqStr(c, U"eq")) r.a[i] = inc(bi_feq);
else if (eqStr(c, U"decompose")) r.a[i] = inc(bi_decp);
else if (eqStr(c, U"primind")) r.a[i] = inc(bi_primInd);
else if (eqStr(c, U"type")) r.a[i] = inc(bi_type);
else err("Unknown system function");
}
dec(x);