mirror of
https://github.com/janet-lang/janet
synced 2025-09-07 13:28:03 +00:00
Update sort documentation.
This commit is contained in:
@@ -783,8 +783,8 @@
|
|||||||
(sort-help a 0 (- (length a) 1) (or by <)))
|
(sort-help a 0 (- (length a) 1) (or by <)))
|
||||||
|
|
||||||
(defn sort-by
|
(defn sort-by
|
||||||
`Returns a new sorted array that compares elements by invoking
|
``Returns `ind` sorted by calling
|
||||||
a function on each element and comparing the result with <.`
|
a function `f` on each element and comparing the result with <.``
|
||||||
[f ind]
|
[f ind]
|
||||||
(sort ind (fn [x y] (< (f x) (f y)))))
|
(sort ind (fn [x y] (< (f x) (f y)))))
|
||||||
|
|
||||||
@@ -794,8 +794,8 @@
|
|||||||
(sort (array/slice ind) by))
|
(sort (array/slice ind) by))
|
||||||
|
|
||||||
(defn sorted-by
|
(defn sorted-by
|
||||||
`Returns a new sorted array that compares elements by invoking
|
``Returns a new sorted array that compares elements by invoking
|
||||||
a function on each element and comparing the result with <.`
|
a function `f` on each element and comparing the result with <.``
|
||||||
[f ind]
|
[f ind]
|
||||||
(sorted ind (fn [x y] (< (f x) (f y)))))
|
(sorted ind (fn [x y] (< (f x) (f y)))))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user