[Home] Module Microsoft.FSharp.MLLib.Map


Immutable maps (aka dictionaries), implemented as binary trees.

Types

TypeDescription
type CMap Immutable maps using user-defined comparison. Use Map.Make to specify a new kind of CMap. For maps of strings to integers:
    let Totals : (string,int) Map.CMapOps = 
        Map.Make(MyStringComparisonFunction)
    ...
    Totals.empty
    Totals.add "a" 3 Totals.empty
 
type CMapOps A collection of operations for creating and using maps based on a particular comparison function.
type Component

Deprecated: This name is deprecated. Use CMapOps instead

Note: an abbreviation for CMapOps <'a,'b>
type Map Immutable maps using structural comparison Maps based on structural comparison are efficient. They are not a suitable choice if keys are recursive data structures or require non-structural comparison semantics.
type t For use when not opening module, e.g. Map.t Note: an abbreviation for Map <'key,'a>
type UserMap

Deprecated: This name is deprecated. Use CMap instead

Note: an abbreviation for ('a,'b) CMap

Values

ValueDescription
val add : 'key -> 'a -> Map <'key,'a> -> Map <'key,'a>
Return a new map with the binding added to the given map.
val empty : Map <'key,'a>
The empty map
val find : 'key -> Map <'key,'a> -> 'a
Lookup an element in the map, raising [[Not_found]]/[[IndexOutOfRangeException]] if no binding exists in the map.
val first : ('key -> 'a -> 'b option) -> Map <'key,'a> -> 'b option
Search the map looking for the first element where the fiven function returns a [[Some]] value
val fold : ('key -> 'a -> 'c -> 'c) -> Map <'key,'a> -> 'c -> 'c
Fold over the bindings in the map
val iter : ('key -> 'a -> unit) -> Map <'key,'a> -> unit
Apply the given function to each binding in the dictionary
val Make : ('key -> 'key -> int) -> CMapOps <'key,'a>
A functor to build a collection of operations for creating and using maps based on the given comparison function. This returns a record that contains the functions you use to create and manipulate maps of this kind. (The returned value is a lot like an ML module, except it is a record in the core language.) You should create a new component for each pair of key/value types. Language restrictions related to polymorphism may mean you have to create a new instantiation of Map.Make for each toplevel key/value type pair.
val map : ('a -> 'b) -> Map <'key,'a> -> Map <'key,'b>
Build a new collection whose elements are the results of applying the given function to each of the elements of the collection.
val mapi : ('key -> 'a -> 'b) -> Map <'key,'a> -> Map <'key,'b>
Build a new collection whose elements are the results of applying the given function to each of the elements of the collection. The integer index passed to the function indicates the index of element being transformed.
val mem : 'key -> Map <'key,'a> -> bool
Test is an element is in the domain of the map
val remove : 'key -> Map <'key,'a> -> Map <'key,'a>
Remove an element from the domain of the map. No exception is raised if the element is not present.
val tryfind : 'key -> Map <'key,'a> -> 'a option
Lookup an element in the map, returning a [[Some]] value if the element is in the domain of the map and [[None]] if not.

See Also

Microsoft.FSharp.MLLib


Documentation for assembly mllib, version 1.1.10.1, generated using F# version 1.1.10.1