Skip to content

Commit

Permalink
Merge branch 'master' of github.com:janet-lang/janet
Browse files Browse the repository at this point in the history
  • Loading branch information
bakpakin committed Jan 7, 2023
2 parents 2093ab2 + 0a8eb9e commit b73855b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
6 changes: 5 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
11 changes: 6 additions & 5 deletions src/boot/boot.janet
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))

Expand Down Expand Up @@ -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)))
Expand Down
4 changes: 2 additions & 2 deletions src/core/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/core/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -250,7 +252,6 @@ JANET_CORE_FN(os_cpu_count,
#endif
}

#ifndef JANET_REDUCED_OS

#ifndef JANET_NO_PROCESSES

Expand Down

0 comments on commit b73855b

Please sign in to comment.