Dict Module
Static Functions on IDictionary Interface
Functions and values
Function or value |
Description
|
Full Usage:
Dict.add key value dic
Parameters:
'Key
value : 'Value
dic : IDictionary<'Key, 'Value>
|
Set value at key in a IDictionary just d.[k]<-v
|
Full Usage:
Dict.addIfKeyAbsent key value dic
Parameters:
'Key
value : 'Value
dic : IDictionary<'Key, 'Value>
Returns: bool
|
Set value only if key does not exist yet.
Returns false if key already exist, does not set value in this case
Same as
|
|
|
|
Get value at key from IDictionary, with nicer Error messages
|
Full Usage:
Dict.getOrSetDefault getDefault key dic
Parameters:
'Key -> 'Value
key : 'Key
dic : IDictionary<'Key, 'Value>
Returns: 'Value
|
If the key ist not present calls the default function, set it as value at the key and return the value. This function is an alternative to the DefaultDict type. Use it if you need to provide a custom implementation of the default function depending on the key.
|
Full Usage:
Dict.getOrSetDefaultValue defaultValue key dic
Parameters:
'Value
key : 'Key
dic : IDictionary<'Key, 'Value>
Returns: 'Value
|
If the key ist not present set it as value at the key and return the value.
|
|
Returns a (lazy) sequence of key and value tuples
|
|
Iterate over keys and values of a Dict
|
|
|
Full Usage:
Dict.map f dic
Parameters:
'Key -> 'Value -> 'T
dic : IDictionary<'Key, 'Value>
Returns: 'T seq
|
Map over keys and values of a Dict
|
Full Usage:
Dict.memoize f
Parameters:
'T -> 'U
Returns: 'T -> 'U
|
Caches the results of a function in a Dictionary. The argument 'T is packed in a wrapper so it can be unit or null(=None) too. (A Dictionary would fail on a null as key )
|
|
Get a value and remove key and value it from dictionary, like *.pop() in Python. Will fail if key does not exist
|
Full Usage:
Dict.set key value dic
Parameters:
'Key
value : 'Value
dic : IDictionary<'Key, 'Value>
|
Set value at key in a IDictionary just d.[k]<-v
|
Full Usage:
Dict.setIfKeyAbsent key value dic
Parameters:
'Key
value : 'Value
dic : IDictionary<'Key, 'Value>
Returns: bool
|
Set value only if key does not exist yet.
Returns false if key already exist, does not set value in this case
Same as
|
Full Usage:
Dict.tryGet k dic
Parameters:
'Key
dic : IDictionary<'Key, 'Value>
Returns: 'Value option
|
Tries to get a value from a IDictionary
|
Full Usage:
Dict.tryPop key dic
Parameters:
'Key
dic : IDictionary<'Key, 'Value>
Returns: 'Value option
|
Tries to get a value and remove key and value it from dictionary, like *.pop() in Python. Will return None if key does not exist
|
|