mirror of
https://github.com/janet-lang/janet
synced 2026-10-11 10:11:41 +00:00
Align some parameter names (#1889)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
This commit is contained in:
+3
-3
@@ -2171,12 +2171,12 @@
|
||||
contents)
|
||||
|
||||
(defn spit
|
||||
``Write `contents` to a file at `path`. Can optionally append to the file.``
|
||||
[path contents &opt mode]
|
||||
``Write `bytes` to a file at `path`. Can optionally append to the file.``
|
||||
[path bytes &opt mode]
|
||||
(default mode :wb)
|
||||
(def f (file/open path mode))
|
||||
(if-not f (error (string "could not open file " path " with mode " mode)))
|
||||
(file/write f contents)
|
||||
(file/write f bytes)
|
||||
(file/close f)
|
||||
nil)
|
||||
|
||||
|
||||
+1
-1
@@ -236,7 +236,7 @@ JANET_CORE_FN(cfun_array_ensure,
|
||||
}
|
||||
|
||||
JANET_CORE_FN(cfun_array_slice,
|
||||
"(array/slice arrtup &opt start end)",
|
||||
"(array/slice ind &opt start end)",
|
||||
"Same as `tuple/slice`, but returns an array.") {
|
||||
JanetView view = janet_getindexed(argv, 0);
|
||||
JanetRange range = janet_getslice(argc, argv);
|
||||
|
||||
+12
-11
@@ -447,12 +447,13 @@ JANET_CORE_FN(cfun_string_replaceall,
|
||||
}
|
||||
|
||||
JANET_CORE_FN(cfun_string_split,
|
||||
"(string/split delim str &opt start limit)",
|
||||
"Splits a string `str` with delimiter `delim` and returns an array of "
|
||||
"substrings. The substrings will not contain the delimiter `delim`. If `delim` "
|
||||
"is not found, the returned array will have one element. Will start searching "
|
||||
"for `delim` at the index `start` (if provided), and return up to a maximum "
|
||||
"of `limit` results (if provided).") {
|
||||
"(string/split sep str &opt start limit)",
|
||||
"Splits a string `str` with separator `sep` and returns an "
|
||||
"array of substrings. The substrings will not contain `sep`. "
|
||||
"If `sep` is not found, the returned array will have one "
|
||||
"element. Will start searching for `sep` at the index `start` "
|
||||
"(if provided), and return up to a maximum of `limit` results "
|
||||
"(if provided).") {
|
||||
int32_t result;
|
||||
JanetArray *array;
|
||||
struct kmp_state state;
|
||||
@@ -475,11 +476,11 @@ JANET_CORE_FN(cfun_string_split,
|
||||
}
|
||||
|
||||
JANET_CORE_FN(cfun_string_checkset,
|
||||
"(string/check-set bytes str)",
|
||||
"Checks that the string `str` only contains bytes that appear "
|
||||
"in the string `bytes`. Returns true if all bytes in `str` "
|
||||
"appear in `bytes`, false if some bytes in `str` do not appear "
|
||||
"in `bytes`.") {
|
||||
"(string/check-set set-bytes bytes)",
|
||||
"Checks that only bytes from `set-bytes` are contained in "
|
||||
"`bytes`. Returns true if all bytes in `bytes` appear in "
|
||||
"`set-bytes` or false if at least one byte in `bytes` does "
|
||||
"not appear in `set-bytes`. Both arguments are bytes types.") {
|
||||
uint32_t bitset[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
janet_fixarity(argc, 2);
|
||||
JanetByteView set = janet_getbytes(argv, 0);
|
||||
|
||||
Reference in New Issue
Block a user