Polymorphic Finite Partial functions via Patricia Trees.
Type | Description |
Function or value | Description | ||
|
|||
Example
Evaluates to [("x", 1)] .
|
|||
Full Usage:
apply fpf a
Parameters:
func<'a, 'b>
-
The fpf to be applied.
a : 'a
-
The supposed fpf's argument.
Returns: 'b
The fpf 's value for a , if fpf is
actually defined for it.
|
Example
Evaluates to 2 .
Example
Throws System.Exception: apply .
|
||
Full Usage:
applyd fpf d a
Parameters:
func<'a, 'b>
-
The fpf to be applied.
d : 'a -> 'b
-
The function to apply to x , if it's not an argument of the fpf .
a : 'a
-
The supposed fpf's argument.
Returns: 'b
The fpf 's value for a , if fpf is
actually defined for it, otherwise applies d to x .
|
|
||
Full Usage:
defined fpf a
Parameters:
func<'a, 'b>
-
The fpf to check.
a : 'a
-
The argument to check.
Returns: bool
true if fpf is defined for a .
|
Example
Evaluates to true .
Example
Evaluates to false .
|
||
Example
Evaluates to ["x"; "y"] .
|
|||
Full Usage:
foldl folder state fpf
Parameters:
'State -> 'a -> 'b -> 'State
-
The normal F# function to update the state given the input fpf.
state : 'State
-
The initial state.
fpf : func<'a, 'b>
-
The input fpf
Returns: 'State
The final state value.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to the argument and value of an fpf, threading
an accumulator argument through the computation. Take the second
argument, and apply the function to it and the first argument and value
of the fpf. Then feed this result into the function along with the
second argument and value and so on. Return the final result. If the
input function is It is, for finite partial functions, the same operation that ListModule.Fold is for list.
Example
Evaluates to 3 .
|
||
Example
Evaluates to [(1, 1); (2, 4); (3, 9)] .
|
|||
Example
Evaluates to [("x", 1); ("y", 2)] .
|
|||
Full Usage:
is_undefined _arg1
Parameters:
func<'a, 'b>
-
The function to be checked.
Returns: bool
True if the function is undefined.
|
In case of equality comparison worries, better use this.
Example
Evaluates to true .
Example
Evaluates to false .
|
||
|
It is, for finite partial functions, the same operation that ListModule.Map is for list.
Example
Evaluates to Leaf (..., [("x", 10)]) .
|
||
Example
Evaluates to [1; 2] .
|
|||
Full Usage:
tryapplyd fpf a d
Parameters:
func<'a, 'b>
-
The fpf to be applied.
a : 'a
-
The supposed fpf's argument.
d : 'b
-
The default value to return in case of failure.
Returns: 'b
The fpf's value for a , if fpf is actually defined for it.
Otherwise, the default value d .
|
Example
Evaluates to 1 .
Example
Evaluates to 9 .
|
||
Full Usage:
tryapplyl fpf a
Parameters:
func<'a, 'b list>
-
The input fpf to be applied.
a : 'a
-
The supposed fpf's argument.
Returns: 'b list
The fpf's value for a , if fpf is actually defined for it.
Otherwise, the default value [] .
|
Example
Evaluates to [1;2;3] .
Example
Evaluates to [] .
|
||
Full Usage:
undef x
Parameters:
'a
Returns: 'b
|
It is to be the same thing of what Fpf.undefined is in the context of the finite partial functions.
Note
In a non-functional world you can create a list of values and
initialize the list signifying nothing: e.g. In a functional world you can create a list of functions and initialize the list with a function causing an exception given that the items is the list are evaluated as functions. undef is that function which is used to initialize a list to cause an exception if the list is empty when evaluated. Example
Multiple items
Throws val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int System.Exception: undefined function .
Example
Evaluates to 100 .
|
||
|
Example
Evaluates to Leaf (..., [("y", 2)]) .
Example
val input: obj
Evaluates to true .
|
||
|
|||
Full Usage:
valmod a b f x
Parameters:
'a
-
The argument to update.
b : 'b
-
The value to assign to the argument.
f : 'a -> 'b
-
The F# function to update.
x : 'a
-
The argument to apply the modified function to.
Returns: 'b
The new value, if applied to the updated argument. Otherwise, the value
of the original function.
|
Corresponds to the mathematical notation \((a \mapsto b)f\) and it is
the same thing of what
Example
val id: x: 'T -> 'T
Evaluates to 100 .
Example
val id: x: 'T -> 'T
Evaluates to 2 .
|