diff --git a/meson.build b/meson.build index 631abcb7..53fc82d4 100644 --- a/meson.build +++ b/meson.build @@ -237,7 +237,11 @@ test_files = [ 'test/suite0007.janet', 'test/suite0008.janet', 'test/suite0009.janet', - 'test/suite0010.janet' + 'test/suite0010.janet', + 'test/suite0011.janet', + 'test/suite0012.janet', + 'test/suite0013.janet', + 'test/suite0014.janet' ] foreach t : test_files test(t, janet_nativeclient, args : files([t]), workdir : meson.current_source_dir()) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index df5152d0..27470270 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -839,15 +839,15 @@ a) (defn sort - ``Sort `ind` in-place, and return it. Uses quick-sort and is not a stable sort. + ``Sorts `ind` in-place, and returns it. Uses quick-sort and is not a stable sort. If a `before?` comparator function is provided, sorts elements using that, otherwise uses `<`.`` [ind &opt before?] (sort-help ind 0 (- (length ind) 1) (or before? <))) (defn sort-by - ``Returns `ind` sorted by calling - a function `f` on each element and comparing the result with `<`.`` + ``Sorts `ind` in-place by calling a function `f` on each element and + comparing the result with `<`.`` [f ind] (sort ind (fn [x y] (< (f x) (f y))))) @@ -2065,8 +2065,9 @@ ret) (defn all - ``Returns true if all `xs` are truthy, otherwise the result of first - falsey predicate value, `(pred x)`.`` + ``Returns true if `(pred item)` returns a truthy value for every item in `xs`. + Otherwise, returns the first falsey `(pred item)` result encountered. + Returns true if `xs` is empty.`` [pred xs] (var ret true) (loop [x :in xs :while ret] (set ret (pred x))) diff --git a/src/core/math.c b/src/core/math.c index 67a77992..22d02691 100644 --- a/src/core/math.c +++ b/src/core/math.c @@ -282,7 +282,7 @@ JANET_DEFINE_MATHOP(log2, log2, "Returns the log base 2 of x.") JANET_DEFINE_MATHOP(sqrt, sqrt, "Returns the square root of x.") JANET_DEFINE_MATHOP(cbrt, cbrt, "Returns the cube root of x.") JANET_DEFINE_MATHOP(ceil, ceil, "Returns the smallest integer value number that is not less than x.") -JANET_DEFINE_MATHOP(fabs, fabs, "Return the absolute value of x.") +JANET_DEFINE_MATHOP(abs, fabs, "Return the absolute value of x.") JANET_DEFINE_MATHOP(floor, floor, "Returns the largest integer value number that is not greater than x.") JANET_DEFINE_MATHOP(trunc, trunc, "Returns the integer between x and 0 nearest to x.") JANET_DEFINE_MATHOP(round, round, "Returns the integer nearest to x.") @@ -368,7 +368,7 @@ void janet_lib_math(JanetTable *env) { JANET_CORE_REG("math/floor", janet_floor), JANET_CORE_REG("math/ceil", janet_ceil), JANET_CORE_REG("math/pow", janet_pow), - JANET_CORE_REG("math/abs", janet_fabs), + JANET_CORE_REG("math/abs", janet_abs), JANET_CORE_REG("math/sinh", janet_sinh), JANET_CORE_REG("math/cosh", janet_cosh), JANET_CORE_REG("math/tanh", janet_tanh), diff --git a/src/core/os.c b/src/core/os.c index daa4bad4..88422a4c 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -209,6 +209,8 @@ JANET_CORE_FN(os_exit, return janet_wrap_nil(); } +#ifndef JANET_REDUCED_OS + JANET_CORE_FN(os_cpu_count, "(os/cpu-count &opt dflt)", "Get an approximate number of CPUs available on for this process to use. If " @@ -250,7 +252,6 @@ JANET_CORE_FN(os_cpu_count, #endif } -#ifndef JANET_REDUCED_OS #ifndef JANET_NO_PROCESSES