diff --git a/src/builtins/grade.h b/src/builtins/grade.h index 1021f477..8b78b522 100644 --- a/src/builtins/grade.h +++ b/src/builtins/grade.h @@ -362,6 +362,8 @@ bool CAT(isSorted,GRADE_UD(Up,Down))(B x) { #undef CMP } +extern B CAT(GRADE_UD(le,ge),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(x)) x = m_unit(x); @@ -378,9 +380,29 @@ B GRADE_CAT(c2)(B t, B w, B x) { u8 we = TI(w,elType); usz wia = IA(w); u8 xe = TI(x,elType); usz xia = IA(x); + B r; if (wia==0 | xia==0) { Arr* ra=allZeroes(xia); arr_shCopy(ra, x); - decG(w); decG(x); return taga(ra); + r=taga(ra); goto done; + } + if (wia==1) { + B c = IGet(w, 0); + if (LIKELY(weI32_MAX-10) thrM(GRADE_CHR": 𝕨 too big"); @@ -390,7 +412,6 @@ B GRADE_CAT(c2)(B t, B w, B x) { FL_SET(w, fl); } - B r; if (LIKELY(we