List Module
Finds, replaces, removes and counts the elements of a list and builds the rotations and combinations of lists.
Functions and values
| Function or value |
Description
|
Full Usage:
List.collectLists p
Parameters:
'a -> bool
Returns: 'a list list -> 'a list
Type parameters: 'a |
|
Full Usage:
List.combinations xss
Parameters:
'a list
Returns: 'b list list
Type parameters: 'a, 'b (requires :> 'b Microsoft.FSharp.Collections.seq) |
Every combination of one element of each list, in order: no lists give one empty combination, and an empty list gives none.
|
Full Usage:
List.countByList xs1 xs2
Parameters:
string list
xs2 : string list
Returns: (string * int) list
|
|
Full Usage:
List.distinct xs
Parameters:
'a list
Returns: 'a list
Type parameters: 'a (requires equality) |
|
Full Usage:
List.findNearestMax n ns
Parameters:
^a
ns : ^a list
Returns: ^a
Modifiers: inline Type parameters: ^a, 'b (requires comparison and (static member op_Subtraction : ^a * ^a -> 'b) and (static member op_Subtraction : ^a * ^a -> 'b) and comparison) |
|
Full Usage:
List.hasExactlyOne pred xs
Parameters:
'a -> bool
xs : 'a list
Returns: bool
Type parameters: 'a |
|
Full Usage:
List.headTail xs
Parameters:
'a list
Returns: 'a option * 'a option
Type parameters: 'a |
|
Full Usage:
List.isConsecutive zero diff xs
Parameters:
^a
diff : 'b
xs : ^a list
Returns: bool
Modifiers: inline Type parameters: ^a, 'b (requires comparison and (static member op_Subtraction : ^a * ^a -> 'b) and equality) |
|
Full Usage:
List.listFilter p
Parameters:
'a -> bool
Returns: 'a list list -> 'a list list
Type parameters: 'a |
filter a list of lists
|
|
|
|
Prism onto the element at index i of a list: getOpt returns it when the list is long enough, set replaces it in place and is a no-op otherwise. Matches Aether's Optics.List.pos_, which the ZForm optics compose onto.
|
Full Usage:
List.prepend xs1 xs2
Parameters:
'a list
xs2 : 'a list
Returns: 'a list
Type parameters: 'a |
Concatenates two lists, placing the elements of xs2 before the elements of xs1. /// Example: [1;2] |> prepend [3;4] = [1;2;3;4]
|
Full Usage:
List.remove pred xs
Parameters:
'a -> bool
xs : 'a list
Returns: 'a list
Type parameters: 'a |
In summary, the remove function removes the first element in the list that satisfies the given predicate, while keeping the order of the other elements intact. If no element satisfying the predicate is found, the original list is returned unchanged.
|
Full Usage:
List.removeDuplicates xs
Parameters:
'a list
Returns: 'a list
Type parameters: 'a (requires equality) |
|
Full Usage:
List.removeFirst pred
Parameters:
'a -> bool
Returns: 'a list -> 'a list
Type parameters: 'a |
|
Full Usage:
List.replace pred x xs
Parameters:
'a -> bool
x : 'a
xs : 'a list
Returns: 'a list
Type parameters: 'a |
Replace an element x in a list xs when the pred function returns true. Note: will only replace the *first* element that satisfies the condition in pred Example: [1;2;3;2] |> replace (fun x -> x = 2) 4 = [1;4;3;2]
|
Full Usage:
List.replaceOrAdd pred x xs
Parameters:
'a -> bool
x : 'a
xs : 'a list
Returns: 'a list
Type parameters: 'a |
|
Full Usage:
List.rotations xs
Parameters:
'a list
-
The input list to rotate
Returns: 'a list list
An array of lists containing all possible rotations
Type parameters: 'a |
Generate all possible cyclic rotations of a list. Each rotation moves one element from its current position to the front, creating n different arrangements where n is the length of the list.
Example
|
Full Usage:
List.sequenceOption xs
Parameters:
'a option list
Returns: 'a list option
Type parameters: 'a |
The values of the options when every option has a value; None when one has none.
|
Full Usage:
List.someIfOne _arg1
Parameters:
'a list
Returns: 'a option
Type parameters: 'a |
|
Full Usage:
List.toString xs
Parameters:
'a list
Returns: string
Modifiers: inline Type parameters: 'a |
|
Full Usage:
List.toString2 xs
Parameters:
'a list
Returns: string
Modifiers: inline Type parameters: 'a |
|
Full Usage:
List.tryFindFirst get n xs
Parameters:
'a -> 'b
n : 'b
xs : 'a list list
Returns: 'a option
Type parameters: 'a, 'b (requires equality) |
Try to find the first element with n in a list of list xsl with a function get to get n from an element
|
Full Usage:
List.tryFindInList pred xs
Parameters:
'a -> bool
xs : 'a list list
Returns: 'a option
Type parameters: 'a |
|
Full Usage:
List.tryFindRest pred xs
Parameters:
'a -> bool
xs : 'a list
Returns: 'a option * 'a list
Type parameters: 'a |
|
GenPRES