Skip to content

Sync docs for belt_SortArrayString.mli #5432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions jscomp/others/belt_SortArrayString.mli
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
(* ```res prelude
* type element = string
* ```
*)

# 2 "others/sort.cppo.mli"
(* Copyright (C) 2017 Authors of ReScript
Expand Down Expand Up @@ -25,8 +29,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)


(** This is a specialized module for [`Belt_SortArray`](), the docs in that module also
applies here, except the comparator is fixed and inlined
(**
This is a specialized module for `Belt.SortArray`, the docs in that module also
applies here, except the comparator is fixed and inlined.
*)

# 34 "others/sort.cppo.mli"
Expand All @@ -35,35 +40,34 @@ type element = string
# 39 "others/sort.cppo.mli"
val strictlySortedLength: element array -> int
(**
The same as [`Belt_SortArray.strictlySortedLength`]() except the comparator is fixed
The same as `Belt.SortArray.strictlySortedLength` except the comparator is fixed.

**return** `+n` means increasing order `-n` means negative order
Returns `+n` means increasing order `-n` means negative order.
*)


val isSorted: element array -> bool
(** `sorted xs` return true if `xs` is in non strict increasing order *)
(** `isSorted(xs)` return true if `xs` is in non strict increasing order. *)

val stableSortInPlace: element array -> unit
(**
The same as [`Belt_SortArray.stableSortInPlaceBy`]() except the comparator is fixed
The same as `Belt.SortArray.stableSortInPlaceBy` except the comparator is fixed.
*)

val stableSort: element array -> element array
(** The same as [`Belt_SortArray.stableSortBy`]() except the comparator is fixed *)
(** The same as `Belt.SortArray.stableSortBy` except the comparator is fixed. *)

val binarySearch: element array -> element -> int
(**
If value is not found and value is less than one or more elements in array,
the negative number returned is the bitwise complement of the index of the first element
If value is not found and value is less than one or more elements in array, the
negative number returned is the bitwise complement of the index of the first element
that is larger than value.

If value is not found and value is greater than all elements in array,
the negative number returned is the bitwise complement of
(the index of the last element plus 1)
If value is not found and value is greater than all elements in array, the negative
number returned is the bitwise complement of (the index of the last element plus 1)

for example, if `key` is smaller than all elements return `-1` since `lnot (-1) = 0`
if `key` is larger than all elements return `- (len + 1)` since `lnot (-(len+1)) = len`
for example, if `key` is smaller than all elements return `-1` since `lnot(-1) = 0`
if `key` is larger than all elements return `- (len + 1)` since `lnot(-(len+1)) = len`.
*)

(**/**)
Expand Down