summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-11-29 10:45:17 +0000
committerubq323 <ubq323@ubq323.website>2024-11-29 10:45:17 +0000
commit9a0a4ee19eebc08e5ec3b2d256476016d128b090 (patch)
treeb769535dc915679ae1821393869d7aab693c434d
parent83056a82a6d55f7edf2d7216d30000a4a6482310 (diff)
schars-ascii -> sbytesHEADtrunk
-rw-r--r--doc.txt2
-rw-r--r--lib.c8
-rw-r--r--tests/sbytes.bth1
-rw-r--r--tests/sbytes.out (renamed from tests/schars_ascii.out)0
-rw-r--r--tests/schars_ascii.bth1
5 files changed, 6 insertions, 6 deletions
diff --git a/doc.txt b/doc.txt
index b597f46..f4b2439 100644
--- a/doc.txt
+++ b/doc.txt
@@ -57,7 +57,7 @@
(s,@ a): spendsplat. (s,@ [a b c]) <=> (s, a b c)
(ssub? needle haystack): is substring?
(ssplit delim text): splits text on delim, delim is removed from sections
- (schars-ascii s): returns arr containing ascii chars (bytes) in s
+ (sbytes s): returns arr containing bytes in s
(sin x) (cos x) (ceil x) (floor x) (abs x): should be obvious
# cmdline args
diff --git a/lib.c b/lib.c
index 01f5110..33ca58b 100644
--- a/lib.c
+++ b/lib.c
@@ -156,9 +156,9 @@ static Val fn_ssplit(State *S, int nargs, Val *args) {
return VAL_OBJ(out);
}
-static Val fn_schars_ascii(State *S, int nargs, Val *args) {
- CHECK(nargs==1, "need exactly 1 args for schars-ascii");
- CHECK(IS_STRING(args[0]), "need string arg for schars-ascii");
+static Val fn_sbytes(State *S, int nargs, Val *args) {
+ CHECK(nargs==1, "need exactly 1 args for sbytes");
+ CHECK(IS_STRING(args[0]), "need string arg for sbytes");
ObjString *s = AS_STRING(args[0]);
ObjArr *a = objarr_new(S);
for (int i = 0; i < s->len; i++)
@@ -220,7 +220,7 @@ static BuiltinFunc builtin_funcs[] = {
{ "s,@", fn_spendsplat },
{ "ssub?", fn_ssub },
{ "ssplit", fn_ssplit },
- { "schars-ascii", fn_schars_ascii },
+ { "sbytes", fn_sbytes },
{ "sin", fn_sin },
{ "cos", fn_cos },
diff --git a/tests/sbytes.bth b/tests/sbytes.bth
new file mode 100644
index 0000000..cce7c8a
--- /dev/null
+++ b/tests/sbytes.bth
@@ -0,0 +1 @@
+(say (sbytes "hello world\n"))
diff --git a/tests/schars_ascii.out b/tests/sbytes.out
index b00b046..b00b046 100644
--- a/tests/schars_ascii.out
+++ b/tests/sbytes.out
diff --git a/tests/schars_ascii.bth b/tests/schars_ascii.bth
deleted file mode 100644
index 402017b..0000000
--- a/tests/schars_ascii.bth
+++ /dev/null
@@ -1 +0,0 @@
-(say (schars-ascii "hello world\n"))