Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- open System.Collections.Generic
- open Microsoft.FSharp.Core
- open Microsoft.FSharp.Collections
- /// <summary>Immutable maps. Keys are ordered by F# generic comparison.</summary>
- ///
- /// <remarks>Map interface based on Microsoft.FSharp.Collections.Map
- /// (See: https://github.com/fsharp/fsharp/blob/master/src/fsharp/FSharp.Core/map.fsi)</remarks>
- type Map<[<EqualityConditionalOn>]'Key,[<EqualityConditionalOn;ComparisonConditionalOn>]'Value when 'Key : comparison> =
- interface
- /// <summary>Returns a new map with the binding added to the given map.</summary>
- /// <param name="key">The input key.</param>
- /// <returns>The resulting map.</returns>
- abstract member Add: key:'Key * value:'Value -> Map<'Key,'Value>
- /// <summary>Returns true if there are no bindings in the map.</summary>
- abstract member IsEmpty: bool
- //TODO:
- /// <summary>Builds a map that contains the bindings of the given IEnumerable.</summary>
- /// <param name="elements">The input sequence of key/value pairs.</param>
- /// <returns>The resulting map.</returns>
- //new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
- /// <summary>Tests if an element is in the domain of the map.</summary>
- /// <param name="key">The input key.</param>
- /// <returns>True if the map contains the given key.</returns>
- abstract member ContainsKey: key:'Key -> bool
- /// <summary>The number of bindings in the map.</summary>
- abstract member Count: int
- /// <summary>Lookup an element in the map. Raise <c>KeyNotFoundException</c> if no binding
- /// exists in the map.</summary>
- /// <param name="key">The input key.</param>
- /// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when the key is not found.</exception>
- /// <returns>The value mapped to the key.</returns>
- abstract member Item : key:'Key -> 'Value with get
- /// <summary>Removes an element from the domain of the map. No exception is raised if the element is not present.</summary>
- /// <param name="key">The input key.</param>
- /// <returns>The resulting map.</returns>
- abstract member Remove: key:'Key -> Map<'Key,'Value>
- /// <summary>Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain
- /// of the map and <c>None</c> if not.</summary>
- /// <param name="key">The input key.</param>
- /// <returns>The mapped value, or None if the key is not in the map.</returns>
- abstract member TryFind: key:'Key -> 'Value option
- inherit IEnumerable<KeyValuePair<'Key, 'Value>>
- //TODO:
- //override Equals : obj -> bool
- //Optional:
- //inherit IDictionary<'Key, 'Value>
- //inherit ICollection<KeyValuePair<'Key, 'Value>>
- //inherit System.IComparable
- //inherit System.Collections.IEnumerable
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement