Searching functions.
Function or value | Description | ||
Full Usage:
mapfilter f l
Parameters:
'a -> 'b
-
The input function.
l : 'a list
-
The input list.
Returns: 'b list
The list of successful application's results.
|
Example
Multiple items
val string: value: 'T -> string -------------------- type string = System.String val failwith: message: string -> 'T
Evaluates to ["2"; "4"] .
Example
Multiple items
val string: value: 'T -> string -------------------- type string = System.String val failwith: message: string -> 'T
Evaluates to [] .
|
||
Full Usage:
maximize f l
Parameters:
'a -> 'b
-
The input function.
l : 'a list
-
The input list.
Returns: 'a
The element of the list that maximises the function.
|
|||
Full Usage:
minimize f l
Parameters:
'a -> 'b
-
The input function.
l : 'a list
-
The input list.
Returns: 'a
The element of the list that minimizes the function.
|
|||
Full Usage:
optimize ord f l
Parameters:
'a -> 'a -> bool
-
The order that defines whether to maximize or minimize.
f : 'b -> 'a
-
The input function.
l : 'b list
-
The input list.
Returns: 'b
The element of the list that optimizes the function.
|
Used to define maximize and minimize.
Example
Evaluates to -1 .
Example
Evaluates to 3 .
|
||
Full Usage:
tryfind f l
Parameters:
'a -> 'b
-
The input function.
l : 'a list
-
The input list.
Returns: 'b
The first successful application of the function to an element of the
list.
|
Fails with tryfind if the application of the function fails for all elements in the list. This will always be the case if the list is empty.
NotePerhaps it could be replaced with the standard ListModule.TryPick. Example
Multiple items
val string: value: 'T -> string -------------------- type string = System.String val failwith: message: string -> 'T
Evaluates to "2" .
Example
Multiple items
val string: value: 'T -> string -------------------- type string = System.String val failwith: message: string -> 'T
Throws System.Exception: tryfind .
|