add 𝕨/𝕩 in dyadic ⌽/⌽⁼ error message

This commit is contained in:
dzaima 2025-02-17 06:30:11 +02:00
parent bdee96a995
commit 9826c4ce0e
3 changed files with 18 additions and 8 deletions

View File

@ -1186,7 +1186,7 @@ B reverse_c2(B t, B w, B x);
#define WRAP_ROT(V, L) ({ i64 v_ = (V); usz l_ = (L); if ((u64)v_ >= (u64)l_) { v_%= (i64)l_; if(v_<0) v_+= l_; } v_; })
NOINLINE B rotate_highrank(bool inv, B w, B x) {
#define INV (inv? "⁼" : "")
if (RNK(w)>1) thrF("⌽%U: 𝕨 must have rank at most 1 (%H ≡ ≢𝕨)", INV, w);
if (RNK(w)>1) thrF("𝕨⌽%U𝕩: 𝕨 must have rank at most 1 (%H ≡ ≢𝕨)", INV, w);
B r;
usz wia = IA(w);
if (isAtm(x) || RNK(x)==0) {
@ -1207,7 +1207,7 @@ NOINLINE B rotate_highrank(bool inv, B w, B x) {
if (wia==0) { r=x; goto decW_ret; }
if (!elNum(TI(w,elType))) {
w = num_squeeze(w);
if (!elNum(TI(w,elType))) thrF("⌽%U: 𝕨 contained non-number", INV);
if (!elNum(TI(w,elType))) thrF("𝕨⌽%U𝕩: 𝕨 contained non-number", INV);
}
bool origF64 = TI(w,elType)==el_f64;
w = toF64Any(w);
@ -1277,7 +1277,7 @@ NOINLINE B rotate_highrank(bool inv, B w, B x) {
decW_ret: decG(w);
return r;
badlen: thrF("⌽%U: Length of list 𝕨 must be at most rank of 𝕩 (%s ≡ ≠𝕨, %H ≡ ≢𝕩⟩", INV, wia, x);
badlen: thrF("𝕨⌽%U𝕩: Length of list 𝕨 must be at most rank of 𝕩 (%s ≡ ≠𝕨, %H ≡ ≢𝕩⟩", INV, wia, x);
#undef INV
}
B reverse_c2(B t, B w, B x) {
@ -1505,9 +1505,9 @@ B shape_ucw(B t, B o, B w, B x) {
B reverse_ix(B t, B w, B x) {
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");
if (isF64(w)) return C2(reverse, m_f64(-o2fG(w)), x);
if (isAtm(w)) thrM("⌽⁼: 𝕨 must consist of integers");
if (isAtm(w)) thrM("𝕨⌽⁼𝕩: 𝕨 must consist of integers");
return rotate_highrank(1, w, x);
}

View File

@ -271,9 +271,19 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄
!"Expected integer, got NaN" % %USE eqerr 0÷0, 0÷0 _eqerr 10, 0, 000,
!"Integer out of range: ∞" % %USE eqerr , _eqerr 10, 0, 000,
!"Expected integer, got function" % %USE eqerr _eqerr 10, 0, 000,
!"Expected integer, got character" % %USE eqerr 'a' _eqerr 10, 0, 000,
!"⌽: 𝕨 contained non-number" % %USE eqerr 3'a', 'a'3, 0'a', 'a'0 _eqerr 000,0000
!"Expected integer, got character" % %USE eqerr 'a' _eqerr 10, 0, 000,
!"𝕨⌽⁼𝕩: 𝕨 must consist of integers" % %USE eqerr 'a' _eqerr 10, 0, 000,
!"𝕨⌽𝕩: 𝕨 contained non-number" % %USE eqerr 3'a', 'a'3, 0'a', 'a'0 _eqerr 000,0000
!"𝕨⌽⁼𝕩: 𝕨 contained non-number" % %USE eqerr 3'a', 'a'3, 0'a', 'a'0 _eqerr 000,0000
!"Integer out of range: ∞" % %USE eqerr 3, 3, 0, 0 _eqerr 000,0000
!"𝕨⌽𝕩: 𝕨 must have rank at most 1 (1‿1 ≡ ≢𝕨)" % %USE eqerr 1 _eqerr 221, 1
!"𝕨⌽⁼𝕩: 𝕨 must have rank at most 1 (1‿1 ≡ ≢𝕨)" % %USE eqerr 1 _eqerr 221, 1
!"𝕨⌽𝕩: Length of list 𝕨 must be at most rank of 𝕩 (3 ≡ ≠𝕨, ⟨⟩ ≡ ≢𝕩⟩" % 123 1
!"𝕨⌽⁼𝕩: 𝕩 must have rank at least 1" % 123 1
!"𝕨⌽𝕩: Length of list 𝕨 must be at most rank of 𝕩 (3 ≡ ≠𝕨, ⟨3⟩ ≡ ≢𝕩⟩" % 123 3
!"𝕨⌽⁼𝕩: 𝕩 must have rank at least 1" % 1
(< {a12}).a %% 12
123 4444256 %% F{(4|𝕨+4)𝕩} 3 F2 2 F˘ 1 F 4444256
(1+1e15) 10 %% (1+9)0
(-1+1e15) 10 %% 99

View File

@ -172,6 +172,6 @@ n←500 ⋄ a←↕n ⋄ i←(-n)+↕2×n ⋄ r←⌽(2×n)⥊a ⋄ ! (⌽a) ≡
!"⋈⁼: Argument wasn't a length-1 list" % (<4) 2
# k⊸⌽
!"⌽⁼: 𝕩 must have rank at least 1" % 1(2) 10
!"𝕨⌽⁼𝕩: 𝕩 must have rank at least 1" % 1(2) 10
(2) 1010100 %% 28292021222324252627
(12) 5525 %% 1552223242021234017895612131410111718191516