//========================================================================= // (c) Microsoft Corporation 2005-2009. //========================================================================= namespace Microsoft.FSharp.Collections open System open System.Collections.Generic open Microsoft.FSharp.Core open Microsoft.FSharp.Collections /// Immutable sets based on binary trees, where comparison is the /// F# structural comparison function, potentially using implementations /// of the IComparable interface on key values. /// /// See the Set module for further operations on sets. /// /// These sets can be used with elements of any type, but you should check that /// structural hashing and equality on the element type are correct for your type. [] type Set<'T> = /// Create a set containing elements drawn from the given sequence. new : elements:seq<'T> -> Set<'T> /// The empty set for the type 'T. static member Empty : Set<'T> /// A useful shortcut for Set.add. Note this operation produces a new set /// and does not mutate the original set. The new set will share many storage /// nodes with the original. See the Set module for further operations on sets. member Add : value:'T -> Set<'T> /// A useful shortcut for Set.remove. Note this operation produces a new set /// and does not mutate the original set. The new set will share many storage /// nodes with the original. See the Set module for further operations on sets. member Remove : value:'T -> Set<'T> /// The number of elements in the set member Count : int /// A useful shortcut for Set.contains. See the Set module for further operations on sets. member Contains : value:'T -> bool /// A useful shortcut for Set.isEmpty. See the Set module for further operations on sets. member IsEmpty : bool /// Return a new set with the elements of the second set removed from the first. static member Subtract : set1:Set<'T> * set2:Set<'T> -> Set<'T> /// Return a new set with the elements of the second set removed from the first. static member (-) : set1:Set<'T> * set2:Set<'T> -> Set<'T> /// Compute the union of the two sets. static member (+) : set1:Set<'T> * set2:Set<'T> -> Set<'T> /// Evaluates to "true" if all elements of the second set are in the first member IsSubsetOf: set:Set<'T> -> bool /// Evaluates to "true" if all elements of the first set are in the second member IsSupersetOf: set:Set<'T> -> bool /// Returns the lowest element in the set according to the ordering being used for the set member MinimumElement: 'T /// Returns the highest element in the set according to the ordering being used for the set member MaximumElement: 'T #if DONT_INCLUDE_DEPRECATED #else /// Returns the least element in the set that is greater than the given key /// according to the ordering being used for the set [] member GetNextElement: value:'T -> 'T option /// Returns the greatest element in the set that is less than the given key /// according to the ordering being used for the set [] member GetPreviousElement: value:'T -> 'T option #endif interface ICollection<'T> interface IEnumerable<'T> interface System.Collections.IEnumerable interface System.IComparable override Equals : obj -> bool namespace Microsoft.FSharp.Collections open System open System.Collections.Generic open Microsoft.FSharp.Core open Microsoft.FSharp.Collections [] [] /// Functional programming operators related to the Set<_> type. module Set = /// The empty set for the type 'T . [] val empty<'T> : Set<'T> /// The set containing the given one element. val singleton: value:'T -> Set<'T> /// Return a new set with an element added to the set. No exception is raised if /// the set already contains the given element. val add: value:'T -> set:Set<'T> -> Set<'T> ///Evaluates to "true" if the given element is in the given set val contains: element:'T -> set:Set<'T> -> bool ///Return the number of elements in the set. Same as size val count: set:Set<'T> -> int ///Test if any element of the collection satisfies the given predicate. ///If the input function is f and the elements are i0...iN ///then computes p i0 or ... or p iN. val exists: predicate:('T -> bool) -> set:Set<'T> -> bool /// Return a new collection containing only the elements of the collection /// for which the given predicate returns true val filter: predicate:('T -> bool) -> set:Set<'T> -> Set<'T> /// Return a new collection containing the results of applying the /// given function to each element of the input set val map: mapping:('T -> 'U) -> set:Set<'T> -> Set<'U> /// Apply the given accumulating function to all the elements of the set val fold: folder:('State -> 'T -> 'State) -> state:'State -> set:Set<'T> -> 'State /// Apply the given accumulating function to all the elements of the set val foldBack: folder:('T -> 'State -> 'State) -> set:Set<'T> -> state:'State -> 'State /// Test if all elements of the collection satisfy the given predicate. /// If the input function is f and the elements are i0...iN and "j0...jN" /// then computes p i0 && ... && p iN. val forall: predicate:('T -> bool) -> set:Set<'T> -> bool /// Compute the intersection of the two sets. val intersect: set1:Set<'T> -> set2:Set<'T> -> Set<'T> ///Compute the intersection of a sequence of sets. The sequence must be non-empty val intersectMany: sets:seq> -> Set<'T> ///Compute the union of the two sets. val union: set1:Set<'T> -> set2:Set<'T> -> Set<'T> ///Compute the union of a sequence of sets. val unionMany: sets:seq> -> Set<'T> ///Return "true" if the set is empty val isEmpty: set:Set<'T> -> bool ///Apply the given function to each element of the set, in order according ///to the comparison function val iter: action:('T -> unit) -> set:Set<'T> -> unit ///Split the set into two sets containing the elements for which the given predicate ///returns true and false respectively val partition: predicate:('T -> bool) -> set:Set<'T> -> (Set<'T> * Set<'T>) ///Return a new set with the given element removed. No exception is raised in ///the set doesn't contain the given element. val remove: value: 'T -> set:Set<'T> -> Set<'T> /// Build a set that contains the same elements as the given list val of_list: elements:'T list -> Set<'T> /// Build a list that contains the elements of the set in order val to_list: set:Set<'T> -> 'T list /// Build a set that contains the same elements as the given array val of_array: array:'T array -> Set<'T> /// Build an array that contains the elements of the set in order val to_array: set:Set<'T> -> 'T array /// Return a view of the collection as an enumerable object val to_seq: set:Set<'T> -> seq<'T> /// Build a new collection from the given enumerable object val of_seq: elements:seq<'T> -> Set<'T> #if DONT_INCLUDE_DEPRECATED #else [] val union_all: seq> -> Set<'T> [] val min_elt: set:Set<'T> -> 'T [] val max_elt: set:Set<'T> -> 'T [] val next_elt: value:'T -> set:Set<'T> -> 'T option [] val prev_elt: value:'T -> set:Set<'T> -> 'T option [] val size: set:Set<'T> -> int [] val compare: set1:Set<'T> -> set2:Set<'T> -> int ///Evaluates to "true" if the given element is in the given set [] val mem: element:'T -> set:Set<'T> -> bool /// Returns the minimum element of the set [] val choose: set:Set<'T> -> 'T /// Evaluates to "true" if all elements of the second set are in the first [] val subset: set1:Set<'T> -> set2:Set<'T> -> bool /// Return a new set with the elements of the second set removed from the first. [] val diff: set1:Set<'T> -> set2:Set<'T> -> Set<'T> [] val intersect_all: seq> -> Set<'T> [] val is_empty: set:Set<'T> -> bool [] val for_all: predicate:('T -> bool) -> set:Set<'T> -> bool [] val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> set:Set<'T> -> 'State [] val fold_right: folder:('T -> 'State -> 'State) -> set:Set<'T> -> state:'State -> 'State #endif