JanetDocsPlaygroundI'm feeling luckyGitHub sign in

sorted-by



    function
    boot.janet on line 861, column 1

    (sorted-by f ind)

    Returns a new sorted array that compares elements by invoking a 
    function `f` on each element and comparing the result with `<`.


1 exampleSign in to add an example
Loading...
(sorted-by > @[1 2 3 4 5 6 7 8 9 10 11 12]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]

(sorted-by < @[1 2 3 4 5 6 7 8 9 10 11 12]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]

(sorted-by = @[1 2 3 4 5 6 7 8 9 10 11 12]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]


jgartePlayground