Functions over predicates and functions.
Function or value | Description | ||
Full Usage:
can f x
Parameters:
'a -> 'b
-
The function to test.
x : 'a
-
The argument on which to test the function.
Returns: bool
true, if f x succeeds; false, otherwise.
|
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 head: list: 'T list -> 'T
Evaluates to true .
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 head: list: 'T list -> 'T
Evaluates to false .
|
||
Full Usage:
check p x
Parameters:
'a -> bool
-
The input predicate.
x : 'a
-
The element that should satisfy the predicate.
Returns: 'a
The input element x itself, if it satisfies p .
|
Example
Evaluates to true .
Example
Throws System.Exception: check .
|
||
Full Usage:
funpow n f x
Parameters:
int
-
The number of times to apply the function.
f : 'a -> 'a
-
The function to apply.
x : 'a
-
The element to apply the function to.
Returns: 'a
The result of applying f to x for n times, if
n is >= 0. Otherwise, the input argument x unchanged.
|
Example
Evaluates to 16.
Example
Evaluates to 2.
Example
Evaluates to 2.
Example
Throws System.DivideByZeroException:
Attempted to divide by zero.
|
||
Full Usage:
non p x
Parameters:
'a -> bool
-
The predicate to reverse.
x : 'a
-
The element to apply the inverse to.
Returns: bool
true if p x returns false, otherwise false.
Modifiers: inline Type parameters: 'a |
|||
Full Usage:
repeat f x
Parameters:
'a -> 'a
-
The function to apply.
x : 'a
-
The element to apply the function to.
Returns: 'a
x , if the application of f x fails.
|
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 removeAt: index: int -> source: 'T list -> 'T list
Evaluates to [] .
|