From 4debe3446cdeb030131121dae1b6477dfc1de0ed Mon Sep 17 00:00:00 2001 From: Charlotte Koch Date: Sun, 20 Nov 2022 20:51:49 -0800 Subject: [PATCH] Explicitly mention that `sort-by` sorts a list in place. --- src/boot/boot.janet | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 4b0af9cd..66b2c5f2 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)))))