FSharpx.Collections


Map Module

Extensions for F#'s Map module.

Functions and values

Function or value Description

Map.catOptionKeys table

Full Usage: Map.catOptionKeys table

Parameters:
Returns: Map<'a, 'b>

The catOptions function takes a map of Options and values and returns a map of all the Some keys and values.

table : Map<Option<'a>, 'b>
Returns: Map<'a, 'b>

Map.catOptionValues table

Full Usage: Map.catOptionValues table

Parameters:
Returns: Map<'a, 'b>

The catOptions function takes a map of keys and Options and returns a map of all the keys and Some values.

table : Map<'a, Option<'b>>
Returns: Map<'a, 'b>

Map.choose f map

Full Usage: Map.choose f map

Parameters:
    f : 'T -> 'b -> 'c option
    map : Map<'T, 'b>

Returns: Map<'T, 'c>
f : 'T -> 'b -> 'c option
map : Map<'T, 'b>
Returns: Map<'T, 'c>

Map.equalsWith eq xs ys

Full Usage: Map.equalsWith eq xs ys

Parameters:
    eq : 'a * 'b -> 'a * 'b -> bool
    xs : Map<'a, 'b>
    ys : Map<'a, 'b>

Returns: bool

Compares two maps for equality using the given comparison function, element by element.

eq : 'a * 'b -> 'a * 'b -> bool
xs : Map<'a, 'b>
ys : Map<'a, 'b>
Returns: bool

Map.findOrDefault key defaultValue map

Full Usage: Map.findOrDefault key defaultValue map

Parameters:
    key : 'T
    defaultValue : 'b
    map : Map<'T, 'b>

Returns: 'b
key : 'T
defaultValue : 'b
map : Map<'T, 'b>
Returns: 'b

Map.insertWith f key defaultValue map

Full Usage: Map.insertWith f key defaultValue map

Parameters:
    f : 'a -> 'a -> 'a
    key : 'b
    defaultValue : 'a
    map : Map<'b, 'a>

Returns: Map<'b, 'a>

insertWith f key defaultValue mp
will insert the pair
(key, value)
into
mp
if
key
does not exist in the map. If the key does exist, the function will insert
f defaultValue oldValue
.

f : 'a -> 'a -> 'a
key : 'b
defaultValue : 'a
map : Map<'b, 'a>
Returns: Map<'b, 'a>

Map.keySet map

Full Usage: Map.keySet map

Parameters:
    map : Map<'a, 'b>

Returns: Set<'a>

Retrieves the key set from a Map

map : Map<'a, 'b>
Returns: Set<'a>

Map.keys map

Full Usage: Map.keys map

Parameters:
    map : Map<'T, 'b>

Returns: seq<'T>

Retrieves the keys from a Map

map : Map<'T, 'b>
Returns: seq<'T>

Map.removeMany keys map

Full Usage: Map.removeMany keys map

Parameters:
    keys : seq<'T>
    map : Map<'T, 'b>

Returns: Map<'T, 'b>

Allows to remove many keys from a Map

keys : seq<'T>
map : Map<'T, 'b>
Returns: Map<'T, 'b>

Map.spanWithKey pred map

Full Usage: Map.spanWithKey pred map

Parameters:
    pred : 'a -> bool
    map : Map<'a, 'b>

Returns: Map<'a, 'b> * Map<'a, 'b>
pred : 'a -> bool
map : Map<'a, 'b>
Returns: Map<'a, 'b> * Map<'a, 'b>

Map.splitWithKey pred d

Full Usage: Map.splitWithKey pred d

Parameters:
    pred : 'a -> bool
    d : Map<'a, 'b>

Returns: Map<'a, 'b> * Map<'a, 'b>
pred : 'a -> bool
d : Map<'a, 'b>
Returns: Map<'a, 'b> * Map<'a, 'b>

Map.union loses wins

Full Usage: Map.union loses wins

Parameters:
    loses : Map<'a, 'b>
    wins : Map<'a, 'b>

Returns: Map<'a, 'b>

Combines the two Maps into a single Map

loses : Map<'a, 'b>
wins : Map<'a, 'b>
Returns: Map<'a, 'b>

Map.updateWith f key map

Full Usage: Map.updateWith f key map

Parameters:
    f : 'a -> 'a option
    key : 'b
    map : Map<'b, 'a>

Returns: Map<'b, 'a>

update f k map
updates the value
x
at key
k
(if it is in the map). If
f x
is
None
, the element is deleted. If it is
Some y
, the key is bound to the new value
y
.

f : 'a -> 'a option
key : 'b
map : Map<'b, 'a>
Returns: Map<'b, 'a>

Map.valueList map

Full Usage: Map.valueList map

Parameters:
    map : Map<'a, 'b>

Returns: 'b list
map : Map<'a, 'b>
Returns: 'b list

Map.values map

Full Usage: Map.values map

Parameters:
    map : Map<'T, 'b>

Returns: seq<'b>

Retrieves the values from a Map

map : Map<'T, 'b>
Returns: seq<'b>