more spaces between 𝕨/𝕩 and names, re-remove •SH args

sh_c1 calls sh_c2, so the arity isn't function-specific
This commit is contained in:
dzaima 2025-02-07 07:31:44 +02:00
parent b945e48d29
commit 74483f3859
10 changed files with 59 additions and 54 deletions

View File

@ -478,7 +478,7 @@ static f64 bqn_atan2iw(f64 x, f64 w) { return w / (tan(x)+0); }
#define MATH(n,N,I) B n##_c2(B t, B w, B x) { \
if (isNum(w) && isNum(x)) return m_f64(I(x.f, w.f)); \
P2(n) \
thrM("𝕨•math." N "𝕩: Unexpected argument types"); \
thrM("𝕨 •math." N " 𝕩: Unexpected argument types"); \
}
MATH(atan2,"Atan2",bqn_atan2)
MATH(atan2ix,"Atan2⁼",bqn_atan2ix)
@ -510,19 +510,19 @@ static u64 lcm_u64(u64 a, u64 b) {
}
B gcd_c2(B t, B w, B x) {
if (isNum(w) && isNum(x)) {
if (!q_u64(w) || !q_u64(x)) thrM("𝕨•math.GCD𝕩: Inputs other than natural numbers not yet supported");
if (!q_u64(w) || !q_u64(x)) thrM("𝕨 •math.GCD 𝕩: Inputs other than natural numbers not yet supported");
return m_f64(gcd_u64(o2u64G(w), o2u64G(x)));
}
P2(gcd)
thrM("𝕨•math.GCD𝕩: Unexpected argument types");
thrM("𝕨 •math.GCD 𝕩: Unexpected argument types");
}
B lcm_c2(B t, B w, B x) {
if (isNum(w) && isNum(x)) {
if (!q_u64(w) || !q_u64(x)) thrM("𝕨•math.LCM𝕩: Inputs other than natural numbers not yet supported");
if (!q_u64(w) || !q_u64(x)) thrM("𝕨 •math.LCM 𝕩: Inputs other than natural numbers not yet supported");
return m_f64(lcm_u64(o2u64G(w), o2u64G(x)));
}
P2(lcm)
thrM("𝕨•math.LCM𝕩: Unexpected argument types");
thrM("𝕨 •math.LCM 𝕩: Unexpected argument types");
}
#undef P2

View File

@ -148,7 +148,7 @@ B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM("
static NOINLINE B arith_recm_slow(f64 (*fn)(f64), FC1 rec, B x, char* s) {
if (isF64(x)) return m_f64(fn(x.f));
if(isArr(x)) return arith_recm(rec, x);
thrF("•math.%S𝕩: 𝕩 contained non-number", s);
thrF("•math.%S 𝕩: 𝕩 contained non-number", s);
}
#define MATH(n,N) B n##_c1(B t, B x) { return arith_recm_slow(n, n##_c1, x, #N); }
MATH(cbrt,Cbrt) MATH(log2,Log2) MATH(log10,Log10) MATH(log1p,Log1p) MATH(expm1,Expm1)

View File

@ -103,13 +103,13 @@ static i64 (*const sum_small_fns[])(void*, usz) = { sum_small_i8, sum_small_i16,
static f64 (*const sum_fns[])(void*, usz, f64) = { sum_i8, sum_i16, sum_i32, sum_f64 };
B sum_c1(B t, B x) {
if (isAtm(x) || RNK(x)!=1) thrF("•math.Sum𝕩: 𝕩 must be a list (%H ≡ ≢𝕩)", x);
if (isAtm(x) || RNK(x)!=1) thrF("•math.Sum 𝕩: 𝕩 must be a list (%H ≡ ≢𝕩)", x);
usz ia = IA(x);
if (ia==0) { decG(x); return m_f64(0); }
u8 xe = TI(x,elType);
if (!elNum(xe)) {
x = any_squeeze(x); xe = TI(x,elType);
if (!elNum(xe)) thrF("•math.Sum𝕩: 𝕩 elements must be numbers", x);
if (!elNum(xe)) thrF("•math.Sum 𝕩: 𝕩 elements must be numbers", x);
}
f64 r;
void* xv = tyany_ptr(x);

View File

@ -154,7 +154,7 @@ B swap_c2(Md1D* d, B w, B x) { return c2(d->f, x , w); }
B timed_c2(Md1D* d, B w, B x) { B f = d->f;
i64 am = o2i64(w);
if (am<=0) thrM("𝕨𝔽•_timed𝕩: 𝕨 must be an integer greater than 0");
if (am<=0) thrM("𝕨 𝔽•_timed 𝕩: 𝕨 must be an integer greater than 0");
incBy(x, am-1);
FC1 fc1 = c1fn(f);
u64 sns = nsTime();

View File

@ -101,7 +101,7 @@ B repr_c1(B t, B x) {
#if FORMATTER
return bqn_repr(x);
#else
thrM("•Repr𝕩: Cannot represent non-numbers with -DFORMATTER=0");
thrM("•Repr 𝕩: Cannot represent non-numbers with -DFORMATTER=0");
#endif
}
}
@ -1163,7 +1163,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er
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 list of strings");
if (isAtm(c) || RNK(c)!=1) thrM("•SH: 𝕩 must be a list of strings");
u64 len = utf16lenB(c);
TALLOC(WCHAR, wstr, len);
toUTF16(c, wstr);
@ -1214,7 +1214,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er
if (iLen>0) { if (raw) free_chars(iBufRaw); else TFREE(iBuf); } // FREE_INPUT
TSFREE(arg);
if (dwResult != ERROR_SUCCESS) {
thrF("•SH 𝕩: Failed to run command: %S", winErrorEx(dwResult));
thrF("•SH: Failed to run command: %S", winErrorEx(dwResult));
}
// prepare output
@ -1242,17 +1242,17 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er
B inObj = bi_N;
bool raw = false;
if (!q_N(w)) {
if (!isNsp(w)) thrM("𝕨 •SH 𝕩: 𝕨 must be a namespace");
if (!isNsp(w)) thrM("•SH: 𝕨 must be a namespace");
inObj = ns_getC(w, "stdin");
if (!q_N(inObj) && !isArr(inObj)) thrM("𝕨 •SH 𝕩: Invalid stdin value");
if (!q_N(inObj) && !isArr(inObj)) thrM("•SH: Invalid stdin value");
B rawObj = ns_getC(w, "raw");
if (!q_N(rawObj)) raw = o2b(rawObj);
}
u64 iLen = q_N(inObj)? 0 : (raw? IA(inObj) : utf8lenB(inObj));
if (isAtm(x) || RNK(x)>1) thrM("𝕨 •SH 𝕩: 𝕩 must be a list of strings");
if (isAtm(x) || RNK(x)>1) thrM("•SH: 𝕩 must be a list of strings");
usz xia = IA(x);
if (xia==0) thrM("𝕨 •SH 𝕩: 𝕩 must have at least one item");
if (xia==0) thrM("•SH: 𝕩 must have at least one item");
B s_out, s_err;
i32 code = sh_core(raw, x, xia, inObj, iLen, &s_out, &s_err);
@ -1270,7 +1270,7 @@ static i32 sh_core(bool raw, B x, usz xia, B inObj, u64 iLen, B* s_outp, B* s_er
return m_hvec3(m_i32(code), s_outObj, s_errObj);
}
#else
B sh_c2(B t, B w, B x) { thrM("𝕨 •SH 𝕩: CBQN was compiled without <spawn.h>"); }
B sh_c2(B t, B w, B x) { thrM("•SH: CBQN was compiled without <spawn.h>"); }
#endif
B sh_c1(B t, B x) { return sh_c2(t, bi_N, x); }

View File

@ -54,8 +54,8 @@ a←(•ParseFloat¨ "1.2"‿"-0"‿"0")∾-⊸⋈0÷0 ⋄ ! (0‿3‿3‿3⊏a)
(((•HashMap˜4).Delete 1).Set´ 1"one").Keys@ %% 0231
(((•HashMap˜4).Delete 1).Set´ 1"one").Values@ %% 023"one"
({𝕩.Set´"xy"}4•HashMap˜0).Count@ %% 1
!"𝕨•HashMap𝕩: Arguments must be lists (⟨⟩≡≢𝕨, ⟨3⟩≡≢𝕩)" % 'a' •HashMap "str"
!"𝕨•HashMap𝕩: 𝕨 and 𝕩 must have the same length (4≡≠𝕨, 3≡≠𝕩)" % "stri" •HashMap "str"
!"𝕨 •HashMap 𝕩: Arguments must be lists (⟨⟩≡≢𝕨, ⟨3⟩≡≢𝕩)" % 'a' •HashMap "str"
!"𝕨 •HashMap 𝕩: 𝕨 and 𝕩 must have the same length (4≡≠𝕨, 3≡≠𝕩)" % "stri" •HashMap "str"
!"•HashMap: 𝕨 contained duplicate keys" % "strs" •HashMap "stri"
!"(hashmap).Get: key not found" % ("abc""de""fgh" •HashMap ¨3).Get "fg"
!"(hashmap).Delete: key not found" % ("abc""de""fgh" •HashMap ¨3).Delete 'a'

View File

@ -17,11 +17,11 @@
! (¨r1r3) ¨r1r2r3r4
)
!"•Import𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn"
!"•Import𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn"
!"•Import𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn"
!"•Import𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic.bqn""" % %USE file •ImportCleanPath File "cyclic.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic_A.bqn""" % %USE file •ImportCleanPath File "cyclic_B.bqn"
!"•Import 𝕩: cyclic import of "".../cyclic_B.bqn""" % %USE file •ImportCleanPath File "cyclic_A.bqn"
%USE file 3 •Import File "notCyclic.bqn" %% 30

View File

@ -113,18 +113,18 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
!"•file.Parent: Path must be non-empty" % •file.Parent ""
!"•file.Name: Path must be non-empty" % •file.Name ""
!"𝕨•file.Lines𝕩: 𝕩 must be a list" % "testfile.bqn" •FLines 22<"abcd"
!"𝕨•file.Lines𝕩: 𝕩 must be a list" % "testfile.bqn" •file.Lines <"abcd"
!"𝕨•file.Lines𝕩: Elements of 𝕩 must be lists of characters" % "testfile.bqn" •FLines "abcd"
!"𝕨 •file.Lines 𝕩: 𝕩 must be a list" % "testfile.bqn" •FLines 22<"abcd"
!"𝕨 •file.Lines 𝕩: 𝕩 must be a list" % "testfile.bqn" •file.Lines <"abcd"
!"𝕨 •file.Lines 𝕩: Elements of 𝕩 must be lists of characters" % "testfile.bqn" •FLines "abcd"
!"Expected character" % "testfile.bqn" •FLines "ab""cd"
!"Expected character" % "testfile.bqn" •FLines 12
!"Expected character" % "testfile.bqn" •FChars "abcd"
!"𝕨•file.Chars𝕩: 𝕩 must be a list of characters" % "testfile.bqn" •FChars <'a'
!"𝕨 •file.Chars 𝕩: 𝕩 must be a list of characters" % "testfile.bqn" •FChars <'a'
!"Expected character" % "testfile.bqn" •FBytes "abcd"
!"𝕨•file.Bytes𝕩: 𝕩 must be a list" % "testfile.bqn" •file.Bytes <'a'
!"𝕨 •file.Bytes 𝕩: 𝕩 must be a list" % "testfile.bqn" •file.Bytes <'a'
!"Expected character" % "badwrite"•FChars """"
!"Expected character" % "badwrite"•FLines "foo"
!"𝕨•file.Chars𝕩: 𝕩 must be a list of characters" % "badwrite"•FChars @
!"𝕨 •file.Chars 𝕩: 𝕩 must be a list of characters" % "badwrite"•FChars @
! {𝕩•file.Name 𝕩 •FChars "abc"(@+10)"def𝕩"}"testfile.bqn"
! {𝕩•file.Name 𝕩 •FBytes •ToUTF8 "abc"(@+10)"def𝕩"}"testfile2.bqn"
@ -141,11 +141,11 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
! 97989910100101102240157149169 @-˜ •file.MapBytes "testfile.bqn"
•file.Name "testfile3B.bqn" •file.Rename "testfile3.bqn" %% "testfile3B.bqn"
!"𝕨•file.Rename𝕩: Failed to rename file" % "testfile3B.bqn" •file.Rename "testfile.bqn"
!"𝕨 •file.Rename 𝕩: Failed to rename file" % "testfile3B.bqn" •file.Rename "testfile.bqn"
•file.Exists¨ "testfile.bqn""nontestfile.bqn""testfile3.bqn""testfile3B.bqn" %% 1001
¯22•file.Createdir "testdirNested" %% "/testDir/testdirNested"
¯8•file.RealPath "testdirNested/.././" %% "/testDir"
!"•file.CreateDir𝕩: Failed to create directory" % •file.Createdir "testdirNested"
!"•file.CreateDir 𝕩: Failed to create directory" % •file.Createdir "testdirNested"
"testfile.bqn""testfile2.bqn""testfile3.bqn""testfile3B.bqn""testdirNested" •file.List "." %% 11011
"testfile.bqn""testfile2.bqn""testfile3.bqn""testfile3B.bqn""testdirNested" •file.List •file.path %% 11011
@ -171,8 +171,8 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
!"•file.Lines: Path must be a list of characters" % 12 •FLines "abc""def"
!"•file.Type: Path must be a list of characters" % •file.Type 12
!"•file.Exists: Path must be a list of characters" % •file.Exists 12
!"•file.Name𝕩: Argument must be a string" % •file.Name 12
!"•file.Parent𝕩: Argument must be a string" % •file.Parent 12
!"•file.Name 𝕩: Argument must be a string" % •file.Name 12
!"•file.Parent 𝕩: Argument must be a string" % •file.Parent 12
!"•file.MapBytes: Path must be a list of characters" % •file.MapBytes 12
!"•file.CreateDir: Path must be a list of characters" % •file.CreateDir 12
!"•file.RealPath: Path must be a list of characters" % •file.RealPath 12
@ -189,7 +189,7 @@ f←•ReBQN{primitives⇐⋈'÷'‿- ⋄ system⇐⟨"primitives", "foo"‿⋈,
# some of •term
!"Expected character" % •term.OutRaw 2{}
!"•term.ErrRaw𝕩: 𝕩 must be a list" % •term.ErrRaw 220
!"•term.ErrRaw 𝕩: 𝕩 must be a list" % •term.ErrRaw 220
@ -236,16 +236,16 @@ v←1 ⋄ ! •BQN∘•Repr⊸≡ ⟨+,1‿2,+¨,(+V)(V+V),2‿2⥊↕4⟩
t0•MonoTime@ ! 0.1•Delay 0.1 ! 0.1(•MonoTime@)-t0
# •_timed tested more at perf.bqn
!"𝕨𝔽•_timed𝕩: 𝕨 must be an integer greater than 0" % 0 •_timed 2
!"𝕨 𝔽•_timed 𝕩: 𝕨 must be an integer greater than 0" % 0 •_timed 2
!"Expected integer, got character" % @ •_timed 2
a1 a {𝕊: a+𝕩}•_timed 10 %% 11
a3 12 {𝕊: a+𝕩}•_timed 10 a %% 123
# •math
! ´0=|1e10×{(+´𝕩)-•math.Sum 𝕩}¨ 1000•rand.Range 0
!"•math.Sum𝕩: 𝕩 must be a list (⟨⟩ ≡ ≢𝕩)" % •math.Sum 2
!"•math.Sum𝕩: 𝕩 must be a list (2‿2 ≡ ≢𝕩)" % •math.Sum 221
!"•math.Sum𝕩: 𝕩 elements must be numbers" % •math.Sum 1'a'
!"•math.Sum 𝕩: 𝕩 must be a list (⟨⟩ ≡ ≢𝕩)" % •math.Sum 2
!"•math.Sum 𝕩: 𝕩 must be a list (2‿2 ≡ ≢𝕩)" % •math.Sum 221
!"•math.Sum 𝕩: 𝕩 elements must be numbers" % •math.Sum 1'a'
@ -265,15 +265,15 @@ E←•internal.EEqual ⋄ {! (𝕏 4⥊0) E 𝕏 1↓¯1×π∾4⥊0}¨ (⊢∾
1e5×{0.1 𝕏 0.2}¨ •math.Atan2,•math.Comb,•math.Hypot,•math.Atan2,•math.Atan2˜ %% 1107149695922360202749331
1e5×{=˜99¨ 𝕏 0.13}¨ •math.Acos,•math.Acosh,•math.Asin,•math.Asinh,•math.Atan,•math.Atanh,•math.Cbrt,•math.Cos,•math.Cosh,•math.Erf,•math.ErfC,•math.Expm1,•math.Fact,•math.Log10,•math.Log1p,•math.Log2,•math.LogFact,•math.Sin,•math.Sinh,•math.Tan,•math.Tanh %% 1470629900000,9900000176274,100169900000,9983181844,9966124904,100339900000,46415144224,99500¯99000,1005001006766,1124699997,887532,105171908553,95135600000,¯10000047712,9531138629,¯332193158496,¯4988179175,998314112,100161001787,10033¯14255,996699505
{𝕩 ! 12 (𝕏 𝕏¨) 34}¨ •math.Atan2,•math.Comb,•math.Hypot,•math.Atan2,•math.Atan2˜,•math.GCD,•math.LCM
!"𝕨•math.GCD𝕩: Inputs other than natural numbers not yet supported" % 1.5 •math.GCD 3
!"𝕨•math.LCM𝕩: Inputs other than natural numbers not yet supported" % 3 •math.LCM 1.5
!"𝕨•math.LCM𝕩: Unexpected argument types" % "foo" •math.LCM 3
!"𝕨•math.GCD𝕩: Unexpected argument types" % 3 •math.GCD {+}
!"•math.Sin𝕩: 𝕩 contained non-number" % •math.Sin "foo"
!"•math.Log10𝕩: 𝕩 contained non-number" % •math.Log10 "foo"
!"𝕨•math.Atan2𝕩: Unexpected argument types" % 1 •math.Atan2 'a'
!"𝕨•math.Atan2⁼𝕩: Unexpected argument types" % 1 •math.Atan2 {}
!"𝕨•math.Atan2˜𝕩: Unexpected argument types" % {} •math.Atan2˜ 'b'
!"𝕨 •math.GCD 𝕩: Inputs other than natural numbers not yet supported" % 1.5 •math.GCD 3
!"𝕨 •math.LCM 𝕩: Inputs other than natural numbers not yet supported" % 3 •math.LCM 1.5
!"𝕨 •math.LCM 𝕩: Unexpected argument types" % "foo" •math.LCM 3
!"𝕨 •math.GCD 𝕩: Unexpected argument types" % 3 •math.GCD {+}
!"•math.Sin 𝕩: 𝕩 contained non-number" % •math.Sin "foo"
!"•math.Log10 𝕩: 𝕩 contained non-number" % •math.Log10 "foo"
!"𝕨 •math.Atan2 𝕩: Unexpected argument types" % 1 •math.Atan2 'a'
!"𝕨 •math.Atan2⁼ 𝕩: Unexpected argument types" % 1 •math.Atan2 {}
!"𝕨 •math.Atan2˜ 𝕩: Unexpected argument types" % {} •math.Atan2˜ 'b'
# •rand / •MakeRand
0 (•MakeRand 0).Range¨2 %%
@ -281,7 +281,7 @@ E←•internal.EEqual ⋄ {! (𝕏 4⥊0) E 𝕏 1↓¯1×π∾4⥊0}¨ (⊢∾
(•MakeRand 0).Deal 0 %%
0 (•MakeRand 0).Subset 0 %%
{!(•rand.Deal 𝕩)𝕩}¨ ¯101+222 # %SLOW
!"𝕨(rand).Range𝕩: Result rank too large (256≡≢𝕨)" % (2561) •rand.Range 0
!"𝕨 (rand).Range 𝕩: Result rank too large (256≡≢𝕨)" % (2561) •rand.Range 0
! ˝ a{r•MakeRand 𝕩 r.Range 1e9, 100 r.Range 1e9, r.Deal 100, 100 r.Deal 200, 100 r.Deal 200, 100 r.Subset 200}¨ 222 !¨´ a
r•MakeRand 1 ! 1¨ {𝕊: 800 r.Subset 1000}¨ 4
r•MakeRand 1 ! 1¨ {𝕊: 50 r.Subset 10000}¨ 4

View File

@ -18,8 +18,13 @@
!"≍⁼: Argument must have a leading axis of 1" % "foo"
!"≍⁼: Argument must have a leading axis of 1" % 311<"foo"
!"⌽: Argument cannot be a unit" % 0
!"⌽𝕩: 𝕩 cannot be a unit" % 0
10 %% 9-10
!"⍉⁼: 𝕩 must not be an atom" % 3
!"⍉⁼𝕩: 𝕩 must not be an atom" % 3
!"𝕨⍉⁼𝕩: 𝕩 must not be an atom" % 0 3
!"𝕨⍉⁼𝕩: Length of 𝕨 must be at most rank of 𝕩" % 00 3
!"𝕨⍉⁼𝕩: Axis 9 does not exist (1≡=𝕩)" % 9 3
!"𝕨⍉⁼𝕩: Axis 9 does not exist (3≡=𝕩)" % 9 3333
!"𝕨⍉⁼𝕩: 𝕨 must have rank at most 1" % (110) 3
<3 %% <3

View File

@ -1,5 +1,5 @@
!"Out of memory" % a(220) 1e9 •internal.Keep {𝕊: a}˘ a
!"⥊: 𝕨 too large" % a(220) 1e9 •internal.Keep a˘ a
!"𝕨𝕩: 𝕨 too large" % a(220) 1e9 •internal.Keep a˘ a
!"Out of memory" % •internal.Keep (225)/(210)10
!"Out of memory" % k16384 nk÷˜232 •internal.Keep (nk) / n1
!"Out of memory" % k64 nk÷˜232 •internal.Keep (nk) / n1 # %SLOW