Sorting functions.
Function or value | Description |
Full Usage:
decreasing f x y
Parameters:
'a -> 'b
-
The function based on which to compare x and y .
x : 'a
-
The supposed greater element.
y : 'a
-
The supposed smaller element.
Returns: bool
true if x is greater than y based on f , otherwise
false.
|
decreasing predicate to use with Sort.sort.
Example
Multiple items
module List from Microsoft.FSharp.Collections -------------------- type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ... val length: list: 'T list -> int
Evaluates to true .
|
Full Usage:
increasing f x y
Parameters:
'a -> 'b
-
The function based on which to compare x and y .
x : 'a
-
The supposed smaller element.
y : 'a
-
The supposed greater element.
Returns: bool
true if x is less than y based on f , otherwise
false.
|
increasing predicate to use with Sort.sort.
Example
Multiple items
module List from Microsoft.FSharp.Collections -------------------- type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ... val length: list: 'T list -> int
Evaluates to true .
|
Full Usage:
merge ord l1 l2
Parameters:
'a -> 'a -> bool
-
The input ordering.
l1 : 'a list
-
The first list to be merged.
l2 : 'a list
-
The second list to be merged.
Returns: 'a list
The merged list.
|
If two lists
NoteIt never fails, but if the lists are not appropriately sorted the results will not in general be correct. Example
Evaluates to [1;2;3;4;5;6;7] .
Example
Evaluates to [1; 3; 4; 6; 5; 2; 7] .
Note that since the second input list was not sorted, the result is not sorted either. |
Full Usage:
sort ord l
Parameters:
'a -> 'a -> bool
-
The ordering relation.
l : 'a list
-
The input list.
Returns: 'a list
The sorted list.
|
The call
Example
Evaluates to [1;1;2;3;3;4;5;5;5;6;9] .
|