diff --git a/src/fsharp/FSharp.Core/Linq.fsi b/src/fsharp/FSharp.Core/Linq.fsi index cc62fe99b58..24f61321b16 100644 --- a/src/fsharp/FSharp.Core/Linq.fsi +++ b/src/fsharp/FSharp.Core/Linq.fsi @@ -16,10 +16,12 @@ open Microsoft.FSharp.Quotations /// Library functionality associated with converting F# quotations to .NET LINQ expression trees. /// module LeafExpressionConverter = + /// /// When used in a quotation, this function indicates a specific conversion /// should be performed when converting the quotation to a LINQ expression. /// /// This function should not be called directly. + /// // // NOTE: when an F# expression tree is converted to a Linq expression tree using ToLinqExpression // the transformation of LinqExpressionHelper(e) is the same as the transformation of @@ -29,36 +31,60 @@ module LeafExpressionConverter = //[] val ImplicitExpressionConversionHelper : 'T -> Expression<'T> + /// /// When used in a quotation, this function indicates a specific conversion /// should be performed when converting the quotation to a LINQ expression. /// /// This function should not be called directly. + /// //[] val MemberInitializationHelper : 'T -> 'T + /// /// When used in a quotation, this function indicates a specific conversion /// should be performed when converting the quotation to a LINQ expression. /// /// This function should not be called directly. + /// //[] val NewAnonymousObjectHelper : 'T -> 'T + /// /// Converts a subset of F# quotations to a LINQ expression, for the subset of LINQ expressions represented by the /// expression syntax in the C# language. + /// + /// + /// val QuotationToExpression : Expr -> Expression + /// /// Converts a subset of F# quotations to a LINQ expression, for the subset of LINQ expressions represented by the /// expression syntax in the C# language. + /// + /// + /// val QuotationToLambdaExpression : Expr<'T> -> Expression<'T> + /// /// Evaluates a subset of F# quotations by first converting to a LINQ expression, for the subset of LINQ expressions represented by the /// expression syntax in the C# language. + /// + /// + /// val EvaluateQuotation : Expr -> obj + /// /// A runtime helper used to evaluate nested quotation literals. + /// + /// + /// val SubstHelper : Expr * Var[] * obj[] -> Expr<'T> + /// /// A runtime helper used to evaluate nested quotation literals. + /// + /// + /// val SubstHelperRaw : Expr * Var[] * obj[] -> Expr val internal (|SpecificCallToMethod|_|) : System.RuntimeMethodHandle -> (Expr -> (Expr option * Type list * Expr list) option) diff --git a/src/fsharp/FSharp.Core/Nullable.fsi b/src/fsharp/FSharp.Core/Nullable.fsi index 0b18896ef8c..6479a0d1732 100644 --- a/src/fsharp/FSharp.Core/Nullable.fsi +++ b/src/fsharp/FSharp.Core/Nullable.fsi @@ -5,107 +5,172 @@ namespace Microsoft.FSharp.Linq open System open Microsoft.FSharp.Core -/// Operators for working with nullable values +/// Operators for working with nullable values, primarily used on F# queries. [] module NullableOperators = - /// The '>=' operator where a nullable value appears on the left + /// The '>=' operator where a nullable value appears on the left + /// + /// val ( ?>= ) : Nullable<'T> -> 'T -> bool when 'T : comparison - /// The '>' operator where a nullable value appears on the left + /// The '>' operator where a nullable value appears on the left + /// + /// val ( ?> ) : Nullable<'T> -> 'T -> bool when 'T : comparison - /// The '<=' operator where a nullable value appears on the left + /// The '<=' operator where a nullable value appears on the left + /// + /// val ( ?<= ) : Nullable<'T> -> 'T -> bool when 'T : comparison - /// The '<' operator where a nullable value appears on the left + /// The '<' operator where a nullable value appears on the left + /// + /// val ( ?< ) : Nullable<'T> -> 'T -> bool when 'T : comparison - /// The '=' operator where a nullable value appears on the left + /// The '=' operator where a nullable value appears on the left + /// + /// val ( ?= ) : Nullable<'T> -> 'T -> bool when 'T : equality - /// The '<>' operator where a nullable value appears on the left + /// The '<>' operator where a nullable value appears on the left + /// + /// val ( ?<> ) : Nullable<'T> -> 'T -> bool when 'T : equality - /// The '>=' operator where a nullable value appears on the right + /// The '>=' operator where a nullable value appears on the right + /// + /// val ( >=? ) : 'T -> Nullable<'T> -> bool when 'T : comparison - /// The '>' operator where a nullable value appears on the right + /// The '>' operator where a nullable value appears on the right + /// + /// val ( >? ) : 'T -> Nullable<'T> -> bool when 'T : comparison - /// The '<=' operator where a nullable value appears on the right + /// The '<=' operator where a nullable value appears on the right + /// + /// val ( <=? ) : 'T -> Nullable<'T> -> bool when 'T : comparison - /// The '<' operator where a nullable value appears on the right + /// The '<' operator where a nullable value appears on the right + /// + /// val ( Nullable<'T> -> bool when 'T : comparison - /// The '=' operator where a nullable value appears on the right + /// The '=' operator where a nullable value appears on the right + /// + /// val ( =? ) : 'T -> Nullable<'T> -> bool when 'T : equality - /// The '<>' operator where a nullable value appears on the right + /// The '<>' operator where a nullable value appears on the right + /// + /// val ( <>? ) : 'T -> Nullable<'T> -> bool when 'T : equality - /// The '>=' operator where a nullable value appears on both left and right sides + /// The '>=' operator where a nullable value appears on both left and right sides + /// + /// val ( ?>=? ) : Nullable<'T> -> Nullable<'T> -> bool when 'T : comparison - /// The '>' operator where a nullable value appears on both left and right sides + /// The '>' operator where a nullable value appears on both left and right sides + /// + /// val ( ?>? ) : Nullable<'T> -> Nullable<'T> -> bool when 'T : comparison - /// The '<=' operator where a nullable value appears on both left and right sides + /// The '<=' operator where a nullable value appears on both left and right sides + /// + /// val ( ?<=? ) : Nullable<'T> -> Nullable<'T> -> bool when 'T : comparison - /// The '<' operator where a nullable value appears on both left and right sides + /// The '<' operator where a nullable value appears on both left and right sides + /// + /// val ( ? -> Nullable<'T> -> bool when 'T : comparison - /// The '=' operator where a nullable value appears on both left and right sides + /// The '=' operator where a nullable value appears on both left and right sides + /// + /// val ( ?=? ) : Nullable<'T> -> Nullable<'T> -> bool when 'T : equality - /// The '<>' operator where a nullable value appears on both left and right sides + /// The '<>' operator where a nullable value appears on both left and right sides + /// + /// val ( ?<>? ) : Nullable<'T> -> Nullable<'T> -> bool when 'T : equality - /// The addition operator where a nullable value appears on the left + /// The addition operator where a nullable value appears on the left + /// + /// val inline ( ?+ ) : Nullable< ^T1 > -> ^T2 -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( + ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The addition operator where a nullable value appears on the right + /// The addition operator where a nullable value appears on the right + /// + /// val inline ( +? ) : ^T1 -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( + ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The addition operator where a nullable value appears on both left and right sides + /// The addition operator where a nullable value appears on both left and right sides + /// + /// val inline ( ?+? ) : Nullable< ^T1 > -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( + ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The subtraction operator where a nullable value appears on the left + /// The subtraction operator where a nullable value appears on the left + /// + /// val inline ( ?- ) : Nullable< ^T1 > -> ^T2 -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( - ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The subtraction operator where a nullable value appears on the right + /// The subtraction operator where a nullable value appears on the right + /// + /// val inline ( -? ) : ^T1 -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( - ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The subtraction operator where a nullable value appears on both left and right sides + /// The subtraction operator where a nullable value appears on both left and right sides + /// + /// val inline ( ?-? ) : Nullable< ^T1 > -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( - ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The multiplication operator where a nullable value appears on the left + /// The multiplication operator where a nullable value appears on the left + /// + /// val inline ( ?* ) : Nullable< ^T1 > -> ^T2 -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( * ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The multiplication operator where a nullable value appears on the right + /// The multiplication operator where a nullable value appears on the right + /// + /// val inline ( *? ) : ^T1 -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( * ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The multiplication operator where a nullable value appears on both left and right sides + /// The multiplication operator where a nullable value appears on both left and right sides + /// + /// val inline ( ?*? ) : Nullable< ^T1 > -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( * ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - - /// The modulus operator where a nullable value appears on the left + /// The modulus operator where a nullable value appears on the left + /// + /// val inline ( ?% ) : Nullable< ^T1 > -> ^T2 -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( % ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The modulus operator where a nullable value appears on the right + /// The modulus operator where a nullable value appears on the right + /// + /// val inline ( %? ) : ^T1 -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( % ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The modulus operator where a nullable value appears on both left and right sides + /// The modulus operator where a nullable value appears on both left and right sides + /// + /// val inline ( ?%? ) : Nullable< ^T1 > -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( % ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The division operator where a nullable value appears on the left + /// The division operator where a nullable value appears on the left + /// + /// val inline ( ?/ ) : Nullable< ^T1 > -> ^T2 -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( / ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The division operator where a nullable value appears on the right + /// The division operator where a nullable value appears on the right + /// + /// val inline ( /? ) : ^T1 -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( / ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int - /// The division operator where a nullable value appears on both left and right sides + /// The division operator where a nullable value appears on both left and right sides + /// + /// val inline ( ?/? ) : Nullable< ^T1 > -> Nullable< ^T2 > -> Nullable< ^T3 > when (^T1 or ^T2) : (static member ( / ) : ^T1 * ^T2 -> ^T3) and default ^T2 : ^T3 and default ^T3 : ^T1 and default ^T3 : ^T2 and default ^T1 : ^T3 and default ^T1 : ^T2 and default ^T1 : int /// Functions for converting nullable values @@ -116,9 +181,12 @@ module Nullable = /// Converts the argument to byte. This is a direct conversion for all /// primitive numeric types. The operation requires an appropriate /// static conversion method on the input type. + /// /// The input value. /// /// The converted byte + /// + /// [] val inline byte : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> byte) and default ^T : int @@ -129,6 +197,8 @@ module Nullable = /// The input value. /// /// The converted byte + /// + /// [] val inline uint8 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> uint8) and default ^T : int @@ -139,6 +209,8 @@ module Nullable = /// The input value. /// /// The converted sbyte + /// + /// [] val inline sbyte : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> sbyte) and default ^T : int @@ -149,6 +221,8 @@ module Nullable = /// The input value. /// /// The converted sbyte + /// + /// [] val inline int8 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> int8) and default ^T : int @@ -159,6 +233,8 @@ module Nullable = /// The input value. /// /// The converted int16 + /// + /// [] val inline int16 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> int16) and default ^T : int @@ -169,6 +245,8 @@ module Nullable = /// The input value. /// /// The converted uint16 + /// + /// [] val inline uint16 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> uint16) and default ^T : int @@ -179,6 +257,8 @@ module Nullable = /// The input value. /// /// The converted int + /// + /// [] val inline int : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> int) and default ^T : int @@ -189,6 +269,8 @@ module Nullable = /// The input value. /// /// The converted unsigned integer + /// + /// [] val inline uint: value: Nullable< ^T > -> Nullable when ^T :(static member op_Explicit: ^T -> uint) and default ^T : uint @@ -197,6 +279,8 @@ module Nullable = /// The input value. /// /// The converted enum type. + /// + /// [] val inline enum : value:Nullable< int32 > -> Nullable< ^U > when ^U : enum @@ -207,6 +291,8 @@ module Nullable = /// The input value. /// /// The converted int32 + /// + /// [] val inline int32 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> int32) and default ^T : int @@ -217,6 +303,8 @@ module Nullable = /// The input value. /// /// The converted uint32 + /// + /// [] val inline uint32 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> uint32) and default ^T : int @@ -227,6 +315,8 @@ module Nullable = /// The input value. /// /// The converted int64 + /// + /// [] val inline int64 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> int64) and default ^T : int @@ -237,6 +327,8 @@ module Nullable = /// The input value. /// /// The converted uint64 + /// + /// [] val inline uint64 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> uint64) and default ^T : int @@ -247,6 +339,8 @@ module Nullable = /// The input value. /// /// The converted float32 + /// + /// [] val inline float32 : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> float32) and default ^T : int @@ -257,6 +351,8 @@ module Nullable = /// The input value. /// /// The converted float + /// + /// [] val inline float : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> float) and default ^T : int @@ -267,6 +363,8 @@ module Nullable = /// The input value. /// /// The converted float32 + /// + /// [] val inline single : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> single) and default ^T : int @@ -277,6 +375,8 @@ module Nullable = /// The input value. /// /// The converted float + /// + /// [] val inline double : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> double) and default ^T : int @@ -287,6 +387,8 @@ module Nullable = /// The input value. /// /// The converted nativeint + /// + /// [] val inline nativeint : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> nativeint) and default ^T : int @@ -297,6 +399,8 @@ module Nullable = /// The input value. /// /// The converted unativeint + /// + /// [] val inline unativeint : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> unativeint) and default ^T : int @@ -307,6 +411,8 @@ module Nullable = /// The input value. /// /// The converted decimal. + /// + /// [] val inline decimal : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> decimal) and default ^T : int @@ -316,5 +422,7 @@ module Nullable = /// The input value. /// /// The converted char. + /// + /// [] val inline char : value:Nullable< ^T > -> Nullable when ^T : (static member op_Explicit : ^T -> char) and default ^T : int diff --git a/src/fsharp/FSharp.Core/Query.fsi b/src/fsharp/FSharp.Core/Query.fsi index 7017fe693e8..118cf4b0e9d 100644 --- a/src/fsharp/FSharp.Core/Query.fsi +++ b/src/fsharp/FSharp.Core/Query.fsi @@ -23,337 +23,399 @@ namespace Microsoft.FSharp.Linq /// /// A method used to support the F# query syntax. /// - new : seq<'T> -> QuerySource<'T,'Q> + new: seq<'T> -> QuerySource<'T,'Q> /// /// A property used to support the F# query syntax. /// - member Source : seq<'T> + member Source: seq<'T> [] /// The type used to support the F# query syntax. Use 'query { ... }' to use the query syntax. See /// also F# Query Expressions in the F# Language Guide. type QueryBuilder = /// Create an instance of this builder. Use 'query { ... }' to use the query syntax. - new : unit -> QueryBuilder + new: unit -> QueryBuilder /// /// A method used to support the F# query syntax. Inputs to queries are implicitly wrapped by a call to one of the overloads of this method. /// - member Source : source:IQueryable<'T> -> QuerySource<'T,'Q> + /// + /// + member Source: source:IQueryable<'T> -> QuerySource<'T,'Q> /// /// A method used to support the F# query syntax. Inputs to queries are implicitly wrapped by a call to one of the overloads of this method. /// - member Source : source:IEnumerable<'T> -> QuerySource<'T,IEnumerable> + /// + /// + member Source: source:IEnumerable<'T> -> QuerySource<'T,IEnumerable> /// /// A method used to support the F# query syntax. Projects each element of a sequence to another sequence and combines the resulting sequences into one sequence. /// - member For : source:QuerySource<'T,'Q> * body:('T -> QuerySource<'Result,'Q2>) -> QuerySource<'Result,'Q> + /// + /// + member For: source:QuerySource<'T,'Q> * body:('T -> QuerySource<'Result,'Q2>) -> QuerySource<'Result,'Q> /// /// A method used to support the F# query syntax. Returns an empty sequence that has the specified type argument. /// - member Zero : unit -> QuerySource<'T,'Q> + /// + /// + member Zero: unit -> QuerySource<'T,'Q> /// /// A method used to support the F# query syntax. Returns a sequence of length one that contains the specified value. /// - member Yield : value:'T -> QuerySource<'T,'Q> + /// + /// + member Yield: value:'T -> QuerySource<'T,'Q> /// /// A method used to support the F# query syntax. Returns a sequence that contains the specified values. /// - member YieldFrom : computation:QuerySource<'T,'Q> -> QuerySource<'T,'Q> + /// + /// + member YieldFrom: computation:QuerySource<'T,'Q> -> QuerySource<'T,'Q> /// /// A method used to support the F# query syntax. Indicates that the query should be passed as a quotation to the Run method. /// - member Quote : Quotations.Expr<'T> -> Quotations.Expr<'T> + /// + /// + member Quote: Quotations.Expr<'T> -> Quotations.Expr<'T> /// /// A method used to support the F# query syntax. Runs the given quotation as a query using LINQ IQueryable rules. /// - member Run : Quotations.Expr> -> IQueryable<'T> - member internal RunQueryAsQueryable : Quotations.Expr> -> IQueryable<'T> - member internal RunQueryAsEnumerable : Quotations.Expr> -> seq<'T> - member internal RunQueryAsValue : Quotations.Expr<'T> -> 'T + /// + /// + member Run: Quotations.Expr> -> IQueryable<'T> + member internal RunQueryAsQueryable: Quotations.Expr> -> IQueryable<'T> + member internal RunQueryAsEnumerable: Quotations.Expr> -> seq<'T> + member internal RunQueryAsValue: Quotations.Expr<'T> -> 'T /// A query operator that determines whether the selected elements contains a specified element. /// + /// + /// [] - member Contains : source:QuerySource<'T,'Q> * key:'T -> bool + member Contains: source:QuerySource<'T,'Q> * key:'T -> bool /// A query operator that returns the number of selected elements. /// + /// + /// [] - member Count : source:QuerySource<'T,'Q> -> int + member Count: source:QuerySource<'T,'Q> -> int /// A query operator that selects the last element of those selected so far. /// + /// + /// [] - member Last : source:QuerySource<'T,'Q> -> 'T + member Last: source:QuerySource<'T,'Q> -> 'T /// A query operator that selects the last element of those selected so far, or a default value if no element is found. /// + /// + /// [] - member LastOrDefault : source:QuerySource<'T,'Q> -> 'T + member LastOrDefault: source:QuerySource<'T,'Q> -> 'T /// A query operator that selects the single, specific element selected so far /// + /// + /// [] - member ExactlyOne : source:QuerySource<'T,'Q> -> 'T + member ExactlyOne: source:QuerySource<'T,'Q> -> 'T /// A query operator that selects the single, specific element of those selected so far, or a default value if that element is not found. /// + /// + /// [] - member ExactlyOneOrDefault : source:QuerySource<'T,'Q> -> 'T + member ExactlyOneOrDefault: source:QuerySource<'T,'Q> -> 'T /// A query operator that selects the first element of those selected so far, or a default value if the sequence contains no elements. /// + /// + /// [] - member HeadOrDefault : source:QuerySource<'T,'Q> -> 'T + member HeadOrDefault: source:QuerySource<'T,'Q> -> 'T /// A query operator that projects each of the elements selected so far. /// + /// + /// [] - member Select : source:QuerySource<'T,'Q> * [] projection:('T -> 'Result) -> QuerySource<'Result,'Q> + member Select: source:QuerySource<'T,'Q> * [] projection:('T -> 'Result) -> QuerySource<'Result,'Q> /// A query operator that selects those elements based on a specified predicate. /// + /// + /// [] - member Where : source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> QuerySource<'T,'Q> + member Where: source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> QuerySource<'T,'Q> /// A query operator that selects a value for each element selected so far and returns the minimum resulting value. /// + /// + /// [] - member MinBy : source:QuerySource<'T,'Q> * [] valueSelector:('T -> 'Value) -> 'Value when 'Value : equality and 'Value : comparison + member MinBy: source:QuerySource<'T,'Q> * [] valueSelector:('T -> 'Value) -> 'Value when 'Value: equality and 'Value: comparison /// A query operator that selects a value for each element selected so far and returns the maximum resulting value. /// + /// + /// [] - member MaxBy : source:QuerySource<'T,'Q> * [] valueSelector:('T -> 'Value) -> 'Value when 'Value : equality and 'Value : comparison + member MaxBy: source:QuerySource<'T,'Q> * [] valueSelector:('T -> 'Value) -> 'Value when 'Value: equality and 'Value: comparison /// A query operator that groups the elements selected so far according to a specified key selector. /// + /// + /// [] - member GroupBy : source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource,'Q> when 'Key : equality + member GroupBy: source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource,'Q> when 'Key: equality /// A query operator that sorts the elements selected so far in ascending order by the given sorting key. /// + /// + /// [] - member SortBy : source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member SortBy: source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that sorts the elements selected so far in descending order by the given sorting key. /// + /// + /// [] - member SortByDescending : source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member SortByDescending: source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that performs a subsequent ordering of the elements selected so far in ascending order by the given sorting key. /// This operator may only be used immediately after a 'sortBy', 'sortByDescending', 'thenBy' or 'thenByDescending', or their nullable variants. /// + /// + /// [] - member ThenBy : source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member ThenBy: source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that performs a subsequent ordering of the elements selected so far in descending order by the given sorting key. /// This operator may only be used immediately after a 'sortBy', 'sortByDescending', 'thenBy' or 'thenByDescending', or their nullable variants. /// + /// + /// [] - member ThenByDescending : source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member ThenByDescending: source:QuerySource<'T,'Q> * [] keySelector:('T -> 'Key) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that selects a value for each element selected so far and groups the elements by the given key. /// + /// + /// [] - member GroupValBy<'T,'Key,'Value,'Q> : source:QuerySource<'T,'Q> * [] resultSelector:('T -> 'Value) * [] keySelector:('T -> 'Key) -> QuerySource,'Q> when 'Key : equality + member GroupValBy<'T,'Key,'Value,'Q> : source:QuerySource<'T,'Q> * [] resultSelector:('T -> 'Value) * [] keySelector:('T -> 'Key) -> QuerySource,'Q> when 'Key: equality /// A query operator that correlates two sets of selected values based on matching keys. /// Normal usage is 'join y in elements2 on (key1 = key2)'. /// + /// + /// [] - member Join : outerSource:QuerySource<'Outer,'Q> * innerSource:QuerySource<'Inner,'Q> * outerKeySelector:('Outer -> 'Key) * innerKeySelector:('Inner -> 'Key) * resultSelector:('Outer -> 'Inner -> 'Result) -> QuerySource<'Result,'Q> + member Join: outerSource:QuerySource<'Outer,'Q> * innerSource:QuerySource<'Inner,'Q> * outerKeySelector:('Outer -> 'Key) * innerKeySelector:('Inner -> 'Key) * resultSelector:('Outer -> 'Inner -> 'Result) -> QuerySource<'Result,'Q> /// A query operator that correlates two sets of selected values based on matching keys and groups the results. /// Normal usage is 'groupJoin y in elements2 on (key1 = key2) into group'. /// + /// + /// [] - member GroupJoin : outerSource:QuerySource<'Outer,'Q> * innerSource:QuerySource<'Inner,'Q> * outerKeySelector:('Outer -> 'Key) * innerKeySelector:('Inner -> 'Key) * resultSelector:('Outer -> seq<'Inner> -> 'Result) -> QuerySource<'Result,'Q> + member GroupJoin: outerSource:QuerySource<'Outer,'Q> * innerSource:QuerySource<'Inner,'Q> * outerKeySelector:('Outer -> 'Key) * innerKeySelector:('Inner -> 'Key) * resultSelector:('Outer -> seq<'Inner> -> 'Result) -> QuerySource<'Result,'Q> /// A query operator that correlates two sets of selected values based on matching keys and groups the results. /// If any group is empty, a group with a single default value is used instead. /// Normal usage is 'leftOuterJoin y in elements2 on (key1 = key2) into group'. /// + /// + /// [] - member LeftOuterJoin : outerSource:QuerySource<'Outer,'Q> * innerSource:QuerySource<'Inner,'Q> * outerKeySelector:('Outer -> 'Key) * innerKeySelector:('Inner -> 'Key) * resultSelector:('Outer -> seq<'Inner> -> 'Result) -> QuerySource<'Result,'Q> + member LeftOuterJoin: outerSource:QuerySource<'Outer,'Q> * innerSource:QuerySource<'Inner,'Q> * outerKeySelector:('Outer -> 'Key) * innerKeySelector:('Inner -> 'Key) * resultSelector:('Outer -> seq<'Inner> -> 'Result) -> QuerySource<'Result,'Q> #if SUPPORT_ZIP_IN_QUERIES /// /// When used in queries, this operator corresponds to the LINQ Zip operator. /// + /// + /// [] - member Zip : firstSource:QuerySource<'T1> * secondSource:QuerySource<'T2> * resultSelector:('T1 -> 'T2 -> 'Result) -> QuerySource<'Result> + member Zip: firstSource:QuerySource<'T1> * secondSource:QuerySource<'T2> * resultSelector:('T1 -> 'T2 -> 'Result) -> QuerySource<'Result> #endif /// A query operator that selects a nullable value for each element selected so far and returns the sum of these values. /// If any nullable does not have a value, it is ignored. /// + /// + /// [] - member inline SumByNullable : source:QuerySource<'T,'Q> * [] valueSelector:('T -> Nullable< ^Value >) -> Nullable< ^Value > - when ^Value : (static member ( + ) : ^Value * ^Value -> ^Value) - and ^Value : (static member Zero : ^Value) - and default ^Value : int + member inline SumByNullable: source:QuerySource<'T,'Q> * [] valueSelector:('T -> Nullable< ^Value >) -> Nullable< ^Value > + when ^Value: (static member ( + ): ^Value * ^Value -> ^Value) + and ^Value: (static member Zero: ^Value) + and default ^Value: int /// A query operator that selects a nullable value for each element selected so far and returns the minimum of these values. /// If any nullable does not have a value, it is ignored. /// + /// + /// [] - member MinByNullable : source:QuerySource<'T,'Q> * [] valueSelector:('T -> Nullable<'Value>) -> Nullable<'Value> - when 'Value : equality - and 'Value : comparison + member MinByNullable: source:QuerySource<'T,'Q> * [] valueSelector:('T -> Nullable<'Value>) -> Nullable<'Value> + when 'Value: equality + and 'Value: comparison /// A query operator that selects a nullable value for each element selected so far and returns the maximum of these values. /// If any nullable does not have a value, it is ignored. /// + /// + /// [] - member MaxByNullable : source:QuerySource<'T,'Q> * [] valueSelector:('T -> Nullable<'Value>) -> Nullable<'Value> when 'Value : equality and 'Value : comparison + member MaxByNullable: source:QuerySource<'T,'Q> * [] valueSelector:('T -> Nullable<'Value>) -> Nullable<'Value> when 'Value: equality and 'Value: comparison /// A query operator that selects a nullable value for each element selected so far and returns the average of these values. /// If any nullable does not have a value, it is ignored. /// + /// + /// [] - member inline AverageByNullable : source:QuerySource<'T,'Q> * [] projection:('T -> Nullable< ^Value >) -> Nullable< ^Value > - when ^Value : (static member ( + ) : ^Value * ^Value -> ^Value) - and ^Value : (static member DivideByInt : ^Value * int -> ^Value) - and ^Value : (static member Zero : ^Value) - and default ^Value : float + member inline AverageByNullable: source:QuerySource<'T,'Q> * [] projection:('T -> Nullable< ^Value >) -> Nullable< ^Value > + when ^Value: (static member ( + ): ^Value * ^Value -> ^Value) + and ^Value: (static member DivideByInt: ^Value * int -> ^Value) + and ^Value: (static member Zero: ^Value) + and default ^Value: float /// A query operator that selects a value for each element selected so far and returns the average of these values. /// + /// + /// [] - member inline AverageBy : source:QuerySource<'T,'Q> * [] projection:('T -> ^Value) -> ^Value - when ^Value : (static member ( + ) : ^Value * ^Value -> ^Value) - and ^Value : (static member DivideByInt : ^Value * int -> ^Value) - and ^Value : (static member Zero : ^Value) - and default ^Value : float + member inline AverageBy: source:QuerySource<'T,'Q> * [] projection:('T -> ^Value) -> ^Value + when ^Value: (static member ( + ): ^Value * ^Value -> ^Value) + and ^Value: (static member DivideByInt: ^Value * int -> ^Value) + and ^Value: (static member Zero: ^Value) + and default ^Value: float /// A query operator that selects distinct elements from the elements selected so far. /// + /// + /// [] - member Distinct: source:QuerySource<'T,'Q> -> QuerySource<'T,'Q> when 'T : equality + member Distinct: source:QuerySource<'T,'Q> -> QuerySource<'T,'Q> when 'T: equality /// A query operator that determines whether any element selected so far satisfies a condition. /// + /// + /// [] member Exists: source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> bool /// A query operator that selects the first element selected so far that satisfies a specified condition. /// + /// + /// [] member Find: source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> 'T /// A query operator that determines whether all elements selected so far satisfies a condition. /// + /// + /// [] member All: source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> bool /// A query operator that selects the first element from those selected so far. /// + /// + /// [] member Head: source:QuerySource<'T,'Q> -> 'T /// A query operator that selects the element at a specified index amongst those selected so far. /// + /// + /// [] member Nth: source:QuerySource<'T,'Q> * index:int -> 'T /// A query operator that bypasses a specified number of the elements selected so far and selects the remaining elements. /// + /// + /// [] member Skip: source:QuerySource<'T,'Q> * count:int -> QuerySource<'T,'Q> /// A query operator that bypasses elements in a sequence as long as a specified condition is true and then selects the remaining elements. /// + /// + /// [] member SkipWhile: source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> QuerySource<'T,'Q> /// A query operator that selects a value for each element selected so far and returns the sum of these values. /// + /// + /// [] - member inline SumBy : source:QuerySource<'T,'Q> * [] projection:('T -> ^Value) -> ^Value - when ^Value : (static member ( + ) : ^Value * ^Value -> ^Value) - and ^Value : (static member Zero : ^Value) - and default ^Value : int + member inline SumBy: source:QuerySource<'T,'Q> * [] projection:('T -> ^Value) -> ^Value + when ^Value: (static member ( + ): ^Value * ^Value -> ^Value) + and ^Value: (static member Zero: ^Value) + and default ^Value: int /// A query operator that selects a specified number of contiguous elements from those selected so far. /// + /// + /// [] member Take: source:QuerySource<'T,'Q> * count:int-> QuerySource<'T,'Q> /// A query operator that selects elements from a sequence as long as a specified condition is true, and then skips the remaining elements. /// + /// + /// [] member TakeWhile: source:QuerySource<'T,'Q> * [] predicate:('T -> bool) -> QuerySource<'T,'Q> /// A query operator that sorts the elements selected so far in ascending order by the given nullable sorting key. /// + /// + /// [] - member SortByNullable : source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member SortByNullable: source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that sorts the elements selected so far in descending order by the given nullable sorting key. /// + /// + /// [] - member SortByNullableDescending : source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member SortByNullableDescending: source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that performs a subsequent ordering of the elements selected so far in ascending order by the given nullable sorting key. /// This operator may only be used immediately after a 'sortBy', 'sortByDescending', 'thenBy' or 'thenByDescending', or their nullable variants. /// + /// + /// [] - member ThenByNullable : source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison + member ThenByNullable: source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison /// A query operator that performs a subsequent ordering of the elements selected so far in descending order by the given nullable sorting key. /// This operator may only be used immediately after a 'sortBy', 'sortByDescending', 'thenBy' or 'thenByDescending', or their nullable variants. /// + /// + /// [] - member ThenByNullableDescending : source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key : equality and 'Key : comparison - - -#if __DEBUG - [] - [] - type QueryQuoteBuilder = - inherit QueryBuilder - new : unit -> QueryQuoteBuilder - member Run : Quotations.Expr<'T> -> Quotations.Expr<'T> - - [] - [] - type QueryLinqExprBuilder = - inherit QueryBuilder - new : unit -> QueryLinqExprBuilder - member Run : Quotations.Expr<'T> -> System.Linq.Expressions.Expression - - [] - type QueryExprBuilder = - inherit QueryBuilder - new : unit -> QueryExprBuilder - member Run : Quotations.Expr<'T> -> Quotations.Expr - - [] - type QueryExprPreTransBuilder = - inherit QueryBuilder - new : unit -> QueryExprPreTransBuilder - member Run : Quotations.Expr<'T> -> Quotations.Expr - - [] - type QueryExprPreEliminateNestedBuilder = - inherit QueryBuilder - new : unit -> QueryExprPreEliminateNestedBuilder - member Run : Quotations.Expr<'T> -> Quotations.Expr -#endif - + member ThenByNullableDescending: source:QuerySource<'T,'Q> * [] keySelector:('T -> Nullable<'Key>) -> QuerySource<'T,'Q> when 'Key: equality and 'Key: comparison namespace Microsoft.FSharp.Linq.QueryRunExtensions @@ -372,7 +434,7 @@ namespace Microsoft.FSharp.Linq.QueryRunExtensions /// A method used to support the F# query syntax. Runs the given quotation as a query using LINQ rules. /// [] - member Run : Microsoft.FSharp.Quotations.Expr<'T> -> 'T + member Run: Microsoft.FSharp.Quotations.Expr<'T> -> 'T /// /// A module used to support the F# query syntax. @@ -383,10 +445,4 @@ namespace Microsoft.FSharp.Linq.QueryRunExtensions /// A method used to support the F# query syntax. Runs the given quotation as a query using LINQ IEnumerable rules. /// [] - member Run : Microsoft.FSharp.Quotations.Expr> -> Microsoft.FSharp.Collections.seq<'T> - - - - - - + member Run: Microsoft.FSharp.Quotations.Expr> -> Microsoft.FSharp.Collections.seq<'T> diff --git a/src/fsharp/FSharp.Core/QueryExtensions.fs b/src/fsharp/FSharp.Core/QueryExtensions.fs index bfddf7e57ef..f21c93ba648 100644 --- a/src/fsharp/FSharp.Core/QueryExtensions.fs +++ b/src/fsharp/FSharp.Core/QueryExtensions.fs @@ -283,5 +283,3 @@ module internal Adapters = tipf expr let MakeSeqConv conv = match conv with NoConv -> NoConv | _ -> SeqConv conv - - diff --git a/src/fsharp/FSharp.Core/array.fsi b/src/fsharp/FSharp.Core/array.fsi index c5d9ed95895..0950c5e9a80 100644 --- a/src/fsharp/FSharp.Core/array.fsi +++ b/src/fsharp/FSharp.Core/array.fsi @@ -2,1603 +2,1957 @@ namespace Microsoft.FSharp.Collections - open System - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - open System.Collections.Generic - - /// Contains operations for working with arrays. +open System +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections +open System.Collections.Generic + +/// Contains operations for working with arrays. +/// +/// +/// See also F# Language Guide - Arrays. +/// +[] +[] +module Array = + + /// Returns a new array that contains all pairings of elements from the first and second arrays. /// - /// - /// See also F# Language Guide - Arrays. - /// - [] - [] - module Array = - - /// Returns a new array that contains all pairings of elements from the first and second arrays. - /// - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// - /// The resulting array of pairs. - [] - val allPairs: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] - - /// Builds a new array that contains the elements of the first array followed by the elements of the second array. - /// - /// The first input array. - /// The second input array. - /// - /// The resulting array. - /// - /// Thrown when either of the input arrays is null. - [] - val append: array1:'T[] -> array2:'T[] -> 'T[] - - /// Returns the average of the elements in the array. - /// - /// The input array. - /// - /// Thrown when array is empty. - /// Thrown when the input array is null. - /// - /// The average of the elements in the array. - [] - val inline average : array:^T[] -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member DivideByInt : ^T*int -> ^T) - and ^T : (static member Zero : ^T) - - - /// Returns the average of the elements generated by applying the function to each element of the array. - /// - /// The function to transform the array elements before averaging. - /// The input array. - /// - /// Thrown when array is empty. - /// - /// The computed average. - /// - /// Thrown when the input array is null. - [] - val inline averageBy : projection:('T -> ^U) -> array:'T[] -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member DivideByInt : ^U*int -> ^U) - and ^U : (static member Zero : ^U) - - /// Reads a range of elements from the first array and write them into the second. - /// - /// The source array. - /// The starting index of the source array. - /// The target array. - /// The starting index of the target array. - /// The number of elements to copy. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when any of sourceIndex, targetIndex or count are negative, - /// or when there aren't enough elements in source or target. - [] - val inline blit: source:'T[] -> sourceIndex:int -> target:'T[] -> targetIndex:int -> count:int -> unit - - /// For each element of the array, applies the given function. Concatenates all the results and return the combined array. - /// - /// The function to create sub-arrays from the input array elements. - /// The input array. - /// - /// The concatenation of the sub-arrays. - /// - /// Thrown when the input array is null. - [] - val collect : mapping:('T -> 'U[]) -> array:'T[] -> 'U[] - - /// Compares two arrays using the given comparison function, element by element. - /// - /// A function that takes an element from each array and returns an int. - /// If it evaluates to a non-zero value iteration is stopped and that value is returned. - /// The first input array. - /// The second input array. - /// - /// Returns the first non-zero result from the comparison function. If the first array has - /// a larger element, the return value is always positive. If the second array has a larger - /// element, the return value is always negative. When the elements are equal in the two - /// arrays, 1 is returned if the first array is longer, 0 is returned if they are equal in - /// length, and -1 is returned when the second array is longer. - /// - /// Thrown when either of the input arrays - /// is null. - [] - val inline compareWith: comparer:('T -> 'T -> int) -> array1:'T[] -> array2:'T[] -> int - - /// Builds a new array that contains the elements of each of the given sequence of arrays. - /// - /// The input sequence of arrays. - /// - /// The concatenation of the sequence of input arrays. - /// - /// Thrown when the input sequence is null. - [] - val concat: arrays:seq<'T[]> -> 'T[] - - /// Tests if the array contains the specified element. - /// - /// The value to locate in the input array. - /// The input array. - /// - /// True if the input array contains the specified element; false otherwise. - /// - /// Thrown when the input array is null. - [] - val inline contains: value:'T -> array:'T[] -> bool when 'T : equality - - /// Builds a new array that contains the elements of the given array. - /// - /// The input array. - /// - /// A copy of the input array. - /// - /// Thrown when the input array is null. - [] - val copy: array:'T[] -> 'T[] - - /// Applies a key-generating function to each element of an array and returns an array yielding unique - /// keys and their number of occurrences in the original array. - /// - /// A function transforming each item of the input array into a key to be - /// compared against the others. - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input array is null. - [] - val countBy : projection:('T -> 'Key) -> array:'T[] -> ('Key * int)[] when 'Key : equality - - /// Creates an array whose elements are all initially the given value. - /// - /// The length of the array to create. - /// The value for the elements. - /// - /// The created array. - /// - /// Thrown when count is negative. - [] - val create: count:int -> value:'T -> 'T[] - - /// Returns the first element of the array, or - /// None if the array is empty. - /// - /// The input array. - /// - /// Thrown when the input array is null. - /// - /// The first element of the array or None. - [] - val tryHead: array:'T[] -> 'T option - - /// Applies the given function to successive elements, returning the first - /// result where function returns Some(x) for some x. If the function - /// never returns Some(x) then None is returned. - /// - /// The function to transform the array elements into options. - /// The input array. - /// - /// The first transformed element that is Some(x). - /// - /// Thrown when the input array is null. - [] - val tryPick: chooser:('T -> 'U option) -> array:'T[] -> 'U option - - /// Fills a range of elements of the array with the given value. - /// - /// The target array. - /// The index of the first element to set. - /// The number of elements to set. - /// The value to set. - /// - /// Thrown when the input array is null. - /// Thrown when either targetIndex or count is negative. - [] - val fill: target:'T[] -> targetIndex:int -> count:int -> value:'T -> unit - - /// Applies the given function to successive elements, returning the first - /// result where function returns Some(x) for some x. If the function - /// never returns Some(x) then is raised. - /// - /// The function to generate options from the elements. - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown if every result from - /// chooser is None. - /// - /// The first result. - [] - val pick: chooser:('T -> 'U option) -> array:'T[] -> 'U - - /// Applies the given function to each element of the array. Returns - /// the array comprised of the results "x" for each element where - /// the function returns Some(x) - /// - /// The function to generate options from the elements. - /// The input array. - /// - /// The array of results. - /// - /// Thrown when the input array is null. - [] - val choose: chooser:('T -> 'U option) -> array:'T[] -> 'U[] - - /// Divides the input array into chunks of size at most chunkSize. - /// - /// The maximum size of each chunk. - /// The input array. - /// - /// The array divided into chunks. - /// - /// Thrown when the input array is null. - /// Thrown when chunkSize is not positive. - [] - val chunkBySize: chunkSize:int -> array:'T[] -> 'T[][] - - /// Returns an array that contains no duplicate entries according to generic hash and - /// equality comparisons on the entries. - /// If an element occurs multiple times in the array then the later occurrences are discarded. - /// - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input array is null. - [] - val distinct: array:'T[] -> 'T[] when 'T : equality - - /// Returns an array that contains no duplicate entries according to the - /// generic hash and equality comparisons on the keys returned by the given key-generating function. - /// If an element occurs multiple times in the array then the later occurrences are discarded. - /// - /// A function transforming the array items into comparable keys. - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input array is null. - [] - val distinctBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : equality - - /// Splits the input array into at most count chunks. - /// - /// The maximum number of chunks. - /// The input array. - /// - /// The array split into chunks. - /// - /// Thrown when the input array is null. - /// Thrown when count is not positive. - [] - val splitInto: count:int -> array:'T[] -> 'T[][] - - /// Returns an empty array of the given type. - /// The empty array. - [] - [] - val empty<'T> : 'T[] - - /// Returns the only element of the array. - /// - /// The input array. - /// - /// The only element of the array. - /// - /// Thrown when the input array is null. - /// Thrown when the input does not have precisely one element. - [] - val exactlyOne: array:'T[] -> 'T - - /// Returns the only element of the array or None if array is empty or contains more than one element. - /// - /// The input array. - /// - /// The only element of the array or None. - /// - /// Thrown when the input array is null. - [] - val tryExactlyOne: array:'T[] -> 'T option - - /// Returns a new list with the distinct elements of the input array which do not appear in the itemsToExclude sequence, - /// using generic hash and equality comparisons to compare values. - /// - /// A sequence whose elements that also occur in the input array will cause those elements to be - /// removed from the result. - /// An array whose elements that are not also in itemsToExclude will be returned. - /// - /// An array that contains the distinct elements of array that do not appear in itemsToExclude. - /// - /// Thrown when either itemsToExclude or array is null. - [] - val except: itemsToExclude:seq<'T> -> array:'T[] -> 'T[] when 'T : equality - - /// Tests if any element of the array satisfies the given predicate. - /// - /// The predicate is applied to the elements of the input array. If any application - /// returns true then the overall result is true and no further elements are tested. - /// Otherwise, false is returned. - /// - /// The function to test the input elements. - /// The input array. - /// - /// True if any result from predicate is true. - /// - /// Thrown when the input array is null. - [] - val exists: predicate:('T -> bool) -> array:'T[] -> bool - - /// Tests if any pair of corresponding elements of the arrays satisfies the given predicate. - /// - /// The predicate is applied to matching elements in the two collections up to the lesser of the - /// two lengths of the collections. If any application returns true then the overall result is - /// true and no further elements are tested. Otherwise, if one collections is longer - /// than the other then the ArgumentException exception is raised. - /// Otherwise, false is returned. - /// - /// The function to test the input elements. - /// The first input array. - /// The second input array. - /// - /// True if any result from predicate is true. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - [] - val exists2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1[] -> array2:'T2[] -> bool + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// + /// The resulting array of pairs. + /// + /// + /// + [] + val allPairs: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] + + /// Builds a new array that contains the elements of the first array followed by the elements of the second array. + /// + /// The first input array. + /// The second input array. + /// + /// The resulting array. + /// + /// Thrown when either of the input arrays is null. + /// + /// + /// + [] + val append: array1:'T[] -> array2:'T[] -> 'T[] + + /// Returns the average of the elements in the array. + /// + /// The input array. + /// + /// Thrown when array is empty. + /// Thrown when the input array is null. + /// + /// The average of the elements in the array. + /// + /// + /// + [] + val inline average : array:^T[] -> ^T + when ^T : (static member ( + ) : ^T * ^T -> ^T) + and ^T : (static member DivideByInt : ^T*int -> ^T) + and ^T : (static member Zero : ^T) + + + /// Returns the average of the elements generated by applying the function to each element of the array. + /// + /// The function to transform the array elements before averaging. + /// The input array. + /// + /// Thrown when array is empty. + /// + /// The computed average. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val inline averageBy : projection:('T -> ^U) -> array:'T[] -> ^U + when ^U : (static member ( + ) : ^U * ^U -> ^U) + and ^U : (static member DivideByInt : ^U*int -> ^U) + and ^U : (static member Zero : ^U) + + /// Reads a range of elements from the first array and write them into the second. + /// + /// The source array. + /// The starting index of the source array. + /// The target array. + /// The starting index of the target array. + /// The number of elements to copy. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when any of sourceIndex, targetIndex or count are negative, + /// or when there aren't enough elements in source or target. + /// + /// + /// + [] + val inline blit: source:'T[] -> sourceIndex:int -> target:'T[] -> targetIndex:int -> count:int -> unit + + /// For each element of the array, applies the given function. Concatenates all the results and return the combined array. + /// + /// The function to create sub-arrays from the input array elements. + /// The input array. + /// + /// The concatenation of the sub-arrays. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val collect : mapping:('T -> 'U[]) -> array:'T[] -> 'U[] + + /// Compares two arrays using the given comparison function, element by element. + /// + /// A function that takes an element from each array and returns an int. + /// If it evaluates to a non-zero value iteration is stopped and that value is returned. + /// The first input array. + /// The second input array. + /// + /// Returns the first non-zero result from the comparison function. If the first array has + /// a larger element, the return value is always positive. If the second array has a larger + /// element, the return value is always negative. When the elements are equal in the two + /// arrays, 1 is returned if the first array is longer, 0 is returned if they are equal in + /// length, and -1 is returned when the second array is longer. + /// + /// Thrown when either of the input arrays + /// is null. + /// + /// + /// + [] + val inline compareWith: comparer:('T -> 'T -> int) -> array1:'T[] -> array2:'T[] -> int + + /// Builds a new array that contains the elements of each of the given sequence of arrays. + /// + /// The input sequence of arrays. + /// + /// The concatenation of the sequence of input arrays. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + [] + val concat: arrays:seq<'T[]> -> 'T[] + + /// Tests if the array contains the specified element. + /// + /// The value to locate in the input array. + /// The input array. + /// + /// True if the input array contains the specified element; false otherwise. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val inline contains: value:'T -> array:'T[] -> bool when 'T : equality + + /// Builds a new array that contains the elements of the given array. + /// + /// The input array. + /// + /// A copy of the input array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val copy: array:'T[] -> 'T[] + + /// Applies a key-generating function to each element of an array and returns an array yielding unique + /// keys and their number of occurrences in the original array. + /// + /// A function transforming each item of the input array into a key to be + /// compared against the others. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val countBy : projection:('T -> 'Key) -> array:'T[] -> ('Key * int)[] when 'Key : equality + + /// Creates an array whose elements are all initially the given value. + /// + /// The length of the array to create. + /// The value for the elements. + /// + /// The created array. + /// + /// Thrown when count is negative. + /// + /// + /// + [] + val create: count:int -> value:'T -> 'T[] + + /// Returns the first element of the array, or + /// None if the array is empty. + /// + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// The first element of the array or None. + /// + /// + /// + [] + val tryHead: array:'T[] -> 'T option + + /// Applies the given function to successive elements, returning the first + /// result where the function returns Some(x) for some x. If the function + /// never returns Some(x) then None is returned. + /// + /// The function to transform the array elements into options. + /// The input array. + /// + /// The first transformed element that is Some(x). + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val tryPick: chooser:('T -> 'U option) -> array:'T[] -> 'U option + + /// Fills a range of elements of the array with the given value. + /// + /// The target array. + /// The index of the first element to set. + /// The number of elements to set. + /// The value to set. + /// + /// Thrown when the input array is null. + /// Thrown when either targetIndex or count is negative. + /// + /// + /// + [] + val fill: target:'T[] -> targetIndex:int -> count:int -> value:'T -> unit + + /// Applies the given function to successive elements, returning the first + /// result where the function returns Some(x) for some x. If the function + /// never returns Some(x) then is raised. + /// + /// The function to generate options from the elements. + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown if every result from + /// chooser is None. + /// + /// The first result. + /// + /// + /// + [] + val pick: chooser:('T -> 'U option) -> array:'T[] -> 'U + + /// Applies the given function to each element of the array. Returns + /// the array comprised of the results x for each element where + /// the function returns Some(x) + /// + /// The function to generate options from the elements. + /// The input array. + /// + /// The array of results. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val choose: chooser:('T -> 'U option) -> array:'T[] -> 'U[] + + /// Divides the input array into chunks of size at most chunkSize. + /// + /// The maximum size of each chunk. + /// The input array. + /// + /// The array divided into chunks. + /// + /// Thrown when the input array is null. + /// Thrown when chunkSize is not positive. + /// + /// + /// + [] + val chunkBySize: chunkSize:int -> array:'T[] -> 'T[][] + + /// Returns an array that contains no duplicate entries according to generic hash and + /// equality comparisons on the entries. + /// If an element occurs multiple times in the array then the later occurrences are discarded. + /// + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val distinct: array:'T[] -> 'T[] when 'T : equality + + /// Returns an array that contains no duplicate entries according to the + /// generic hash and equality comparisons on the keys returned by the given key-generating function. + /// If an element occurs multiple times in the array then the later occurrences are discarded. + /// + /// A function transforming the array items into comparable keys. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val distinctBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : equality + + /// Splits the input array into at most count chunks. + /// + /// The maximum number of chunks. + /// The input array. + /// + /// The array split into chunks. + /// + /// Thrown when the input array is null. + /// Thrown when count is not positive. + /// + /// + /// + [] + val splitInto: count:int -> array:'T[] -> 'T[][] + + /// Returns an empty array of the given type. + /// The empty array. + [] + /// + /// + /// + [] + val empty<'T> : 'T[] + + /// Returns the only element of the array. + /// + /// The input array. + /// + /// The only element of the array. + /// + /// Thrown when the input array is null. + /// Thrown when the input does not have precisely one element. + /// + /// + /// + [] + val exactlyOne: array:'T[] -> 'T + + /// Returns the only element of the array or None if array is empty or contains more than one element. + /// + /// The input array. + /// + /// The only element of the array or None. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val tryExactlyOne: array:'T[] -> 'T option + + /// Returns a new list with the distinct elements of the input array which do not appear in the itemsToExclude sequence, + /// using generic hash and equality comparisons to compare values. + /// + /// A sequence whose elements that also occur in the input array will cause those elements to be + /// removed from the result. + /// An array whose elements that are not also in itemsToExclude will be returned. + /// + /// An array that contains the distinct elements of array that do not appear in itemsToExclude. + /// + /// Thrown when either itemsToExclude or array is null. + /// + /// + /// + [] + val except: itemsToExclude:seq<'T> -> array:'T[] -> 'T[] when 'T : equality + + /// Tests if any element of the array satisfies the given predicate. + /// + /// The predicate is applied to the elements of the input array. If any application + /// returns true then the overall result is true and no further elements are tested. + /// Otherwise, false is returned. + /// + /// The function to test the input elements. + /// The input array. + /// + /// True if any result from predicate is true. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val exists: predicate:('T -> bool) -> array:'T[] -> bool + + /// Tests if any pair of corresponding elements of the arrays satisfies the given predicate. + /// + /// The predicate is applied to matching elements in the two collections up to the lesser of the + /// two lengths of the collections. If any application returns true then the overall result is + /// true and no further elements are tested. Otherwise, if one collections is longer + /// than the other then the ArgumentException exception is raised. + /// Otherwise, false is returned. + /// + /// The function to test the input elements. + /// The first input array. + /// The second input array. + /// + /// True if any result from predicate is true. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// + /// + [] + val exists2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1[] -> array2:'T2[] -> bool + + /// Returns a new collection containing only the elements of the collection + /// for which the given predicate returns "true". + /// + /// The function to test the input elements. + /// The input array. + /// + /// An array containing the elements for which the given predicate returns true. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val filter: predicate:('T -> bool) -> array:'T[] -> 'T[] + + /// Returns the first element for which the given function returns 'true'. + /// Raise if no such element exists. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown if predicate + /// never returns true. + /// + /// The first element for which predicate returns true. + /// + /// + /// + [] + val find: predicate:('T -> bool) -> array:'T[] -> 'T + + /// Returns the last element for which the given function returns 'true'. + /// Raise if no such element exists. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown if predicate + /// never returns true. + /// Thrown when the input array is null. + /// + /// The last element for which predicate returns true. + /// + /// + /// + [] + val findBack: predicate:('T -> bool) -> array:'T[] -> 'T + + /// Returns the index of the first element in the array + /// that satisfies the given predicate. Raise if + /// none of the elements satisfy the predicate. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown if predicate + /// never returns true. + /// Thrown when the input array is null. + /// + /// The index of the first element in the array that satisfies the given predicate. + /// + /// + /// + [] + val findIndex: predicate:('T -> bool) -> array:'T[] -> int + + /// Returns the index of the last element in the array + /// that satisfies the given predicate. Raise if + /// none of the elements satisfy the predicate. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown if predicate + /// never returns true. + /// Thrown when the input array is null. + /// + /// The index of the last element in the array that satisfies the given predicate. + /// + /// + /// + [] + val findIndexBack: predicate:('T -> bool) -> array:'T[] -> int + + /// Tests if all elements of the array satisfy the given predicate. + /// + /// The predicate is applied to the elements of the input collection. If any application + /// returns false then the overall result is false and no further elements are tested. + /// Otherwise, true is returned. + /// + /// The function to test the input elements. + /// The input array. + /// + /// True if all of the array elements satisfy the predicate. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val forall: predicate:('T -> bool) -> array:'T[] -> bool - /// Returns a new collection containing only the elements of the collection - /// for which the given predicate returns "true". - /// - /// The function to test the input elements. - /// The input array. - /// - /// An array containing the elements for which the given predicate returns true. - /// - /// Thrown when the input array is null. - [] - val filter: predicate:('T -> bool) -> array:'T[] -> 'T[] - /// Returns the first element for which the given function returns 'true'. - /// Raise if no such element exists. - /// - /// The function to test the input elements. - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown if predicate - /// never returns true. - /// - /// The first element for which predicate returns true. - [] - val find: predicate:('T -> bool) -> array:'T[] -> 'T - - /// Returns the last element for which the given function returns 'true'. - /// Raise if no such element exists. - /// - /// The function to test the input elements. - /// The input array. - /// - /// Thrown if predicate - /// never returns true. - /// Thrown when the input array is null. - /// - /// The last element for which predicate returns true. - [] - val findBack: predicate:('T -> bool) -> array:'T[] -> 'T - - /// Returns the index of the first element in the array - /// that satisfies the given predicate. Raise if - /// none of the elements satisfy the predicate. - /// - /// The function to test the input elements. - /// The input array. - /// - /// Thrown if predicate - /// never returns true. - /// Thrown when the input array is null. - /// - /// The index of the first element in the array that satisfies the given predicate. - [] - val findIndex: predicate:('T -> bool) -> array:'T[] -> int - - /// Returns the index of the last element in the array - /// that satisfies the given predicate. Raise if - /// none of the elements satisfy the predicate. - /// - /// The function to test the input elements. - /// The input array. - /// - /// Thrown if predicate - /// never returns true. - /// Thrown when the input array is null. - /// - /// The index of the last element in the array that satisfies the given predicate. - [] - val findIndexBack: predicate:('T -> bool) -> array:'T[] -> int - - /// Tests if all elements of the array satisfy the given predicate. - /// - /// The predicate is applied to the elements of the input collection. If any application - /// returns false then the overall result is false and no further elements are tested. - /// Otherwise, true is returned. - /// - /// The function to test the input elements. - /// The input array. - /// - /// True if all of the array elements satisfy the predicate. - /// - /// Thrown when the input array is null. - [] - val forall: predicate:('T -> bool) -> array:'T[] -> bool - - - /// Tests if all corresponding elements of the array satisfy the given predicate pairwise. - /// - /// The predicate is applied to matching elements in the two collections up to the lesser of the - /// two lengths of the collections. If any application returns false then the overall result is - /// false and no further elements are tested. Otherwise, if one collection is longer - /// than the other then the ArgumentException exception is raised. - /// Otherwise, true is returned. - /// - /// The function to test the input elements. - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - /// - /// True if all of the array elements satisfy the predicate. - [] - val forall2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1[] -> array2:'T2[] -> bool - - /// Applies a function to each element of the collection, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN then computes - /// f (... (f s i0)...) iN - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The input array. - /// - /// The final state. - /// - /// Thrown when the input array is null. - [] - val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> array: 'T[] -> 'State - - /// Applies a function to each element of the array, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN then computes - /// f i0 (...(f iN s)) - /// - /// The function to update the state given the input elements. - /// The input array. - /// The initial state. - /// - /// The state object after the folding function is applied to each element of the array. - /// - /// Thrown when the input array is null. - [] - val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> array:'T[] -> state:'State -> 'State - - /// Applies a function to pairs of elements drawn from the two collections, - /// left-to-right, threading an accumulator argument - /// through the computation. The two input - /// arrays must have the same lengths, otherwise an ArgumentException is - /// raised. - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - /// - /// The final state. - [] - val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> array1:'T1[] -> array2:'T2[] -> 'State - - /// Apply a function to pairs of elements drawn from the two collections, right-to-left, - /// threading an accumulator argument through the computation. The two input - /// arrays must have the same lengths, otherwise an ArgumentException is - /// raised. - /// - /// The function to update the state given the input elements. - /// The first input array. - /// The second input array. - /// The initial state. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - /// - /// The final state. - [] - val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> array1:'T1[] -> array2:'T2[] -> state:'State -> 'State - - /// Gets an element from an array. - /// - /// The input array. - /// The input index. - /// - /// The value of the array at the given index. - /// - /// Thrown when the input array is null. - /// Thrown when the index is negative or the input array does not contain enough elements. - [] - val get: array:'T[] -> index:int -> 'T - - /// Returns the first element of the array. - /// - /// The input array. - /// - /// The first element of the array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - [] - val head: array:'T[] -> 'T - - /// Applies a key-generating function to each element of an array and yields an array of - /// unique keys. Each unique key contains an array of all elements that match - /// to this key. - /// - /// A function that transforms an element of the array into a comparable key. - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input array is null. - [] - val groupBy : projection:('T -> 'Key) -> array:'T[] -> ('Key * 'T[])[] when 'Key : equality - - /// Builds a new array whose elements are the corresponding elements of the input array - /// paired with the integer index (from 0) of each element. - /// - /// The input array. - /// - /// The array of indexed elements. - /// - /// Thrown when the input array is null. - [] - val indexed: array:'T[] -> (int * 'T)[] - - /// Creates an array given the dimension and a generator function to compute the elements. - /// - /// The number of elements to initialize. - /// The function to generate the initial values for each index. - /// - /// The created array. - /// - /// Thrown when count is negative. - [] - val inline init: count:int -> initializer:(int -> 'T) -> 'T[] - - /// Creates an array where the entries are initially the default value Unchecked.defaultof<'T>. - /// - /// The length of the array to create. - /// - /// The created array. - /// - /// Thrown when count is negative. - [] - val zeroCreate: count:int -> 'T[] - - /// Returns true if the given array is empty, otherwise false. - /// - /// The input array. - /// - /// True if the array is empty. - /// - /// Thrown when the input array is null. - [] - val isEmpty: array:'T[] -> bool - - /// Applies the given function to each element of the array. - /// - /// The function to apply. - /// The input array. - /// - /// Thrown when the input array is null. - [] - val inline iter: action:('T -> unit) -> array:'T[] -> unit - - /// Applies the given function to pair of elements drawn from matching indices in two arrays. The - /// two arrays must have the same lengths, otherwise an ArgumentException is - /// raised. - /// - /// The function to apply. - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - [] - val iter2: action:('T1 -> 'T2 -> unit) -> array1:'T1[] -> array2:'T2[] -> unit - - /// Applies the given function to each element of the array. The integer passed to the - /// function indicates the index of element. - /// - /// The function to apply to each index and element. - /// The input array. - /// - /// Thrown when the input array is null. - [] - val iteri: action:(int -> 'T -> unit) -> array:'T[] -> unit - - /// Applies the given function to pair of elements drawn from matching indices in two arrays, - /// also passing the index of the elements. The two arrays must have the same lengths, - /// otherwise an ArgumentException is raised. - /// - /// The function to apply to each index and pair of elements. - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - [] - val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> array1:'T1[] -> array2:'T2[] -> unit - - /// Returns the last element of the array. - /// - /// The input array. - /// - /// The last element of the array. - /// - /// Thrown when the input array is null. - /// Thrown when the input does not have any elements. - [] - val inline last: array:'T[] -> 'T - - /// Gets an element from an array. - /// - /// The input index. - /// The input array. - /// - /// The value of the array at the given index. - /// - /// Thrown when the input array is null. - /// Thrown when the index is negative or the input array does not contain enough elements. - [] - val item: index:int -> array:'T[] -> 'T - - /// Returns the length of an array. You can also use property arr.Length. - /// - /// The input array. - /// - /// The length of the array. - /// - /// Thrown when the input array is null. - [] - val length: array:'T[] -> int - - /// Returns the last element of the array. - /// Return None if no such element exists. - /// - /// The input array. - /// - /// The last element of the array or None. - /// - /// Thrown when the input sequence is null. - [] - val tryLast: array:'T[] -> 'T option - - /// Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the array. - /// - /// The function to transform elements of the array. - /// The input array. - /// - /// The array of transformed elements. - /// - /// Thrown when the input array is null. - [] - val inline map: mapping:('T -> 'U) -> array:'T[] -> 'U[] - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding elements of the two collections pairwise. The two input - /// arrays must have the same lengths, otherwise an ArgumentException is - /// raised. - /// - /// The function to transform the pairs of the input elements. - /// The first input array. - /// The second input array. - /// - /// Thrown when the input arrays differ in length. - /// Thrown when either of the input arrays is null. - /// - /// The array of transformed elements. - [] - val map2: mapping:('T1 -> 'T2 -> 'U) -> array1:'T1[] -> array2:'T2[] -> 'U[] - - /// Combines map and fold. Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the input array. The function is also used to accumulate a final value. - /// - /// The function to transform elements from the input array and accumulate the final value. - /// The initial state. - /// The input array. - /// - /// Thrown when the input array is null. - /// - /// The array of transformed elements, and the final accumulated value. - [] - val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> array:'T[] -> 'Result[] * 'State - - /// Combines map and foldBack. Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the input array. The function is also used to accumulate a final value. - /// - /// The function to transform elements from the input array and accumulate the final value. - /// The input array. - /// The initial state. - /// - /// Thrown when the input array is null. - /// - /// The array of transformed elements, and the final accumulated value. - [] - val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> array:'T[] -> state:'State -> 'Result[] * 'State - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding triples from the three collections. The three input - /// arrays must have the same length, otherwise an ArgumentException is - /// raised. - /// - /// The function to transform the pairs of the input elements. - /// The first input array. - /// The second input array. - /// The third input array. - /// - /// Thrown when the input arrays differ in length. - /// Thrown when any of the input arrays is null. - /// - /// The array of transformed elements. - [] - val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> array1:'T1[] -> array2:'T2[] -> array3:'T3[] -> 'U[] - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding elements of the two collections pairwise, also passing the index of - /// the elements. The two input arrays must have the same lengths, otherwise an ArgumentException is - /// raised. - /// - /// The function to transform pairs of input elements and their indices. - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - /// - /// The array of transformed elements. - [] - val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> array1:'T1[] -> array2:'T2[] -> 'U[] - - /// Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the array. The integer index passed to the - /// function indicates the index of element being transformed. - /// - /// The function to transform elements and their indices. - /// The input array. - /// - /// The array of transformed elements. - /// - /// Thrown when the input array is null. - [] - val mapi: mapping:(int -> 'T -> 'U) -> array:'T[] -> 'U[] - - /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. - /// - /// Throws ArgumentException for empty arrays. - /// - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// - /// The maximum element. - [] - val inline max : array:'T[] -> 'T when 'T : comparison - - /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. - /// - /// Throws ArgumentException for empty arrays. - /// - /// The function to transform the elements into a type supporting comparison. - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// - /// The maximum element. - [] - val inline maxBy : projection:('T -> 'U) -> array:'T[] -> 'T when 'U : comparison - - /// Returns the lowest of all elements of the array, compared via Operators.min. - /// - /// Throws ArgumentException for empty arrays - /// - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// - /// The minimum element. - [] - val inline min : array:'T[] -> 'T when 'T : comparison - - /// Returns the lowest of all elements of the array, compared via Operators.min on the function result. - /// - /// Throws ArgumentException for empty arrays. - /// - /// The function to transform the elements into a type supporting comparison. - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// - /// The minimum element. - [] - val inline minBy : projection:('T -> 'U) -> array:'T[] -> 'T when 'U : comparison - - /// Builds an array from the given list. - /// - /// The input list. - /// - /// The array of elements from the list. - [] - val ofList: list:'T list -> 'T[] - - /// Builds a new array from the given enumerable object. - /// - /// The input sequence. - /// - /// The array of elements from the sequence. - /// - /// Thrown when the input sequence is null. - [] - val ofSeq: source:seq<'T> -> 'T[] - - /// Returns an array of each element in the input array and its predecessor, with the - /// exception of the first element which is only returned as the predecessor of the second element. - /// - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input sequence is null. - [] - val pairwise: array:'T[] -> ('T * 'T)[] - - /// Splits the collection into two collections, containing the - /// elements for which the given predicate returns "true" and "false" - /// respectively. - /// - /// The function to test the input elements. - /// The input array. - /// - /// A pair of arrays. The first containing the elements the predicate evaluated to true, - /// and the second containing those evaluated to false. - /// - /// Thrown when the input array is null. - [] - val partition: predicate:('T -> bool) -> array:'T[] -> 'T[] * 'T[] - - /// Returns an array with all elements permuted according to the - /// specified permutation. - /// - /// The function that maps input indices to output indices. - /// The input array. - /// - /// The output array. - /// - /// Thrown when the input array is null. - /// Thrown when indexMap does not produce a valid permutation. - [] - val permute : indexMap:(int -> int) -> array:'T[] -> 'T[] - - /// Applies a function to each element of the array, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN - /// then computes f (... (f i0 i1)...) iN. - /// Raises ArgumentException if the array has size zero. - /// - /// The function to reduce a pair of elements to a single element. - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// - /// The final result of the reductions. - [] - val reduce: reduction:('T -> 'T -> 'T) -> array:'T[] -> 'T - - /// Applies a function to each element of the array, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN - /// then computes f i0 (...(f iN-1 iN)). - /// - /// A function that takes in the next-to-last element of the list and the - /// current accumulated result to produce the next accumulated result. - /// The input array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// - /// The final result of the reductions. - [] - val reduceBack: reduction:('T -> 'T -> 'T) -> array:'T[] -> 'T - - /// Creates an array by replicating the given initial value. - /// - /// The number of elements to replicate. - /// The value to replicate - /// - /// The generated array. - /// - /// Thrown when count is negative. - [] - val replicate: count:int -> initial:'T -> 'T[] - - /// Returns a new array with the elements in reverse order. - /// - /// The input array. - /// - /// The reversed array. - /// - /// Thrown when the input array is null. - [] - val rev: array:'T[] -> 'T[] - - /// Like fold, but return the intermediary and final results. - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The input array. - /// - /// The array of state values. - /// - /// Thrown when the input array is null. - [] - val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> array:'T[] -> 'State[] - - /// Like foldBack, but return both the intermediary and final results. - /// - /// The function to update the state given the input elements. - /// The input array. - /// The initial state. - /// - /// The array of state values. - /// - /// Thrown when the input array is null. - [] - val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> array:'T[] -> state:'State -> 'State[] - - /// Returns an array that contains one item only. - /// - /// The input item. - /// - /// The result array of one item. - [] - val inline singleton: value:'T -> 'T[] - - /// Sets an element of an array. - /// - /// The input array. - /// The input index. - /// The input value. - /// - /// Thrown when the input array is null. - /// Thrown when the index is negative or the input array does not contain enough elements. - [] - val set: array:'T[] -> index:int -> value:'T -> unit - - /// Builds a new array that contains the elements of the given array, excluding the first N elements. - /// - /// The number of elements to skip. If negative the full array will be returned as a copy. - /// The input array. - /// - /// A copy of the input array, after removing the first N elements. - /// - /// Thrown when the input array is null. - /// Thrown when count exceeds the number of - /// elements in the array. - [] - val skip: count:int -> array:'T[] -> 'T[] - - /// Bypasses elements in an array while the given predicate returns True, and then returns - /// the remaining elements in a new array. - /// - /// A function that evaluates an element of the array to a boolean value. - /// The input array. - /// - /// The created sub array. - /// - /// Thrown when the input array is null. - [] - val skipWhile: predicate:('T -> bool) -> array:'T[] -> 'T[] - - /// Builds a new array that contains the given subrange specified by - /// starting index and length. - /// - /// The input array. - /// The index of the first element of the sub array. - /// The length of the sub array. - /// - /// The created sub array. - /// - /// Thrown when the input array is null. - /// Thrown when either startIndex or count is negative, - /// or when there aren't enough elements in the input array. - [] - val sub: array:'T[] -> startIndex:int -> count:int -> 'T[] - - /// Sorts the elements of an array, returning a new array. Elements are compared using . - /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. - /// For a stable sort, consider using . - /// - /// The input array. - /// - /// The sorted array. - /// - /// Thrown when the input array is null. - [] - val sort: array:'T[] -> 'T[] when 'T : comparison - - /// Sorts the elements of an array, using the given projection for the keys and returning a new array. - /// Elements are compared using . - /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. - /// For a stable sort, consider using . - /// - /// The function to transform array elements into the type that is compared. - /// The input array. - /// - /// The sorted array. - /// - /// Thrown when the input array is null. - [] - val sortBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison - - /// Sorts the elements of an array, using the given comparison function as the order, returning a new array. - /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. - /// For a stable sort, consider using . - /// - /// The function to compare pairs of array elements. - /// The input array. - /// - /// The sorted array. - /// - /// Thrown when the input array is null. - [] - val sortWith: comparer:('T -> 'T -> int) -> array:'T[] -> 'T[] - - /// Sorts the elements of an array by mutating the array in-place, using the given projection for the keys. - /// Elements are compared using . - /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. - /// For a stable sort, consider using . - /// - /// The function to transform array elements into the type that is compared. - /// The input array. - /// - /// Thrown when the input array is null. - [] - val sortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison - - - - /// Sorts the elements of an array by mutating the array in-place, using the given comparison function as the order. - /// - /// The function to compare pairs of array elements. - /// The input array. - /// - /// Thrown when the input array is null. - [] - val sortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit + /// Tests if all corresponding elements of the array satisfy the given predicate pairwise. + /// + /// The predicate is applied to matching elements in the two collections up to the lesser of the + /// two lengths of the collections. If any application returns false then the overall result is + /// false and no further elements are tested. Otherwise, if one collection is longer + /// than the other then the ArgumentException exception is raised. + /// Otherwise, true is returned. + /// + /// The function to test the input elements. + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// True if all of the array elements satisfy the predicate. + /// + /// + /// + [] + val forall2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1[] -> array2:'T2[] -> bool + + /// Applies a function to each element of the collection, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN then computes + /// f (... (f s i0)...) iN + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The input array. + /// + /// The final state. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> array: 'T[] -> 'State + + /// Applies a function to each element of the array, starting from the end, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN then computes + /// f i0 (...(f iN s)) + /// + /// The function to update the state given the input elements. + /// The input array. + /// The initial state. + /// + /// The state object after the folding function is applied to each element of the array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> array:'T[] -> state:'State -> 'State + + /// Applies a function to pairs of elements drawn from the two collections, + /// left-to-right, threading an accumulator argument + /// through the computation. The two input + /// arrays must have the same lengths, otherwise an ArgumentException is + /// raised. + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// The final state. + /// + /// + /// + [] + val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> array1:'T1[] -> array2:'T2[] -> 'State + + /// Apply a function to pairs of elements drawn from the two collections, right-to-left, + /// threading an accumulator argument through the computation. The two input + /// arrays must have the same lengths, otherwise an ArgumentException is + /// raised. + /// + /// The function to update the state given the input elements. + /// The first input array. + /// The second input array. + /// The initial state. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// The final state. + /// + /// + /// + [] + val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> array1:'T1[] -> array2:'T2[] -> state:'State -> 'State + + /// Gets an element from an array. + /// + /// The input array. + /// The input index. + /// + /// The value of the array at the given index. + /// + /// Thrown when the input array is null. + /// Thrown when the index is negative or the input array does not contain enough elements. + /// + /// + /// + [] + val get: array:'T[] -> index:int -> 'T + + /// Returns the first element of the array. + /// + /// The input array. + /// + /// The first element of the array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// + /// + [] + val head: array:'T[] -> 'T + + /// Applies a key-generating function to each element of an array and yields an array of + /// unique keys. Each unique key contains an array of all elements that match + /// to this key. + /// + /// A function that transforms an element of the array into a comparable key. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val groupBy : projection:('T -> 'Key) -> array:'T[] -> ('Key * 'T[])[] when 'Key : equality + + /// Builds a new array whose elements are the corresponding elements of the input array + /// paired with the integer index (from 0) of each element. + /// + /// The input array. + /// + /// The array of indexed elements. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val indexed: array:'T[] -> (int * 'T)[] + + /// Creates an array given the dimension and a generator function to compute the elements. + /// + /// The number of elements to initialize. + /// The function to generate the initial values for each index. + /// + /// The created array. + /// + /// Thrown when count is negative. + /// + /// + /// + [] + val inline init: count:int -> initializer:(int -> 'T) -> 'T[] + + /// Creates an array where the entries are initially the default value Unchecked.defaultof<'T>. + /// + /// The length of the array to create. + /// + /// The created array. + /// + /// Thrown when count is negative. + /// + /// + /// + [] + val zeroCreate: count:int -> 'T[] + + /// Returns true if the given array is empty, otherwise false. + /// + /// The input array. + /// + /// True if the array is empty. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val isEmpty: array:'T[] -> bool + + /// Applies the given function to each element of the array. + /// + /// The function to apply. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val inline iter: action:('T -> unit) -> array:'T[] -> unit + + /// Applies the given function to pair of elements drawn from matching indices in two arrays. The + /// two arrays must have the same lengths, otherwise an ArgumentException is + /// raised. + /// + /// The function to apply. + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// + /// + [] + val iter2: action:('T1 -> 'T2 -> unit) -> array1:'T1[] -> array2:'T2[] -> unit + + /// Applies the given function to each element of the array. The integer passed to the + /// function indicates the index of element. + /// + /// The function to apply to each index and element. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val iteri: action:(int -> 'T -> unit) -> array:'T[] -> unit + + /// Applies the given function to pair of elements drawn from matching indices in two arrays, + /// also passing the index of the elements. The two arrays must have the same lengths, + /// otherwise an ArgumentException is raised. + /// + /// The function to apply to each index and pair of elements. + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// + /// + [] + val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> array1:'T1[] -> array2:'T2[] -> unit + + /// Returns the last element of the array. + /// + /// The input array. + /// + /// The last element of the array. + /// + /// Thrown when the input array is null. + /// Thrown when the input does not have any elements. + /// + /// + /// + [] + val inline last: array:'T[] -> 'T + + /// Gets an element from an array. + /// + /// The input index. + /// The input array. + /// + /// The value of the array at the given index. + /// + /// Thrown when the input array is null. + /// Thrown when the index is negative or the input array does not contain enough elements. + /// + /// + /// + [] + val item: index:int -> array:'T[] -> 'T + + /// Returns the length of an array. You can also use property arr.Length. + /// + /// The input array. + /// + /// The length of the array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val length: array:'T[] -> int + + /// Returns the last element of the array. + /// Return None if no such element exists. + /// + /// The input array. + /// + /// The last element of the array or None. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + [] + val tryLast: array:'T[] -> 'T option + + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. + /// + /// The function to transform elements of the array. + /// The input array. + /// + /// The array of transformed elements. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val inline map: mapping:('T -> 'U) -> array:'T[] -> 'U[] + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding elements of the two collections pairwise. The two input + /// arrays must have the same lengths, otherwise an ArgumentException is + /// raised. + /// + /// The function to transform the pairs of the input elements. + /// The first input array. + /// The second input array. + /// + /// Thrown when the input arrays differ in length. + /// Thrown when either of the input arrays is null. + /// + /// The array of transformed elements. + /// + /// + /// + [] + val map2: mapping:('T1 -> 'T2 -> 'U) -> array1:'T1[] -> array2:'T2[] -> 'U[] + + /// Combines map and fold. Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the input array. The function is also used to accumulate a final value. + /// + /// The function to transform elements from the input array and accumulate the final value. + /// The initial state. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// The array of transformed elements, and the final accumulated value. + /// + /// + /// + [] + val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> array:'T[] -> 'Result[] * 'State + + /// Combines map and foldBack. Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the input array. The function is also used to accumulate a final value. + /// + /// The function to transform elements from the input array and accumulate the final value. + /// The input array. + /// The initial state. + /// + /// Thrown when the input array is null. + /// + /// The array of transformed elements, and the final accumulated value. + /// + /// + /// + [] + val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> array:'T[] -> state:'State -> 'Result[] * 'State + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding triples from the three collections. The three input + /// arrays must have the same length, otherwise an ArgumentException is + /// raised. + /// + /// The function to transform the pairs of the input elements. + /// The first input array. + /// The second input array. + /// The third input array. + /// + /// Thrown when the input arrays differ in length. + /// Thrown when any of the input arrays is null. + /// + /// The array of transformed elements. + /// + /// + /// + [] + val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> array1:'T1[] -> array2:'T2[] -> array3:'T3[] -> 'U[] + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding elements of the two collections pairwise, also passing the index of + /// the elements. The two input arrays must have the same lengths, otherwise an ArgumentException is + /// raised. + /// + /// The function to transform pairs of input elements and their indices. + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// The array of transformed elements. + /// + /// + /// + [] + val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> array1:'T1[] -> array2:'T2[] -> 'U[] + + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. The integer index passed to the + /// function indicates the index of element being transformed. + /// + /// The function to transform elements and their indices. + /// The input array. + /// + /// The array of transformed elements. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val mapi: mapping:(int -> 'T -> 'U) -> array:'T[] -> 'U[] + + /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. + /// + /// Throws ArgumentException for empty arrays. + /// + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// The maximum element. + /// + /// + /// + [] + val inline max : array:'T[] -> 'T when 'T : comparison + + /// Returns the greatest of all elements of the array, compared via Operators.max on the function result. + /// + /// Throws ArgumentException for empty arrays. + /// + /// The function to transform the elements into a type supporting comparison. + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// The maximum element. + /// + /// + /// + [] + val inline maxBy : projection:('T -> 'U) -> array:'T[] -> 'T when 'U : comparison + + /// Returns the lowest of all elements of the array, compared via Operators.min. + /// + /// Throws ArgumentException for empty arrays + /// + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// The minimum element. + /// + /// + /// + [] + val inline min : array:'T[] -> 'T when 'T : comparison + + /// Returns the lowest of all elements of the array, compared via Operators.min on the function result. + /// + /// Throws ArgumentException for empty arrays. + /// + /// The function to transform the elements into a type supporting comparison. + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// The minimum element. + /// + /// + /// + [] + val inline minBy : projection:('T -> 'U) -> array:'T[] -> 'T when 'U : comparison + + /// Builds an array from the given list. + /// + /// The input list. + /// + /// The array of elements from the list. + /// + /// + /// + [] + val ofList: list:'T list -> 'T[] + + /// Builds a new array from the given enumerable object. + /// + /// The input sequence. + /// + /// The array of elements from the sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + [] + val ofSeq: source:seq<'T> -> 'T[] + + /// Returns an array of each element in the input array and its predecessor, with the + /// exception of the first element which is only returned as the predecessor of the second element. + /// + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + [] + val pairwise: array:'T[] -> ('T * 'T)[] + + /// Splits the collection into two collections, containing the + /// elements for which the given predicate returns "true" and "false" + /// respectively. + /// + /// The function to test the input elements. + /// The input array. + /// + /// A pair of arrays. The first containing the elements the predicate evaluated to true, + /// and the second containing those evaluated to false. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val partition: predicate:('T -> bool) -> array:'T[] -> 'T[] * 'T[] + + /// Returns an array with all elements permuted according to the + /// specified permutation. + /// + /// The function that maps input indices to output indices. + /// The input array. + /// + /// The output array. + /// + /// Thrown when the input array is null. + /// Thrown when indexMap does not produce a valid permutation. + /// + /// + /// + [] + val permute : indexMap:(int -> int) -> array:'T[] -> 'T[] + + /// Applies a function to each element of the array, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN + /// then computes f (... (f i0 i1)...) iN. + /// Raises ArgumentException if the array has size zero. + /// + /// The function to reduce a pair of elements to a single element. + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// The final result of the reductions. + /// + /// + /// + [] + val reduce: reduction:('T -> 'T -> 'T) -> array:'T[] -> 'T + + /// Applies a function to each element of the array, starting from the end, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN + /// then computes f i0 (...(f iN-1 iN)). + /// + /// A function that takes in the next-to-last element of the list and the + /// current accumulated result to produce the next accumulated result. + /// The input array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// + /// The final result of the reductions. + /// + /// + /// + [] + val reduceBack: reduction:('T -> 'T -> 'T) -> array:'T[] -> 'T + + /// Creates an array by replicating the given initial value. + /// + /// The number of elements to replicate. + /// The value to replicate + /// + /// The generated array. + /// + /// Thrown when count is negative. + /// + /// + /// + [] + val replicate: count:int -> initial:'T -> 'T[] + + /// Returns a new array with the elements in reverse order. + /// + /// The input array. + /// + /// The reversed array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val rev: array:'T[] -> 'T[] + + /// Like fold, but return the intermediary and final results. + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The input array. + /// + /// The array of state values. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> array:'T[] -> 'State[] + + /// Like foldBack, but return both the intermediary and final results. + /// + /// The function to update the state given the input elements. + /// The input array. + /// The initial state. + /// + /// The array of state values. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> array:'T[] -> state:'State -> 'State[] + + /// Returns an array that contains one item only. + /// + /// The input item. + /// + /// The result array of one item. + /// + /// + /// + [] + val inline singleton: value:'T -> 'T[] + + /// Sets an element of an array. + /// + /// The input array. + /// The input index. + /// The input value. + /// + /// Thrown when the input array is null. + /// Thrown when the index is negative or the input array does not contain enough elements. + /// + /// + /// + [] + val set: array:'T[] -> index:int -> value:'T -> unit + + /// Builds a new array that contains the elements of the given array, excluding the first N elements. + /// + /// The number of elements to skip. If negative the full array will be returned as a copy. + /// The input array. + /// + /// A copy of the input array, after removing the first N elements. + /// + /// Thrown when the input array is null. + /// Thrown when count exceeds the number of + /// elements in the array. + /// + /// + /// + [] + val skip: count:int -> array:'T[] -> 'T[] + + /// Bypasses elements in an array while the given predicate returns True, and then returns + /// the remaining elements in a new array. + /// + /// A function that evaluates an element of the array to a boolean value. + /// The input array. + /// + /// The created sub array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val skipWhile: predicate:('T -> bool) -> array:'T[] -> 'T[] + + /// Builds a new array that contains the given subrange specified by + /// starting index and length. + /// + /// The input array. + /// The index of the first element of the sub array. + /// The length of the sub array. + /// + /// The created sub array. + /// + /// Thrown when the input array is null. + /// Thrown when either startIndex or count is negative, + /// or when there aren't enough elements in the input array. + /// + /// + /// + [] + val sub: array:'T[] -> startIndex:int -> count:int -> 'T[] + + /// Sorts the elements of an array, returning a new array. Elements are compared using . + /// + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// For a stable sort, consider using . + /// + /// The input array. + /// + /// The sorted array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val sort: array:'T[] -> 'T[] when 'T : comparison + + /// Sorts the elements of an array, using the given projection for the keys and returning a new array. + /// Elements are compared using . + /// + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// For a stable sort, consider using . + /// + /// The function to transform array elements into the type that is compared. + /// The input array. + /// + /// The sorted array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val sortBy: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison + + /// Sorts the elements of an array, using the given comparison function as the order, returning a new array. + /// + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// For a stable sort, consider using . + /// + /// The function to compare pairs of array elements. + /// The input array. + /// + /// The sorted array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val sortWith: comparer:('T -> 'T -> int) -> array:'T[] -> 'T[] + + /// Sorts the elements of an array by mutating the array in-place, using the given projection for the keys. + /// Elements are compared using . + /// + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// For a stable sort, consider using . + /// + /// The function to transform array elements into the type that is compared. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val sortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison - /// Sorts the elements of an array by mutating the array in-place, using the given comparison function. - /// Elements are compared using . - /// - /// The input array. - /// - /// Thrown when the input array is null. - [] - val sortInPlace: array:'T[] -> unit when 'T : comparison - /// Splits an array into two arrays, at the given index. - /// - /// The index at which the array is split. - /// The input array. - /// - /// The two split arrays. - /// - /// Thrown when the input array is null. - /// Thrown when split index exceeds the number of elements - /// in the array. - [] - val splitAt: index:int -> array:'T[] -> ('T[] * 'T[]) - /// Sorts the elements of an array, in descending order, returning a new array. Elements are compared using . - /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. - /// For a stable sort, consider using . - /// - /// The input array. - /// - /// The sorted array. - [] - val inline sortDescending: array:'T[] -> 'T[] when 'T : comparison + /// Sorts the elements of an array by mutating the array in-place, using the given comparison function as the order. + /// + /// The function to compare pairs of array elements. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val sortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit + + /// Sorts the elements of an array by mutating the array in-place, using the given comparison function. + /// Elements are compared using . + /// + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val sortInPlace: array:'T[] -> unit when 'T : comparison + + /// Splits an array into two arrays, at the given index. + /// + /// The index at which the array is split. + /// The input array. + /// + /// The two split arrays. + /// + /// Thrown when the input array is null. + /// Thrown when split index exceeds the number of elements + /// in the array. + /// + /// + /// + [] + val splitAt: index:int -> array:'T[] -> ('T[] * 'T[]) + + /// Sorts the elements of an array, in descending order, returning a new array. Elements are compared using . + /// + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// For a stable sort, consider using . + /// + /// The input array. + /// + /// The sorted array. + /// + /// + /// + [] + val inline sortDescending: array:'T[] -> 'T[] when 'T : comparison + + /// Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array. + /// Elements are compared using . + /// + /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. + /// For a stable sort, consider using . + /// + /// The function to transform array elements into the type that is compared. + /// The input array. + /// + /// The sorted array. + /// + /// + /// + [] + val inline sortByDescending: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison + + /// Returns the sum of the elements in the array. + /// + /// The input array. + /// + /// The resulting sum. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val inline sum : array: ^T[] -> ^T + when ^T : (static member ( + ) : ^T * ^T -> ^T) + and ^T : (static member Zero : ^T) - /// Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array. - /// Elements are compared using . - /// - /// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. - /// For a stable sort, consider using . - /// - /// The function to transform array elements into the type that is compared. - /// The input array. - /// - /// The sorted array. - [] - val inline sortByDescending: projection:('T -> 'Key) -> array:'T[] -> 'T[] when 'Key : comparison - /// Returns the sum of the elements in the array. - /// - /// The input array. - /// - /// The resulting sum. - /// - /// Thrown when the input array is null. - [] - val inline sum : array: ^T[] -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member Zero : ^T) + /// Returns the sum of the results generated by applying the function to each element of the array. + /// + /// The function to transform the array elements into the type to be summed. + /// The input array. + /// + /// The resulting sum. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val inline sumBy : projection:('T -> ^U) -> array:'T[] -> ^U + when ^U : (static member ( + ) : ^U * ^U -> ^U) + and ^U : (static member Zero : ^U) + + /// Returns the first N elements of the array. + /// Throws InvalidOperationException + /// if the count exceeds the number of elements in the array. Array.truncate + /// returns as many items as the array contains instead of throwing an exception. + /// + /// The number of items to take. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// Thrown when the input array is empty. + /// Thrown when count exceeds the number of elements + /// in the list. + /// + /// + /// + [] + val take: count:int -> array:'T[] -> 'T[] + + /// Returns an array that contains all elements of the original array while the + /// given predicate returns True, and then returns no further elements. + /// + /// A function that evaluates to false when no more items should be returned. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val takeWhile: predicate:('T -> bool) -> array:'T[] -> 'T[] + + /// Returns a new array containing the elements of the original except the first element. + /// + /// The input array. + /// + /// Thrown when the array is empty. + /// Thrown when the input array is null. + /// + /// A new array containing the elements of the original except the first element. + /// + /// + /// + [] + val tail: array:'T[] -> 'T[] + + /// Builds a list from the given array. + /// + /// The input array. + /// + /// The list of array elements. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val toList: array:'T[] -> 'T list + + /// Views the given array as a sequence. + /// + /// The input array. + /// + /// The sequence of array elements. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val toSeq: array:'T[] -> seq<'T> + + /// Returns the transpose of the given sequence of arrays. + /// + /// The input sequence of arrays. + /// + /// The transposed array. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input arrays differ in length. + /// + /// + /// + [] + val transpose: arrays:seq<'T[]> -> 'T[][] + + /// Returns at most N elements in a new array. + /// + /// The maximum number of items to return. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val truncate: count:int -> array:'T[] -> 'T[] + + /// Returns the first element for which the given function returns True. + /// Return None if no such element exists. + /// + /// The function to test the input elements. + /// The input array. + /// + /// The first element that satisfies the predicate, or None. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val tryFind: predicate:('T -> bool) -> array:'T[] -> 'T option + + /// Returns the last element for which the given function returns True. + /// Return None if no such element exists. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// The last element that satisfies the predicate, or None. + /// + /// + /// + [] + val tryFindBack: predicate:('T -> bool) -> array:'T[] -> 'T option + + /// Returns the index of the first element in the array + /// that satisfies the given predicate. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// The index of the first element that satisfies the predicate, or None. + /// + /// + /// + [] + val tryFindIndex : predicate:('T -> bool) -> array:'T[] -> int option + + /// Tries to find the nth element in the array. + /// Returns None if index is negative or the input array does not contain enough elements. + /// + /// The index of element to retrieve. + /// The input array. + /// + /// The nth element of the array or None. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val tryItem: index:int -> array:'T[] -> 'T option + + /// Returns the index of the last element in the array + /// that satisfies the given predicate. + /// + /// The function to test the input elements. + /// The input array. + /// + /// Thrown when the input array is null. + /// + /// The index of the last element that satisfies the predicate, or None. + /// + /// + /// + [] + val tryFindIndexBack : predicate:('T -> bool) -> array:'T[] -> int option + + /// Returns an array that contains the elements generated by the given computation. + /// The given initial state argument is passed to the element generator. + /// + /// A function that takes in the current state and returns an option tuple of the next + /// element of the array and the next state value. + /// The initial state value. + /// + /// The result array. + /// + /// + /// + [] + val unfold<'T,'State> : generator:('State -> ('T * 'State) option) -> state:'State -> 'T[] + + /// Splits an array of pairs into two arrays. + /// + /// The input array. + /// + /// The two arrays. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val unzip: array:('T1 * 'T2)[] -> ('T1[] * 'T2[]) + + /// Splits an array of triples into three arrays. + /// + /// The input array. + /// + /// The tuple of three arrays. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val unzip3: array:('T1 * 'T2 * 'T3)[] -> ('T1[] * 'T2[] * 'T3[]) + + /// Returns a new array containing only the elements of the array + /// for which the given predicate returns "true". + /// + /// The function to test the input elements. + /// The input array. + /// + /// An array containing the elements for which the given predicate returns true. + /// + /// Thrown when the input array is null. + /// + /// + /// + [] + val where: predicate:('T -> bool) -> array:'T[] -> 'T[] + + /// Returns an array of sliding windows containing elements drawn from the input + /// array. Each window is returned as a fresh array. + /// + /// The number of elements in each window. + /// The input array. + /// + /// The result array. + /// + /// Thrown when the input array is null. + /// Thrown when windowSize is not positive. + /// + /// + /// + [] + val windowed : windowSize:int -> array:'T[] -> 'T[][] + + /// Combines the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an ArgumentException is + /// raised. + /// + /// The first input array. + /// The second input array. + /// + /// Thrown when either of the input arrays is null. + /// Thrown when the input arrays differ in length. + /// + /// The array of tupled elements. + /// + /// + /// + [] + val zip: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] + + /// Combines three arrays into an array of pairs. The three arrays must have equal lengths, otherwise an ArgumentException is + /// raised. + /// + /// The first input array. + /// The second input array. + /// The third input array. + /// + /// Thrown when any of the input arrays are null. + /// Thrown when the input arrays differ in length. + /// + /// The array of tupled elements. + /// + /// + /// + [] + val zip3: array1:'T1[] -> array2:'T2[] -> array3:'T3[] -> ('T1 * 'T2 * 'T3)[] - /// Returns the sum of the results generated by applying the function to each element of the array. - /// - /// The function to transform the array elements into the type to be summed. - /// The input array. - /// - /// The resulting sum. - /// - /// Thrown when the input array is null. - [] - val inline sumBy : projection:('T -> ^U) -> array:'T[] -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member Zero : ^U) - - /// Returns the first N elements of the array. - /// Throws InvalidOperationException - /// if the count exceeds the number of elements in the array. Array.truncate - /// returns as many items as the array contains instead of throwing an exception. - /// - /// The number of items to take. - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input array is null. - /// Thrown when the input array is empty. - /// Thrown when count exceeds the number of elements - /// in the list. - [] - val take: count:int -> array:'T[] -> 'T[] - - /// Returns an array that contains all elements of the original array while the - /// given predicate returns True, and then returns no further elements. - /// - /// A function that evaluates to false when no more items should be returned. - /// The input array. - /// - /// The result array. - /// - /// Thrown when the input array is null. - [] - val takeWhile: predicate:('T -> bool) -> array:'T[] -> 'T[] + /// Return a new array with the item at a given index removed. + /// + /// The index of the item to be removed. + /// The input array. + /// + /// The result array. + /// + /// Thrown when index is outside 0..source.Length - 1 + /// + /// + /// + /// [| 0; 1; 2 |] |> Array.removeAt 1 // evaluates to [| 0; 2 |] + /// + /// + [] + val removeAt : index: int -> source: 'T[] -> 'T[] + + /// Return a new array with the number of items starting at a given index removed. + /// + /// The index of the item to be removed. + /// The number of items to remove. + /// The input array. + /// + /// The result array. + /// + /// Thrown when index is outside 0..source.Length - count + /// + /// + /// + /// [| 0; 1; 2; 3 |] |> Array.removeManyAt 1 2 // evaluates to [| 0; 3 |] + /// + /// + [] + val removeManyAt : index: int -> count: int -> source: 'T[] -> 'T[] + + /// Return a new array with the item at a given index set to the new value. + /// + /// The index of the item to be replaced. + /// The new value. + /// The input array. + /// + /// The result array. + /// + /// Thrown when index is outside 0..source.Length - 1 + /// + /// + /// + /// [| 0; 1; 2 |] |> Array.updateAt 1 9 // evaluates to [| 0; 9; 2 |] + /// + /// + [] + val updateAt : index: int -> value: 'T -> source: 'T[] -> 'T[] + + /// Return a new array with a new item inserted before the given index. + /// + /// The index where the item should be inserted. + /// The value to insert. + /// The input array. + /// + /// The result array. + /// + /// Thrown when index is below 0 or greater than source.Length. + /// + /// + /// + /// [| 0; 1; 2 |] |> Array.insertAt 1 9 // evaluates to [| 0; 9; 1; 2 |] + /// + /// + [] + val insertAt : index: int -> value: 'T -> source: 'T[] -> 'T[] + + /// Return a new array with new items inserted before the given index. + /// + /// The index where the items should be inserted. + /// The values to insert. + /// The input array. + /// + /// The result array. + /// + /// Thrown when index is below 0 or greater than source.Length. + /// + /// + /// + /// [| 0; 1; 2 |] |> Array.insertManyAt 1 [8; 9] // evaluates to [| 0; 8; 9; 1; 2 |] + /// + /// + [] + val insertManyAt : index: int -> values: seq<'T> -> source: 'T[] -> 'T[] - /// Returns a new array containing the elements of the original except the first element. - /// - /// The input array. - /// - /// Thrown when the array is empty. - /// Thrown when the input array is null. - /// - /// A new array containing the elements of the original except the first element. - [] - val tail: array:'T[] -> 'T[] + /// Provides parallel operations on arrays + module Parallel = - /// Builds a list from the given array. - /// - /// The input array. + /// Apply the given function to each element of the array. Return + /// the array comprised of the results x for each element where + /// the function returns Some(x). /// - /// The list of array elements. - /// - /// Thrown when the input array is null. - [] - val toList: array:'T[] -> 'T list - - /// Views the given array as a sequence. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to elements of the input array is not specified. /// + /// The function to generate options from the elements. /// The input array. /// - /// The sequence of array elements. + /// The array of results. /// /// Thrown when the input array is null. - [] - val toSeq: array:'T[] -> seq<'T> + /// + /// + /// + [] + val choose: chooser:('T -> 'U option) -> array:'T[] -> 'U[] - /// Returns the transpose of the given sequence of arrays. - /// - /// The input sequence of arrays. + /// For each element of the array, apply the given function. Concatenate all the results and return the combined array. /// - /// The transposed array. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input arrays differ in length. - [] - val transpose: arrays:seq<'T[]> -> 'T[][] - - /// Returns at most N elements in a new array. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to elements of the input array is not specified. /// - /// The maximum number of items to return. + /// /// The input array. /// - /// The result array. + /// 'U[] /// /// Thrown when the input array is null. - [] - val truncate: count:int -> array:'T[] -> 'T[] - - /// Returns the first element for which the given function returns True. - /// Return None if no such element exists. - /// - /// The function to test the input elements. - /// The input array. - /// - /// The first element that satisfies the predicate, or None. + /// + /// + /// + [] + val collect : mapping:('T -> 'U[]) -> array:'T[] -> 'U[] + + /// Build a new array whose elements are the results of applying the given function + /// to each of the elements of the array. /// - /// Thrown when the input array is null. - [] - val tryFind: predicate:('T -> bool) -> array:'T[] -> 'T option - - /// Returns the last element for which the given function returns True. - /// Return None if no such element exists. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to elements of the input array is not specified. /// - /// The function to test the input elements. + /// /// The input array. /// - /// Thrown when the input array is null. - /// - /// The last element that satisfies the predicate, or None. - [] - val tryFindBack: predicate:('T -> bool) -> array:'T[] -> 'T option - - /// Returns the index of the first element in the array - /// that satisfies the given predicate. - /// - /// The function to test the input elements. - /// The input array. + /// The array of results. /// /// Thrown when the input array is null. + /// + /// + /// + [] + val map : mapping:('T -> 'U) -> array:'T[] -> 'U[] + + /// Build a new array whose elements are the results of applying the given function + /// to each of the elements of the array. The integer index passed to the + /// function indicates the index of element being transformed. /// - /// The index of the first element that satisfies the predicate, or None. - [] - val tryFindIndex : predicate:('T -> bool) -> array:'T[] -> int option - - /// Tries to find the nth element in the array. - /// Returns None if index is negative or the input array does not contain enough elements. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to elements of the input array is not specified. /// - /// The index of element to retrieve. + /// /// The input array. /// - /// The nth element of the array or None. - /// - /// Thrown when the input array is null. - [] - val tryItem: index:int -> array:'T[] -> 'T option - - /// Returns the index of the last element in the array - /// that satisfies the given predicate. - /// - /// The function to test the input elements. - /// The input array. + /// The array of results. /// /// Thrown when the input array is null. - /// - /// The index of the last element that satisfies the predicate, or None. - [] - val tryFindIndexBack : predicate:('T -> bool) -> array:'T[] -> int option - - /// Returns an array that contains the elements generated by the given computation. - /// The given initial state argument is passed to the element generator. - /// - /// A function that takes in the current state and returns an option tuple of the next - /// element of the array and the next state value. - /// The initial state value. - /// - /// The result array. - [] - val unfold<'T,'State> : generator:('State -> ('T * 'State) option) -> state:'State -> 'T[] + /// + /// + /// + [] + val mapi: mapping:(int -> 'T -> 'U) -> array:'T[] -> 'U[] - /// Splits an array of pairs into two arrays. - /// - /// The input array. - /// - /// The two arrays. + /// Apply the given function to each element of the array. /// - /// Thrown when the input array is null. - [] - val unzip: array:('T1 * 'T2)[] -> ('T1[] * 'T2[]) - - /// Splits an array of triples into three arrays. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to elements of the input array is not specified. /// + /// /// The input array. /// - /// The tuple of three arrays. - /// /// Thrown when the input array is null. - [] - val unzip3: array:('T1 * 'T2 * 'T3)[] -> ('T1[] * 'T2[] * 'T3[]) + /// + /// + /// + [] + val iter : action:('T -> unit) -> array:'T[] -> unit - /// Returns a new array containing only the elements of the array - /// for which the given predicate returns "true". - /// - /// The function to test the input elements. - /// The input array. - /// - /// An array containing the elements for which the given predicate returns true. + /// Apply the given function to each element of the array. The integer passed to the + /// function indicates the index of element. /// - /// Thrown when the input array is null. - [] - val where: predicate:('T -> bool) -> array:'T[] -> 'T[] - - /// Returns an array of sliding windows containing elements drawn from the input - /// array. Each window is returned as a fresh array. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to elements of the input array is not specified. /// - /// The number of elements in each window. + /// /// The input array. /// - /// The result array. - /// /// Thrown when the input array is null. - /// Thrown when windowSize is not positive. - [] - val windowed : windowSize:int -> array:'T[] -> 'T[][] - - /// Combines the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an ArgumentException is - /// raised. - /// - /// The first input array. - /// The second input array. - /// - /// Thrown when either of the input arrays is null. - /// Thrown when the input arrays differ in length. - /// - /// The array of tupled elements. - [] - val zip: array1:'T1[] -> array2:'T2[] -> ('T1 * 'T2)[] - - /// Combines three arrays into an array of pairs. The three arrays must have equal lengths, otherwise an ArgumentException is - /// raised. - /// - /// The first input array. - /// The second input array. - /// The third input array. - /// - /// Thrown when any of the input arrays are null. - /// Thrown when the input arrays differ in length. - /// - /// The array of tupled elements. - [] - val zip3: array1:'T1[] -> array2:'T2[] -> array3:'T3[] -> ('T1 * 'T2 * 'T3)[] - - - /// Return a new array with the item at a given index removed. - /// - /// The index of the item to be removed. - /// The input array. - /// - /// - /// - /// [| 0; 1; 2 |] |> Array.removeAt 1 // evaluates to [| 0; 2 |] - /// - /// /// - /// The result array. + /// /// - /// Thrown when index is outside 0..source.Length - 1 - [] - val removeAt : index: int -> source: 'T[] -> 'T[] + [] + val iteri: action:(int -> 'T -> unit) -> array:'T[] -> unit - /// Return a new array with the number of items starting at a given index removed. - /// - /// The index of the item to be removed. - /// The number of items to remove. - /// The input array. - /// - /// - /// - /// [| 0; 1; 2; 3 |] |> Array.removeManyAt 1 2 // evaluates to [| 0; 3 |] - /// - /// - /// - /// The result array. + /// Create an array given the dimension and a generator function to compute the elements. /// - /// Thrown when index is outside 0..source.Length - count - [] - val removeManyAt : index: int -> count: int -> source: 'T[] -> 'T[] - - /// Return a new array with the item at a given index set to the new value. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to indices is not specified. /// - /// The index of the item to be replaced. - /// The new value. - /// The input array. + /// + /// /// - /// - /// - /// [| 0; 1; 2 |] |> Array.updateAt 1 9 // evaluates to [| 0; 9; 2 |] - /// - /// + /// The array of results. /// - /// The result array. - /// - /// Thrown when index is outside 0..source.Length - 1 - [] - val updateAt : index: int -> value: 'T -> source: 'T[] -> 'T[] + /// + /// + [] + val init : count:int -> initializer:(int -> 'T) -> 'T[] - /// Return a new array with a new item inserted before the given index. - /// - /// The index where the item should be inserted. - /// The value to insert. - /// The input array. + /// Split the collection into two collections, containing the + /// elements for which the given predicate returns "true" and "false" + /// respectively /// - /// - /// - /// [| 0; 1; 2 |] |> Array.insertAt 1 9 // evaluates to [| 0; 9; 1; 2 |] - /// - /// - /// - /// The result array. + /// Performs the operation in parallel using . + /// The order in which the given function is applied to indices is not specified. /// - /// Thrown when index is below 0 or greater than source.Length. - [] - val insertAt : index: int -> value: 'T -> source: 'T[] -> 'T[] - - /// Return a new array with new items inserted before the given index. + /// The function to test the input elements. + /// The input array. /// - /// The index where the items should be inserted. - /// The values to insert. - /// The input array. + /// The two arrays of results. /// - /// - /// - /// [| 0; 1; 2 |] |> Array.insertManyAt 1 [8; 9] // evaluates to [| 0; 8; 9; 1; 2 |] - /// - /// + /// Thrown when the input array is null. /// - /// The result array. - /// - /// Thrown when index is below 0 or greater than source.Length. - [] - val insertManyAt : index: int -> values: seq<'T> -> source: 'T[] -> 'T[] - - /// Provides parallel operations on arrays - module Parallel = - - /// Apply the given function to each element of the array. Return - /// the array comprised of the results "x" for each element where - /// the function returns Some(x). - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to elements of the input array is not specified. - /// - /// The function to generate options from the elements. - /// The input array. - /// - /// The array of results. - /// - /// Thrown when the input array is null. - [] - val choose: chooser:('T -> 'U option) -> array:'T[] -> 'U[] - - /// For each element of the array, apply the given function. Concatenate all the results and return the combined array. - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to elements of the input array is not specified. - /// - /// - /// The input array. - /// - /// 'U[] - /// - /// Thrown when the input array is null. - [] - val collect : mapping:('T -> 'U[]) -> array:'T[] -> 'U[] - - /// Build a new array whose elements are the results of applying the given function - /// to each of the elements of the array. - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to elements of the input array is not specified. - /// - /// - /// The input array. - /// - /// The array of results. - /// - /// Thrown when the input array is null. - [] - val map : mapping:('T -> 'U) -> array:'T[] -> 'U[] - - /// Build a new array whose elements are the results of applying the given function - /// to each of the elements of the array. The integer index passed to the - /// function indicates the index of element being transformed. - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to elements of the input array is not specified. - /// - /// - /// The input array. - /// - /// The array of results. - /// - /// Thrown when the input array is null. - [] - val mapi: mapping:(int -> 'T -> 'U) -> array:'T[] -> 'U[] - - /// Apply the given function to each element of the array. - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to elements of the input array is not specified. - /// - /// - /// The input array. - /// - /// Thrown when the input array is null. - [] - val iter : action:('T -> unit) -> array:'T[] -> unit - - /// Apply the given function to each element of the array. The integer passed to the - /// function indicates the index of element. - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to elements of the input array is not specified. - /// - /// - /// The input array. - /// - /// Thrown when the input array is null. - [] - val iteri: action:(int -> 'T -> unit) -> array:'T[] -> unit - - /// Create an array given the dimension and a generator function to compute the elements. - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to indices is not specified. - /// - /// - /// - /// - /// The array of results. - [] - val init : count:int -> initializer:(int -> 'T) -> 'T[] - - /// Split the collection into two collections, containing the - /// elements for which the given predicate returns "true" and "false" - /// respectively - /// - /// Performs the operation in parallel using . - /// The order in which the given function is applied to indices is not specified. - /// - /// The function to test the input elements. - /// The input array. - /// - /// The two arrays of results. - /// - /// Thrown when the input array is null. - [] - val partition : predicate:('T -> bool) -> array:'T[] -> 'T[] * 'T[] + /// + /// + [] + val partition : predicate:('T -> bool) -> array:'T[] -> 'T[] * 'T[] diff --git a/src/fsharp/FSharp.Core/array2.fsi b/src/fsharp/FSharp.Core/array2.fsi index 372bc131419..ec60c34a095 100644 --- a/src/fsharp/FSharp.Core/array2.fsi +++ b/src/fsharp/FSharp.Core/array2.fsi @@ -2,230 +2,268 @@ namespace Microsoft.FSharp.Collections - open System - open Microsoft.FSharp.Collections - open Microsoft.FSharp.Core - - [] - [] - /// Contains operations for working with 2-dimensional arrays. - /// - /// - /// See also F# Language Guide - Arrays. - /// - /// F# and CLI multi-dimensional arrays are typically zero-based. - /// However, CLI multi-dimensional arrays used in conjunction with external - /// libraries (e.g. libraries associated with Visual Basic) be - /// non-zero based, using a potentially different base for each dimension. - /// The operations in this module will accept such arrays, and - /// the basing on an input array will be propagated to a matching output - /// array on the Array2D.map and Array2D.mapi operations. - /// Non-zero-based arrays can also be created using Array2D.zeroCreateBased, - /// Array2D.createBased and Array2D.initBased. - /// - module Array2D = - - /// Fetches the base-index for the first dimension of the array. - /// - /// The input array. - /// - /// The base-index of the first dimension of the array. - [] - val base1: array:'T[,] -> int - - /// Fetches the base-index for the second dimension of the array. - /// - /// The input array. - /// - /// The base-index of the second dimension of the array. - [] - val base2: array:'T[,] -> int - - /// Builds a new array whose elements are the same as the input array. - /// - /// For non-zero-based arrays the basing on an input array will be propagated to the output - /// array. - /// - /// The input array. - /// - /// A copy of the input array. - [] - val copy: array:'T[,] -> 'T[,] - - /// Reads a range of elements from the first array and write them into the second. - /// - /// The source array. - /// The first-dimension index to begin copying from in the source array. - /// The second-dimension index to begin copying from in the source array. - /// The target array. - /// The first-dimension index to begin copying into in the target array. - /// The second-dimension index to begin copying into in the target array. - /// The number of elements to copy across the first dimension of the arrays. - /// The number of elements to copy across the second dimension of the arrays. - /// Thrown when any of the indices are negative or if either of - /// the counts are larger than the dimensions of the array allow. - [] - val blit: source:'T[,] -> sourceIndex1:int -> sourceIndex2:int -> target:'T[,] -> targetIndex1:int -> targetIndex2:int -> length1:int -> length2:int -> unit - - /// Creates an array given the dimensions and a generator function to compute the elements. - /// - /// The length of the first dimension of the array. - /// The length of the second dimension of the array. - /// A function to produce elements of the array given the two indices. - /// - /// The generated array. - /// Thrown when either of the lengths is negative. - [] - val init: length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] - - /// Creates an array whose elements are all initially the given value. - /// - /// The length of the first dimension of the array. - /// The length of the second dimension of the array. - /// The value to populate the new array. - /// - /// The created array. - /// Thrown when length1 or length2 is negative. - [] - val create: length1:int -> length2:int -> value:'T -> 'T[,] - - /// Creates an array where the entries are initially Unchecked.defaultof<'T>. - /// - /// The length of the first dimension of the array. - /// The length of the second dimension of the array. - /// - /// The created array. - /// Thrown when length1 or length2 is negative. - [] - val zeroCreate : length1:int -> length2:int -> 'T[,] - - /// Creates a based array given the dimensions and a generator function to compute the elements. - /// - /// The base for the first dimension of the array. - /// The base for the second dimension of the array. - /// The length of the first dimension of the array. - /// The length of the second dimension of the array. - /// A function to produce elements of the array given the two indices. - /// - /// The created array. - /// Thrown when base1, base2, length1, or length2 is negative. - [] - val initBased: base1:int -> base2:int -> length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] - - /// Creates a based array whose elements are all initially the given value. - /// - /// The base for the first dimension of the array. - /// The base for the second dimension of the array. - /// The length of the first dimension of the array. - /// The length of the second dimension of the array. - /// The value to populate the new array. - /// - /// The created array. - /// Thrown when base1, base2, length1, or length2 is negative. - [] - val createBased: base1:int -> base2:int -> length1:int -> length2:int -> initial: 'T -> 'T[,] - - /// Creates a based array where the entries are initially Unchecked.defaultof<'T>. - /// - /// The base for the first dimension of the array. - /// The base for the second dimension of the array. - /// The length of the first dimension of the array. - /// The length of the second dimension of the array. - /// - /// The created array. - /// Thrown when base1, base2, length1, or length2 is negative. - [] - val zeroCreateBased : base1:int -> base2:int -> length1:int -> length2:int -> 'T[,] - - /// Applies the given function to each element of the array. - /// - /// A function to apply to each element of the array. - /// The input array. - [] - val iter: action:('T -> unit) -> array:'T[,] -> unit - - /// Applies the given function to each element of the array. The integer indices passed to the - /// function indicates the index of element. - /// - /// A function to apply to each element of the array with the indices available as an argument. - /// The input array. - [] - val iteri: action:(int -> int -> 'T -> unit) -> array:'T[,] -> unit - - /// Returns the length of an array in the first dimension. - /// - /// The input array. - /// - /// The length of the array in the first dimension. - [] - val length1: array:'T[,] -> int - - /// Returns the length of an array in the second dimension. - /// - /// The input array. - /// - /// The length of the array in the second dimension. - [] - val length2: array:'T[,] -> int - - /// Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the array. - /// - /// For non-zero-based arrays the basing on an input array will be propagated to the output - /// array. - /// - /// A function that is applied to transform each item of the input array. - /// The input array. - /// - /// An array whose elements have been transformed by the given mapping. - [] - val map: mapping:('T -> 'U) -> array:'T[,] -> 'U[,] - - /// Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the array. The integer indices passed to the - /// function indicates the element being transformed. - /// - /// For non-zero-based arrays the basing on an input array will be propagated to the output - /// array. - /// - /// A function that is applied to transform each element of the array. The two integers - /// provide the index of the element. - /// The input array. - /// - /// An array whose elements have been transformed by the given mapping. - [] - val mapi: mapping:(int -> int -> 'T -> 'U) -> array:'T[,] -> 'U[,] - - - /// Builds a new array whose elements are the same as the input array but - /// where a non-zero-based input array generates a corresponding zero-based - /// output array. - /// - /// The input array. - /// - /// The zero-based output array. - [] - val rebase: array:'T[,] -> 'T[,] - - /// Sets the value of an element in an array. You can also use the syntax array.[index1,index2] <- value. - /// - /// The input array. - /// The index along the first dimension. - /// The index along the second dimension. - /// The value to set in the array. - /// Thrown when the indices are negative or exceed the bounds of the array. - [] - val set: array:'T[,] -> index1:int -> index2:int -> value:'T -> unit - - /// Fetches an element from a 2D array. You can also use the syntax array.[index1,index2]. - /// - /// The input array. - /// The index along the first dimension. - /// The index along the second dimension. - /// - /// The value of the array at the given index. - /// Thrown when the indices are negative or exceed the bounds of the array. - [] - val get: array:'T[,] -> index1:int -> index2:int -> 'T +open System +open Microsoft.FSharp.Collections +open Microsoft.FSharp.Core + +[] +[] +/// Contains operations for working with 2-dimensional arrays. +/// +/// +/// See also F# Language Guide - Arrays. +/// +/// F# and CLI multi-dimensional arrays are typically zero-based. +/// However, CLI multi-dimensional arrays used in conjunction with external +/// libraries (e.g. libraries associated with Visual Basic) be +/// non-zero based, using a potentially different base for each dimension. +/// The operations in this module will accept such arrays, and +/// the basing on an input array will be propagated to a matching output +/// array on the Array2D.map and Array2D.mapi operations. +/// Non-zero-based arrays can also be created using Array2D.zeroCreateBased, +/// Array2D.createBased and Array2D.initBased. +/// +module Array2D = + + /// Fetches the base-index for the first dimension of the array. + /// + /// The input array. + /// + /// The base-index of the first dimension of the array. + /// + /// + [] + val base1: array:'T[,] -> int + + /// Fetches the base-index for the second dimension of the array. + /// + /// The input array. + /// + /// The base-index of the second dimension of the array. + /// + /// + [] + val base2: array:'T[,] -> int + + /// Builds a new array whose elements are the same as the input array. + /// + /// For non-zero-based arrays the basing on an input array will be propagated to the output + /// array. + /// + /// The input array. + /// + /// A copy of the input array. + /// + /// + [] + val copy: array:'T[,] -> 'T[,] + + /// Reads a range of elements from the first array and write them into the second. + /// + /// The source array. + /// The first-dimension index to begin copying from in the source array. + /// The second-dimension index to begin copying from in the source array. + /// The target array. + /// The first-dimension index to begin copying into in the target array. + /// The second-dimension index to begin copying into in the target array. + /// The number of elements to copy across the first dimension of the arrays. + /// The number of elements to copy across the second dimension of the arrays. + /// Thrown when any of the indices are negative or if either of + /// the counts are larger than the dimensions of the array allow. + /// + /// + [] + val blit: source:'T[,] -> sourceIndex1:int -> sourceIndex2:int -> target:'T[,] -> targetIndex1:int -> targetIndex2:int -> length1:int -> length2:int -> unit + + /// Creates an array given the dimensions and a generator function to compute the elements. + /// + /// The length of the first dimension of the array. + /// The length of the second dimension of the array. + /// A function to produce elements of the array given the two indices. + /// + /// The generated array. + /// Thrown when either of the lengths is negative. + /// + /// + [] + val init: length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] + + /// Creates an array whose elements are all initially the given value. + /// + /// The length of the first dimension of the array. + /// The length of the second dimension of the array. + /// The value to populate the new array. + /// + /// The created array. + /// Thrown when length1 or length2 is negative. + /// + /// + [] + val create: length1:int -> length2:int -> value:'T -> 'T[,] + + /// Creates an array where the entries are initially Unchecked.defaultof<'T>. + /// + /// The length of the first dimension of the array. + /// The length of the second dimension of the array. + /// + /// The created array. + /// Thrown when length1 or length2 is negative. + /// + /// + [] + val zeroCreate : length1:int -> length2:int -> 'T[,] + + /// Creates a based array given the dimensions and a generator function to compute the elements. + /// + /// The base for the first dimension of the array. + /// The base for the second dimension of the array. + /// The length of the first dimension of the array. + /// The length of the second dimension of the array. + /// A function to produce elements of the array given the two indices. + /// + /// The created array. + /// Thrown when base1, base2, length1, or length2 is negative. + /// + /// + [] + val initBased: base1:int -> base2:int -> length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] + + /// Creates a based array whose elements are all initially the given value. + /// + /// The base for the first dimension of the array. + /// The base for the second dimension of the array. + /// The length of the first dimension of the array. + /// The length of the second dimension of the array. + /// The value to populate the new array. + /// + /// The created array. + /// Thrown when base1, base2, length1, or length2 is negative. + /// + /// + [] + val createBased: base1:int -> base2:int -> length1:int -> length2:int -> initial: 'T -> 'T[,] + + /// Creates a based array where the entries are initially Unchecked.defaultof<'T>. + /// + /// The base for the first dimension of the array. + /// The base for the second dimension of the array. + /// The length of the first dimension of the array. + /// The length of the second dimension of the array. + /// + /// The created array. + /// Thrown when base1, base2, length1, or length2 is negative. + /// + /// + [] + val zeroCreateBased : base1:int -> base2:int -> length1:int -> length2:int -> 'T[,] + + /// Applies the given function to each element of the array. + /// + /// A function to apply to each element of the array. + /// The input array. + /// + /// + [] + val iter: action:('T -> unit) -> array:'T[,] -> unit + + /// Applies the given function to each element of the array. The integer indices passed to the + /// function indicates the index of element. + /// + /// A function to apply to each element of the array with the indices available as an argument. + /// The input array. + /// + /// + [] + val iteri: action:(int -> int -> 'T -> unit) -> array:'T[,] -> unit + + /// Returns the length of an array in the first dimension. + /// + /// The input array. + /// + /// The length of the array in the first dimension. + /// + /// + [] + val length1: array:'T[,] -> int + + /// Returns the length of an array in the second dimension. + /// + /// The input array. + /// + /// The length of the array in the second dimension. + /// + /// + [] + val length2: array:'T[,] -> int + + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. + /// + /// For non-zero-based arrays the basing on an input array will be propagated to the output + /// array. + /// + /// A function that is applied to transform each item of the input array. + /// The input array. + /// + /// An array whose elements have been transformed by the given mapping. + /// + /// + [] + val map: mapping:('T -> 'U) -> array:'T[,] -> 'U[,] + + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. The integer indices passed to the + /// function indicates the element being transformed. + /// + /// For non-zero-based arrays the basing on an input array will be propagated to the output + /// array. + /// + /// A function that is applied to transform each element of the array. The two integers + /// provide the index of the element. + /// The input array. + /// + /// An array whose elements have been transformed by the given mapping. + /// + /// + [] + val mapi: mapping:(int -> int -> 'T -> 'U) -> array:'T[,] -> 'U[,] + + + /// Builds a new array whose elements are the same as the input array but + /// where a non-zero-based input array generates a corresponding zero-based + /// output array. + /// + /// The input array. + /// + /// The zero-based output array. + /// + /// + [] + val rebase: array:'T[,] -> 'T[,] + + /// Sets the value of an element in an array. You can also use the syntax array.[index1,index2] <- value. + /// + /// The input array. + /// The index along the first dimension. + /// The index along the second dimension. + /// The value to set in the array. + /// Thrown when the indices are negative or exceed the bounds of the array. + /// + /// + [] + val set: array:'T[,] -> index1:int -> index2:int -> value:'T -> unit + + /// Fetches an element from a 2D array. You can also use the syntax array.[index1,index2]. + /// + /// The input array. + /// The index along the first dimension. + /// The index along the second dimension. + /// + /// The value of the array at the given index. + /// Thrown when the indices are negative or exceed the bounds of the array. + /// + /// + [] + val get: array:'T[,] -> index1:int -> index2:int -> 'T diff --git a/src/fsharp/FSharp.Core/array3.fsi b/src/fsharp/FSharp.Core/array3.fsi index 60be384d0d8..49b585aa8eb 100644 --- a/src/fsharp/FSharp.Core/array3.fsi +++ b/src/fsharp/FSharp.Core/array3.fsi @@ -2,232 +2,274 @@ namespace Microsoft.FSharp.Collections - open System - open Microsoft.FSharp.Collections - open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.Operators - - [] - [] - /// Contains operations for working with rank 3 arrays. - /// - /// - /// See also F# Language Guide - Arrays. - /// - module Array3D = - - /// Creates an array whose elements are all initially the given value. - /// The length of the first dimension. - /// The length of the second dimension. - /// The length of the third dimension. - /// The value of the array elements. - /// - /// The created array. - [] - val create: length1:int -> length2:int -> length3:int -> initial:'T -> 'T[,,] - - /// Creates an array given the dimensions and a generator function to compute the elements. - /// - /// The length of the first dimension. - /// The length of the second dimension. - /// The length of the third dimension. - /// The function to create an initial value at each index into the array. - /// - /// The created array. - [] - val init: length1:int -> length2:int -> length3:int -> initializer:(int -> int -> int -> 'T) -> 'T[,,] - - /// Fetches an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]' - /// - /// The input array. - /// The index along the first dimension. - /// The index along the second dimension. - /// The index along the third dimension. - /// - /// The value at the given index. - [] - val get: array:'T[,,] -> index1:int -> index2:int -> index3:int -> 'T - - /// Applies the given function to each element of the array. - /// - /// The function to apply to each element of the array. - /// The input array. - [] - val iter: action:('T -> unit) -> array:'T[,,] -> unit - - /// Applies the given function to each element of the array. The integer indices passed to the - /// function indicates the index of element. - /// - /// The function to apply to each element of the array. - /// The input array. - [] - val iteri: action:(int -> int -> int -> 'T -> unit) -> array:'T[,,] -> unit - - /// Returns the length of an array in the first dimension - /// - /// The input array. - /// - /// The length of the array in the first dimension. - [] - val length1: array:'T[,,] -> int - - /// Returns the length of an array in the second dimension. - /// - /// The input array. - /// - /// The length of the array in the second dimension. - [] - val length2: array:'T[,,] -> int - - /// Returns the length of an array in the third dimension. - /// - /// The input array. - /// - /// The length of the array in the third dimension. - [] - val length3: array:'T[,,] -> int - - /// Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the array. - /// - /// For non-zero-based arrays the basing on an input array will be propagated to the output - /// array. - /// The function to transform each element of the array. - /// The input array. - /// - /// The array created from the transformed elements. - [] - val map: mapping:('T -> 'U) -> array:'T[,,] -> 'U[,,] - - /// Builds a new array whose elements are the results of applying the given function - /// to each of the elements of the array. The integer indices passed to the - /// function indicates the element being transformed. - /// - /// For non-zero-based arrays the basing on an input array will be propagated to the output - /// array. - /// The function to transform the elements at each index in the array. - /// The input array. - /// - /// The array created from the transformed elements. - [] - val mapi: mapping:(int -> int -> int -> 'T -> 'U) -> array:'T[,,] -> 'U[,,] - - /// Sets the value of an element in an array. You can also - /// use the syntax 'array.[index1,index2,index3] <- value'. - /// - /// The input array. - /// The index along the first dimension. - /// The index along the second dimension. - /// The index along the third dimension. - /// The value to set at the given index. - [] - val set: array:'T[,,] -> index1:int -> index2:int -> index3:int -> value:'T -> unit - - /// Creates an array where the entries are initially the "default" value. - /// - /// The length of the first dimension. - /// The length of the second dimension. - /// The length of the third dimension. - /// - /// The created array. - [] - val zeroCreate: length1:int -> length2:int -> length3:int -> 'T[,,] - - - - [] - [] - /// Contains operations for working with rank 4 arrays. - module Array4D = - - /// Creates an array whose elements are all initially the given value - /// - /// The length of the first dimension. - /// The length of the second dimension. - /// The length of the third dimension. - /// The length of the fourth dimension. - /// The initial value for each element of the array. - /// - /// The created array. - [] - val create: length1:int -> length2:int -> length3:int -> length4:int -> initial:'T -> 'T[,,,] - - /// Creates an array given the dimensions and a generator function to compute the elements. - /// - /// The length of the first dimension. - /// The length of the second dimension. - /// The length of the third dimension. - /// The length of the fourth dimension. - /// The function to create an initial value at each index in the array. - /// - /// The created array. - [] - val init: length1:int -> length2:int -> length3:int -> length4:int -> initializer:(int -> int -> int -> int -> 'T) -> 'T[,,,] - - /// Returns the length of an array in the first dimension - /// - /// The input array. - /// - /// The length of the array in the first dimension. - [] - val length1: array:'T[,,,] -> int - - /// Returns the length of an array in the second dimension. - /// - /// The input array. - /// - /// The length of the array in the second dimension. - [] - val length2: array:'T[,,,] -> int - - /// Returns the length of an array in the third dimension. - /// - /// The input array. - /// - /// The length of the array in the third dimension. - [] - val length3: array:'T[,,,] -> int - - /// Returns the length of an array in the fourth dimension. - /// - /// The input array. - /// - /// The length of the array in the fourth dimension. - [] - val length4: array:'T[,,,] -> int - - /// Creates an array where the entries are initially the "default" value. - /// - /// The length of the first dimension. - /// The length of the second dimension. - /// The length of the third dimension. - /// The length of the fourth dimension. - /// - /// The created array. - [] - val zeroCreate: length1:int -> length2:int -> length3:int -> length4:int -> 'T[,,,] - - /// Fetches an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]' - /// - /// The input array. - /// The index along the first dimension. - /// The index along the second dimension. - /// The index along the third dimension. - /// The index along the fourth dimension. - /// - /// The value at the given index. - [] - val get: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> 'T - - /// Sets the value of an element in an array. You can also - /// use the syntax 'array.[index1,index2,index3,index4] <- value'. - /// - /// The input array. - /// The index along the first dimension. - /// The index along the second dimension. - /// The index along the third dimension. - /// The index along the fourth dimension. - /// The value to set. - [] - val set: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> value:'T -> unit +open System +open Microsoft.FSharp.Collections +open Microsoft.FSharp.Core +open Microsoft.FSharp.Core.Operators + +[] +[] +/// Contains operations for working with rank 3 arrays. +/// +/// +/// See also F# Language Guide - Arrays. +/// +module Array3D = + + /// Creates an array whose elements are all initially the given value. + /// The length of the first dimension. + /// The length of the second dimension. + /// The length of the third dimension. + /// The value of the array elements. + /// + /// The created array. + /// + /// + [] + val create: length1:int -> length2:int -> length3:int -> initial:'T -> 'T[,,] + + /// Creates an array given the dimensions and a generator function to compute the elements. + /// + /// The length of the first dimension. + /// The length of the second dimension. + /// The length of the third dimension. + /// The function to create an initial value at each index into the array. + /// + /// The created array. + /// + /// + [] + val init: length1:int -> length2:int -> length3:int -> initializer:(int -> int -> int -> 'T) -> 'T[,,] + + /// Fetches an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]' + /// + /// The input array. + /// The index along the first dimension. + /// The index along the second dimension. + /// The index along the third dimension. + /// + /// The value at the given index. + /// + /// + [] + val get: array:'T[,,] -> index1:int -> index2:int -> index3:int -> 'T + + /// Applies the given function to each element of the array. + /// + /// The function to apply to each element of the array. + /// The input array. + /// + /// + [] + val iter: action:('T -> unit) -> array:'T[,,] -> unit + + /// Applies the given function to each element of the array. The integer indices passed to the + /// function indicates the index of element. + /// + /// The function to apply to each element of the array. + /// The input array. + /// + /// + [] + val iteri: action:(int -> int -> int -> 'T -> unit) -> array:'T[,,] -> unit + + /// Returns the length of an array in the first dimension + /// + /// The input array. + /// + /// The length of the array in the first dimension. + /// + /// + [] + val length1: array:'T[,,] -> int + + /// Returns the length of an array in the second dimension. + /// + /// The input array. + /// + /// The length of the array in the second dimension. + /// + /// + [] + val length2: array:'T[,,] -> int + + /// Returns the length of an array in the third dimension. + /// + /// The input array. + /// + /// The length of the array in the third dimension. + /// + /// + [] + val length3: array:'T[,,] -> int + + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. + /// + /// For non-zero-based arrays the basing on an input array will be propagated to the output + /// array. + /// The function to transform each element of the array. + /// The input array. + /// + /// The array created from the transformed elements. + /// + /// + [] + val map: mapping:('T -> 'U) -> array:'T[,,] -> 'U[,,] + + /// Builds a new array whose elements are the results of applying the given function + /// to each of the elements of the array. The integer indices passed to the + /// function indicates the element being transformed. + /// + /// For non-zero-based arrays the basing on an input array will be propagated to the output + /// array. + /// The function to transform the elements at each index in the array. + /// The input array. + /// + /// The array created from the transformed elements. + /// + /// + [] + val mapi: mapping:(int -> int -> int -> 'T -> 'U) -> array:'T[,,] -> 'U[,,] + + /// Sets the value of an element in an array. You can also + /// use the syntax 'array.[index1,index2,index3] <- value'. + /// + /// The input array. + /// The index along the first dimension. + /// The index along the second dimension. + /// The index along the third dimension. + /// The value to set at the given index. + /// + /// + [] + val set: array:'T[,,] -> index1:int -> index2:int -> index3:int -> value:'T -> unit + + /// Creates an array where the entries are initially the "default" value. + /// + /// The length of the first dimension. + /// The length of the second dimension. + /// The length of the third dimension. + /// + /// The created array. + /// + /// + [] + val zeroCreate: length1:int -> length2:int -> length3:int -> 'T[,,] + + + +[] +[] +/// Contains operations for working with rank 4 arrays. +module Array4D = + + /// Creates an array whose elements are all initially the given value + /// + /// The length of the first dimension. + /// The length of the second dimension. + /// The length of the third dimension. + /// The length of the fourth dimension. + /// The initial value for each element of the array. + /// + /// The created array. + /// + /// + [] + val create: length1:int -> length2:int -> length3:int -> length4:int -> initial:'T -> 'T[,,,] + + /// Creates an array given the dimensions and a generator function to compute the elements. + /// + /// The length of the first dimension. + /// The length of the second dimension. + /// The length of the third dimension. + /// The length of the fourth dimension. + /// The function to create an initial value at each index in the array. + /// + /// The created array. + /// + /// + [] + val init: length1:int -> length2:int -> length3:int -> length4:int -> initializer:(int -> int -> int -> int -> 'T) -> 'T[,,,] + + /// Returns the length of an array in the first dimension + /// + /// The input array. + /// + /// The length of the array in the first dimension. + /// + /// + [] + val length1: array:'T[,,,] -> int + + /// Returns the length of an array in the second dimension. + /// + /// The input array. + /// + /// The length of the array in the second dimension. + /// + /// + [] + val length2: array:'T[,,,] -> int + + /// Returns the length of an array in the third dimension. + /// + /// The input array. + /// + /// The length of the array in the third dimension. + /// + /// + [] + val length3: array:'T[,,,] -> int + + /// Returns the length of an array in the fourth dimension. + /// + /// The input array. + /// + /// The length of the array in the fourth dimension. + /// + /// + [] + val length4: array:'T[,,,] -> int + + /// Creates an array where the entries are initially the "default" value. + /// + /// The length of the first dimension. + /// The length of the second dimension. + /// The length of the third dimension. + /// The length of the fourth dimension. + /// + /// The created array. + /// + /// + [] + val zeroCreate: length1:int -> length2:int -> length3:int -> length4:int -> 'T[,,,] + + /// Fetches an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]' + /// + /// The input array. + /// The index along the first dimension. + /// The index along the second dimension. + /// The index along the third dimension. + /// The index along the fourth dimension. + /// + /// The value at the given index. + /// + /// + [] + val get: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> 'T + + /// Sets the value of an element in an array. You can also + /// use the syntax 'array.[index1,index2,index3,index4] <- value'. + /// + /// The input array. + /// The index along the first dimension. + /// The index along the second dimension. + /// The index along the third dimension. + /// The index along the fourth dimension. + /// The value to set. + /// + /// + [] + val set: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> value:'T -> unit diff --git a/src/fsharp/FSharp.Core/async.fsi b/src/fsharp/FSharp.Core/async.fsi index 0cae20eb808..75869a2e4ba 100644 --- a/src/fsharp/FSharp.Core/async.fsi +++ b/src/fsharp/FSharp.Core/async.fsi @@ -68,6 +68,8 @@ namespace Microsoft.FSharp.Control /// The result of the computation. /// /// Starting Async Computations + /// + /// static member RunSynchronously : computation:Async<'T> * ?timeout : int * ?cancellationToken:CancellationToken-> 'T /// Starts the asynchronous computation in the thread pool. Do not await its result. @@ -79,6 +81,8 @@ namespace Microsoft.FSharp.Control /// If one is not supplied, the default cancellation token is used. /// /// Starting Async Computations + /// + /// static member Start : computation:Async * ?cancellationToken:CancellationToken -> unit /// Executes a computation in the thread pool. @@ -89,11 +93,15 @@ namespace Microsoft.FSharp.Control /// in the corresponding state once the computation terminates (produces the result, throws exception or gets canceled) /// /// Starting Async Computations + /// + /// static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T> /// Creates an asynchronous computation which starts the given computation as a /// /// Starting Async Computations + /// + /// static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async> /// Creates an asynchronous computation that executes computation. @@ -106,6 +114,8 @@ namespace Microsoft.FSharp.Control /// A computation that returns a choice of type T or exception. /// /// Cancellation and Exceptions + /// + /// static member Catch : computation:Async<'T> -> Async> /// Creates an asynchronous computation that executes computation. @@ -119,6 +129,8 @@ namespace Microsoft.FSharp.Control /// is cancelled. /// /// Cancellation and Exceptions + /// + /// static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T> /// Generates a scoped, cooperative cancellation handler for use within an asynchronous workflow. @@ -138,6 +150,8 @@ namespace Microsoft.FSharp.Control /// before being disposed. /// /// Cancellation and Exceptions + /// + /// static member OnCancel : interruption: (unit -> unit) -> Async /// Creates an asynchronous computation that returns the CancellationToken governing the execution @@ -150,6 +164,8 @@ namespace Microsoft.FSharp.Control /// expression. /// /// Cancellation and Exceptions + /// + /// static member CancellationToken : Async /// Raises the cancellation condition for the most recent set of asynchronous computations started @@ -158,6 +174,8 @@ namespace Microsoft.FSharp.Control /// specific CancellationToken. /// /// Cancellation and Exceptions + /// + /// static member CancelDefaultToken : unit -> unit /// Gets the default cancellation token for executing asynchronous computations. @@ -165,6 +183,8 @@ namespace Microsoft.FSharp.Control /// The default CancellationToken. /// /// Cancellation and Exceptions + /// + /// static member DefaultCancellationToken : CancellationToken //---------- Parallelism @@ -195,6 +215,8 @@ namespace Microsoft.FSharp.Control /// A new computation that waits for the input computation to finish. /// /// Cancellation and Exceptions + /// + /// static member StartChild : computation:Async<'T> * ?millisecondsTimeout : int -> Async> /// Creates an asynchronous computation that executes all the given asynchronous computations, @@ -214,6 +236,8 @@ namespace Microsoft.FSharp.Control /// A computation that returns an array of values from the sequence of input computations. /// /// Composing Async Computations + /// + /// static member Parallel : computations:seq> -> Async<'T[]> /// Creates an asynchronous computation that executes all the given asynchronous computations, @@ -234,6 +258,8 @@ namespace Microsoft.FSharp.Control /// A computation that returns an array of values from the sequence of input computations. /// /// Composing Async Computations + /// + /// static member Parallel : computations:seq> * ?maxDegreeOfParallelism : int -> Async<'T[]> /// Creates an asynchronous computation that executes all the given asynchronous computations sequentially. @@ -252,6 +278,8 @@ namespace Microsoft.FSharp.Control /// A computation that returns an array of values from the sequence of input computations. /// /// Composing Async Computations + /// + /// static member Sequential : computations:seq> -> Async<'T[]> /// Creates an asynchronous computation that executes all given asynchronous computations in parallel, @@ -271,6 +299,8 @@ namespace Microsoft.FSharp.Control /// A computation that returns the first succeeding computation. /// /// Composing Async Computations + /// + /// static member Choice : computations:seq> -> Async<'T option> //---------- Thread Control @@ -281,6 +311,8 @@ namespace Microsoft.FSharp.Control /// A computation that will execute on a new thread. /// /// Threads and Contexts + /// + /// static member SwitchToNewThread : unit -> Async /// Creates an asynchronous computation that queues a work item that runs @@ -289,6 +321,8 @@ namespace Microsoft.FSharp.Control /// A computation that generates a new work item in the thread pool. /// /// Threads and Contexts + /// + /// static member SwitchToThreadPool : unit -> Async /// Creates an asynchronous computation that runs @@ -300,6 +334,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that uses the syncContext context to execute. /// /// Threads and Contexts + /// + /// static member SwitchToContext : syncContext:System.Threading.SynchronizationContext -> Async /// Creates an asynchronous computation that captures the current @@ -312,6 +348,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that provides the callback with the current continuations. /// /// Composing Async Computations + /// + /// static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> /// Creates an asynchronous computation that waits for a single invocation of a CLI @@ -332,6 +370,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that waits for the event to be invoked. /// /// Awaiting Results + /// + /// static member AwaitEvent: event:IEvent<'Del,'T> * ?cancelAction : (unit -> unit) -> Async<'T> when 'Del : delegate<'T,unit> and 'Del :> System.Delegate /// Creates an asynchronous computation that will wait on the given WaitHandle. @@ -345,6 +385,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that waits on the given WaitHandle. /// /// Awaiting Results + /// + /// static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout:int -> Async /// Creates an asynchronous computation that will wait on the IAsyncResult. @@ -358,6 +400,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that waits on the given IAsyncResult. /// /// Awaiting Results + /// + /// static member AwaitIAsyncResult: iar: System.IAsyncResult * ?millisecondsTimeout:int -> Async /// Return an asynchronous computation that will wait for the given task to complete and return @@ -377,6 +421,8 @@ namespace Microsoft.FSharp.Control /// /// /// Awaiting Results + /// + /// static member AwaitTask: task: Task<'T> -> Async<'T> /// Return an asynchronous computation that will wait for the given task to complete and return @@ -396,6 +442,8 @@ namespace Microsoft.FSharp.Control /// /// /// Awaiting Results + /// + /// static member AwaitTask: task: Task -> Async /// @@ -412,6 +460,8 @@ namespace Microsoft.FSharp.Control /// and not infinite. /// /// Awaiting Results + /// + /// static member Sleep: millisecondsDueTime:int -> Async /// @@ -427,6 +477,8 @@ namespace Microsoft.FSharp.Control /// Thrown when the due time is negative. /// /// Awaiting Results + /// + /// static member Sleep: dueTime:TimeSpan -> Async /// @@ -449,6 +501,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation wrapping the given Begin/End functions. /// /// Legacy .NET Async Interoperability + /// + /// static member FromBeginEnd : beginAction:(System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// @@ -472,6 +526,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation wrapping the given Begin/End functions. /// /// Legacy .NET Async Interoperability + /// + /// static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// @@ -494,6 +550,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation wrapping the given Begin/End functions. /// /// Legacy .NET Async Interoperability + /// + /// static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// Creates an asynchronous computation in terms of a Begin/End pair of actions in @@ -516,6 +574,8 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation wrapping the given Begin/End functions. /// /// Legacy .NET Async Interoperability + /// + /// static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) * ?cancelAction : (unit -> unit) -> Async<'T> /// Creates three functions that can be used to implement the .NET 1.0 Asynchronous @@ -527,6 +587,8 @@ namespace Microsoft.FSharp.Control /// A tuple of the begin, end, and cancel members. /// /// Legacy .NET Async Interoperability + /// + /// static member AsBeginEnd : computation:('Arg -> Async<'T>) -> // The 'Begin' member ('Arg * System.AsyncCallback * obj -> System.IAsyncResult) * @@ -543,6 +605,8 @@ namespace Microsoft.FSharp.Control /// A computation that is equivalent to the input computation, but disregards the result. /// /// Composing Async Computations + /// + /// static member Ignore : computation: Async<'T> -> Async /// Runs an asynchronous computation, starting immediately on the current operating system @@ -559,11 +623,15 @@ namespace Microsoft.FSharp.Control /// The default is used if this parameter is not provided. /// /// Starting Async Computations + /// + /// static member StartWithContinuations: computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken-> unit + /// + /// static member internal StartWithContinuationsUsingDispatchInfo: computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(ExceptionDispatchInfo -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * @@ -579,6 +647,8 @@ namespace Microsoft.FSharp.Control /// The default is used if this parameter is not provided. /// /// Starting Async Computations + /// + /// static member StartImmediate: computation:Async * ?cancellationToken:CancellationToken-> unit @@ -599,6 +669,8 @@ namespace Microsoft.FSharp.Control /// in the corresponding state once the computation terminates (produces the result, throws exception or gets canceled) /// /// Starting Async Computations + /// + /// static member StartImmediateAsTask: computation:Async<'T> * ?cancellationToken:CancellationToken-> Task<'T> @@ -617,28 +689,39 @@ namespace Microsoft.FSharp.Control /// The F# compiler emits calls to this function to implement F# async expressions. /// /// A value indicating asynchronous execution. + /// + /// member IsCancellationRequested: bool /// The F# compiler emits calls to this function to implement F# async expressions. /// /// A value indicating asynchronous execution. + /// + /// static member Success: AsyncActivation<'T> -> result: 'T -> AsyncReturn /// The F# compiler emits calls to this function to implement F# async expressions. /// /// A value indicating asynchronous execution. + /// + /// member OnSuccess: result: 'T -> AsyncReturn /// The F# compiler emits calls to this function to implement F# async expressions. + /// + /// member OnExceptionRaised: unit -> unit /// The F# compiler emits calls to this function to implement F# async expressions. /// /// A value indicating asynchronous execution. + /// + /// member OnCancellation: unit -> AsyncReturn /// Used by MailboxProcessor member internal QueueContinuationWithTrampoline: 'T -> AsyncReturn + /// Used by MailboxProcessor member internal CallContinuation: 'T -> AsyncReturn @@ -742,6 +825,8 @@ namespace Microsoft.FSharp.Control /// /// An asynchronous computation that will enumerate the sequence and run body /// for each element. + /// + /// member For: sequence:seq<'T> * body:('T -> Async) -> Async /// Creates an asynchronous computation that just returns (). @@ -751,6 +836,8 @@ namespace Microsoft.FSharp.Control /// The existence of this method permits the use of empty else branches in the /// async { ... } computation expression syntax. /// An asynchronous computation that returns (). + /// + /// member Zero : unit -> Async /// Creates an asynchronous computation that first runs computation1 @@ -765,6 +852,8 @@ namespace Microsoft.FSharp.Control /// The second part of the sequenced computation. /// /// An asynchronous computation that runs both of the computations sequentially. + /// + /// member inline Combine : computation1:Async * computation2:Async<'T> -> Async<'T> /// Creates an asynchronous computation that runs computation repeatedly @@ -780,6 +869,8 @@ namespace Microsoft.FSharp.Control /// of a while expression. /// /// An asynchronous computation that behaves similarly to a while loop when run. + /// + /// member While : guard:(unit -> bool) * computation:Async -> Async /// Creates an asynchronous computation that returns the result v. @@ -792,6 +883,8 @@ namespace Microsoft.FSharp.Control /// The value to return from the computation. /// /// An asynchronous computation that returns value when executed. + /// + /// member inline Return : value:'T -> Async<'T> /// Delegates to the input computation. @@ -802,6 +895,8 @@ namespace Microsoft.FSharp.Control /// The input computation. /// /// The input computation. + /// + /// member inline ReturnFrom : computation:Async<'T> -> Async<'T> /// Creates an asynchronous computation that runs generator. @@ -811,6 +906,8 @@ namespace Microsoft.FSharp.Control /// The function to run. /// /// An asynchronous computation that runs generator. + /// + /// member Delay : generator:(unit -> Async<'T>) -> Async<'T> /// Creates an asynchronous computation that runs binder(resource). @@ -827,6 +924,8 @@ namespace Microsoft.FSharp.Control /// computation. /// /// An asynchronous computation that binds and eventually disposes resource. + /// + /// member Using: resource:'T * binder:('T -> Async<'U>) -> Async<'U> when 'T :> System.IDisposable /// Creates an asynchronous computation that runs computation, and when @@ -842,6 +941,8 @@ namespace Microsoft.FSharp.Control /// /// An asynchronous computation that performs a monadic bind on the result /// of computation. + /// + /// member inline Bind: computation: Async<'T> * binder: ('T -> Async<'U>) -> Async<'U> /// Creates an asynchronous computation that runs computation. The action compensation is executed @@ -859,6 +960,8 @@ namespace Microsoft.FSharp.Control /// /// An asynchronous computation that executes computation and compensation afterwards or /// when an exception is raised. + /// + /// member inline TryFinally : computation:Async<'T> * compensation:(unit -> unit) -> Async<'T> /// Creates an asynchronous computation that runs computation and returns its result. @@ -874,6 +977,8 @@ namespace Microsoft.FSharp.Control /// /// An asynchronous computation that executes computation and calls catchHandler if an /// exception is thrown. + /// + /// member inline TryWith : computation:Async<'T> * catchHandler:(exn -> Async<'T>) -> Async<'T> // member inline TryWithFilter : computation:Async<'T> * catchHandler:(exn -> Async<'T> option) -> Async<'T> @@ -898,9 +1003,12 @@ namespace Microsoft.FSharp.Control /// An optional number of bytes to read from the stream. /// /// An asynchronous computation that will read from the stream into the given buffer. + /// /// Thrown when the sum of offset and count is longer than /// the buffer length. /// Thrown when offset or count is negative. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncRead : buffer:byte[] * ?offset:int * ?count:int -> Async @@ -909,6 +1017,8 @@ namespace Microsoft.FSharp.Control /// The number of bytes to read. /// /// An asynchronous computation that returns the read byte[] when run. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncRead : count:int -> Async @@ -919,9 +1029,12 @@ namespace Microsoft.FSharp.Control /// An optional number of bytes to write to the stream. /// /// An asynchronous computation that will write the given bytes to the stream. + /// /// Thrown when the sum of offset and count is longer than /// the buffer length. /// Thrown when offset or count is negative. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncWrite : buffer:byte[] * ?offset:int * ?count:int -> Async @@ -932,6 +1045,8 @@ namespace Microsoft.FSharp.Control /// be invoked for each observation. /// /// The function to be called for each observation. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member Add: callback:('T -> unit) -> unit @@ -942,6 +1057,8 @@ namespace Microsoft.FSharp.Control /// The function to be called for each observation. /// /// An object that will remove the listener if disposed. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member Subscribe: callback:('T -> unit) -> System.IDisposable @@ -954,6 +1071,8 @@ namespace Microsoft.FSharp.Control type System.Net.WebRequest with /// Returns an asynchronous computation that, when run, will wait for a response to the given WebRequest. /// An asynchronous computation that waits for response to the WebRequest. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncGetResponse : unit -> Async @@ -964,6 +1083,8 @@ namespace Microsoft.FSharp.Control /// The URI to retrieve. /// /// An asynchronous computation that will wait for the download of the URI. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncDownloadString : address:System.Uri -> Async @@ -972,6 +1093,8 @@ namespace Microsoft.FSharp.Control /// The URI to retrieve. /// /// An asynchronous computation that will wait for the download of the URI. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncDownloadData : address:System.Uri -> Async @@ -981,6 +1104,8 @@ namespace Microsoft.FSharp.Control /// The filename to save download to. /// /// An asynchronous computation that will wait for the download of the URI to specified file. + /// + /// [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncDownloadFile : address:System.Uri * fileName: string -> Async diff --git a/src/fsharp/FSharp.Core/collections.fsi b/src/fsharp/FSharp.Core/collections.fsi index ce063e711a3..429b4633999 100644 --- a/src/fsharp/FSharp.Core/collections.fsi +++ b/src/fsharp/FSharp.Core/collections.fsi @@ -3,69 +3,84 @@ /// This namespace contains some common collections in a style primarily designed for use from F#. namespace Microsoft.FSharp.Collections - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - open Microsoft.FSharp.Primitives.Basics - open System - open System.Collections.Generic - /// Common notions of value ordering implementing the - /// interface, for constructing sorted data structures and performing sorting operations. - module ComparisonIdentity = - - /// Get an implementation of comparison semantics using structural comparison. - /// - /// An object implementing using . - val inline Structural<'T> : IComparer<'T> when 'T : comparison +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections +open Microsoft.FSharp.Primitives.Basics +open System +open System.Collections.Generic - /// Get an implementation of comparison semantics using non-structural comparison. - /// - /// An object implementing using . - val inline NonStructural< ^T > : IComparer< ^T > when ^T : (static member ( < ) : ^T * ^T -> bool) and ^T : (static member ( > ) : ^T * ^T -> bool) +/// Common notions of value ordering implementing the +/// interface, for constructing sorted data structures and performing sorting operations. +module ComparisonIdentity = + + /// Get an implementation of comparison semantics using structural comparison. + /// + /// An object implementing using . + /// + /// + val inline Structural<'T> : IComparer<'T> when 'T : comparison - /// Get an implementation of comparison semantics using the given function. - /// - /// A function to compare two values. - /// - /// An object implementing using the supplied function. - val FromFunction : comparer:('T -> 'T -> int) -> IComparer<'T> - - /// Common notions of value identity implementing the - /// interface, for constructing objects and other collections - module HashIdentity = + /// Get an implementation of comparison semantics using non-structural comparison. + /// + /// An object implementing using . + /// + /// + val inline NonStructural< ^T > : IComparer< ^T > when ^T : (static member ( < ) : ^T * ^T -> bool) and ^T : (static member ( > ) : ^T * ^T -> bool) - /// Get an implementation of equality semantics using structural equality and structural hashing. - /// - /// An object implementing using and . - val inline Structural<'T> : IEqualityComparer<'T> when 'T : equality - - /// Get an implementation of equality semantics using non-structural equality and non-structural hashing. - /// - /// - /// An object implementing using - /// and . - /// - val inline NonStructural<'T> : IEqualityComparer< ^T > when ^T : equality and ^T : (static member ( = ) : ^T * ^T -> bool) - - /// Get an implementation of equality semantics semantics using structural equality and structural hashing. - /// - /// An object implementing . - val inline LimitedStructural<'T> : limit: int -> IEqualityComparer<'T> when 'T : equality - - /// Get an implementation of equality semantics using reference equality and reference hashing. - /// - /// - /// An object implementing using - /// and . - /// - val Reference<'T> : IEqualityComparer<'T> when 'T : not struct - - /// Get an implementation of equality semantics using the given functions. - /// - /// A function to generate a hash code from a value. - /// A function to test equality of two values. - /// - /// An object implementing using the given functions. - val inline FromFunctions<'T> : hasher:('T -> int) -> equality:('T -> 'T -> bool) -> IEqualityComparer<'T> + /// Get an implementation of comparison semantics using the given function. + /// + /// A function to compare two values. + /// + /// An object implementing using the supplied function. + /// + /// + val FromFunction : comparer:('T -> 'T -> int) -> IComparer<'T> + +/// Common notions of value identity implementing the +/// interface, for constructing objects and other collections +module HashIdentity = + /// Get an implementation of equality semantics using structural equality and structural hashing. + /// + /// An object implementing using and . + /// + /// + val inline Structural<'T> : IEqualityComparer<'T> when 'T : equality + + /// Get an implementation of equality semantics using non-structural equality and non-structural hashing. + /// + /// + /// An object implementing using + /// and . + /// + /// + /// + val inline NonStructural<'T> : IEqualityComparer< ^T > when ^T : equality and ^T : (static member ( = ) : ^T * ^T -> bool) + + /// Get an implementation of equality semantics semantics using structural equality and structural hashing. + /// + /// An object implementing . + /// + /// + val inline LimitedStructural<'T> : limit: int -> IEqualityComparer<'T> when 'T : equality + + /// Get an implementation of equality semantics using reference equality and reference hashing. + /// + /// + /// An object implementing using + /// and . + /// + /// + /// + val Reference<'T> : IEqualityComparer<'T> when 'T : not struct + /// Get an implementation of equality semantics using the given functions. + /// + /// A function to generate a hash code from a value. + /// A function to test equality of two values. + /// + /// An object implementing using the given functions. + /// + /// + val inline FromFunctions<'T> : hasher:('T -> int) -> equality:('T -> 'T -> bool) -> IEqualityComparer<'T> diff --git a/src/fsharp/FSharp.Core/event.fsi b/src/fsharp/FSharp.Core/event.fsi index fd6c23e0008..20b1bb9a3b9 100644 --- a/src/fsharp/FSharp.Core/event.fsi +++ b/src/fsharp/FSharp.Core/event.fsi @@ -2,54 +2,79 @@ namespace Microsoft.FSharp.Control - open System - open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.Operators - open Microsoft.FSharp.Control - open Microsoft.FSharp.Collections +open System +open Microsoft.FSharp.Core +open Microsoft.FSharp.Core.Operators +open Microsoft.FSharp.Control +open Microsoft.FSharp.Collections - /// Event implementations for an arbitrary type of delegate. - /// - /// Events and Observables - [] - type DelegateEvent<'Delegate when 'Delegate :> System.Delegate> = - /// Creates an event object suitable for implementing an arbitrary type of delegate. - /// The event object. - new : unit -> DelegateEvent<'Delegate> - /// Triggers the event using the given parameters. - /// The parameters for the event. - member Trigger : args:obj[] -> unit - /// Publishes the event as a first class event value. - member Publish : IDelegateEvent<'Delegate> - - /// Event implementations for a delegate types following the standard .NET Framework convention of a first 'sender' argument. +/// Event implementations for an arbitrary type of delegate. +/// +/// Events and Observables +[] +type DelegateEvent<'Delegate when 'Delegate :> System.Delegate> = + /// Creates an event object suitable for implementing an arbitrary type of delegate. + /// The event object. + /// + /// + new : unit -> DelegateEvent<'Delegate> + + /// Triggers the event using the given parameters. + /// The parameters for the event. + /// + /// + member Trigger : args:obj[] -> unit + + /// Publishes the event as a first class event value. + /// + /// + member Publish : IDelegateEvent<'Delegate> + +/// Event implementations for a delegate types following the standard .NET Framework convention of a first 'sender' argument. +/// +/// Events and Observables +[] +type Event<'Delegate,'Args when 'Delegate : delegate<'Args,unit> and 'Delegate :> System.Delegate and 'Delegate : not struct> = + + /// Creates an event object suitable for delegate types following the standard .NET Framework convention of a first 'sender' argument. + /// The created event. + /// + /// + new : unit -> Event<'Delegate,'Args> + + /// Triggers the event using the given sender object and parameters. The sender object may be null. /// - /// Events and Observables - [] - type Event<'Delegate,'Args when 'Delegate : delegate<'Args,unit> and 'Delegate :> System.Delegate and 'Delegate : not struct> = - /// Creates an event object suitable for delegate types following the standard .NET Framework convention of a first 'sender' argument. - /// The created event. - new : unit -> Event<'Delegate,'Args> - /// Triggers the event using the given sender object and parameters. The sender object may be null. - /// - /// The object triggering the event. - /// The parameters for the event. - member Trigger : sender:obj * args:'Args -> unit - /// Publishes the event as a first class event value. - member Publish : IEvent<'Delegate,'Args> - - - /// Event implementations for the IEvent<_> type. + /// The object triggering the event. + /// The parameters for the event. + /// + /// + member Trigger : sender:obj * args:'Args -> unit + + /// Publishes the event as a first class event value. + /// + /// + member Publish : IEvent<'Delegate,'Args> + +/// Event implementations for the IEvent<_> type. +/// +/// Events and Observables +[] +type Event<'T> = + + /// Creates an observable object. + /// The created event. + /// + /// + new : unit -> Event<'T> + + /// Triggers the event using the given parameters. /// - /// Events and Observables - [] - type Event<'T> = - /// Creates an observable object. - /// The created event. - new : unit -> Event<'T> - /// Triggers an observation using the given parameters. - /// - /// The event parameters. - member Trigger : arg:'T -> unit - /// Publishes an observation as a first class value. - member Publish : IEvent<'T> + /// The event parameters. + /// + /// + member Trigger : arg:'T -> unit + + /// Publishes the event as a first class value. + /// + /// + member Publish : IEvent<'T> diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi index c7ae3fc6cf1..c1dea425552 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi @@ -20,6 +20,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val printf: format:Printf.TextWriterFormat<'T> -> 'T @@ -28,6 +30,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val printfn: format:Printf.TextWriterFormat<'T> -> 'T @@ -36,6 +40,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val eprintf: format:Printf.TextWriterFormat<'T> -> 'T @@ -44,6 +50,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val eprintfn: format:Printf.TextWriterFormat<'T> -> 'T @@ -52,6 +60,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val sprintf: format:Printf.StringFormat<'T> -> 'T @@ -61,6 +71,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val failwithf: format:Printf.StringFormat<'T,'Result> -> 'T @@ -70,6 +82,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val fprintf : textWriter:System.IO.TextWriter -> format:Printf.TextWriterFormat<'T> -> 'T @@ -79,6 +93,8 @@ module ExtraTopLevelOperators = /// The formatter. /// /// The formatted result. + /// + /// [] val fprintfn : textWriter:System.IO.TextWriter -> format:Printf.TextWriterFormat<'T> -> 'T @@ -87,28 +103,40 @@ module ExtraTopLevelOperators = /// The input sequence of elements. /// /// The created set. + /// + /// [] val set : elements:seq<'T> -> Set<'T> /// Builds an asynchronous workflow using computation expression syntax. + /// + /// [] val async : Microsoft.FSharp.Control.AsyncBuilder /// Converts the argument to 32-bit float. + /// /// This is a direct conversion for all /// primitive numeric types. For strings, the input is converted using Single.Parse() with InvariantCulture settings. Otherwise the operation requires and invokes a ToSingle method on the input type. + /// + /// [] val inline single : value:^T -> single when ^T : (static member op_Explicit : ^T -> single) and default ^T : int /// Converts the argument to 64-bit float. + /// /// This is a direct conversion for all /// primitive numeric types. For strings, the input is converted using Double.Parse() with InvariantCulture settings. Otherwise the operation requires and invokes a ToDouble method on the input type. + /// + /// [] val inline double : value:^T -> double when ^T : (static member op_Explicit : ^T -> double) and default ^T : int /// Converts the argument to byte. /// This is a direct conversion for all /// primitive numeric types. For strings, the input is converted using Byte.Parse() on strings and otherwise requires a ToByte method on the input type. + /// + /// [] val inline uint8 : value:^T -> uint8 when ^T : (static member op_Explicit : ^T -> uint8) and default ^T : int @@ -116,15 +144,18 @@ module ExtraTopLevelOperators = /// This is a direct conversion for all /// primitive numeric types. For strings, the input is converted using SByte.Parse() with InvariantCulture settings. /// Otherwise the operation requires and invokes a ToSByte method on the input type. + /// + /// [] val inline int8 : value:^T -> int8 when ^T : (static member op_Explicit : ^T -> int8) and default ^T : int - module Checked = /// Converts the argument to byte. /// This is a direct, checked conversion for all /// primitive numeric types. For strings, the input is converted using Byte.Parse() on strings and otherwise requires a ToByte method on the input type. + /// + /// [] val inline uint8 : value:^T -> byte when ^T : (static member op_Explicit : ^T -> uint8) and default ^T : int @@ -132,38 +163,53 @@ module ExtraTopLevelOperators = /// This is a direct, checked conversion for all /// primitive numeric types. For strings, the input is converted using SByte.Parse() with InvariantCulture settings. /// Otherwise the operation requires and invokes a ToSByte method on the input type. + /// + /// [] val inline int8 : value:^T -> sbyte when ^T : (static member op_Explicit : ^T -> int8) and default ^T : int /// Builds a read-only lookup table from a sequence of key/value pairs. The key objects are indexed using generic hashing and equality. + /// + /// [] val dict : keyValuePairs:seq<'Key * 'Value> -> System.Collections.Generic.IDictionary<'Key,'Value> when 'Key : equality /// Builds a read-only lookup table from a sequence of key/value pairs. The key objects are indexed using generic hashing and equality. + /// + /// [] val readOnlyDict : keyValuePairs:seq<'Key * 'Value> -> System.Collections.Generic.IReadOnlyDictionary<'Key,'Value> when 'Key : equality /// Builds a 2D array from a sequence of sequences of elements. + /// + /// [] val array2D : rows:seq<#seq<'T>> -> 'T[,] /// Special prefix operator for splicing typed expressions into quotation holes. + /// + /// [] val (~%) : expression:Microsoft.FSharp.Quotations.Expr<'T> -> 'T /// Special prefix operator for splicing untyped expressions into quotation holes. + /// + /// [] val (~%%) : expression:Microsoft.FSharp.Quotations.Expr -> 'T /// An active pattern to force the execution of values of type Lazy<_>. + /// + /// [] val (|Lazy|) : input:Lazy<'T> -> 'T /// Builds a query using query syntax and operators. + /// + /// val query : Microsoft.FSharp.Linq.QueryBuilder - namespace Microsoft.FSharp.Core.CompilerServices open System @@ -174,7 +220,6 @@ namespace Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Control open Microsoft.FSharp.Quotations - /// Represents the product of two measure expressions when returned as a generic argument of a provided type. /// /// @@ -193,6 +238,7 @@ namespace Microsoft.FSharp.Core.CompilerServices [] type TypeProviderAttribute = inherit System.Attribute + /// Creates an instance of the attribute /// TypeProviderAttribute new : unit -> TypeProviderAttribute @@ -202,43 +248,57 @@ namespace Microsoft.FSharp.Core.CompilerServices | SuppressRelocate = 0x80000000 | IsErased = 0x40000000 - /// Place attribute on runtime assembly to indicate that there is a corresponding design-time - /// assembly that contains a type provider. Runtime and designer assembly may be the same. + /// Place this attribute on a runtime assembly to indicate that there is a corresponding design-time + /// assembly that contains a type provider. Runtime and design-time assembly may be the same. [] type TypeProviderAssemblyAttribute = inherit System.Attribute + /// Creates an instance of the attribute /// TypeProviderAssemblyAttribute new : unit -> TypeProviderAssemblyAttribute + /// Creates an instance of the attribute /// TypeProviderAssemblyAttribute /// The name of the design-time assembly for this type provider. new : assemblyName : string -> TypeProviderAssemblyAttribute + + /// Gets the assembly name. member AssemblyName : string - /// The TypeProviderXmlDocAttribute attribute can be added to types and members. - /// The language service will display the CommentText property from the attribute - /// in the appropriate place when the user hovers over a type or member. + /// A type provider may provide an instance of this attribute to indicate the documentation to show for + /// a provided type or member. [] type TypeProviderXmlDocAttribute = inherit System.Attribute + /// Creates an instance of the attribute /// TypeProviderXmlDocAttribute new : commentText : string -> TypeProviderXmlDocAttribute + + /// Gets the comment text. member CommentText : string + /// A type provider may provide an instance of this attribute to indicate the definition location for a provided type or member. [] type TypeProviderDefinitionLocationAttribute = inherit System.Attribute new : unit -> TypeProviderDefinitionLocationAttribute + + /// Gets or sets the file path for the definition location. member FilePath : string with get, set + + /// Gets or sets the line for the location. member Line : int with get, set + + /// Gets or sets the column for the location. member Column : int with get, set [] /// Indicates that a code editor should hide all System.Object methods from the intellisense menus for instances of a provided type type TypeProviderEditorHideMethodsAttribute = inherit System.Attribute + /// Creates an instance of the attribute /// TypeProviderEditorHideMethodsAttribute new : unit -> TypeProviderEditorHideMethodsAttribute @@ -272,7 +332,6 @@ namespace Microsoft.FSharp.Core.CompilerServices /// Checks if given type exists in target system runtime library member SystemRuntimeContainsType : string -> bool - /// /// Represents a namespace provided by a type provider component. /// @@ -304,7 +363,7 @@ namespace Microsoft.FSharp.Core.CompilerServices inherit System.IDisposable /// - /// Namespace name the this TypeProvider injects types into. + /// Gets the namespaces provided by the type provider. /// abstract GetNamespaces : unit -> IProvidedNamespace[] @@ -320,7 +379,9 @@ namespace Microsoft.FSharp.Core.CompilerServices /// /// Apply static arguments to a provided type that accepts static arguments. /// + /// /// The provider must return a type with the given mangled name. + /// /// the provided type definition which has static parameters /// the full path of the type, including encoded representations of static parameters /// the static parameters, indexed by name @@ -359,7 +420,6 @@ namespace Microsoft.FSharp.Core.CompilerServices /// A method returned by GetMethod on a provided type /// /// The static parameters of the provided method, if any - abstract GetStaticParametersForMethod : methodWithoutArguments:MethodBase -> ParameterInfo[] /// diff --git a/src/fsharp/FSharp.Core/list.fsi b/src/fsharp/FSharp.Core/list.fsi index 906b2028cb9..0a1c0135d4d 100644 --- a/src/fsharp/FSharp.Core/list.fsi +++ b/src/fsharp/FSharp.Core/list.fsi @@ -2,1524 +2,1668 @@ namespace Microsoft.FSharp.Collections - open System - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - /// Contains operations for working with values of type . - /// - /// Operations for collections such as lists, arrays, sets, maps and sequences. See also - /// F# Collection Types in the F# Language Guide. - /// - [] - [] - module List = - - /// Returns a new list that contains all pairings of elements from the first and second lists. - /// - /// The first input list. - /// The second input list. - /// - /// The resulting list of pairs. - /// - /// - /// - /// let people = ["Kirk"; "Spock"; "McCoy"] - /// let numbers = [1;2] - /// people |> List.allPairs numbers - /// - /// The sample evaluates to - /// - /// [(1, "Kirk"); (1, "Spock"); (1, "McCoy"); (2, "Kirk"); (2, "Spock"); (2, "McCoy")] - /// - /// - [] - val allPairs: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list - - /// Returns a new list that contains the elements of the first list - /// followed by elements of the second. - /// - /// The first input list. - /// The second input list. - /// - /// The resulting list. - /// - /// - /// - /// List.append [1..3] [4..7] // evaluates [1; 2; 3; 4; 5; 6; 7] - /// - /// [4..7] |> List.append [1..3] // evaluates [1; 2; 3; 4; 5; 6; 7] - /// - /// - [] - val append: list1: 'T list -> list2: 'T list -> 'T list - - /// Returns the average of the elements in the list. - /// - /// Raises if list is empty. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The resulting average. - /// - /// - /// - /// [1.0 .. 9.0] |> List.average // evaluates 5.0 - /// - /// - /// - /// - /// - /// [1 .. 9] |> List.average - /// - /// The sample does not compile because The type 'int' does not support the operator 'DivideByInt' - /// (see averageBy examples for a solution) - /// - [] - val inline average : list:^T list -> ^T - when ^T : (static member (+) : ^T * ^T -> ^T) - and ^T : (static member DivideByInt : ^T*int -> ^T) - and ^T : (static member Zero : ^T) - - /// Returns the average of the elements generated by applying the function to each element of the list. - /// - /// Raises if list is empty. - /// The function to transform the list elements into the type to be averaged. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The resulting average. - /// - /// Average the age of persons by extracting the age from records - /// - /// type People = { - /// name: string - /// age: int } - /// let getAgeAsFloat person = float person.age - /// let people = - /// [ { name = "Kirk"; age = 26 } - /// { name = "Spock"; age = 90 } - /// { name = "McCoy"; age = 37 } ] - /// people |> List.averageBy getAgeAsFloat // evaluates 51.0 - /// - /// - /// - /// Average a list of integer numbers by converting to float - /// - /// [1 .. 9] |> List.averageBy float // evaluates 5.0 - /// - /// - [] - val inline averageBy: projection:('T -> ^U) -> list:'T list -> ^U - when ^U : (static member (+) : ^U * ^U -> ^U) - and ^U : (static member DivideByInt : ^U*int -> ^U) - and ^U : (static member Zero : ^U) - - /// Applies the given function to each element of the list. Returns - /// the list comprised of the results x for each element where - /// the function returns Some(x) - /// - /// The function to generate options from the elements. - /// The input list. - /// - /// The list comprising the values selected from the chooser function. - /// - /// - /// - /// type Happiness = AlwaysHappy | MostOfTheTimeGrumpy - /// type People = { - /// name: string - /// happiness: Happiness } - /// let takeJustHappyPersons person = - /// match person.happiness with - /// | AlwaysHappy -> Some person.name - /// | MostOfTheTimeGrumpy -> None - /// let candidatesForTheTrip = - /// [ { name = "SpongeBob"; happiness = AlwaysHappy } - /// { name = "Patrick"; happiness = AlwaysHappy } - /// { name = "Squidward"; happiness = MostOfTheTimeGrumpy } ] - /// candidatesForTheTrip |> List.choose takeJustHappyPersons - /// - /// The sample evaluates to [ "SpongeBob"; "Patrick" ] - /// - /// - /// - /// - /// // Using the identity function "id" (is defined like fun x -> x) - /// let input1 = [ Some 1; None; Some 3; None ] - /// input1 |> List.choose id // evaluates [1; 3] - /// - /// let input2: int option list = [] - /// input2 |> List.choose id // evaluates [] (notice that has the type "int list") - /// - /// let input3: string option list =[ None; None ] - /// input3 |> List.choose id // evaluates [] (notice that has the type "string list") - /// - /// - [] - val choose: chooser:('T -> 'U option) -> list:'T list -> 'U list - - /// Divides the input list into chunks of size at most chunkSize. - /// - /// The maximum size of each chunk. - /// The input list. - /// - /// The list divided into chunks. - /// - /// Thrown when chunkSize is not positive. - /// - /// - /// - /// [1 .. 10 ] |> List.chunkBySize 3 // evaluates - /// - /// Evaluates to [[1; 2; 3]; [4; 5; 6]; [7; 8; 9]; [10]] . Please notice the last chunk. - /// - /// - /// let output2 = [1 .. 5 ] |> List.chunkBySize 10 - /// - /// Evaluates to [[1; 2; 3; 4; 5]] - /// - /// - /// let input : string list = [] - /// let output3 = input |> List.chunkBySize 10 - /// - /// Evaluates to []. Please notice that has the type string list list. - /// - [] - val chunkBySize: chunkSize:int -> list:'T list -> 'T list list - - /// For each element of the list, applies the given function. Concatenates all the results and return the combined list. - /// - /// The function to transform each input element into a sublist to be concatenated. - /// The input list. - /// - /// The concatenation of the transformed sublists. - /// - /// For each positive number in the array we are generating all the previous positive numbers - /// - /// [1..4] |> List.collect (fun x -> [1..x]) - /// - /// The sample evaluates to [1; 1; 2; 1; 2; 3; 1; 2; 3; 4] (added extra spaces for easy reading) - /// - [] - val collect: mapping:('T -> 'U list) -> list:'T list -> 'U list - - /// Compares two lists using the given comparison function, element by element. - /// - /// A function that takes an element from each list and returns an int. - /// If it evaluates to a non-zero value iteration is stopped and that value is returned. - /// The first input list. - /// The second input list. - /// - /// Returns the first non-zero result from the comparison function. If the first list has a - /// larger element, the return value is always positive. If the second list has a larger - /// element, the return value is always negative. When the elements are equal in the two - /// lists, 1 is returned if the first list is longer, 0 is returned if they are equal in - /// length, and -1 is returned when the second list is longer. - [] - val inline compareWith: comparer:('T -> 'T -> int) -> list1:'T list -> list2:'T list -> int - - /// Returns a new list that contains the elements of each the lists in order. - /// - /// The input sequence of lists. - /// - /// The resulting concatenated list. - /// - /// - /// - /// let input = [ [1;2] - /// [3;4;5] - /// [6;7;8;9] ] - /// input |> List.concat // evaluates [1; 2; 3; 4; 5; 6; 7; 8; 9] - /// - /// - [] - val concat: lists:seq<'T list> -> 'T list - - /// Tests if the list contains the specified element. - /// - /// The value to locate in the input list. - /// The input list. - /// - /// True if the input list contains the specified element; false otherwise. - /// - /// - /// - /// [1..9] |> List.contains 0 // evaluates false - /// - /// [1..9] |> List.contains 3 // evaluates true - /// - /// let input = [1, "SpongeBob"; 2, "Patrick"; 3, "Squidward"; 4, "Mr. Krabs"] - /// input |> List.contains (2, "Patrick") // evaluates true - /// input |> List.contains (22, "Patrick") // evaluates false - /// - /// - [] - val inline contains: value:'T -> source:'T list -> bool when 'T : equality - - /// Returns a list that contains no duplicate entries according to generic hash and - /// equality comparisons on the entries. - /// If an element occurs multiple times in the list then the later occurrences are discarded. - /// - /// The input list. - /// - /// The result list. - /// - /// - /// - /// let input = [6;1;2;3;1;4;5;5] - /// input |> List.distinct // evaluates [6; 1; 2; 3; 4; 5] - /// - /// - [] - val distinct: list:'T list -> 'T list when 'T : equality - - /// Returns a list that contains no duplicate entries according to the - /// generic hash and equality comparisons on the keys returned by the given key-generating function. - /// If an element occurs multiple times in the list then the later occurrences are discarded. - /// - /// A function transforming the list items into comparable keys. - /// The input list. - /// - /// The result list. - /// - /// - /// - /// let isEven x = 0 = x % 2 - /// let input = [6;1;2;3;1;4;5;5] - /// input |> List.distinctBy isEven // evaluates [6; 1] - /// - /// - [] - val distinctBy: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : equality - - /// Applies a key-generating function to each element of a list and returns a list yielding unique - /// keys and their number of occurrences in the original list. - /// - /// A function transforming each item of the input list into a key to be - /// compared against the others. - /// The input list. - /// - /// The result list. - /// - /// Counting the number of occurrences of chars - /// - /// let input = ['H'; 'a'; 'p'; 'p'; 'i'; 'n'; 'e'; 's'; 's'] - /// input |> List.countBy id - /// - /// Evalutes [('H', 1); ('a', 1); ('p', 2); ('i', 1); ('n', 1); ('e', 1); ('s', 2)] - /// - [] - val countBy : projection:('T -> 'Key) -> list:'T list -> ('Key * int) list when 'Key : equality - - /// Splits the input list into at most count chunks. - /// - /// The maximum number of chunks. - /// The input list. - /// - /// The list split into chunks. - /// - /// Thrown when count is not positive. - /// - /// - /// - /// [1..10] |> List.splitInto 2 // evaluates [[1; 2; 3; 4; 5]; [6; 7; 8; 9; 10]] - /// [1..10] |> List.splitInto 4 // evaluates [[1; 2; 3]; [4; 5; 6]; [7; 8]; [9; 10]] - /// - /// - [] - val splitInto: count:int -> list:'T list -> 'T list list - - /// Returns an empty list of the given type. - [] - [] - val empty<'T> : 'T list - - /// Returns a new list with the distinct elements of the input list which do not appear in the itemsToExclude sequence, - /// using generic hash and equality comparisons to compare values. - /// - /// A sequence whose elements that also occur in the input list will cause those elements to be - /// removed from the result. - /// A list whose elements that are not also in itemsToExclude will be returned. - /// - /// A list that contains the distinct elements of list that do not appear in itemsToExclude. - /// - /// Thrown when itemsToExclude is null. - /// - /// - /// - /// let input = [1, "Kirk"; 2, "Spock"; 3, "Kenobi"] - /// input |> List.except [3, "Kenobi"] // evaluates [(1, "Kirk"); (2, "Spock")] - /// - /// - /// - /// - /// - /// [0..10] |> List.except [1..5] // evaluates [0; 6; 7; 8; 9; 10] - /// [1..5] |> List.except [0..10] // evaluates [] - /// - /// - [] - val except: itemsToExclude:seq<'T> -> list:'T list -> 'T list when 'T : equality - - /// Returns the only element of the list. - /// - /// The input list. - /// - /// The only element of the list. - /// - /// Thrown when the input does not have precisely one element. - /// - /// - /// - /// ["the chosen one"] |> List.exactlyOne // evaluates "the chosen one" - /// - /// - /// - /// - /// - /// let input : string list = [] - /// input |> List.exactlyOne - /// - /// Will throw the exception: System.ArgumentException: The input sequence was empty - /// - /// - /// - /// - /// [1..5] |> List.exactlyOne - /// - /// Will throw the exception: System.ArgumentException: The input sequence contains more than one element - /// - [] - val exactlyOne: list:'T list -> 'T - - /// Returns the only element of the list or None if it is empty or contains more than one element. - /// - /// The input list. - /// - /// The only element of the list or None. - /// - /// - /// - /// [1] |> List.tryExactlyOne // evaluates Some 1 - /// [1;2] |> List.tryExactlyOne // evaluates None - /// ([] : int list) |> List.tryExactlyOne // evaluates None - /// - /// - [] - val tryExactlyOne: list:'T list -> 'T option - - /// Tests if any element of the list satisfies the given predicate. - /// - /// The predicate is applied to the elements of the input list. If any application - /// returns true then the overall result is true and no further elements are tested. - /// Otherwise, false is returned. - /// The function to test the input elements. - /// The input list. - /// - /// True if any element satisfies the predicate. - /// - /// - /// - /// let input = [1, "Kirk"; 2, "Spock"; 3, "Kenobi"] - /// - /// input |> List.exists (fun x -> x = (3, "Kenobi")) // evaluates true - /// - /// input |> List.exists (fun (n, name) -> n > 5) // evaluates false - /// - /// - [] - val exists: predicate:('T -> bool) -> list:'T list -> bool - - /// Tests if any pair of corresponding elements of the lists satisfies the given predicate. - /// - /// The predicate is applied to matching elements in the two collections up to the lesser of the - /// two lengths of the collections. If any application returns true then the overall result is - /// true and no further elements are tested. Otherwise, if one collections is longer - /// than the other then the exception is raised. - /// Otherwise, false is returned. - /// - /// The function to test the input elements. - /// The first input list. - /// The second input list. - /// - /// Thrown when the input lists differ in length. - /// - /// True if any pair of elements satisfy the predicate. - /// - /// Check if the sum of pairs (from 2 different lists) have at least one even number - /// - /// let anEvenSum a b = 0 = (a + b) % 2 - /// - /// ([1..4], [2..5]) - /// ||> List.exists2 anEvenSum // evaluates false - /// - /// ([1..4], [2;4;5;6]) - /// ||> List.exists2 anEvenSum // evaluates true - /// - /// - [] - val exists2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool - - /// Returns the first element for which the given function returns True. - /// Raises KeyNotFoundException if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// Thrown if the predicate evaluates to false for - /// all the elements of the list. - /// - /// The first element that satisfies the predicate. - /// - /// - /// - /// let isEven x = 0 = x % 2 - /// let isGreaterThan x y = y > x - /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] - /// - /// input |> List.find (fun (x,_) -> isEven x) // evaluates (2, "Kirk") - /// input |> List.find (fun (x,_) -> x |> isGreaterThan 6) // raises an exception - /// - /// - [] - val find: predicate:('T -> bool) -> list:'T list -> 'T - - /// Returns the last element for which the given function returns True. - /// Raises KeyNotFoundException if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// Thrown if the predicate evaluates to false for - /// all the elements of the list. - /// - /// The last element that satisfies the predicate. - /// - /// - /// - /// let isEven x = 0 = x % 2 - /// let isGreaterThan x y = y > x - /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] - /// - /// input |> List.findBack (fun (x,_) -> isEven x) // evaluates (4, "Kenobi") - /// input |> List.findBack (fun (x,_) -> x |> isGreaterThan 6) // raises an exception - /// - /// - [] - val findBack: predicate:('T -> bool) -> list:'T list -> 'T - - /// Returns the index of the first element in the list - /// that satisfies the given predicate. - /// Raises KeyNotFoundException if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// Thrown if the predicate evaluates to false for all the - /// elements of the list. - /// - /// The index of the first element that satisfies the predicate. - /// - /// - /// - /// let isEven x = 0 = x % 2 - /// let isGreaterThan x y = y > x - /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] - /// - /// input |> List.findIndex (fun (x,_) -> isEven x) // evaluates 1 - /// input |> List.findIndex (fun (x,_) -> x |> isGreaterThan 6) // raises an exception - /// - /// - [] - val findIndex: predicate:('T -> bool) -> list:'T list -> int - - /// Returns the index of the last element in the list - /// that satisfies the given predicate. - /// Raises KeyNotFoundException if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// Thrown if the predicate evaluates to false for all the - /// elements of the list. - /// - /// The index of the last element that satisfies the predicate. - /// - /// - /// - /// let isEven x = 0 = x % 2 - /// let isGreaterThan x y = y > x - /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] - /// - /// input |> List.findIndexBack (fun (x,_) -> isEven x) // evaluates 3 - /// input |> List.findIndexBack (fun (x,_) -> x |> isGreaterThan 6) // raises an exception - /// - /// - [] - val findIndexBack: predicate:('T -> bool) -> list:'T list -> int - - /// Returns a new collection containing only the elements of the collection - /// for which the given predicate returns "true" - /// - /// The function to test the input elements. - /// The input list. - /// - /// A list containing only the elements that satisfy the predicate. - /// - /// - /// - /// let input = [1, "Luke"; 2, "Kirk"; 3, "Kenobi"; 4, "Spock"] - /// let isComingFromStarTrek (x,_) = isEven x - /// - /// input |> List.filter isComingFromStarTrek - /// - /// Evaluates to [(2, "Kirk"); (4, "Spock")] - /// - [] - val filter: predicate:('T -> bool) -> list:'T list -> 'T list - - /// Applies a function to each element of the collection, threading an accumulator argument - /// through the computation. Take the second argument, and apply the function to it - /// and the first element of the list. Then feed this result into the function along - /// with the second element and so on. Return the final result. - /// If the input function is f and the elements are i0...iN then - /// computes f (... (f s i0) i1 ...) iN. - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The input list. - /// - /// The final state value. - /// - /// Making the sum of squares for the first 5 natural numbers - /// - /// (0, [1..5]) ||> List.fold (fun s v -> s + v * v) // evaluates 55 - /// - /// - /// - /// Shopping for fruits hungry, you tend to take more of each as the hunger grows - /// - /// type Fruit = Apple | Pear | Orange - /// type BagItem = { fruit: Fruit; quantity: int } - /// let takeMore (previous: BagItem list) fruit = - /// let toTakeThisTime = - /// match previous with - /// | bagItem :: otherBagItems -> bagItem.quantity + 1 - /// | [] -> 1 - /// { fruit = fruit; quantity = toTakeThisTime } :: previous - /// let input = [ Apple; Pear; Orange ] - /// - /// ([], input) ||> List.fold takeMore - /// - /// Evaluates to - /// - /// [{ fruit = Orange; quantity = 3 } - /// { fruit = Pear; quantity = 2 } - /// { fruit = Apple; quantity = 1 }] - /// - /// - [] - val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State - - /// Applies a function to corresponding elements of two collections, threading an accumulator argument - /// through the computation. The collections must have identical sizes. - /// If the input function is f and the elements are i0...iN and j0...jN - /// then computes f (... (f s i0 j0)...) iN jN. - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The first input list. - /// The second input list. - /// - /// The final state value. - [] - val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State - - /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN then - /// computes f i0 (...(f iN s)). - /// - /// The function to update the state given the input elements. - /// The input list. - /// The initial state. - /// - /// The state object after the folding function is applied to each element of the list. - /// - /// Making the sum of squares for the first 5 natural numbers - /// - /// ([1..5], 0) ||> List.foldBack (fun v s -> s + v * v) // evaluates 55 - /// - /// - /// - /// Shopping for fruits hungry, you tend to take more of each as the hunger grows - /// - /// type Fruit = Apple | Pear | Orange - /// type BagItem = { fruit: Fruit; quantity: int } - /// let takeMore fruit (previous: BagItem list) = - /// let toTakeThisTime = - /// match previous with - /// | bagItem :: otherBagItems -> bagItem.quantity + 1 - /// | [] -> 1 - /// { fruit = fruit; quantity = toTakeThisTime } :: previous - /// let input = [ Apple; Pear; Orange ] - /// - /// (input, []) ||> List.foldBack takeMore - /// - /// Evaluates to - /// - /// [{ fruit = Apple; quantity = 3 } - /// { fruit = Pear; quantity = 2 } - /// { fruit = Orange; quantity = 1 }] - /// - /// - [] - val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State - - /// Applies a function to corresponding elements of two collections, threading an accumulator argument - /// through the computation. The collections must have identical sizes. - /// If the input function is f and the elements are i0...iN and j0...jN - /// then computes f i0 j0 (...(f iN jN s)). - /// - /// The function to update the state given the input elements. - /// The first input list. - /// The second input list. - /// The initial state. - /// - /// The final state value. - [] - val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> list1:'T1 list -> list2:'T2 list -> state:'State -> 'State - - /// Tests if all elements of the collection satisfy the given predicate. - /// - /// The predicate is applied to the elements of the input list. If any application - /// returns false then the overall result is false and no further elements are tested. - /// Otherwise, true is returned. - /// The function to test the input elements. - /// The input list. - /// - /// True if all of the elements satisfy the predicate. - [] - val forall: predicate:('T -> bool) -> list:'T list -> bool - - /// Tests if all corresponding elements of the collection satisfy the given predicate pairwise. - /// - /// The predicate is applied to matching elements in the two collections up to the lesser of the - /// two lengths of the collections. If any application returns false then the overall result is - /// false and no further elements are tested. Otherwise, if one collection is longer - /// than the other then the exception is raised. - /// Otherwise, true is returned. - /// The function to test the input elements. - /// The first input list. - /// The second input list. - /// - /// Thrown when the input lists differ in length. - /// - /// True if all of the pairs of elements satisfy the predicate. - [] - val forall2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool - - /// Applies a key-generating function to each element of a list and yields a list of - /// unique keys. Each unique key contains a list of all elements that match - /// to this key. - /// - /// A function that transforms an element of the list into a comparable key. - /// The input list. - /// - /// The result list. - [] - val groupBy : projection:('T -> 'Key) -> list:'T list -> ('Key * 'T list) list when 'Key : equality - - /// Returns the first element of the list. - /// - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The first element of the list. - [] - val head: list:'T list -> 'T - - /// Returns a new list whose elements are the corresponding elements - /// of the input list paired with the index (from 0) of each element. - /// - /// The input list. - /// - /// The list of indexed elements. - [] - val indexed: list:'T list -> (int * 'T) list - - /// Creates a list by calling the given generator on each index. - /// - /// The length of the list to generate. - /// The function to generate an element from an index. - /// - /// The list of generated elements. - [] - val init: length:int -> initializer:(int -> 'T) -> 'T list - - /// Returns true if the list contains no elements, false otherwise. - /// - /// The input list. - /// - /// True if the list is empty. - [] - val isEmpty: list:'T list -> bool - - /// Indexes into the list. The first element has index 0. - /// - /// The index to retrieve. - /// The input list. - /// - /// The value at the given index. - /// - /// Thrown when the index is negative or the input list does not contain enough elements. - [] - val item: index:int -> list:'T list -> 'T - - /// Applies the given function to each element of the collection. - /// - /// The function to apply to elements from the input list. - /// The input list. - [] - val inline iter: action:('T -> unit) -> list:'T list -> unit - - /// Applies the given function to two collections simultaneously. The - /// collections must have identical size. - /// - /// The function to apply to pairs of elements from the input lists. - /// The first input list. - /// The second input list. - [] - val iter2: action:('T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit - - /// Applies the given function to each element of the collection. The integer passed to the - /// function indicates the index of element. - /// - /// The function to apply to the elements of the list along with their index. - /// The input list. - [] - val inline iteri: action:(int -> 'T -> unit) -> list:'T list -> unit - - /// Applies the given function to two collections simultaneously. The - /// collections must have identical size. The integer passed to the - /// function indicates the index of element. - /// - /// The function to apply to a pair of elements from the input lists along with their index. - /// The first input list. - /// The second input list. - [] - val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit - - /// Returns the last element of the list. - /// - /// The input list. - /// - /// The last element of the list. - /// - /// Thrown when the input does not have any elements. - [] - val last: list:'T list -> 'T - - /// Returns the length of the list. - /// - /// The input list. - /// - /// The length of the list. - [] - val length: list:'T list -> int - - /// Returns the last element of the list. - /// Return None if no such element exists. - /// - /// The input list. - /// - /// The last element of the list or None. - [] - val tryLast: list:'T list -> 'T option - - /// Builds a new collection whose elements are the results of applying the given function - /// to each of the elements of the collection. - /// - /// The function to transform elements from the input list. - /// The input list. - /// - /// The list of transformed elements. - [] - val map: mapping:('T -> 'U) -> list:'T list -> 'U list - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding elements of the two collections pairwise. - /// - /// The function to transform pairs of elements from the input lists. - /// The first input list. - /// The second input list. - /// - /// The list of transformed elements. - [] - val map2: mapping:('T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding elements of the three collections simultaneously. - /// - /// The function to transform triples of elements from the input lists. - /// The first input list. - /// The second input list. - /// The third input list. - /// - /// The list of transformed elements. - [] - val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> 'U list - - /// Combines map and fold. Builds a new list whose elements are the results of applying the given function - /// to each of the elements of the input list. The function is also used to accumulate a final value. - /// - /// The function to transform elements from the input list and accumulate the final value. - /// The initial state. - /// The input list. - /// - /// The list of transformed elements, and the final accumulated value. - [] - val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> list:'T list -> 'Result list * 'State - - /// Combines map and foldBack. Builds a new list whose elements are the results of applying the given function - /// to each of the elements of the input list. The function is also used to accumulate a final value. - /// - /// The function to transform elements from the input list and accumulate the final value. - /// The input list. - /// The initial state. - /// - /// The list of transformed elements, and the final accumulated value. - [] - val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> list:'T list -> state:'State -> 'Result list * 'State - - /// Builds 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 (from 0) of element being transformed. - /// - /// The function to transform elements and their indices. - /// The input list. - /// - /// The list of transformed elements. - [] - val mapi: mapping:(int -> 'T -> 'U) -> list:'T list -> 'U list - - /// Like mapi, but mapping corresponding elements from two lists of equal length. - /// - /// The function to transform pairs of elements from the two lists and their index. - /// The first input list. - /// The second input list. - /// - /// The list of transformed elements. - [] - val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list - - /// Return the greatest of all elements of the list, compared via Operators.max. - /// - /// Raises if list is empty - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The maximum element. - [] - val inline max : list:'T list -> 'T when 'T : comparison - - /// Returns the greatest of all elements of the list, compared via Operators.max on the function result. - /// - /// Raises if list is empty. - /// The function to transform the list elements into the type to be compared. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The maximum element. - [] - val inline maxBy : projection:('T -> 'U) -> list:'T list -> 'T when 'U : comparison - - /// Returns the lowest of all elements of the list, compared via Operators.min. - /// - /// Raises if list is empty - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The minimum value. - [] - val inline min : list:'T list -> 'T when 'T : comparison - - /// Returns the lowest of all elements of the list, compared via Operators.min on the function result - /// - /// Raises if list is empty. - /// The function to transform list elements into the type to be compared. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The minimum value. - [] - val inline minBy : projection:('T -> 'U) -> list:'T list -> 'T when 'U : comparison - - /// Indexes into the list. The first element has index 0. - /// - /// The input list. - /// The index to retrieve. - /// - /// The value at the given index. - /// - /// Thrown when the index is negative or the input list does not contain enough elements. - [] - [] - val nth: list:'T list -> index:int -> 'T - - /// Builds a list from the given array. - /// - /// The input array. - /// - /// The list of elements from the array. - [] - val ofArray : array:'T[] -> 'T list - - /// Builds a new list from the given enumerable object. - /// - /// The input sequence. - /// - /// The list of elements from the sequence. - [] - val ofSeq: source:seq<'T> -> 'T list - - /// Returns a list of each element in the input list and its predecessor, with the - /// exception of the first element which is only returned as the predecessor of the second element. - /// - /// The input list. - /// - /// The result list. - [] - val pairwise: list:'T list -> ('T * 'T) list - - /// Splits the collection into two collections, containing the - /// elements for which the given predicate returns True and False - /// respectively. Element order is preserved in both of the created lists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// A list containing the elements for which the predicate evaluated to false and a list - /// containing the elements for which the predicate evaluated to true. - [] - val partition: predicate:('T -> bool) -> list:'T list -> ('T list * 'T list) - - /// Applies the given function to successive elements, returning the first - /// result where function returns Some(x) for some x. If no such - /// element exists then raise - /// - /// The function to generate options from the elements. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The first resulting value. - [] - val pick: chooser:('T -> 'U option) -> list:'T list -> 'U - - /// Returns a list with all elements permuted according to the - /// specified permutation. - /// - /// The function to map input indices to output indices. - /// The input list. - /// - /// The permuted list. - /// - /// Thrown when indexMap does not produce a valid permutation. - [] - val permute : indexMap:(int -> int) -> list:'T list -> 'T list - - /// Apply a function to each element of the collection, threading an accumulator argument - /// through the computation. Apply the function to the first two elements of the list. - /// Then feed this result into the function along with the third element and so on. - /// Return the final result. If the input function is f and the elements are i0...iN then computes - /// f (... (f i0 i1) i2 ...) iN. - /// - /// Raises if list is empty - /// - /// The function to reduce two list elements to a single element. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The final reduced value. - [] - val reduce: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T - - /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN then computes - /// f i0 (...(f iN-1 iN)). - /// - /// A function that takes in the next-to-last element of the list and the - /// current accumulated result to produce the next accumulated result. - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The final result of the reductions. - [] - val reduceBack: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T - - /// Creates a list by replicating the given initial value. - /// - /// The number of elements to replicate. - /// The value to replicate - /// - /// The generated list. - [] - val replicate: count:int -> initial:'T -> 'T list - - /// Returns a new list with the elements in reverse order. - /// - /// The input list. - /// - /// The reversed list. - [] - val rev: list:'T list -> 'T list - - /// Applies a function to each element of the collection, threading an accumulator argument - /// through the computation. Take the second argument, and apply the function to it - /// and the first element of the list. Then feed this result into the function along - /// with the second element and so on. Returns the list of intermediate results and the final result. - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The input list. - /// - /// The list of states. - [] - val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State list - - /// Like foldBack, but returns both the intermediary and final results - /// - /// The function to update the state given the input elements. - /// The input list. - /// The initial state. - /// - /// The list of states. - [] - val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State list - - /// Returns a list that contains one item only. - /// - /// The input item. - /// - /// The result list of one item. - [] - val inline singleton: value:'T -> 'T list - - /// Returns the list after removing the first N elements. - /// - /// The number of elements to skip. If the number is 0 or negative the input list is returned. - /// The input list. - /// - /// The list after removing the first N elements. - /// - /// Thrown when count exceeds the number of - /// elements in the list. - [] - val skip: count:int -> list: 'T list -> 'T list - - /// Bypasses elements in a list while the given predicate returns True, and then returns - /// the remaining elements of the list. - /// - /// A function that evaluates an element of the list to a boolean value. - /// The input list. - /// - /// The result list. - [] - val skipWhile: predicate:('T -> bool) -> list:'T list -> 'T list - - /// Sorts the given list using the given comparison function. - /// - /// This is a stable sort, i.e. the original order of equal elements is preserved. - /// The function to compare the list elements. - /// The input list. - /// - /// The sorted list. - [] - val sortWith: comparer:('T -> 'T -> int) -> list:'T list -> 'T list - - /// Sorts the given list using keys given by the given projection. Keys are compared using . - /// - /// This is a stable sort, i.e. the original order of equal elements is preserved. - /// The function to transform the list elements into the type to be compared. - /// The input list. - /// - /// The sorted list. - [] - val sortBy: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison - - /// Sorts the given list using . - /// - /// This is a stable sort, i.e. the original order of equal elements is preserved. - /// The input list. - /// - /// The sorted list. - [] - val sort: list:'T list -> 'T list when 'T : comparison - - /// Splits a list into two lists, at the given index. - /// - /// The index at which the list is split. - /// The input list. - /// - /// The two split lists. - /// - /// Thrown when split index exceeds the number of elements - /// in the list. - [] - val splitAt: index:int -> list:'T list -> ('T list * 'T list) - - /// Sorts the given list in descending order using keys given by the given projection. Keys are compared using . - /// - /// This is a stable sort, i.e. the original order of equal elements is preserved. - /// The function to transform the list elements into the type to be compared. - /// The input list. - /// - /// The sorted list. - [] - val inline sortByDescending: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison - - /// Sorts the given list in descending order using . - /// - /// This is a stable sort, i.e. the original order of equal elements is preserved. - /// The input list. - /// - /// The sorted list. - [] - val inline sortDescending: list:'T list -> 'T list when 'T : comparison - - /// Returns the sum of the elements in the list. - /// - /// The input list. - /// - /// The resulting sum. - [] - val inline sum : list:^T list -> ^T - when ^T : (static member (+) : ^T * ^T -> ^T) - and ^T : (static member Zero : ^T) - - /// Returns the sum of the results generated by applying the function to each element of the list. - /// - /// The function to transform the list elements into the type to be summed. - /// The input list. - /// - /// The resulting sum. - [] - val inline sumBy : projection:('T -> ^U) -> list:'T list -> ^U - when ^U : (static member (+) : ^U * ^U -> ^U) - and ^U : (static member Zero : ^U) - - /// Returns the list after removing the first element. - /// - /// The input list. - /// - /// Thrown when the list is empty. - /// - /// The list after removing the first element. - [] - val tail: list:'T list -> 'T list - - /// Returns the first N elements of the list. - /// Throws InvalidOperationException - /// if the count exceeds the number of elements in the list. List.truncate - /// returns as many items as the list contains instead of throwing an exception. - /// - /// The number of items to take. - /// The input list. - /// - /// The result list. - /// - /// Thrown when the input list is empty. - /// Thrown when count exceeds the number of elements - /// in the list. - [] - val take: count:int -> list:'T list -> 'T list - - /// Returns a list that contains all elements of the original list while the - /// given predicate returns True, and then returns no further elements. - /// - /// A function that evaluates to false when no more items should be returned. - /// The input list. - /// - /// The result list. - [] - val takeWhile: predicate:('T -> bool) -> list:'T list -> 'T list - - /// Builds an array from the given list. - /// - /// The input list. - /// - /// The array containing the elements of the list. - [] - val toArray: list:'T list -> 'T[] - - /// Views the given list as a sequence. - /// - /// The input list. - /// - /// The sequence of elements in the list. - [] - val toSeq: list:'T list -> seq<'T> - - /// Returns the first element of the list, or - /// None if the list is empty. - /// - /// The input list. - /// - /// The first element of the list or None. - [] - val tryHead: list:'T list -> 'T option - - /// Returns the transpose of the given sequence of lists. - /// - /// The input sequence of list. - /// - /// The transposed list. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input lists differ in length. - [] - val transpose: lists:seq<'T list> -> 'T list list - - /// Returns at most N elements in a new list. - /// - /// The maximum number of items to return. - /// The input list. - /// - /// The result list. - [] - val truncate: count:int -> list:'T list -> 'T list - - /// Applies the given function to successive elements, returning Some(x) the first - /// result where function returns Some(x) for some x. If no such element - /// exists then return None. - /// - /// The function to generate options from the elements. - /// The input list. - /// - /// The first resulting value or None. - [] - val tryPick: chooser:('T -> 'U option) -> list:'T list -> 'U option - - /// Returns the first element for which the given function returns True. - /// Return None if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// The first element for which the predicate returns true, or None if - /// every element evaluates to false. - [] - val tryFind: predicate:('T -> bool) -> list:'T list -> 'T option - - /// Returns the last element for which the given function returns True. - /// Return None if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// The last element for which the predicate returns true, or None if - /// every element evaluates to false. - [] - val tryFindBack: predicate:('T -> bool) -> list:'T list -> 'T option - - /// Returns the index of the first element in the list - /// that satisfies the given predicate. - /// Return None if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// The index of the first element for which the predicate returns true, or None if - /// every element evaluates to false. - [] - val tryFindIndex: predicate:('T -> bool) -> list:'T list -> int option - - /// Tries to find the nth element in the list. - /// Returns None if index is negative or the list does not contain enough elements. - /// - /// The index to retrieve. - /// The input list. - /// - /// The value at the given index or None. - [] - val tryItem: index:int -> list:'T list -> 'T option - - /// Returns the index of the last element in the list - /// that satisfies the given predicate. - /// Return None if no such element exists. - /// - /// The function to test the input elements. - /// The input list. - /// - /// The index of the last element for which the predicate returns true, or None if - /// every element evaluates to false. - [] - val tryFindIndexBack: predicate:('T -> bool) -> list:'T list -> int option - - /// Returns a list that contains the elements generated by the given computation. - /// The given initial state argument is passed to the element generator. - /// - /// A function that takes in the current state and returns an option tuple of the next - /// element of the list and the next state value. - /// The initial state value. - /// - /// The result list. - [] - val unfold<'T,'State> : generator:('State -> ('T * 'State) option) -> state:'State -> 'T list - - /// Splits a list of pairs into two lists. - /// - /// The input list. - /// - /// Two lists of split elements. - [] - val unzip: list:('T1 * 'T2) list -> ('T1 list * 'T2 list) - - /// Splits a list of triples into three lists. - /// - /// The input list. - /// - /// Three lists of split elements. - [] - val unzip3: list:('T1 * 'T2 * 'T3) list -> ('T1 list * 'T2 list * 'T3 list) - - /// Returns a new list containing only the elements of the list - /// for which the given predicate returns "true" - /// - /// The function to test the input elements. - /// The input list. - /// - /// A list containing only the elements that satisfy the predicate. - [] - val where: predicate:('T -> bool) -> list:'T list -> 'T list - - /// Returns a list of sliding windows containing elements drawn from the input - /// list. Each window is returned as a fresh list. - /// - /// The number of elements in each window. - /// The input list. - /// - /// The result list. - /// - /// Thrown when windowSize is not positive. - [] - val windowed : windowSize:int -> list:'T list -> 'T list list - - /// Combines the two lists into a list of pairs. The two lists must have equal lengths. - /// - /// The first input list. - /// The second input list. - /// - /// A single list containing pairs of matching elements from the input lists. - [] - val zip: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list - - /// Combines the three lists into a list of triples. The lists must have equal lengths. - /// - /// The first input list. - /// The second input list. - /// The third input list. - /// - /// A single list containing triples of matching elements from the input lists. - [] - val zip3: list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> ('T1 * 'T2 * 'T3) list - - /// Return a new list with the item at a given index removed. - /// - /// The index of the item to be removed. - /// The input list. - /// - /// - /// - /// [ 0; 1; 2 ] |> List.removeAt 1 // evaluates to [ 0; 2 ] - /// - /// - /// - /// The result list. - /// - /// Thrown when index is outside 0..source.Length - 1 - [] - val removeAt: index: int -> source: 'T list -> 'T list - - /// Return a new list with the number of items starting at a given index removed. - /// - /// The index of the item to be removed. - /// The number of items to remove. - /// The input list. - /// - /// - /// - /// [ 0; 1; 2; 3 ] |> List.removeManyAt 1 2 // evaluates to [ 0; 3 ] - /// - /// - /// - /// The result list. - /// - /// Thrown when index is outside 0..source.Length - count - [] - val removeManyAt: index: int -> count: int -> source: 'T list -> 'T list +open System +open System.Collections.Generic +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections + +/// Contains operations for working with values of type . +/// +/// Operations for collections such as lists, arrays, sets, maps and sequences. See also +/// F# Collection Types in the F# Language Guide. +/// +[] +[] +module List = + + /// Returns a new list that contains all pairings of elements from the first and second lists. + /// + /// The first input list. + /// The second input list. + /// + /// The resulting list of pairs. + /// + /// + /// + /// let people = ["Kirk"; "Spock"; "McCoy"] + /// let numbers = [1;2] + /// people |> List.allPairs numbers + /// + /// The sample evaluates to + /// + /// [(1, "Kirk"); (1, "Spock"); (1, "McCoy"); (2, "Kirk"); (2, "Spock"); (2, "McCoy")] + /// + /// + [] + val allPairs: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list + + /// Returns a new list that contains the elements of the first list + /// followed by elements of the second. + /// + /// The first input list. + /// The second input list. + /// + /// The resulting list. + /// + /// + /// + /// List.append [1..3] [4..7] // evaluates [1; 2; 3; 4; 5; 6; 7] + /// + /// [4..7] |> List.append [1..3] // evaluates [1; 2; 3; 4; 5; 6; 7] + /// + /// + [] + val append: list1: 'T list -> list2: 'T list -> 'T list + + /// Returns the average of the elements in the list. + /// + /// Raises if list is empty. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The resulting average. + /// + /// + /// + /// [1.0 .. 9.0] |> List.average // evaluates 5.0 + /// + /// + /// + /// + /// + /// [1 .. 9] |> List.average + /// + /// The sample does not compile because The type 'int' does not support the operator 'DivideByInt' + /// (see averageBy examples for a solution) + /// + [] + val inline average : list:^T list -> ^T + when ^T : (static member (+) : ^T * ^T -> ^T) + and ^T : (static member DivideByInt : ^T*int -> ^T) + and ^T : (static member Zero : ^T) + + /// Returns the average of the elements generated by applying the function to each element of the list. + /// + /// Raises if list is empty. + /// The function to transform the list elements into the type to be averaged. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The resulting average. + /// + /// Average the age of persons by extracting the age from records + /// + /// type People = { + /// name: string + /// age: int } + /// let getAgeAsFloat person = float person.age + /// let people = + /// [ { name = "Kirk"; age = 26 } + /// { name = "Spock"; age = 90 } + /// { name = "McCoy"; age = 37 } ] + /// people |> List.averageBy getAgeAsFloat // evaluates 51.0 + /// + /// + /// + /// Average a list of integer numbers by converting to float + /// + /// [1 .. 9] |> List.averageBy float // evaluates 5.0 + /// + /// + [] + val inline averageBy: projection:('T -> ^U) -> list:'T list -> ^U + when ^U : (static member (+) : ^U * ^U -> ^U) + and ^U : (static member DivideByInt : ^U*int -> ^U) + and ^U : (static member Zero : ^U) + + /// Applies the given function to each element of the list. Returns + /// the list comprised of the results x for each element where + /// the function returns Some(x) + /// + /// The function to generate options from the elements. + /// The input list. + /// + /// The list comprising the values selected from the chooser function. + /// + /// + /// + /// type Happiness = AlwaysHappy | MostOfTheTimeGrumpy + /// type People = { + /// name: string + /// happiness: Happiness } + /// let takeJustHappyPersons person = + /// match person.happiness with + /// | AlwaysHappy -> Some person.name + /// | MostOfTheTimeGrumpy -> None + /// let candidatesForTheTrip = + /// [ { name = "SpongeBob"; happiness = AlwaysHappy } + /// { name = "Patrick"; happiness = AlwaysHappy } + /// { name = "Squidward"; happiness = MostOfTheTimeGrumpy } ] + /// candidatesForTheTrip |> List.choose takeJustHappyPersons + /// + /// The sample evaluates to [ "SpongeBob"; "Patrick" ] + /// + /// + /// + /// + /// // Using the identity function "id" (is defined like fun x -> x) + /// let input1 = [ Some 1; None; Some 3; None ] + /// input1 |> List.choose id // evaluates [1; 3] + /// + /// let input2: int option list = [] + /// input2 |> List.choose id // evaluates [] (notice that has the type "int list") + /// + /// let input3: string option list =[ None; None ] + /// input3 |> List.choose id // evaluates [] (notice that has the type "string list") + /// + /// + [] + val choose: chooser:('T -> 'U option) -> list:'T list -> 'U list + + /// Divides the input list into chunks of size at most chunkSize. + /// + /// The maximum size of each chunk. + /// The input list. + /// + /// The list divided into chunks. + /// + /// Thrown when chunkSize is not positive. + /// + /// + /// + /// [1 .. 10 ] |> List.chunkBySize 3 // evaluates + /// + /// Evaluates to [[1; 2; 3]; [4; 5; 6]; [7; 8; 9]; [10]] . Please notice the last chunk. + /// + /// + /// let output2 = [1 .. 5 ] |> List.chunkBySize 10 + /// + /// Evaluates to [[1; 2; 3; 4; 5]] + /// + /// + /// let input : string list = [] + /// let output3 = input |> List.chunkBySize 10 + /// + /// Evaluates to []. Please notice that has the type string list list. + /// + [] + val chunkBySize: chunkSize:int -> list:'T list -> 'T list list + + /// For each element of the list, applies the given function. Concatenates all the results and return the combined list. + /// + /// The function to transform each input element into a sublist to be concatenated. + /// The input list. + /// + /// The concatenation of the transformed sublists. + /// + /// For each positive number in the array we are generating all the previous positive numbers + /// + /// [1..4] |> List.collect (fun x -> [1..x]) + /// + /// The sample evaluates to [1; 1; 2; 1; 2; 3; 1; 2; 3; 4] (added extra spaces for easy reading) + /// + [] + val collect: mapping:('T -> 'U list) -> list:'T list -> 'U list + + /// Compares two lists using the given comparison function, element by element. + /// + /// A function that takes an element from each list and returns an int. + /// If it evaluates to a non-zero value iteration is stopped and that value is returned. + /// The first input list. + /// The second input list. + /// + /// Returns the first non-zero result from the comparison function. If the first list has a + /// larger element, the return value is always positive. If the second list has a larger + /// element, the return value is always negative. When the elements are equal in the two + /// lists, 1 is returned if the first list is longer, 0 is returned if they are equal in + /// length, and -1 is returned when the second list is longer. + /// + /// + [] + val inline compareWith: comparer:('T -> 'T -> int) -> list1:'T list -> list2:'T list -> int + + /// Returns a new list that contains the elements of each the lists in order. + /// + /// The input sequence of lists. + /// + /// The resulting concatenated list. + /// + /// + /// + /// let input = [ [1;2] + /// [3;4;5] + /// [6;7;8;9] ] + /// input |> List.concat // evaluates [1; 2; 3; 4; 5; 6; 7; 8; 9] + /// + /// + [] + val concat: lists:seq<'T list> -> 'T list - /// Return a new list with the item at a given index set to the new value. - /// - /// The index of the item to be replaced. - /// The new value. - /// The input list. - /// - /// - /// - /// [ 0; 1; 2 ] |> List.updateAt 1 9 // evaluates to [ 0; 9; 2 ] - /// - /// - /// - /// The result list. - /// - /// Thrown when index is outside 0..source.Length - 1 - [] - val updateAt: index: int -> value: 'T -> source: 'T list -> 'T list + /// Tests if the list contains the specified element. + /// + /// The value to locate in the input list. + /// The input list. + /// + /// True if the input list contains the specified element; false otherwise. + /// + /// + /// + /// [1..9] |> List.contains 0 // evaluates false + /// + /// [1..9] |> List.contains 3 // evaluates true + /// + /// let input = [1, "SpongeBob"; 2, "Patrick"; 3, "Squidward"; 4, "Mr. Krabs"] + /// input |> List.contains (2, "Patrick") // evaluates true + /// input |> List.contains (22, "Patrick") // evaluates false + /// + /// + [] + val inline contains: value:'T -> source:'T list -> bool when 'T : equality + + /// Returns a list that contains no duplicate entries according to generic hash and + /// equality comparisons on the entries. + /// If an element occurs multiple times in the list then the later occurrences are discarded. + /// + /// The input list. + /// + /// The result list. + /// + /// + /// + /// let input = [6;1;2;3;1;4;5;5] + /// input |> List.distinct // evaluates [6; 1; 2; 3; 4; 5] + /// + /// + [] + val distinct: list:'T list -> 'T list when 'T : equality + + /// Returns a list that contains no duplicate entries according to the + /// generic hash and equality comparisons on the keys returned by the given key-generating function. + /// If an element occurs multiple times in the list then the later occurrences are discarded. + /// + /// A function transforming the list items into comparable keys. + /// The input list. + /// + /// The result list. + /// + /// + /// + /// let isEven x = 0 = x % 2 + /// let input = [6;1;2;3;1;4;5;5] + /// input |> List.distinctBy isEven // evaluates [6; 1] + /// + /// + [] + val distinctBy: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : equality + + /// Applies a key-generating function to each element of a list and returns a list yielding unique + /// keys and their number of occurrences in the original list. + /// + /// A function transforming each item of the input list into a key to be + /// compared against the others. + /// The input list. + /// + /// The result list. + /// + /// Counting the number of occurrences of chars + /// + /// let input = ['H'; 'a'; 'p'; 'p'; 'i'; 'n'; 'e'; 's'; 's'] + /// input |> List.countBy id + /// + /// Evalutes [('H', 1); ('a', 1); ('p', 2); ('i', 1); ('n', 1); ('e', 1); ('s', 2)] + /// + [] + val countBy : projection:('T -> 'Key) -> list:'T list -> ('Key * int) list when 'Key : equality + + /// Splits the input list into at most count chunks. + /// + /// The maximum number of chunks. + /// The input list. + /// + /// The list split into chunks. + /// + /// Thrown when count is not positive. + /// + /// + /// + /// [1..10] |> List.splitInto 2 // evaluates [[1; 2; 3; 4; 5]; [6; 7; 8; 9; 10]] + /// [1..10] |> List.splitInto 4 // evaluates [[1; 2; 3]; [4; 5; 6]; [7; 8]; [9; 10]] + /// + /// + [] + val splitInto: count:int -> list:'T list -> 'T list list + + /// Returns an empty list of the given type. + [] + [] + val empty<'T> : 'T list + + /// Returns a new list with the distinct elements of the input list which do not appear in the itemsToExclude sequence, + /// using generic hash and equality comparisons to compare values. + /// + /// A sequence whose elements that also occur in the input list will cause those elements to be + /// removed from the result. + /// A list whose elements that are not also in itemsToExclude will be returned. + /// + /// A list that contains the distinct elements of list that do not appear in itemsToExclude. + /// + /// Thrown when itemsToExclude is null. + /// + /// + /// + /// let input = [1, "Kirk"; 2, "Spock"; 3, "Kenobi"] + /// input |> List.except [3, "Kenobi"] // evaluates [(1, "Kirk"); (2, "Spock")] + /// + /// + /// + /// + /// + /// [0..10] |> List.except [1..5] // evaluates [0; 6; 7; 8; 9; 10] + /// [1..5] |> List.except [0..10] // evaluates [] + /// + /// + [] + val except: itemsToExclude:seq<'T> -> list:'T list -> 'T list when 'T : equality + + /// Returns the only element of the list. + /// + /// The input list. + /// + /// The only element of the list. + /// + /// Thrown when the input does not have precisely one element. + /// + /// + /// + /// ["the chosen one"] |> List.exactlyOne // evaluates "the chosen one" + /// + /// + /// + /// + /// + /// let input : string list = [] + /// input |> List.exactlyOne + /// + /// Will throw the exception: System.ArgumentException: The input sequence was empty + /// + /// + /// + /// + /// [1..5] |> List.exactlyOne + /// + /// Will throw the exception: System.ArgumentException: The input sequence contains more than one element + /// + [] + val exactlyOne: list:'T list -> 'T + + /// Returns the only element of the list or None if it is empty or contains more than one element. + /// + /// The input list. + /// + /// The only element of the list or None. + /// + /// + /// + /// [1] |> List.tryExactlyOne // evaluates Some 1 + /// [1;2] |> List.tryExactlyOne // evaluates None + /// ([] : int list) |> List.tryExactlyOne // evaluates None + /// + /// + [] + val tryExactlyOne: list:'T list -> 'T option + + /// Tests if any element of the list satisfies the given predicate. + /// + /// The predicate is applied to the elements of the input list. If any application + /// returns true then the overall result is true and no further elements are tested. + /// Otherwise, false is returned. + /// The function to test the input elements. + /// The input list. + /// + /// True if any element satisfies the predicate. + /// + /// + /// + /// let input = [1, "Kirk"; 2, "Spock"; 3, "Kenobi"] + /// + /// input |> List.exists (fun x -> x = (3, "Kenobi")) // evaluates true + /// + /// input |> List.exists (fun (n, name) -> n > 5) // evaluates false + /// + /// + [] + val exists: predicate:('T -> bool) -> list:'T list -> bool + + /// Tests if any pair of corresponding elements of the lists satisfies the given predicate. + /// + /// The predicate is applied to matching elements in the two collections up to the lesser of the + /// two lengths of the collections. If any application returns true then the overall result is + /// true and no further elements are tested. Otherwise, if one collections is longer + /// than the other then the exception is raised. + /// Otherwise, false is returned. + /// + /// The function to test the input elements. + /// The first input list. + /// The second input list. + /// + /// Thrown when the input lists differ in length. + /// + /// True if any pair of elements satisfy the predicate. + /// + /// Check if the sum of pairs (from 2 different lists) have at least one even number + /// + /// let anEvenSum a b = 0 = (a + b) % 2 + /// + /// ([1..4], [2..5]) + /// ||> List.exists2 anEvenSum // evaluates false + /// + /// ([1..4], [2;4;5;6]) + /// ||> List.exists2 anEvenSum // evaluates true + /// + /// + [] + val exists2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool + + /// Returns the first element for which the given function returns True. + /// Raises KeyNotFoundException if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// Thrown if the predicate evaluates to false for + /// all the elements of the list. + /// + /// The first element that satisfies the predicate. + /// + /// + /// + /// let isEven x = 0 = x % 2 + /// let isGreaterThan x y = y > x + /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] + /// + /// input |> List.find (fun (x,_) -> isEven x) // evaluates (2, "Kirk") + /// input |> List.find (fun (x,_) -> x |> isGreaterThan 6) // raises an exception + /// + /// + [] + val find: predicate:('T -> bool) -> list:'T list -> 'T + + /// Returns the last element for which the given function returns True. + /// Raises KeyNotFoundException if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// Thrown if the predicate evaluates to false for + /// all the elements of the list. + /// + /// The last element that satisfies the predicate. + /// + /// + /// + /// let isEven x = 0 = x % 2 + /// let isGreaterThan x y = y > x + /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] + /// + /// input |> List.findBack (fun (x,_) -> isEven x) // evaluates (4, "Kenobi") + /// input |> List.findBack (fun (x,_) -> x |> isGreaterThan 6) // raises an exception + /// + /// + [] + val findBack: predicate:('T -> bool) -> list:'T list -> 'T + + /// Returns the index of the first element in the list + /// that satisfies the given predicate. + /// Raises KeyNotFoundException if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// Thrown if the predicate evaluates to false for all the + /// elements of the list. + /// + /// The index of the first element that satisfies the predicate. + /// + /// + /// + /// let isEven x = 0 = x % 2 + /// let isGreaterThan x y = y > x + /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] + /// + /// input |> List.findIndex (fun (x,_) -> isEven x) // evaluates 1 + /// input |> List.findIndex (fun (x,_) -> x |> isGreaterThan 6) // raises an exception + /// + /// + [] + val findIndex: predicate:('T -> bool) -> list:'T list -> int + + /// Returns the index of the last element in the list + /// that satisfies the given predicate. + /// Raises KeyNotFoundException if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// Thrown if the predicate evaluates to false for all the + /// elements of the list. + /// + /// The index of the last element that satisfies the predicate. + /// + /// + /// + /// let isEven x = 0 = x % 2 + /// let isGreaterThan x y = y > x + /// let input = [1, "Luke"; 2, "Kirk"; 3, "Spock"; 4, "Kenobi"] + /// + /// input |> List.findIndexBack (fun (x,_) -> isEven x) // evaluates 3 + /// input |> List.findIndexBack (fun (x,_) -> x |> isGreaterThan 6) // raises an exception + /// + /// + [] + val findIndexBack: predicate:('T -> bool) -> list:'T list -> int + + /// Returns a new collection containing only the elements of the collection + /// for which the given predicate returns "true" + /// + /// The function to test the input elements. + /// The input list. + /// + /// A list containing only the elements that satisfy the predicate. + /// + /// + /// + /// let input = [1, "Luke"; 2, "Kirk"; 3, "Kenobi"; 4, "Spock"] + /// let isComingFromStarTrek (x,_) = isEven x + /// + /// input |> List.filter isComingFromStarTrek + /// + /// Evaluates to [(2, "Kirk"); (4, "Spock")] + /// + [] + val filter: predicate:('T -> bool) -> list:'T list -> 'T list + + /// Applies a function to each element of the collection, threading an accumulator argument + /// through the computation. Take the second argument, and apply the function to it + /// and the first element of the list. Then feed this result into the function along + /// with the second element and so on. Return the final result. + /// If the input function is f and the elements are i0...iN then + /// computes f (... (f s i0) i1 ...) iN. + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The input list. + /// + /// The final state value. + /// + /// Making the sum of squares for the first 5 natural numbers + /// + /// (0, [1..5]) ||> List.fold (fun s v -> s + v * v) // evaluates 55 + /// + /// + /// + /// Shopping for fruits hungry, you tend to take more of each as the hunger grows + /// + /// type Fruit = Apple | Pear | Orange + /// type BagItem = { fruit: Fruit; quantity: int } + /// let takeMore (previous: BagItem list) fruit = + /// let toTakeThisTime = + /// match previous with + /// | bagItem :: otherBagItems -> bagItem.quantity + 1 + /// | [] -> 1 + /// { fruit = fruit; quantity = toTakeThisTime } :: previous + /// let input = [ Apple; Pear; Orange ] + /// + /// ([], input) ||> List.fold takeMore + /// + /// Evaluates to + /// + /// [{ fruit = Orange; quantity = 3 } + /// { fruit = Pear; quantity = 2 } + /// { fruit = Apple; quantity = 1 }] + /// + /// + [] + val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State + + /// Applies a function to corresponding elements of two collections, threading an accumulator argument + /// through the computation. The collections must have identical sizes. + /// If the input function is f and the elements are i0...iN and j0...jN + /// then computes f (... (f s i0 j0)...) iN jN. + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The first input list. + /// The second input list. + /// + /// The final state value. + /// + /// + [] + val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State + + /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN then + /// computes f i0 (...(f iN s)). + /// + /// The function to update the state given the input elements. + /// The input list. + /// The initial state. + /// + /// The state object after the folding function is applied to each element of the list. + /// + /// Making the sum of squares for the first 5 natural numbers + /// + /// ([1..5], 0) ||> List.foldBack (fun v s -> s + v * v) // evaluates 55 + /// + /// + /// + /// Shopping for fruits hungry, you tend to take more of each as the hunger grows + /// + /// type Fruit = Apple | Pear | Orange + /// type BagItem = { fruit: Fruit; quantity: int } + /// let takeMore fruit (previous: BagItem list) = + /// let toTakeThisTime = + /// match previous with + /// | bagItem :: otherBagItems -> bagItem.quantity + 1 + /// | [] -> 1 + /// { fruit = fruit; quantity = toTakeThisTime } :: previous + /// let input = [ Apple; Pear; Orange ] + /// + /// (input, []) ||> List.foldBack takeMore + /// + /// Evaluates to + /// + /// [{ fruit = Apple; quantity = 3 } + /// { fruit = Pear; quantity = 2 } + /// { fruit = Orange; quantity = 1 }] + /// + /// + [] + val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State + + /// Applies a function to corresponding elements of two collections, threading an accumulator argument + /// through the computation. The collections must have identical sizes. + /// If the input function is f and the elements are i0...iN and j0...jN + /// then computes f i0 j0 (...(f iN jN s)). + /// + /// The function to update the state given the input elements. + /// The first input list. + /// The second input list. + /// The initial state. + /// + /// The final state value. + /// + /// + [] + val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> list1:'T1 list -> list2:'T2 list -> state:'State -> 'State + + /// Tests if all elements of the collection satisfy the given predicate. + /// + /// The predicate is applied to the elements of the input list. If any application + /// returns false then the overall result is false and no further elements are tested. + /// Otherwise, true is returned. + /// The function to test the input elements. + /// The input list. + /// + /// True if all of the elements satisfy the predicate. + /// + /// + [] + val forall: predicate:('T -> bool) -> list:'T list -> bool + + /// Tests if all corresponding elements of the collection satisfy the given predicate pairwise. + /// + /// The predicate is applied to matching elements in the two collections up to the lesser of the + /// two lengths of the collections. If any application returns false then the overall result is + /// false and no further elements are tested. Otherwise, if one collection is longer + /// than the other then the exception is raised. + /// Otherwise, true is returned. + /// The function to test the input elements. + /// The first input list. + /// The second input list. + /// + /// Thrown when the input lists differ in length. + /// + /// True if all of the pairs of elements satisfy the predicate. + /// + /// + [] + val forall2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool + + /// Applies a key-generating function to each element of a list and yields a list of + /// unique keys. Each unique key contains a list of all elements that match + /// to this key. + /// + /// A function that transforms an element of the list into a comparable key. + /// The input list. + /// + /// The result list. + /// + /// + [] + val groupBy : projection:('T -> 'Key) -> list:'T list -> ('Key * 'T list) list when 'Key : equality + + /// Returns the first element of the list. + /// + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The first element of the list. + [] + val head: list:'T list -> 'T + + /// Returns a new list whose elements are the corresponding elements + /// of the input list paired with the index (from 0) of each element. + /// + /// The input list. + /// + /// The list of indexed elements. + /// + /// + [] + val indexed: list:'T list -> (int * 'T) list + + /// Creates a list by calling the given generator on each index. + /// + /// The length of the list to generate. + /// The function to generate an element from an index. + /// + /// The list of generated elements. + /// + /// + [] + val init: length:int -> initializer:(int -> 'T) -> 'T list + + /// Returns true if the list contains no elements, false otherwise. + /// + /// The input list. + /// + /// True if the list is empty. + /// + /// + [] + val isEmpty: list:'T list -> bool + + /// Indexes into the list. The first element has index 0. + /// + /// The index to retrieve. + /// The input list. + /// + /// The value at the given index. + /// + /// Thrown when the index is negative or the input list does not contain enough elements. + /// + /// + [] + val item: index:int -> list:'T list -> 'T + + /// Applies the given function to each element of the collection. + /// + /// The function to apply to elements from the input list. + /// The input list. + /// + /// + [] + val inline iter: action:('T -> unit) -> list:'T list -> unit + + /// Applies the given function to two collections simultaneously. The + /// collections must have identical size. + /// + /// The function to apply to pairs of elements from the input lists. + /// The first input list. + /// The second input list. + /// + /// + [] + val iter2: action:('T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit + + /// Applies the given function to each element of the collection. The integer passed to the + /// function indicates the index of element. + /// + /// The function to apply to the elements of the list along with their index. + /// The input list. + /// + /// + [] + val inline iteri: action:(int -> 'T -> unit) -> list:'T list -> unit + + /// Applies the given function to two collections simultaneously. The + /// collections must have identical size. The integer passed to the + /// function indicates the index of element. + /// + /// The function to apply to a pair of elements from the input lists along with their index. + /// The first input list. + /// The second input list. + /// + /// + [] + val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit + + /// Returns the last element of the list. + /// + /// The input list. + /// + /// The last element of the list. + /// + /// Thrown when the input does not have any elements. + /// + /// + [] + val last: list:'T list -> 'T + + /// Returns the length of the list. + /// + /// The input list. + /// + /// The length of the list. + /// + /// + [] + val length: list:'T list -> int + + /// Returns the last element of the list. + /// Return None if no such element exists. + /// + /// The input list. + /// + /// The last element of the list or None. + /// + /// + [] + val tryLast: list:'T list -> 'T option + + /// Builds a new collection whose elements are the results of applying the given function + /// to each of the elements of the collection. + /// + /// The function to transform elements from the input list. + /// The input list. + /// + /// The list of transformed elements. + /// + /// + [] + val map: mapping:('T -> 'U) -> list:'T list -> 'U list + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding elements of the two collections pairwise. + /// + /// The function to transform pairs of elements from the input lists. + /// The first input list. + /// The second input list. + /// + /// The list of transformed elements. + /// + /// + [] + val map2: mapping:('T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding elements of the three collections simultaneously. + /// + /// The function to transform triples of elements from the input lists. + /// The first input list. + /// The second input list. + /// The third input list. + /// + /// The list of transformed elements. + /// + /// + [] + val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> 'U list + + /// Combines map and fold. Builds a new list whose elements are the results of applying the given function + /// to each of the elements of the input list. The function is also used to accumulate a final value. + /// + /// The function to transform elements from the input list and accumulate the final value. + /// The initial state. + /// The input list. + /// + /// The list of transformed elements, and the final accumulated value. + /// + /// + [] + val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> list:'T list -> 'Result list * 'State + + /// Combines map and foldBack. Builds a new list whose elements are the results of applying the given function + /// to each of the elements of the input list. The function is also used to accumulate a final value. + /// + /// The function to transform elements from the input list and accumulate the final value. + /// The input list. + /// The initial state. + /// + /// The list of transformed elements, and the final accumulated value. + /// + /// + [] + val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> list:'T list -> state:'State -> 'Result list * 'State + + /// Builds 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 (from 0) of element being transformed. + /// + /// The function to transform elements and their indices. + /// The input list. + /// + /// The list of transformed elements. + /// + /// + [] + val mapi: mapping:(int -> 'T -> 'U) -> list:'T list -> 'U list + + /// Like mapi, but mapping corresponding elements from two lists of equal length. + /// + /// The function to transform pairs of elements from the two lists and their index. + /// The first input list. + /// The second input list. + /// + /// The list of transformed elements. + /// + /// + [] + val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list + + /// Return the greatest of all elements of the list, compared via Operators.max. + /// + /// Raises if list is empty + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The maximum element. + /// + /// + [] + val inline max : list:'T list -> 'T when 'T : comparison + + /// Returns the greatest of all elements of the list, compared via Operators.max on the function result. + /// + /// Raises if list is empty. + /// The function to transform the list elements into the type to be compared. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The maximum element. + /// + /// + [] + val inline maxBy : projection:('T -> 'U) -> list:'T list -> 'T when 'U : comparison + + /// Returns the lowest of all elements of the list, compared via Operators.min. + /// + /// Raises if list is empty + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The minimum value. + /// + /// + [] + val inline min : list:'T list -> 'T when 'T : comparison + + /// Returns the lowest of all elements of the list, compared via Operators.min on the function result + /// + /// Raises if list is empty. + /// The function to transform list elements into the type to be compared. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The minimum value. + /// + /// + [] + val inline minBy : projection:('T -> 'U) -> list:'T list -> 'T when 'U : comparison + + /// Indexes into the list. The first element has index 0. + /// + /// The input list. + /// The index to retrieve. + /// + /// The value at the given index. + /// + /// Thrown when the index is negative or the input list does not contain enough elements. + [] + [] + val nth: list:'T list -> index:int -> 'T + + /// Builds a list from the given array. + /// + /// The input array. + /// + /// The list of elements from the array. + /// + /// + [] + val ofArray : array:'T[] -> 'T list + + /// Builds a new list from the given enumerable object. + /// + /// The input sequence. + /// + /// The list of elements from the sequence. + /// + /// + [] + val ofSeq: source:seq<'T> -> 'T list + + /// Returns a list of each element in the input list and its predecessor, with the + /// exception of the first element which is only returned as the predecessor of the second element. + /// + /// The input list. + /// + /// The result list. + /// + /// + [] + val pairwise: list:'T list -> ('T * 'T) list + + /// Splits the collection into two collections, containing the + /// elements for which the given predicate returns True and False + /// respectively. Element order is preserved in both of the created lists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// A list containing the elements for which the predicate evaluated to false and a list + /// containing the elements for which the predicate evaluated to true. + /// + /// + [] + val partition: predicate:('T -> bool) -> list:'T list -> ('T list * 'T list) + + /// Applies the given function to successive elements, returning the first + /// result where function returns Some(x) for some x. If no such + /// element exists then raise + /// + /// The function to generate options from the elements. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The first resulting value. + /// + /// + [] + val pick: chooser:('T -> 'U option) -> list:'T list -> 'U + + /// Returns a list with all elements permuted according to the + /// specified permutation. + /// + /// The function to map input indices to output indices. + /// The input list. + /// + /// The permuted list. + /// + /// Thrown when indexMap does not produce a valid permutation. + /// + /// + [] + val permute : indexMap:(int -> int) -> list:'T list -> 'T list + + /// Apply a function to each element of the collection, threading an accumulator argument + /// through the computation. Apply the function to the first two elements of the list. + /// Then feed this result into the function along with the third element and so on. + /// Return the final result. If the input function is f and the elements are i0...iN then computes + /// f (... (f i0 i1) i2 ...) iN. + /// + /// Raises if list is empty + /// + /// The function to reduce two list elements to a single element. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The final reduced value. + /// + /// + [] + val reduce: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T + + /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN then computes + /// f i0 (...(f iN-1 iN)). + /// + /// A function that takes in the next-to-last element of the list and the + /// current accumulated result to produce the next accumulated result. + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The final result of the reductions. + /// + /// + [] + val reduceBack: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T + + /// Creates a list by replicating the given initial value. + /// + /// The number of elements to replicate. + /// The value to replicate + /// + /// The generated list. + /// + /// + [] + val replicate: count:int -> initial:'T -> 'T list + + /// Returns a new list with the elements in reverse order. + /// + /// The input list. + /// + /// The reversed list. + /// + /// + [] + val rev: list:'T list -> 'T list + + /// Applies a function to each element of the collection, threading an accumulator argument + /// through the computation. Take the second argument, and apply the function to it + /// and the first element of the list. Then feed this result into the function along + /// with the second element and so on. Returns the list of intermediate results and the final result. + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The input list. + /// + /// The list of states. + /// + /// + [] + val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State list + + /// Like foldBack, but returns both the intermediary and final results + /// + /// The function to update the state given the input elements. + /// The input list. + /// The initial state. + /// + /// The list of states. + /// + /// + [] + val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State list + + /// Returns a list that contains one item only. + /// + /// The input item. + /// + /// The result list of one item. + /// + /// + [] + val inline singleton: value:'T -> 'T list + + /// Returns the list after removing the first N elements. + /// + /// The number of elements to skip. If the number is 0 or negative the input list is returned. + /// The input list. + /// + /// The list after removing the first N elements. + /// + /// Thrown when count exceeds the number of + /// elements in the list. + /// + /// + [] + val skip: count:int -> list: 'T list -> 'T list + + /// Bypasses elements in a list while the given predicate returns True, and then returns + /// the remaining elements of the list. + /// + /// A function that evaluates an element of the list to a boolean value. + /// The input list. + /// + /// The result list. + /// + /// + [] + val skipWhile: predicate:('T -> bool) -> list:'T list -> 'T list + + /// Sorts the given list using the given comparison function. + /// + /// This is a stable sort, i.e. the original order of equal elements is preserved. + /// The function to compare the list elements. + /// The input list. + /// + /// The sorted list. + /// + /// + [] + val sortWith: comparer:('T -> 'T -> int) -> list:'T list -> 'T list + + /// Sorts the given list using keys given by the given projection. Keys are compared using . + /// + /// This is a stable sort, i.e. the original order of equal elements is preserved. + /// The function to transform the list elements into the type to be compared. + /// The input list. + /// + /// The sorted list. + /// + /// + [] + val sortBy: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison + + /// Sorts the given list using . + /// + /// This is a stable sort, i.e. the original order of equal elements is preserved. + /// The input list. + /// + /// The sorted list. + /// + /// + [] + val sort: list:'T list -> 'T list when 'T : comparison + + /// Splits a list into two lists, at the given index. + /// + /// The index at which the list is split. + /// The input list. + /// + /// The two split lists. + /// + /// Thrown when split index exceeds the number of elements + /// in the list. + /// + /// + [] + val splitAt: index:int -> list:'T list -> ('T list * 'T list) + + /// Sorts the given list in descending order using keys given by the given projection. Keys are compared using . + /// + /// This is a stable sort, i.e. the original order of equal elements is preserved. + /// The function to transform the list elements into the type to be compared. + /// The input list. + /// + /// The sorted list. + /// + /// + [] + val inline sortByDescending: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : comparison + + /// Sorts the given list in descending order using . + /// + /// This is a stable sort, i.e. the original order of equal elements is preserved. + /// The input list. + /// + /// The sorted list. + /// + /// + [] + val inline sortDescending: list:'T list -> 'T list when 'T : comparison + + /// Returns the sum of the elements in the list. + /// + /// The input list. + /// + /// The resulting sum. + /// + /// + [] + val inline sum : list:^T list -> ^T + when ^T : (static member (+) : ^T * ^T -> ^T) + and ^T : (static member Zero : ^T) + + /// Returns the sum of the results generated by applying the function to each element of the list. + /// + /// The function to transform the list elements into the type to be summed. + /// The input list. + /// + /// The resulting sum. + /// + /// + [] + val inline sumBy : projection:('T -> ^U) -> list:'T list -> ^U + when ^U : (static member (+) : ^U * ^U -> ^U) + and ^U : (static member Zero : ^U) + + /// Returns the list after removing the first element. + /// + /// The input list. + /// + /// Thrown when the list is empty. + /// + /// The list after removing the first element. + /// + /// + [] + val tail: list:'T list -> 'T list + + /// Returns the first N elements of the list. + /// Throws InvalidOperationException + /// if the count exceeds the number of elements in the list. List.truncate + /// returns as many items as the list contains instead of throwing an exception. + /// + /// The number of items to take. + /// The input list. + /// + /// The result list. + /// + /// Thrown when the input list is empty. + /// Thrown when count exceeds the number of elements + /// in the list. + /// + /// + [] + val take: count:int -> list:'T list -> 'T list + + /// Returns a list that contains all elements of the original list while the + /// given predicate returns True, and then returns no further elements. + /// + /// A function that evaluates to false when no more items should be returned. + /// The input list. + /// + /// The result list. + /// + /// + [] + val takeWhile: predicate:('T -> bool) -> list:'T list -> 'T list + + /// Builds an array from the given list. + /// + /// The input list. + /// + /// The array containing the elements of the list. + /// + /// + [] + val toArray: list:'T list -> 'T[] + + /// Views the given list as a sequence. + /// + /// The input list. + /// + /// The sequence of elements in the list. + /// + /// + [] + val toSeq: list:'T list -> seq<'T> + + /// Returns the first element of the list, or + /// None if the list is empty. + /// + /// The input list. + /// + /// The first element of the list or None. + /// + /// + [] + val tryHead: list:'T list -> 'T option + + /// Returns the transpose of the given sequence of lists. + /// + /// The input sequence of list. + /// + /// The transposed list. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input lists differ in length. + /// + /// + [] + val transpose: lists:seq<'T list> -> 'T list list + + /// Returns at most N elements in a new list. + /// + /// The maximum number of items to return. + /// The input list. + /// + /// The result list. + /// + /// + [] + val truncate: count:int -> list:'T list -> 'T list + + /// Applies the given function to successive elements, returning Some(x) the first + /// result where function returns Some(x) for some x. If no such element + /// exists then return None. + /// + /// The function to generate options from the elements. + /// The input list. + /// + /// The first resulting value or None. + /// + /// + [] + val tryPick: chooser:('T -> 'U option) -> list:'T list -> 'U option + + /// Returns the first element for which the given function returns True. + /// Return None if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// The first element for which the predicate returns true, or None if + /// every element evaluates to false. + /// + /// + [] + val tryFind: predicate:('T -> bool) -> list:'T list -> 'T option + + /// Returns the last element for which the given function returns True. + /// Return None if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// The last element for which the predicate returns true, or None if + /// every element evaluates to false. + /// + /// + [] + val tryFindBack: predicate:('T -> bool) -> list:'T list -> 'T option + + /// Returns the index of the first element in the list + /// that satisfies the given predicate. + /// Return None if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// The index of the first element for which the predicate returns true, or None if + /// every element evaluates to false. + /// + /// + [] + val tryFindIndex: predicate:('T -> bool) -> list:'T list -> int option + + /// Tries to find the nth element in the list. + /// Returns None if index is negative or the list does not contain enough elements. + /// + /// The index to retrieve. + /// The input list. + /// + /// The value at the given index or None. + /// + /// + [] + val tryItem: index:int -> list:'T list -> 'T option + + /// Returns the index of the last element in the list + /// that satisfies the given predicate. + /// Return None if no such element exists. + /// + /// The function to test the input elements. + /// The input list. + /// + /// The index of the last element for which the predicate returns true, or None if + /// every element evaluates to false. + /// + /// + [] + val tryFindIndexBack: predicate:('T -> bool) -> list:'T list -> int option + + /// Returns a list that contains the elements generated by the given computation. + /// The given initial state argument is passed to the element generator. + /// + /// A function that takes in the current state and returns an option tuple of the next + /// element of the list and the next state value. + /// The initial state value. + /// + /// The result list. + /// + /// + [] + val unfold<'T,'State> : generator:('State -> ('T * 'State) option) -> state:'State -> 'T list + + /// Splits a list of pairs into two lists. + /// + /// The input list. + /// + /// Two lists of split elements. + /// + /// + [] + val unzip: list:('T1 * 'T2) list -> ('T1 list * 'T2 list) + + /// Splits a list of triples into three lists. + /// + /// The input list. + /// + /// Three lists of split elements. + /// + /// + [] + val unzip3: list:('T1 * 'T2 * 'T3) list -> ('T1 list * 'T2 list * 'T3 list) + + /// Returns a new list containing only the elements of the list + /// for which the given predicate returns "true" + /// + /// The function to test the input elements. + /// The input list. + /// + /// A list containing only the elements that satisfy the predicate. + /// + /// + [] + val where: predicate:('T -> bool) -> list:'T list -> 'T list + + /// Returns a list of sliding windows containing elements drawn from the input + /// list. Each window is returned as a fresh list. + /// + /// The number of elements in each window. + /// The input list. + /// + /// The result list. + /// + /// Thrown when windowSize is not positive. + /// + /// + [] + val windowed : windowSize:int -> list:'T list -> 'T list list + + /// Combines the two lists into a list of pairs. The two lists must have equal lengths. + /// + /// The first input list. + /// The second input list. + /// + /// A single list containing pairs of matching elements from the input lists. + /// + /// + [] + val zip: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list + + /// Combines the three lists into a list of triples. The lists must have equal lengths. + /// + /// The first input list. + /// The second input list. + /// The third input list. + /// + /// A single list containing triples of matching elements from the input lists. + /// + /// + [] + val zip3: list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> ('T1 * 'T2 * 'T3) list - /// Return a new list with a new item inserted before the given index. - /// - /// The index where the item should be inserted. - /// The value to insert. - /// The input list. - /// - /// - /// - /// [ 0; 1; 2 ] |> List.insertAt 1 9 // evaluates to [ 0; 9; 1; 2 ] - /// - /// - /// - /// The result list. - /// - /// Thrown when index is below 0 or greater than source.Length. - [] - val insertAt: index: int -> value: 'T -> source: 'T list -> 'T list - - /// Return a new list with new items inserted before the given index. - /// - /// The index where the items should be inserted. - /// The values to insert. - /// The input list. - /// - /// - /// - /// [ 0; 1; 2 ] |> List.insertManyAt 1 [ 8; 9 ] // evaluates to [ 0; 8; 9; 1; 2 ] - /// - /// - /// - /// The result list. - /// - /// Thrown when index is below 0 or greater than source.Length. - [] - val insertManyAt: index: int -> values: seq<'T> -> source: 'T list -> 'T list + /// Return a new list with the item at a given index removed. + /// + /// The index of the item to be removed. + /// The input list. + /// + /// The result list. + /// + /// Thrown when index is outside 0..source.Length - 1 + /// + /// + /// + /// [ 0; 1; 2 ] |> List.removeAt 1 // evaluates to [ 0; 2 ] + /// + /// + [] + val removeAt: index: int -> source: 'T list -> 'T list + + /// Return a new list with the number of items starting at a given index removed. + /// + /// The index of the item to be removed. + /// The number of items to remove. + /// The input list. + /// + /// The result list. + /// + /// Thrown when index is outside 0..source.Length - count + /// + /// + /// + /// [ 0; 1; 2; 3 ] |> List.removeManyAt 1 2 // evaluates to [ 0; 3 ] + /// + /// + [] + val removeManyAt: index: int -> count: int -> source: 'T list -> 'T list + + /// Return a new list with the item at a given index set to the new value. + /// + /// The index of the item to be replaced. + /// The new value. + /// The input list. + /// + /// The result list. + /// + /// Thrown when index is outside 0..source.Length - 1 + /// + /// + /// + /// [ 0; 1; 2 ] |> List.updateAt 1 9 // evaluates to [ 0; 9; 2 ] + /// + /// + [] + val updateAt: index: int -> value: 'T -> source: 'T list -> 'T list + + /// Return a new list with a new item inserted before the given index. + /// + /// The index where the item should be inserted. + /// The value to insert. + /// The input list. + /// + /// The result list. + /// + /// Thrown when index is below 0 or greater than source.Length. + /// + /// + /// + /// [ 0; 1; 2 ] |> List.insertAt 1 9 // evaluates to [ 0; 9; 1; 2 ] + /// + /// + [] + val insertAt: index: int -> value: 'T -> source: 'T list -> 'T list + + /// Return a new list with new items inserted before the given index. + /// + /// The index where the items should be inserted. + /// The values to insert. + /// The input list. + /// + /// The result list. + /// + /// Thrown when index is below 0 or greater than source.Length. + /// + /// + /// + /// [ 0; 1; 2 ] |> List.insertManyAt 1 [ 8; 9 ] // evaluates to [ 0; 8; 9; 1; 2 ] + /// + /// + [] + val insertManyAt: index: int -> values: seq<'T> -> source: 'T list -> 'T list diff --git a/src/fsharp/FSharp.Core/mailbox.fsi b/src/fsharp/FSharp.Core/mailbox.fsi index 3f36a6f9def..b864b99ad43 100644 --- a/src/fsharp/FSharp.Core/mailbox.fsi +++ b/src/fsharp/FSharp.Core/mailbox.fsi @@ -2,180 +2,213 @@ namespace Microsoft.FSharp.Control - open System.Threading - - open Microsoft.FSharp.Core - open Microsoft.FSharp.Control - - [] - /// A handle to a capability to reply to a PostAndReply message. - /// - /// Agents - type AsyncReplyChannel<'Reply> = - /// Sends a reply to a PostAndReply message. - /// The value to send. - member Reply : value:'Reply -> unit - - /// A message-processing agent which executes an asynchronous computation. - /// - /// The agent encapsulates a message queue that supports multiple-writers and - /// a single reader agent. Writers send messages to the agent by using the Post - /// method and its variations. - /// - /// The agent may wait for messages using the Receive or TryReceive methods or - /// scan through all available messages using the Scan or TryScan method. - /// - /// Agents - [] - type MailboxProcessor<'Msg> = - - /// Creates an agent. The body function is used to generate the asynchronous - /// computation executed by the agent. This function is not executed until - /// Start is called. - /// - /// The function to produce an asynchronous computation that will be executed - /// as the read loop for the MailboxProcessor when Start is called. - /// An optional cancellation token for the body. - /// Defaults to Async.DefaultCancellationToken. - /// - /// The created MailboxProcessor. - new : body:(MailboxProcessor<'Msg> -> Async) * ?cancellationToken: CancellationToken -> MailboxProcessor<'Msg> - - /// Creates and starts an agent. The body function is used to generate the asynchronous - /// computation executed by the agent. - /// - /// The function to produce an asynchronous computation that will be executed - /// as the read loop for the MailboxProcessor when Start is called. - /// An optional cancellation token for the body. - /// Defaults to Async.DefaultCancellationToken. - /// - /// The created MailboxProcessor. - static member Start : body:(MailboxProcessor<'Msg> -> Async) * ?cancellationToken: CancellationToken -> MailboxProcessor<'Msg> - - /// Posts a message to the message queue of the MailboxProcessor, asynchronously. - /// - /// The message to post. - member Post : message:'Msg -> unit - - /// Posts a message to an agent and await a reply on the channel, synchronously. - /// - /// The message is generated by applying buildMessage to a new reply channel - /// to be incorporated into the message. The receiving agent must process this - /// message and invoke the Reply method on this reply channel precisely once. - /// The function to incorporate the AsyncReplyChannel into - /// the message to be sent. - /// An optional timeout parameter (in milliseconds) to wait for a reply message. - /// Defaults to -1 which corresponds to . - /// - /// The reply from the agent. - member PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply - - /// Posts a message to an agent and await a reply on the channel, asynchronously. - /// - /// The message is generated by applying buildMessage to a new reply channel - /// to be incorporated into the message. The receiving agent must process this - /// message and invoke the Reply method on this reply channel precisely once. - /// The function to incorporate the AsyncReplyChannel into - /// the message to be sent. - /// An optional timeout parameter (in milliseconds) to wait for a reply message. - /// Defaults to -1 which corresponds to . - /// - /// An asynchronous computation that will wait for the reply from the agent. - member PostAndAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply> - - /// Like PostAndReply, but returns None if no reply within the timeout period. - /// - /// The function to incorporate the AsyncReplyChannel into - /// the message to be sent. - /// An optional timeout parameter (in milliseconds) to wait for a reply message. - /// Defaults to -1 which corresponds to . - /// - /// The reply from the agent or None if the timeout expires. - member TryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply option - - /// Like AsyncPostAndReply, but returns None if no reply within the timeout period. - /// - /// The function to incorporate the AsyncReplyChannel into - /// the message to be sent. - /// An optional timeout parameter (in milliseconds) to wait for a reply message. - /// Defaults to -1 which corresponds to . - /// - /// An asynchronous computation that will return the reply or None if the timeout expires. - member PostAndTryAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply option> - - /// Waits for a message. This will consume the first message in arrival order. - /// - /// This method is for use within the body of the agent. - /// - /// This method is for use within the body of the agent. For each agent, at most - /// one concurrent reader may be active, so no more than one concurrent call to - /// Receive, TryReceive, Scan and/or TryScan may be active. - /// An optional timeout in milliseconds. Defaults to -1 which corresponds - /// to . - /// - /// An asynchronous computation that returns the received message. - /// Thrown when the timeout is exceeded. - member Receive : ?timeout:int -> Async<'Msg> - - /// Waits for a message. This will consume the first message in arrival order. - /// - /// This method is for use within the body of the agent. - /// - /// Returns None if a timeout is given and the timeout is exceeded. - /// - /// This method is for use within the body of the agent. For each agent, at most - /// one concurrent reader may be active, so no more than one concurrent call to - /// Receive, TryReceive, Scan and/or TryScan may be active. - /// An optional timeout in milliseconds. Defaults to -1 which - /// corresponds to . - /// - /// An asynchronous computation that returns the received message or - /// None if the timeout is exceeded. - member TryReceive : ?timeout:int -> Async<'Msg option> - - /// Scans for a message by looking through messages in arrival order until scanner - /// returns a Some value. Other messages remain in the queue. - /// - /// Returns None if a timeout is given and the timeout is exceeded. - /// - /// This method is for use within the body of the agent. For each agent, at most - /// one concurrent reader may be active, so no more than one concurrent call to - /// Receive, TryReceive, Scan and/or TryScan may be active. - /// The function to return None if the message is to be skipped - /// or Some if the message is to be processed and removed from the queue. - /// An optional timeout in milliseconds. Defaults to -1 which corresponds - /// to . - /// - /// An asynchronous computation that scanner built off the read message. - /// Thrown when the timeout is exceeded. - member Scan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T> - - /// Scans for a message by looking through messages in arrival order until scanner - /// returns a Some value. Other messages remain in the queue. - /// - /// This method is for use within the body of the agent. For each agent, at most - /// one concurrent reader may be active, so no more than one concurrent call to - /// Receive, TryReceive, Scan and/or TryScan may be active. - /// The function to return None if the message is to be skipped - /// or Some if the message is to be processed and removed from the queue. - /// An optional timeout in milliseconds. Defaults to -1 which corresponds - /// to . - /// - /// An asynchronous computation that scanner built off the read message. - member TryScan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T option> - - /// Starts the agent. - member Start : unit -> unit - - /// Raises a timeout exception if a message not received in this amount of time. By default - /// no timeout is used. - member DefaultTimeout : int with get, set - - /// Occurs when the execution of the agent results in an exception. - [] - member Error : IEvent - - interface System.IDisposable - - /// Returns the number of unprocessed messages in the message queue of the agent. - member CurrentQueueLength : int +open System.Threading + +open Microsoft.FSharp.Core +open Microsoft.FSharp.Control + +[] +/// A handle to a capability to reply to a PostAndReply message. +/// +/// Agents +type AsyncReplyChannel<'Reply> = + /// Sends a reply to a PostAndReply message. + /// The value to send. + member Reply : value:'Reply -> unit + +/// A message-processing agent which executes an asynchronous computation. +/// +/// The agent encapsulates a message queue that supports multiple-writers and +/// a single reader agent. Writers send messages to the agent by using the Post +/// method and its variations. +/// +/// The agent may wait for messages using the Receive or TryReceive methods or +/// scan through all available messages using the Scan or TryScan method. +/// +/// Agents +[] +type MailboxProcessor<'Msg> = + + /// Creates an agent. The body function is used to generate the asynchronous + /// computation executed by the agent. This function is not executed until + /// Start is called. + /// + /// The function to produce an asynchronous computation that will be executed + /// as the read loop for the MailboxProcessor when Start is called. + /// An optional cancellation token for the body. + /// Defaults to Async.DefaultCancellationToken. + /// + /// The created MailboxProcessor. + /// + /// + new: body:(MailboxProcessor<'Msg> -> Async) * ?cancellationToken: CancellationToken -> MailboxProcessor<'Msg> + + /// Creates and starts an agent. The body function is used to generate the asynchronous + /// computation executed by the agent. + /// + /// The function to produce an asynchronous computation that will be executed + /// as the read loop for the MailboxProcessor when Start is called. + /// An optional cancellation token for the body. + /// Defaults to Async.DefaultCancellationToken. + /// + /// The created MailboxProcessor. + /// + /// + static member Start : body:(MailboxProcessor<'Msg> -> Async) * ?cancellationToken: CancellationToken -> MailboxProcessor<'Msg> + + /// Posts a message to the message queue of the MailboxProcessor, asynchronously. + /// + /// The message to post. + /// + /// + member Post : message:'Msg -> unit + + /// Posts a message to an agent and await a reply on the channel, synchronously. + /// + /// The message is generated by applying buildMessage to a new reply channel + /// to be incorporated into the message. The receiving agent must process this + /// message and invoke the Reply method on this reply channel precisely once. + /// The function to incorporate the AsyncReplyChannel into + /// the message to be sent. + /// An optional timeout parameter (in milliseconds) to wait for a reply message. + /// Defaults to -1 which corresponds to . + /// + /// The reply from the agent. + /// + /// + member PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply + + /// Posts a message to an agent and await a reply on the channel, asynchronously. + /// + /// The message is generated by applying buildMessage to a new reply channel + /// to be incorporated into the message. The receiving agent must process this + /// message and invoke the Reply method on this reply channel precisely once. + /// The function to incorporate the AsyncReplyChannel into + /// the message to be sent. + /// An optional timeout parameter (in milliseconds) to wait for a reply message. + /// Defaults to -1 which corresponds to . + /// + /// An asynchronous computation that will wait for the reply from the agent. + /// + /// + member PostAndAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply> + + /// Like PostAndReply, but returns None if no reply within the timeout period. + /// + /// The function to incorporate the AsyncReplyChannel into + /// the message to be sent. + /// An optional timeout parameter (in milliseconds) to wait for a reply message. + /// Defaults to -1 which corresponds to . + /// + /// The reply from the agent or None if the timeout expires. + /// + /// + member TryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply option + + /// Like AsyncPostAndReply, but returns None if no reply within the timeout period. + /// + /// The function to incorporate the AsyncReplyChannel into + /// the message to be sent. + /// An optional timeout parameter (in milliseconds) to wait for a reply message. + /// Defaults to -1 which corresponds to . + /// + /// An asynchronous computation that will return the reply or None if the timeout expires. + /// + /// + member PostAndTryAsyncReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply option> + + /// Waits for a message. This will consume the first message in arrival order. + /// + /// This method is for use within the body of the agent. + /// + /// This method is for use within the body of the agent. For each agent, at most + /// one concurrent reader may be active, so no more than one concurrent call to + /// Receive, TryReceive, Scan and/or TryScan may be active. + /// An optional timeout in milliseconds. Defaults to -1 which corresponds + /// to . + /// + /// An asynchronous computation that returns the received message. + /// Thrown when the timeout is exceeded. + /// + /// + member Receive : ?timeout:int -> Async<'Msg> + + /// Waits for a message. This will consume the first message in arrival order. + /// + /// This method is for use within the body of the agent. + /// + /// Returns None if a timeout is given and the timeout is exceeded. + /// + /// This method is for use within the body of the agent. For each agent, at most + /// one concurrent reader may be active, so no more than one concurrent call to + /// Receive, TryReceive, Scan and/or TryScan may be active. + /// An optional timeout in milliseconds. Defaults to -1 which + /// corresponds to . + /// + /// An asynchronous computation that returns the received message or + /// None if the timeout is exceeded. + /// + /// + member TryReceive : ?timeout:int -> Async<'Msg option> + + /// Scans for a message by looking through messages in arrival order until scanner + /// returns a Some value. Other messages remain in the queue. + /// + /// Returns None if a timeout is given and the timeout is exceeded. + /// + /// This method is for use within the body of the agent. For each agent, at most + /// one concurrent reader may be active, so no more than one concurrent call to + /// Receive, TryReceive, Scan and/or TryScan may be active. + /// + /// The function to return None if the message is to be skipped + /// or Some if the message is to be processed and removed from the queue. + /// An optional timeout in milliseconds. Defaults to -1 which corresponds + /// to . + /// + /// An asynchronous computation that scanner built off the read message. + /// + /// Thrown when the timeout is exceeded. + /// + /// + member Scan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T> + + /// Scans for a message by looking through messages in arrival order until scanner + /// returns a Some value. Other messages remain in the queue. + /// + /// This method is for use within the body of the agent. For each agent, at most + /// one concurrent reader may be active, so no more than one concurrent call to + /// Receive, TryReceive, Scan and/or TryScan may be active. + /// + /// The function to return None if the message is to be skipped + /// or Some if the message is to be processed and removed from the queue. + /// An optional timeout in milliseconds. Defaults to -1 which corresponds + /// to . + /// + /// An asynchronous computation that scanner built off the read message. + /// + /// + member TryScan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T option> + + /// Starts the agent. + /// + /// + member Start : unit -> unit + + /// Raises a timeout exception if a message not received in this amount of time. By default + /// no timeout is used. + /// + /// + member DefaultTimeout : int with get, set + + /// Occurs when the execution of the agent results in an exception. + /// + /// + [] + member Error : IEvent + + /// Returns the number of unprocessed messages in the message queue of the agent. + /// + /// + member CurrentQueueLength : int + + interface System.IDisposable diff --git a/src/fsharp/FSharp.Core/map.fsi b/src/fsharp/FSharp.Core/map.fsi index b02e06cc0f0..9759af14467 100644 --- a/src/fsharp/FSharp.Core/map.fsi +++ b/src/fsharp/FSharp.Core/map.fsi @@ -2,362 +2,444 @@ namespace Microsoft.FSharp.Collections - open System - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - /// Immutable maps based on binary trees, where keys are ordered by F# generic comparison. By default - /// comparison is the F# structural comparison function or uses implementations of the IComparable interface on key values. - /// - /// See the module for further operations on maps. - /// - /// All members of this class are thread-safe and may be used concurrently from multiple threads. - [] - [] - type Map<[]'Key,[]'Value when 'Key : comparison> = - /// Returns a new map with the binding added to the given map. - /// If a binding with the given key already exists in the input map, the existing binding is replaced by the new binding in the result map. - /// The key to add. - /// The value to add. - /// - /// The resulting map. - member Add: key:'Key * value:'Value -> Map<'Key,'Value> - - /// Returns a new map with the value stored under key changed according to f. - /// - /// The input key. - /// The change function. - /// - /// The resulting map. - member Change: key:'Key * f:('Value option -> 'Value option) -> Map<'Key,'Value> - - /// Returns true if there are no bindings in the map. - member IsEmpty: bool - - /// Builds a map that contains the bindings of the given IEnumerable. - /// - /// The input sequence of key/value pairs. - /// - /// The resulting map. - new : elements:seq<'Key * 'Value> -> Map<'Key,'Value> - - /// Tests if an element is in the domain of the map. - /// - /// The input key. - /// - /// True if the map contains the given key. - member ContainsKey: key:'Key -> bool - - /// The number of bindings in the map. - member Count: int - - /// Lookup an element in the map. Raise KeyNotFoundException if no binding - /// exists in the map. - /// - /// The input key. - /// Thrown when the key is not found. - /// - /// The value mapped to the key. - member Item : key:'Key -> 'Value with get - - /// Removes an element from the domain of the map. No exception is raised if the element is not present. - /// - /// The input key. - /// - /// The resulting map. - member Remove: key:'Key -> Map<'Key,'Value> - - /// Lookup an element in the map, returning a Some value if the element is in the domain - /// of the map and None if not. - /// - /// The input key. - /// - /// The mapped value, or None if the key is not in the map. - member TryFind: key:'Key -> 'Value option - - /// Lookup an element in the map, assigning to value if the element is in the domain - /// of the map and returning false if not. - /// - /// The input key. - /// A reference to the output value. - /// - /// true if the value is present, false if not. - member TryGetValue: key: 'Key * [] value: byref<'Value> -> bool - - /// The keys in the map. - /// The sequence will be ordered by the keys of the map. - member Keys : ICollection<'Key> - - /// All the values in the map, including the duplicates. - /// The sequence will be ordered by the keys of the map. - member Values : ICollection<'Value> - - interface IDictionary<'Key, 'Value> - interface ICollection> - interface IEnumerable> - interface System.IComparable - interface System.Collections.IEnumerable - interface IReadOnlyCollection> - interface IReadOnlyDictionary<'Key,'Value> - override Equals : obj -> bool - - /// Contains operations for working with values of type . - [] - [] - module Map = - - /// Returns a new map with the binding added to the given map. - /// If a binding with the given key already exists in the input map, the existing binding is replaced by the new binding in the result map. - /// - /// The input key. - /// The input value. - /// The input map. - /// - /// The resulting map. - [] - val add: key:'Key -> value:'T -> table:Map<'Key,'T> -> Map<'Key,'T> - - /// Returns a new map with the value stored under key changed according to f. - /// - /// The input key. - /// The change function. - /// The input map. - /// - /// The resulting map. - [] - val change: key:'Key -> f:('T option -> 'T option) -> table:Map<'Key,'T> -> Map<'Key,'T> - - /// Returns a new map made from the given bindings. - /// - /// The input list of key/value pairs. - /// - /// The resulting map. - [] - val ofList: elements:('Key * 'T) list -> Map<'Key,'T> - - /// Returns a new map made from the given bindings. - /// - /// The input array of key/value pairs. - /// - /// The resulting map. - [] - val ofArray: elements:('Key * 'T)[] -> Map<'Key,'T> - - /// Returns a new map made from the given bindings. - /// - /// The input sequence of key/value pairs. - /// - /// The resulting map. - [] - val ofSeq: elements:seq<'Key * 'T> -> Map<'Key,'T> - - /// Views the collection as an enumerable sequence of pairs. - /// The sequence will be ordered by the keys of the map. - /// - /// The input map. - /// - /// The sequence of key/value pairs. - [] - val toSeq: table:Map<'Key,'T> -> seq<'Key * 'T> - - /// Returns a list of all key-value pairs in the mapping. - /// The list will be ordered by the keys of the map. - /// - /// The input map. - /// - /// The list of key/value pairs. - [] - val toList: table:Map<'Key,'T> -> ('Key * 'T) list - - /// Returns an array of all key-value pairs in the mapping. - /// The array will be ordered by the keys of the map. - /// - /// The input map. - /// - /// The array of key/value pairs. - [] - val toArray: table:Map<'Key,'T> -> ('Key * 'T)[] - - /// Is the map empty? - /// - /// The input map. - /// - /// True if the map is empty. - [] - val isEmpty: table:Map<'Key,'T> -> bool - - /// The empty map. - [] - [] - val empty<'Key,'T> : Map<'Key,'T> when 'Key : comparison - - /// Lookup an element in the map, raising KeyNotFoundException if no binding - /// exists in the map. - /// - /// The input key. - /// The input map. - /// Thrown when the key does not exist in the map. - /// - /// The value mapped to the given key. - [] - val find: key:'Key -> table:Map<'Key,'T> -> 'T - - /// Searches the map looking for the first element where the given function returns a Some value. - /// - /// The function to generate options from the key/value pairs. - /// The input map. - /// - /// The first result. - [] - val tryPick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U option - - /// Searches the map looking for the first element where the given function returns a Some value - /// - /// The function to generate options from the key/value pairs. - /// The input map. - /// - /// The first result. - [] - val pick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U - - /// Folds over the bindings in the map. - /// - /// The function to update the state given the input key/value pairs. - /// The input map. - /// The initial state. - /// - /// The final state value. - [] - val foldBack<'Key,'T,'State> : folder:('Key -> 'T -> 'State -> 'State) -> table:Map<'Key,'T> -> state:'State -> 'State when 'Key : comparison - - /// Folds over the bindings in the map - /// - /// The function to update the state given the input key/value pairs. - /// The initial state. - /// The input map. - /// - /// The final state value. - [] - val fold<'Key,'T,'State> : folder:('State -> 'Key -> 'T -> 'State) -> state:'State -> table:Map<'Key,'T> -> 'State when 'Key : comparison - - /// Applies the given function to each binding in the dictionary - /// - /// The function to apply to each key/value pair. - /// The input map. - [] - val iter: action:('Key -> 'T -> unit) -> table:Map<'Key,'T> -> unit - - /// Returns true if the given predicate returns true for one of the - /// bindings in the map. - /// - /// The function to test the input elements. - /// The input map. - /// - /// True if the predicate returns true for one of the key/value pairs. - [] - val exists: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool - - /// Builds a new map containing only the bindings for which the given predicate returns 'true'. - /// - /// The function to test the key/value pairs. - /// The input map. - /// - /// The filtered map. - [] - val filter: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> - - /// Returns true if the given predicate returns true for all of the - /// bindings in the map. - /// - /// The function to test the input elements. - /// The input map. - /// - /// True if the predicate evaluates to true for all of the bindings in the map. - [] - val forall: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool - - /// Builds a new collection whose elements are the results of applying the given function - /// to each of the elements of the collection. The key passed to the - /// function indicates the key of element being transformed. - /// - /// The function to transform the key/value pairs. - /// The input map. - /// - /// The resulting map of keys and transformed values. - [] - val map: mapping:('Key -> 'T -> 'U) -> table:Map<'Key,'T> -> Map<'Key,'U> - - /// Tests if an element is in the domain of the map. - /// - /// The input key. - /// The input map. - /// - /// True if the map contains the key. - [] - val containsKey: key:'Key -> table:Map<'Key,'T> -> bool - - /// Builds two new maps, one containing the bindings for which the given predicate returns 'true', - /// and the other the remaining bindings. - /// - /// The function to test the input elements. - /// The input map. - /// - /// A pair of maps in which the first contains the elements for which the predicate returned true - /// and the second containing the elements for which the predicated returned false. - [] - val partition: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> * Map<'Key, 'T> - - /// Removes an element from the domain of the map. No exception is raised if the element is not present. - /// - /// The input key. - /// The input map. - /// - /// The resulting map. - [] - val remove: key:'Key -> table:Map<'Key,'T> -> Map<'Key,'T> - - /// Lookup an element in the map, returning a Some value if the element is in the domain - /// of the map and None if not. - /// - /// The input key. - /// The input map. - /// - /// The found Some value or None. - [] - val tryFind: key:'Key -> table:Map<'Key,'T> -> 'T option - - /// Evaluates the function on each mapping in the collection. Returns the key for the first mapping - /// where the function returns 'true'. Raise KeyNotFoundException if no such element exists. - /// - /// The function to test the input elements. - /// The input map. - /// Thrown if the key does not exist in the map. - /// - /// The first key for which the predicate evaluates true. - [] - val findKey: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key - - /// Returns the key of the first mapping in the collection that satisfies the given predicate. - /// Returns 'None' if no such element exists. - /// - /// The function to test the input elements. - /// The input map. - /// - /// The first key for which the predicate returns true or None if the predicate evaluates to false for each key/value pair. - [] - val tryFindKey: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key option - - /// The number of bindings in the map. - [] - val count: table:Map<'Key,'T> -> int - - /// The keys in the map. - /// The sequence will be ordered by the keys of the map. - [] - val keys: table: Map<'Key, 'T> -> ICollection<'Key> - - /// The values in the map, including the duplicates. - /// The sequence will be ordered by the keys of the map. - [] - val values: table: Map<'Key, 'T> -> ICollection<'T> +open System +open System.Collections.Generic +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections + +/// Immutable maps based on binary trees, where keys are ordered by F# generic comparison. By default +/// comparison is the F# structural comparison function or uses implementations of the IComparable interface on key values. +/// +/// See the module for further operations on maps. +/// +/// All members of this class are thread-safe and may be used concurrently from multiple threads. +[] +[] +type Map<[]'Key,[]'Value when 'Key : comparison> = + /// Returns a new map with the binding added to the given map. + /// If a binding with the given key already exists in the input map, the existing binding is replaced by the new binding in the result map. + /// The key to add. + /// The value to add. + /// + /// The resulting map. + /// + /// + member Add: key:'Key * value:'Value -> Map<'Key,'Value> + + /// Returns a new map with the value stored under key changed according to f. + /// + /// The input key. + /// The change function. + /// + /// The resulting map. + /// + /// + member Change: key:'Key * f:('Value option -> 'Value option) -> Map<'Key,'Value> + + /// Returns true if there are no bindings in the map. + /// + /// + member IsEmpty: bool + + /// Builds a map that contains the bindings of the given IEnumerable. + /// + /// The input sequence of key/value pairs. + /// + /// The resulting map. + /// + /// + new : elements:seq<'Key * 'Value> -> Map<'Key,'Value> + + /// Tests if an element is in the domain of the map. + /// + /// The input key. + /// + /// True if the map contains the given key. + /// + /// + member ContainsKey: key:'Key -> bool + + /// The number of bindings in the map. + /// + /// + member Count: int + + /// Lookup an element in the map. Raise KeyNotFoundException if no binding + /// exists in the map. + /// + /// The input key. + /// Thrown when the key is not found. + /// + /// The value mapped to the key. + /// + /// + member Item : key:'Key -> 'Value with get + + /// Removes an element from the domain of the map. No exception is raised if the element is not present. + /// + /// The input key. + /// + /// The resulting map. + /// + /// + member Remove: key:'Key -> Map<'Key,'Value> + + /// Lookup an element in the map, returning a Some value if the element is in the domain + /// of the map and None if not. + /// + /// The input key. + /// + /// The mapped value, or None if the key is not in the map. + /// + /// + member TryFind: key:'Key -> 'Value option + + /// Lookup an element in the map, assigning to value if the element is in the domain + /// of the map and returning false if not. + /// + /// The input key. + /// A reference to the output value. + /// + /// true if the value is present, false if not. + /// + /// + member TryGetValue: key: 'Key * [] value: byref<'Value> -> bool + + /// The keys in the map. + /// The sequence will be ordered by the keys of the map. + /// + /// + member Keys : ICollection<'Key> + + /// All the values in the map, including the duplicates. + /// The sequence will be ordered by the keys of the map. + /// + /// + member Values : ICollection<'Value> + + interface IDictionary<'Key, 'Value> + interface ICollection> + interface IEnumerable> + interface System.IComparable + interface System.Collections.IEnumerable + interface IReadOnlyCollection> + interface IReadOnlyDictionary<'Key,'Value> + override Equals : obj -> bool + +/// Contains operations for working with values of type . +[] +[] +module Map = + + /// Returns a new map with the binding added to the given map. + /// If a binding with the given key already exists in the input map, the existing binding is replaced by the new binding in the result map. + /// + /// The input key. + /// The input value. + /// The input map. + /// + /// The resulting map. + /// + /// + [] + val add: key:'Key -> value:'T -> table:Map<'Key,'T> -> Map<'Key,'T> + + /// Returns a new map with the value stored under key changed according to f. + /// + /// The input key. + /// The change function. + /// The input map. + /// + /// The resulting map. + /// + /// + [] + val change: key:'Key -> f:('T option -> 'T option) -> table:Map<'Key,'T> -> Map<'Key,'T> + + /// Returns a new map made from the given bindings. + /// + /// The input list of key/value pairs. + /// + /// The resulting map. + /// + /// + [] + val ofList: elements:('Key * 'T) list -> Map<'Key,'T> + + /// Returns a new map made from the given bindings. + /// + /// The input array of key/value pairs. + /// + /// The resulting map. + /// + /// + [] + val ofArray: elements:('Key * 'T)[] -> Map<'Key,'T> + + /// Returns a new map made from the given bindings. + /// + /// The input sequence of key/value pairs. + /// + /// The resulting map. + /// + /// + [] + val ofSeq: elements:seq<'Key * 'T> -> Map<'Key,'T> + + /// Views the collection as an enumerable sequence of pairs. + /// The sequence will be ordered by the keys of the map. + /// + /// The input map. + /// + /// The sequence of key/value pairs. + /// + /// + [] + val toSeq: table:Map<'Key,'T> -> seq<'Key * 'T> + + /// Returns a list of all key-value pairs in the mapping. + /// The list will be ordered by the keys of the map. + /// + /// The input map. + /// + /// The list of key/value pairs. + /// + /// + [] + val toList: table:Map<'Key,'T> -> ('Key * 'T) list + + /// Returns an array of all key-value pairs in the mapping. + /// The array will be ordered by the keys of the map. + /// + /// The input map. + /// + /// The array of key/value pairs. + /// + /// + [] + val toArray: table:Map<'Key,'T> -> ('Key * 'T)[] + + /// Is the map empty? + /// + /// The input map. + /// + /// True if the map is empty. + /// + /// + [] + val isEmpty: table:Map<'Key,'T> -> bool + + /// The empty map. + /// + /// + [] + [] + val empty<'Key,'T> : Map<'Key,'T> when 'Key : comparison + + /// Lookup an element in the map, raising KeyNotFoundException if no binding + /// exists in the map. + /// + /// The input key. + /// The input map. + /// Thrown when the key does not exist in the map. + /// + /// The value mapped to the given key. + /// + /// + [] + val find: key:'Key -> table:Map<'Key,'T> -> 'T + + /// Searches the map looking for the first element where the given function returns a Some value. + /// + /// The function to generate options from the key/value pairs. + /// The input map. + /// + /// The first result. + /// + /// + [] + val tryPick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U option + + /// Searches the map looking for the first element where the given function returns a Some value + /// + /// The function to generate options from the key/value pairs. + /// The input map. + /// + /// The first result. + /// + /// + [] + val pick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U + + /// Folds over the bindings in the map. + /// + /// The function to update the state given the input key/value pairs. + /// The input map. + /// The initial state. + /// + /// The final state value. + /// + /// + [] + val foldBack<'Key,'T,'State> : folder:('Key -> 'T -> 'State -> 'State) -> table:Map<'Key,'T> -> state:'State -> 'State when 'Key : comparison + + /// Folds over the bindings in the map + /// + /// The function to update the state given the input key/value pairs. + /// The initial state. + /// The input map. + /// + /// The final state value. + /// + /// + [] + val fold<'Key,'T,'State> : folder:('State -> 'Key -> 'T -> 'State) -> state:'State -> table:Map<'Key,'T> -> 'State when 'Key : comparison + + /// Applies the given function to each binding in the dictionary + /// + /// The function to apply to each key/value pair. + /// The input map. + /// + /// + [] + val iter: action:('Key -> 'T -> unit) -> table:Map<'Key,'T> -> unit + + /// Returns true if the given predicate returns true for one of the + /// bindings in the map. + /// + /// The function to test the input elements. + /// The input map. + /// + /// True if the predicate returns true for one of the key/value pairs. + /// + /// + [] + val exists: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool + + /// Builds a new map containing only the bindings for which the given predicate returns 'true'. + /// + /// The function to test the key/value pairs. + /// The input map. + /// + /// The filtered map. + /// + /// + [] + val filter: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> + + /// Returns true if the given predicate returns true for all of the + /// bindings in the map. + /// + /// The function to test the input elements. + /// The input map. + /// + /// True if the predicate evaluates to true for all of the bindings in the map. + /// + /// + [] + val forall: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool + + /// Builds a new collection whose elements are the results of applying the given function + /// to each of the elements of the collection. The key passed to the + /// function indicates the key of element being transformed. + /// + /// The function to transform the key/value pairs. + /// The input map. + /// + /// The resulting map of keys and transformed values. + /// + /// + [] + val map: mapping:('Key -> 'T -> 'U) -> table:Map<'Key,'T> -> Map<'Key,'U> + + /// Tests if an element is in the domain of the map. + /// + /// The input key. + /// The input map. + /// + /// True if the map contains the key. + /// + /// + [] + val containsKey: key:'Key -> table:Map<'Key,'T> -> bool + + /// Builds two new maps, one containing the bindings for which the given predicate returns 'true', + /// and the other the remaining bindings. + /// + /// The function to test the input elements. + /// The input map. + /// + /// A pair of maps in which the first contains the elements for which the predicate returned true + /// and the second containing the elements for which the predicated returned false. + /// + /// + [] + val partition: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> * Map<'Key, 'T> + + /// Removes an element from the domain of the map. No exception is raised if the element is not present. + /// + /// The input key. + /// The input map. + /// + /// The resulting map. + /// + /// + [] + val remove: key:'Key -> table:Map<'Key,'T> -> Map<'Key,'T> + + /// Lookup an element in the map, returning a Some value if the element is in the domain + /// of the map and None if not. + /// + /// The input key. + /// The input map. + /// + /// The found Some value or None. + /// + /// + [] + val tryFind: key:'Key -> table:Map<'Key,'T> -> 'T option + + /// Evaluates the function on each mapping in the collection. Returns the key for the first mapping + /// where the function returns 'true'. Raise KeyNotFoundException if no such element exists. + /// + /// The function to test the input elements. + /// The input map. + /// Thrown if the key does not exist in the map. + /// + /// The first key for which the predicate evaluates true. + /// + /// + [] + val findKey: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key + + /// Returns the key of the first mapping in the collection that satisfies the given predicate. + /// Returns 'None' if no such element exists. + /// + /// The function to test the input elements. + /// The input map. + /// + /// The first key for which the predicate returns true or None if the predicate evaluates to false for each key/value pair. + /// + /// + [] + val tryFindKey: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key option + + /// The number of bindings in the map. + /// + /// + [] + val count: table:Map<'Key,'T> -> int + + /// The keys in the map. + /// The sequence will be ordered by the keys of the map. + /// + /// + [] + val keys: table: Map<'Key, 'T> -> ICollection<'Key> + + /// The values in the map, including the duplicates. + /// The sequence will be ordered by the keys of the map. + /// + /// + [] + val values: table: Map<'Key, 'T> -> ICollection<'T> diff --git a/src/fsharp/FSharp.Core/nativeptr.fsi b/src/fsharp/FSharp.Core/nativeptr.fsi index cc2d7b0fc75..0c13ec823a5 100644 --- a/src/fsharp/FSharp.Core/nativeptr.fsi +++ b/src/fsharp/FSharp.Core/nativeptr.fsi @@ -2,188 +2,226 @@ namespace Microsoft.FSharp.NativeInterop - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - [] - [] - /// Contains operations on native pointers. Use of these operators may - /// result in the generation of unverifiable code. - /// - /// - /// Library functionality for native interopability. See - /// also F# External Functions in - /// the F# Language Guide. - /// - module NativePtr = - - [] - [] - /// Returns a typed native pointer for a given machine address. - /// - /// The machine address. - /// - /// A typed native pointer. - val inline ofNativeInt : address: nativeint -> nativeptr<'T> - - [] - [] - /// Returns a machine address for a given typed native pointer. - /// - /// The typed native pointer. - /// - /// The machine address. - val inline toNativeInt : address: nativeptr<'T> -> nativeint - - [] - [] - /// Returns a typed native pointer for a untyped native pointer. - /// - /// The untyped native pointer. - /// - /// A typed native pointer. - val inline ofVoidPtr : address: voidptr -> nativeptr<'T> - - [] - [] - /// Returns an untyped native pointer for a given typed native pointer. - /// - /// The typed native pointer. - /// - /// An untyped native pointer. - val inline toVoidPtr : address: nativeptr<'T> -> voidptr - - [] - [] - /// Returns a typed native pointer for a Common IL (Intermediate Language) signature pointer. - /// - /// The Common IL signature pointer. - /// - /// A typed native pointer. - val inline ofILSigPtr : address: ilsigptr<'T> -> nativeptr<'T> - - [] - [] - /// Returns a Common IL (Intermediate Language) signature pointer for a given typed native pointer. - /// - /// The typed native pointer. - /// - /// A Common IL signature pointer. - val inline toILSigPtr : address: nativeptr<'T> -> ilsigptr<'T> - - /// Converts a given typed native pointer to a managed pointer. - /// - /// The typed native pointer. - /// - /// The managed pointer. - [] - [] - val inline toByRef: address: nativeptr<'T> -> byref<'T> - - [] - [] - /// Returns a typed native pointer by adding index * sizeof<'T> to the - /// given input pointer. - /// - /// The input pointer. - /// The index by which to offset the pointer. - /// - /// A typed pointer. - val inline add : address: nativeptr<'T> -> index: int -> nativeptr<'T> - - [] - [] - /// Dereferences the typed native pointer computed by adding index * sizeof<'T> to the - /// given input pointer. - /// - /// The input pointer. - /// The index by which to offset the pointer. - /// - /// The value at the pointer address. - val inline get : address: nativeptr<'T> -> index: int -> 'T - - [] - [] - /// Dereferences the given typed native pointer. - /// - /// The input pointer. - /// - /// The value at the pointer address. - val inline read : address: nativeptr<'T> -> 'T - - [] - [] - /// Assigns the value into the memory location referenced by the given typed native pointer. - /// - /// The input pointer. - /// The value to assign. - val inline write : address: nativeptr<'T> -> value: 'T -> unit - - [] - [] - /// Assigns the value into the memory location referenced by the typed native - /// pointer computed by adding index * sizeof<'T> to the given input pointer. - /// - /// The input pointer. - /// The index by which to offset the pointer. - /// The value to assign. - val inline set : address: nativeptr<'T> -> index: int -> value: 'T -> unit - - /// Allocates a region of memory on the stack. - /// - /// The number of objects of type T to allocate. - /// - /// A typed pointer to the allocated memory. - [] - [] - val inline stackalloc: count: int -> nativeptr<'T> - - /// Gets the null native pointer. - /// - /// The null native pointer. - [] - [] - [] - val inline nullPtr<'T when 'T : unmanaged> : nativeptr<'T> - - /// Tests whether the given native pointer is null. - /// - /// The input pointer. - /// - /// Whether the given native pointer is null. - [] - [] - val inline isNullPtr: address: nativeptr<'T> -> bool - - [] - [] - /// Clears the value stored at the location of a given native pointer. - /// - /// The input pointer. - val inline clear : address: nativeptr<'T> -> unit - - [] - [] - /// Initializes a specified block of memory starting at a specific address to a given byte count and initial byte value. - /// - /// The input pointer. - /// The initial byte value. - /// The total repeat count of the byte value. - val inline initBlock : address: nativeptr<'T> -> value: byte -> count: uint32 -> unit - - [] - [] - /// Copies a value to a specified destination address from a specified source address. - /// - /// The destination pointer. - /// The source pointer. - val inline copy : destination: nativeptr<'T> -> source: nativeptr<'T> -> unit - - [] - [] - /// Copies a block of memory to a specified destination address starting from a specified source address until a specified byte count of (count * sizeof<'T>). - /// - /// The destination pointer. - /// The source pointer. - /// The source pointer. - val inline copyBlock : destination: nativeptr<'T> -> source: nativeptr<'T> -> count: int -> unit +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections + +[] +[] +/// Contains operations on native pointers. Use of these operators may +/// result in the generation of unverifiable code. +/// +/// +/// Library functionality for native interopability. See +/// also F# External Functions in +/// the F# Language Guide. +/// +module NativePtr = + + /// Returns a typed native pointer for a given machine address. + /// + /// The machine address. + /// + /// A typed native pointer. + /// + /// + [] + [] + val inline ofNativeInt : address: nativeint -> nativeptr<'T> + + /// Returns a machine address for a given typed native pointer. + /// + /// The typed native pointer. + /// + /// The machine address. + /// + /// + [] + [] + val inline toNativeInt : address: nativeptr<'T> -> nativeint + + /// Returns a typed native pointer for a untyped native pointer. + /// + /// The untyped native pointer. + /// + /// A typed native pointer. + /// + /// + [] + [] + val inline ofVoidPtr : address: voidptr -> nativeptr<'T> + + /// Returns an untyped native pointer for a given typed native pointer. + /// + /// The typed native pointer. + /// + /// An untyped native pointer. + /// + /// + [] + [] + val inline toVoidPtr : address: nativeptr<'T> -> voidptr + + /// Returns a typed native pointer for a Common IL (Intermediate Language) signature pointer. + /// + /// The Common IL signature pointer. + /// + /// A typed native pointer. + /// + /// + [] + [] + val inline ofILSigPtr : address: ilsigptr<'T> -> nativeptr<'T> + + /// Returns a Common IL (Intermediate Language) signature pointer for a given typed native pointer. + /// + /// The typed native pointer. + /// + /// A Common IL signature pointer. + /// + /// + [] + [] + val inline toILSigPtr : address: nativeptr<'T> -> ilsigptr<'T> + + /// Converts a given typed native pointer to a managed pointer. + /// + /// The typed native pointer. + /// + /// The managed pointer. + /// + /// + [] + [] + val inline toByRef: address: nativeptr<'T> -> byref<'T> + + /// Returns a typed native pointer by adding index * sizeof<'T> to the + /// given input pointer. + /// + /// The input pointer. + /// The index by which to offset the pointer. + /// + /// A typed pointer. + /// + /// + [] + [] + val inline add : address: nativeptr<'T> -> index: int -> nativeptr<'T> + + /// Dereferences the typed native pointer computed by adding index * sizeof<'T> to the + /// given input pointer. + /// + /// The input pointer. + /// The index by which to offset the pointer. + /// + /// The value at the pointer address. + /// + /// + [] + [] + val inline get : address: nativeptr<'T> -> index: int -> 'T + + /// Dereferences the given typed native pointer. + /// + /// The input pointer. + /// + /// The value at the pointer address. + /// + /// + [] + [] + val inline read : address: nativeptr<'T> -> 'T + + /// Assigns the value into the memory location referenced by the given typed native pointer. + /// + /// The input pointer. + /// The value to assign. + /// + /// + [] + [] + val inline write : address: nativeptr<'T> -> value: 'T -> unit + + /// Assigns the value into the memory location referenced by the typed native + /// pointer computed by adding index * sizeof<'T> to the given input pointer. + /// + /// The input pointer. + /// The index by which to offset the pointer. + /// The value to assign. + /// + /// + [] + [] + val inline set : address: nativeptr<'T> -> index: int -> value: 'T -> unit + + /// Allocates a region of memory on the stack. + /// + /// The number of objects of type T to allocate. + /// + /// A typed pointer to the allocated memory. + /// + /// + [] + [] + val inline stackalloc: count: int -> nativeptr<'T> + + /// Gets the null native pointer. + /// + /// The null native pointer. + /// + /// + [] + [] + [] + val inline nullPtr<'T when 'T : unmanaged> : nativeptr<'T> + + /// Tests whether the given native pointer is null. + /// + /// The input pointer. + /// + /// Whether the given native pointer is null. + /// + /// + [] + [] + val inline isNullPtr: address: nativeptr<'T> -> bool + + /// Clears the value stored at the location of a given native pointer. + /// + /// The input pointer. + /// + /// + [] + [] + val inline clear : address: nativeptr<'T> -> unit + + /// Initializes a specified block of memory starting at a specific address to a given byte count and initial byte value. + /// + /// The input pointer. + /// The initial byte value. + /// The total repeat count of the byte value. + /// + /// + [] + [] + val inline initBlock : address: nativeptr<'T> -> value: byte -> count: uint32 -> unit + + /// Copies a value to a specified destination address from a specified source address. + /// + /// The destination pointer. + /// The source pointer. + /// + /// + [] + [] + val inline copy : destination: nativeptr<'T> -> source: nativeptr<'T> -> unit + + /// Copies a block of memory to a specified destination address starting from a specified source address until a specified byte count of (count * sizeof<'T>). + /// + /// The destination pointer. + /// The source pointer. + /// The source pointer. + /// + /// + [] + [] + val inline copyBlock : destination: nativeptr<'T> -> source: nativeptr<'T> -> count: int -> unit diff --git a/src/fsharp/FSharp.Core/observable.fsi b/src/fsharp/FSharp.Core/observable.fsi index bf3c218de57..80c77039ee0 100644 --- a/src/fsharp/FSharp.Core/observable.fsi +++ b/src/fsharp/FSharp.Core/observable.fsi @@ -2,147 +2,168 @@ namespace Microsoft.FSharp.Control - open System - open Microsoft.FSharp.Core +open System +open Microsoft.FSharp.Core - [] - [] - /// Contains operations for working with first class event and other observable objects. - /// - /// Events and Observables - module Observable = +[] +[] +/// Contains operations for working with first class event and other observable objects. +/// +/// Events and Observables +module Observable = - /// Returns an observable for the merged observations from the sources. - /// The returned object propagates success and error values arising - /// from either source and completes when both the sources have completed. - /// - /// For each observer, the registered intermediate observing object is not - /// thread safe. That is, observations arising from the sources must not - /// be triggered concurrently on different threads. - /// The first Observable. - /// The second Observable. - /// - /// An Observable that propagates information from both sources. - [] - val merge: source1:IObservable<'T> -> source2:IObservable<'T> -> IObservable<'T> + /// Returns an observable for the merged observations from the sources. + /// The returned object propagates success and error values arising + /// from either source and completes when both the sources have completed. + /// + /// For each observer, the registered intermediate observing object is not + /// thread safe. That is, observations arising from the sources must not + /// be triggered concurrently on different threads. + /// + /// The first Observable. + /// The second Observable. + /// + /// An Observable that propagates information from both sources. + /// + /// + [] + val merge: source1:IObservable<'T> -> source2:IObservable<'T> -> IObservable<'T> - /// Returns an observable which transforms the observations of the source by the - /// given function. The transformation function is executed once for each - /// subscribed observer. The returned object also propagates error observations - /// arising from the source and completes when the source completes. - /// The function applied to observations from the source. - /// The input Observable. - /// - /// An Observable of the type specified by mapping. - [] - val map: mapping:('T -> 'U) -> source:IObservable<'T> -> IObservable<'U> + /// Returns an observable which transforms the observations of the source by the + /// given function. The transformation function is executed once for each + /// subscribed observer. The returned object also propagates error observations + /// arising from the source and completes when the source completes. + /// The function applied to observations from the source. + /// The input Observable. + /// + /// An Observable of the type specified by mapping. + /// + /// + [] + val map: mapping:('T -> 'U) -> source:IObservable<'T> -> IObservable<'U> - /// Returns an observable which filters the observations of the source - /// by the given function. The observable will see only those observations - /// for which the predicate returns true. The predicate is executed once for - /// each subscribed observer. The returned object also propagates error - /// observations arising from the source and completes when the source completes. - /// - /// The function to apply to observations to determine if it should - /// be kept. - /// The input Observable. - /// - /// An Observable that filters observations based on filter. - [] - val filter: predicate:('T -> bool) -> source:IObservable<'T> -> IObservable<'T> + /// Returns an observable which filters the observations of the source + /// by the given function. The observable will see only those observations + /// for which the predicate returns true. The predicate is executed once for + /// each subscribed observer. The returned object also propagates error + /// observations arising from the source and completes when the source completes. + /// + /// The function to apply to observations to determine if it should + /// be kept. + /// The input Observable. + /// + /// An Observable that filters observations based on filter. + /// + /// + [] + val filter: predicate:('T -> bool) -> source:IObservable<'T> -> IObservable<'T> - /// Returns two observables which partition the observations of the source by - /// the given function. The first will trigger observations for those values - /// for which the predicate returns true. The second will trigger observations - /// for those values where the predicate returns false. The predicate is - /// executed once for each subscribed observer. Both also propagate all error - /// observations arising from the source and each completes when the source - /// completes. - /// - /// The function to determine which output Observable will trigger - /// a particular observation. - /// The input Observable. - /// - /// A tuple of Observables. The first triggers when the predicate returns true, and - /// the second triggers when the predicate returns false. - [] - val partition: predicate:('T -> bool) -> source:IObservable<'T> -> (IObservable<'T> * IObservable<'T>) + /// Returns two observables which partition the observations of the source by + /// the given function. The first will trigger observations for those values + /// for which the predicate returns true. The second will trigger observations + /// for those values where the predicate returns false. The predicate is + /// executed once for each subscribed observer. Both also propagate all error + /// observations arising from the source and each completes when the source + /// completes. + /// + /// The function to determine which output Observable will trigger + /// a particular observation. + /// The input Observable. + /// + /// A tuple of Observables. The first triggers when the predicate returns true, and + /// the second triggers when the predicate returns false. + /// + /// + [] + val partition: predicate:('T -> bool) -> source:IObservable<'T> -> (IObservable<'T> * IObservable<'T>) - /// Returns two observables which split the observations of the source by the - /// given function. The first will trigger observations x for which the - /// splitter returns Choice1Of2 x. The second will trigger observations - /// y for which the splitter returns Choice2Of2 y The splitter is - /// executed once for each subscribed observer. Both also propagate error - /// observations arising from the source and each completes when the source - /// completes. - /// - /// The function that takes an observation an transforms - /// it into one of the two output Choice types. - /// The input Observable. - /// - /// A tuple of Observables. The first triggers when splitter returns Choice1of2 - /// and the second triggers when splitter returns Choice2of2. - [] - val split: splitter:('T -> Choice<'U1,'U2>) -> source:IObservable<'T> -> (IObservable<'U1> * IObservable<'U2>) + /// Returns two observables which split the observations of the source by the + /// given function. The first will trigger observations x for which the + /// splitter returns Choice1Of2 x. The second will trigger observations + /// y for which the splitter returns Choice2Of2 y The splitter is + /// executed once for each subscribed observer. Both also propagate error + /// observations arising from the source and each completes when the source + /// completes. + /// + /// The function that takes an observation an transforms + /// it into one of the two output Choice types. + /// The input Observable. + /// + /// A tuple of Observables. The first triggers when splitter returns Choice1of2 + /// and the second triggers when splitter returns Choice2of2. + /// + /// + [] + val split: splitter:('T -> Choice<'U1,'U2>) -> source:IObservable<'T> -> (IObservable<'U1> * IObservable<'U2>) - /// Returns an observable which chooses a projection of observations from the source - /// using the given function. The returned object will trigger observations x - /// for which the splitter returns Some x. The returned object also propagates - /// all errors arising from the source and completes when the source completes. - /// - /// The function that returns Some for observations to be propagated - /// and None for observations to ignore. - /// The input Observable. - /// - /// An Observable that only propagates some of the observations from the source. - [] - val choose: chooser:('T -> 'U option) -> source:IObservable<'T> -> IObservable<'U> + /// Returns an observable which chooses a projection of observations from the source + /// using the given function. The returned object will trigger observations x + /// for which the splitter returns Some x. The returned object also propagates + /// all errors arising from the source and completes when the source completes. + /// + /// The function that returns Some for observations to be propagated + /// and None for observations to ignore. + /// The input Observable. + /// + /// An Observable that only propagates some of the observations from the source. + /// + /// + [] + val choose: chooser:('T -> 'U option) -> source:IObservable<'T> -> IObservable<'U> - /// Returns an observable which, for each observer, allocates an item of state - /// and applies the given accumulating function to successive values arising from - /// the input. The returned object will trigger observations for each computed - /// state value, excluding the initial value. The returned object propagates - /// all errors arising from the source and completes when the source completes. - /// - /// For each observer, the registered intermediate observing object is not thread safe. - /// That is, observations arising from the source must not be triggered concurrently - /// on different threads. - /// The function to update the state with each observation. - /// The initial state. - /// The input Observable. - /// - /// An Observable that triggers on the updated state values. - [] - val scan: collector:('U -> 'T -> 'U) -> state:'U -> source:IObservable<'T> -> IObservable<'U> + /// Returns an observable which, for each observer, allocates an item of state + /// and applies the given accumulating function to successive values arising from + /// the input. The returned object will trigger observations for each computed + /// state value, excluding the initial value. The returned object propagates + /// all errors arising from the source and completes when the source completes. + /// + /// For each observer, the registered intermediate observing object is not thread safe. + /// That is, observations arising from the source must not be triggered concurrently + /// on different threads. + /// The function to update the state with each observation. + /// The initial state. + /// The input Observable. + /// + /// An Observable that triggers on the updated state values. + /// + /// + [] + val scan: collector:('U -> 'T -> 'U) -> state:'U -> source:IObservable<'T> -> IObservable<'U> - /// Creates an observer which permanently subscribes to the given observable and which calls - /// the given function for each observation. - /// - /// The function to be called on each observation. - /// The input Observable. - [] - val add : callback:('T -> unit) -> source:IObservable<'T> -> unit + /// Creates an observer which permanently subscribes to the given observable and which calls + /// the given function for each observation. + /// + /// The function to be called on each observation. + /// The input Observable. + /// + /// + [] + val add : callback:('T -> unit) -> source:IObservable<'T> -> unit - /// Creates an observer which subscribes to the given observable and which calls - /// the given function for each observation. - /// - /// The function to be called on each observation. - /// The input Observable. - /// - /// An object that will remove the callback if disposed. - [] - val subscribe : callback:('T -> unit) -> source:IObservable<'T> -> System.IDisposable + /// Creates an observer which subscribes to the given observable and which calls + /// the given function for each observation. + /// + /// The function to be called on each observation. + /// The input Observable. + /// + /// An object that will remove the callback if disposed. + /// + /// + [] + val subscribe : callback:('T -> unit) -> source:IObservable<'T> -> System.IDisposable - /// Returns a new observable that triggers on the second and subsequent triggerings of the input observable. - /// The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as - /// a pair. The argument passed to the N-1th triggering is held in hidden internal state until the - /// Nth triggering occurs. - /// - /// For each observer, the registered intermediate observing object is not thread safe. - /// That is, observations arising from the source must not be triggered concurrently - /// on different threads. - /// The input Observable. - /// - /// An Observable that triggers on successive pairs of observations from the input Observable. - [] - val pairwise: source:IObservable<'T> -> IObservable<'T * 'T> + /// Returns a new observable that triggers on the second and subsequent triggerings of the input observable. + /// The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as + /// a pair. The argument passed to the N-1th triggering is held in hidden internal state until the + /// Nth triggering occurs. + /// + /// For each observer, the registered intermediate observing object is not thread safe. + /// That is, observations arising from the source must not be triggered concurrently + /// on different threads. + /// The input Observable. + /// + /// An Observable that triggers on successive pairs of observations from the input Observable. + /// + /// + [] + val pairwise: source:IObservable<'T> -> IObservable<'T * 'T> diff --git a/src/fsharp/FSharp.Core/option.fsi b/src/fsharp/FSharp.Core/option.fsi index d148f29d4a0..aa85e6414c6 100644 --- a/src/fsharp/FSharp.Core/option.fsi +++ b/src/fsharp/FSharp.Core/option.fsi @@ -15,14 +15,14 @@ module Option = /// Returns true if the option is not None. /// The input option. /// - /// + /// True if the option is not None. + /// + /// /// /// None |> Option.isSome // evaluates to false /// Some 42 |> Option.isSome // evaluates to true /// /// - /// - /// True if the option is not None. [] val inline isSome: option:'T option -> bool @@ -30,14 +30,14 @@ module Option = /// /// The input option. /// - /// + /// True if the option is None. + /// + /// /// /// None |> Option.isNone // evaluates to true /// Some 42 |> Option.isNone // evaluates to false /// /// - /// - /// True if the option is None. [] val inline isNone: option:'T option -> bool @@ -50,7 +50,7 @@ module Option = /// /// Identical to the built-in operator, except with the arguments swapped. /// - /// + /// /// /// (99, None) ||> Option.defaultValue // evaluates to 99 /// (99, Some 42) ||> Option.defaultValue // evaluates to 42 @@ -67,7 +67,7 @@ module Option = /// The option if the option is Some, else the result of evaluating . /// is not evaluated unless is None. /// - /// + /// /// /// None |> Option.defaultWith (fun () -> 99) // evaluates to 99 /// Some 42 |> Option.defaultWith (fun () -> 99) // evaluates to 42 @@ -81,7 +81,9 @@ module Option = /// The value to use if is None. /// The input option. /// - /// + /// The option if the option is Some, else the alternate option. + /// + /// /// /// (None, None) ||> Option.orElse // evaluates to None /// (Some 99, None) ||> Option.orElse // evaluates to Some 99 @@ -89,8 +91,6 @@ module Option = /// (Some 99, Some 42) ||> Option.orElse // evaluates to Some 42 /// /// - /// - /// The option if the option is Some, else the alternate option. [] val orElse: ifNone:'T option -> option:'T option -> 'T option @@ -102,7 +102,7 @@ module Option = /// The option if the option is Some, else the result of evaluating . /// is not evaluated unless is None. /// - /// + /// /// /// None |> Option.orElseWith (fun () -> None) // evaluates to None /// None |> Option.orElseWith (fun () -> (Some 99)) // evaluates to Some 99 @@ -117,15 +117,16 @@ module Option = /// /// The input option. /// - /// + /// The value within the option. + /// + /// Thrown when the option is None. + /// + /// /// /// Some 42 |> Option.get // evaluates to 42 /// None |> Option.get // throws exception! /// /// - /// - /// The value within the option. - /// Thrown when the option is None. [] val get: option:'T option -> 'T @@ -133,14 +134,14 @@ module Option = /// /// The input option. /// - /// + /// A zero if the option is None, a one otherwise. + /// + /// /// /// None |> Option.count // evaluates to 0 /// Some 99 |> Option.count // evaluates to 1 /// /// - /// - /// A zero if the option is None, a one otherwise. [] val count: option:'T option -> int @@ -150,16 +151,16 @@ module Option = /// The initial state. /// The input option. /// - /// + /// The original state if the option is None, otherwise it returns the updated state with the folder + /// and the option value. + /// + /// /// /// (0, None) ||> Option.fold (fun accum x -> accum + x * 2) // evaluates to 0 /// (0, Some 1) ||> Option.fold (fun accum x -> accum + x * 2) // evaluates to 2 /// (10, Some 1) ||> Option.fold (fun accum x -> accum + x * 2) // evaluates to 12 /// /// - /// - /// The original state if the option is None, otherwise it returns the updated state with the folder - /// and the option value. [] val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State @@ -169,16 +170,16 @@ module Option = /// The input option. /// The initial state. /// - /// + /// The original state if the option is None, otherwise it returns the updated state with the folder + /// and the option value. + /// + /// /// /// (None, 0) ||> Option.foldBack (fun x accum -> accum + x * 2) // evaluates to 0 /// (Some 1, 0) ||> Option.foldBack (fun x accum -> accum + x * 2) // evaluates to 2 /// (Some 1, 10) ||> Option.foldBack (fun x accum -> accum + x * 2) // evaluates to 12 /// /// - /// - /// The original state if the option is None, otherwise it returns the updated state with the folder - /// and the option value. [] val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State @@ -187,16 +188,16 @@ module Option = /// A function that evaluates to a boolean when given a value from the option type. /// The input option. /// - /// + /// False if the option is None, otherwise it returns the result of applying the predicate + /// to the option value. + /// + /// /// /// None |> Option.exists (fun x -> x >= 5) // evaluates to false /// Some 42 |> Option.exists (fun x -> x >= 5) // evaluates to true /// Some 4 |> Option.exists (fun x -> x >= 5) // evaluates to false /// /// - /// - /// False if the option is None, otherwise it returns the result of applying the predicate - /// to the option value. [] val exists: predicate:('T -> bool) -> option:'T option -> bool @@ -205,16 +206,16 @@ module Option = /// A function that evaluates to a boolean when given a value from the option type. /// The input option. /// - /// + /// True if the option is None, otherwise it returns the result of applying the predicate + /// to the option value. + /// + /// /// /// None |> Option.forall (fun x -> x >= 5) // evaluates to true /// Some 42 |> Option.forall (fun x -> x >= 5) // evaluates to true /// Some 4 |> Option.forall (fun x -> x >= 5) // evaluates to false /// /// - /// - /// True if the option is None, otherwise it returns the result of applying the predicate - /// to the option value. [] val forall: predicate:('T -> bool) -> option:'T option -> bool @@ -223,15 +224,15 @@ module Option = /// The value to test for equality. /// The input option. /// - /// + /// True if the option is Some and contains a value equal to , otherwise false. + /// + /// /// /// (99, None) ||> Option.contains // evaluates to false /// (99, Some 99) ||> Option.contains // evaluates to true /// (99, Some 100) ||> Option.contains // evaluates to false /// /// - /// - /// True if the option is Some and contains a value equal to , otherwise false. [] val inline contains: value:'T -> option:'T option -> bool when 'T : equality @@ -240,14 +241,14 @@ module Option = /// A function to apply to the option value. /// The input option. /// - /// + /// Unit if the option is None, otherwise it returns the result of applying the predicate + /// + /// /// /// None |> Option.iter (printfn "%s") // does nothing /// Some "Hello world" |> Option.iter (printfn "%s") // prints "Hello world" /// /// - /// - /// Unit if the option is None, otherwise it returns the result of applying the predicate /// to the option value. [] val iter: action:('T -> unit) -> option:'T option -> unit @@ -257,14 +258,14 @@ module Option = /// A function to apply to the option value. /// The input option. /// - /// + /// An option of the input value after applying the mapping function, or None if the input is None. + /// + /// /// /// None |> Option.map (fun x -> x * 2) // evaluates to None /// Some 42 |> Option.map (fun x -> x * 2) // evaluates to Some 84 /// /// - /// - /// An option of the input value after applying the mapping function, or None if the input is None. [] val map: mapping:('T -> 'U) -> option:'T option -> 'U option @@ -274,7 +275,9 @@ module Option = /// The first option. /// The second option. /// - /// + /// An option of the input values after applying the mapping function, or None if either input is None. + /// + /// /// /// (None, None) ||> Option.map2 (fun x y -> x + y) // evaluates to None /// (Some 5, None) ||> Option.map2 (fun x y -> x + y) // evaluates to None @@ -282,8 +285,6 @@ module Option = /// (Some 5, Some 10) ||> Option.map2 (fun x y -> x + y) // evaluates to Some 15 /// /// - /// - /// An option of the input values after applying the mapping function, or None if either input is None. [] val map2: mapping:('T1 -> 'T2 -> 'U) -> option1: 'T1 option -> option2: 'T2 option -> 'U option @@ -294,7 +295,9 @@ module Option = /// The second option. /// The third option. /// - /// + /// An option of the input values after applying the mapping function, or None if any input is None. + /// + /// /// /// (None, None, None) |||> Option.map3 (fun x y z -> x + y + z) // evaluates to None /// (Some 100, None, None) |||> Option.map3 (fun x y z -> x + y + z) // evaluates to None @@ -303,8 +306,6 @@ module Option = /// (Some 5, Some 100, Some 10) |||> Option.map3 (fun x y z -> x + y + z) // evaluates to Some 115 /// /// - /// - /// An option of the input values after applying the mapping function, or None if any input is None. [] val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> option1: 'T1 option -> option2: 'T2 option -> option3: 'T3 option -> 'U option @@ -314,7 +315,9 @@ module Option = /// an option containing a value of type U. /// The input option. /// - /// + /// An option of the output type of the binder. + /// + /// /// /// let tryParse input = /// match System.Int32.TryParse input with @@ -325,8 +328,6 @@ module Option = /// Some "Forty-two" |> Option.bind tryParse // evaluates to None /// /// - /// - /// An option of the output type of the binder. [] val bind: binder:('T -> 'U option) -> option:'T option -> 'U option @@ -335,9 +336,10 @@ module Option = /// The input option. /// /// The input value if the value is Some; otherwise, None. + /// /// flatten is equivalent to bind id. /// - /// + /// /// /// None |> Option.flatten // evaluates to None /// (Some (None)) |> Option.flatten // evaluates to None @@ -352,15 +354,15 @@ module Option = /// A function that evaluates whether the value contained in the option should remain, or be filtered out. /// The input option. /// - /// + /// The input if the predicate evaluates to true; otherwise, None. + /// + /// /// /// None |> Option.filter (fun x -> x >= 5) // evaluates to None /// Some 42 |> Option.filter (fun x -> x >= 5) // evaluates to Some 42 /// Some 4 |> Option.filter (fun x -> x >= 5) // evaluates to None /// /// - /// - /// The input if the predicate evaluates to true; otherwise, None. [] val filter: predicate:('T -> bool) -> option:'T option -> 'T option @@ -368,14 +370,14 @@ module Option = /// /// The input option. /// - /// + /// The result array. + /// + /// /// /// None |> Option.toArray // evaluates to [||] /// Some 42 |> Option.toArray // evaluates to [|42|] /// /// - /// - /// The result array. [] val toArray: option:'T option -> 'T[] @@ -383,14 +385,14 @@ module Option = /// /// The input option. /// - /// + /// The result list. + /// + /// /// /// None |> Option.toList // evaluates to [] /// Some 42 |> Option.toList // evaluates to [42] /// /// - /// - /// The result list. [] val toList: option:'T option -> 'T list @@ -398,14 +400,14 @@ module Option = /// /// The input option. /// - /// + /// The result value. + /// + /// /// /// None |> Option.toNullable // evaluates to new System.Nullable<int>() /// Some 42 |> Option.toNullable // evaluates to new System.Nullable(42) /// /// - /// - /// The result value. [] val toNullable: option:'T option -> Nullable<'T> @@ -413,14 +415,14 @@ module Option = /// /// The input nullable value. /// - /// + /// The result option. + /// + /// /// /// System.Nullable<int>() |> Option.ofNullable // evaluates to None /// System.Nullable(42) |> Option.ofNullable // evaluates to Some 42 /// /// - /// - /// The result option. [] val ofNullable: value:Nullable<'T> -> 'T option @@ -428,14 +430,14 @@ module Option = /// /// The input value. /// - /// + /// The result option. + /// + /// /// /// (null: string) |> Option.ofObj // evaluates to None /// "not a null string" |> Option.ofObj // evaluates to (Some "not a null string") /// /// - /// - /// The result option. [] val ofObj: value: 'T -> 'T option when 'T : null @@ -443,14 +445,14 @@ module Option = /// /// The input value. /// - /// + /// The result value, which is null if the input was None. + /// + /// /// /// None |> Option.toObj // evaluates to null /// Some "not a null string" |> Option.toObj // evaluates to "not a null string" /// /// - /// - /// The result value, which is null if the input was None. [] val toObj: value: 'T option -> 'T when 'T : null @@ -463,6 +465,8 @@ module ValueOption = /// The input value option. /// /// True if the value option is not ValueNone. + /// + /// [] val inline isSome: voption: 'T voption -> bool @@ -471,6 +475,8 @@ module ValueOption = /// The input value option. /// /// True if the voption is ValueNone. + /// + /// [] val inline isNone: voption: 'T voption -> bool @@ -481,6 +487,8 @@ module ValueOption = /// /// The voption if the voption is ValueSome, else the default value. /// Identical to the built-in operator, except with the arguments swapped. + /// + /// [] val defaultValue: value:'T -> voption: 'T voption -> 'T @@ -491,6 +499,8 @@ module ValueOption = /// /// The voption if the voption is ValueSome, else the result of evaluating . /// is not evaluated unless is ValueNone. + /// + /// [] val defaultWith: defThunk:(unit -> 'T) -> voption: 'T voption -> 'T @@ -500,6 +510,8 @@ module ValueOption = /// The input option. /// /// The option if the option is Some, else the alternate option. + /// + /// [] val orElse: ifNone:'T voption -> voption: 'T voption -> 'T voption @@ -510,6 +522,8 @@ module ValueOption = /// /// The voption if the voption is ValueSome, else the result of evaluating . /// is not evaluated unless is ValueNone. + /// + /// [] val orElseWith: ifNoneThunk:(unit -> 'T voption) -> voption: 'T voption -> 'T voption @@ -519,6 +533,8 @@ module ValueOption = /// /// The value within the option. /// Thrown when the option is ValueNone. + /// + /// [] val get: voption: 'T voption -> 'T @@ -527,6 +543,8 @@ module ValueOption = /// The input value option. /// /// A zero if the option is ValueNone, a one otherwise. + /// + /// [] val count: voption: 'T voption -> int @@ -538,6 +556,8 @@ module ValueOption = /// /// The original state if the option is ValueNone, otherwise it returns the updated state with the folder /// and the voption value. + /// + /// [] val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> voption: 'T voption -> 'State @@ -549,6 +569,8 @@ module ValueOption = /// /// The original state if the option is ValueNone, otherwise it returns the updated state with the folder /// and the voption value. + /// + /// [] val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> voption: 'T voption -> state:'State -> 'State @@ -559,6 +581,8 @@ module ValueOption = /// /// False if the option is ValueNone, otherwise it returns the result of applying the predicate /// to the option value. + /// + /// [] val exists: predicate:('T -> bool) -> voption: 'T voption -> bool @@ -569,6 +593,8 @@ module ValueOption = /// /// True if the option is None, otherwise it returns the result of applying the predicate /// to the option value. + /// + /// [] val forall: predicate:('T -> bool) -> voption: 'T voption -> bool @@ -578,6 +604,8 @@ module ValueOption = /// The input value option. /// /// True if the option is ValueSome and contains a value equal to , otherwise false. + /// + /// [] val inline contains: value:'T -> voption: 'T voption -> bool when 'T : equality @@ -588,6 +616,8 @@ module ValueOption = /// /// Unit if the option is ValueNone, otherwise it returns the result of applying the predicate /// to the voption value. + /// + /// [] val iter: action:('T -> unit) -> voption: 'T voption -> unit @@ -597,6 +627,8 @@ module ValueOption = /// The input value option. /// /// A value option of the input value after applying the mapping function, or ValueNone if the input is ValueNone. + /// + /// [] val map: mapping:('T -> 'U) -> voption: 'T voption -> 'U voption @@ -607,6 +639,8 @@ module ValueOption = /// The second value option. /// /// A value option of the input values after applying the mapping function, or ValueNone if either input is ValueNone. + /// + /// [] val map2: mapping:('T1 -> 'T2 -> 'U) -> voption1: 'T1 voption -> voption2: 'T2 voption -> 'U voption @@ -618,6 +652,8 @@ module ValueOption = /// The third value option. /// /// A value option of the input values after applying the mapping function, or ValueNone if any input is ValueNone. + /// + /// [] val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> voption1: 'T1 voption -> voption2: 'T2 voption -> voption3: 'T3 voption -> 'U voption @@ -628,6 +664,8 @@ module ValueOption = /// The input value option. /// /// An option of the output type of the binder. + /// + /// [] val bind: binder:('T -> 'U voption) -> voption: 'T voption -> 'U voption @@ -637,6 +675,8 @@ module ValueOption = /// /// The input value if the value is Some; otherwise, ValueNone. /// flatten is equivalent to bind id. + /// + /// [] val flatten: voption: 'T voption voption -> 'T voption @@ -646,6 +686,8 @@ module ValueOption = /// The input value option. /// /// The input if the predicate evaluates to true; otherwise, ValueNone. + /// + /// [] val filter: predicate:('T -> bool) -> voption: 'T voption -> 'T voption @@ -654,6 +696,8 @@ module ValueOption = /// The input value option. /// /// The result array. + /// + /// [] val toArray: voption: 'T voption -> 'T[] @@ -662,6 +706,8 @@ module ValueOption = /// The input value option. /// /// The result list. + /// + /// [] val toList: voption: 'T voption -> 'T list @@ -670,6 +716,8 @@ module ValueOption = /// The input value option. /// /// The result value. + /// + /// [] val toNullable: voption: 'T voption -> Nullable<'T> @@ -678,6 +726,8 @@ module ValueOption = /// The input nullable value. /// /// The result value option. + /// + /// [] val ofNullable: value:Nullable<'T> -> 'T voption @@ -686,6 +736,8 @@ module ValueOption = /// The input value. /// /// The result value option. + /// + /// [] val ofObj: value: 'T -> 'T voption when 'T : null @@ -694,5 +746,7 @@ module ValueOption = /// The input value. /// /// The result value, which is null if the input was ValueNone. + /// + /// [] val toObj: value: 'T voption -> 'T when 'T : null diff --git a/src/fsharp/FSharp.Core/printf.fsi b/src/fsharp/FSharp.Core/printf.fsi index 46177c6d1af..4508a380f09 100644 --- a/src/fsharp/FSharp.Core/printf.fsi +++ b/src/fsharp/FSharp.Core/printf.fsi @@ -23,6 +23,8 @@ type PrintfFormat<'Printer,'State,'Residue,'Result> = /// The input string. /// /// The PrintfFormat containing the formatted result. + /// + /// new : value:string -> PrintfFormat<'Printer,'State,'Residue,'Result> /// Construct a format string @@ -30,15 +32,25 @@ type PrintfFormat<'Printer,'State,'Residue,'Result> = /// The captured expressions in an interpolated string. /// The types of expressions for %A holes in interpolated string. /// The PrintfFormat containing the formatted result. + /// + /// [] new : value:string * captures: obj[] * captureTys: Type[] -> PrintfFormat<'Printer,'State,'Residue,'Result> /// The raw text of the format string. + /// + /// member Value : string + /// The captures associated with an interpolated string. + /// + /// [] member Captures: obj[] + /// The capture types associated with an interpolated string. + /// + /// [] member CaptureTypes: System.Type[] @@ -51,6 +63,8 @@ type PrintfFormat<'Printer,'State,'Residue,'Result> = /// Tuple of values generated by scan or match. /// /// Language Primitives +/// +/// type PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> = inherit PrintfFormat<'Printer,'State,'Residue,'Result> @@ -60,13 +74,19 @@ type PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> = /// The input string. /// /// The created format string. + /// + /// new: value:string -> PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> /// Construct a format string + /// /// The input string. /// The captured expressions in an interpolated string. /// The types of expressions for %A holes in interpolated string. + /// /// The created format string. + /// + /// [] new: value:string * captures: obj[] * captureTys: Type[] -> PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> @@ -128,6 +148,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val bprintf: builder:StringBuilder -> format:BuilderFormat<'T> -> 'T @@ -137,6 +159,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val fprintf: textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T @@ -146,6 +170,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val fprintfn: textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T @@ -154,6 +180,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val eprintf: format:TextWriterFormat<'T> -> 'T @@ -162,6 +190,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val eprintfn: format:TextWriterFormat<'T> -> 'T @@ -170,6 +200,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val printf: format:TextWriterFormat<'T> -> 'T @@ -178,6 +210,8 @@ module Printf = /// The input formatter. /// /// The return type and arguments of the formatter. + /// + /// [] val printfn: format:TextWriterFormat<'T> -> 'T @@ -187,6 +221,8 @@ module Printf = /// The input formatter. /// /// The formatted string. + /// + /// [] val sprintf: format:StringFormat<'T> -> 'T @@ -198,6 +234,8 @@ module Printf = /// The input formatter. /// /// The arguments of the formatter. + /// + /// [] val kbprintf: continuation:(unit -> 'Result) -> builder:StringBuilder -> format:BuilderFormat<'T,'Result> -> 'T @@ -209,6 +247,8 @@ module Printf = /// The input formatter. /// /// The arguments of the formatter. + /// + /// [] val kfprintf: continuation:(unit -> 'Result) -> textWriter:TextWriter -> format:TextWriterFormat<'T,'Result> -> 'T @@ -220,6 +260,8 @@ module Printf = /// The input formatter. /// /// The arguments of the formatter. + /// + /// [] val kprintf: continuation:(string -> 'Result) -> format:StringFormat<'T,'Result> -> 'T @@ -230,6 +272,8 @@ module Printf = /// The input formatter. /// /// The arguments of the formatter. + /// + /// [] val ksprintf: continuation:(string -> 'Result) -> format:StringFormat<'T,'Result> -> 'T @@ -239,5 +283,7 @@ module Printf = /// The input formatter. /// /// The arguments of the formatter. + /// + /// [] val failwithf: format:StringFormat<'T,'Result> -> 'T diff --git a/src/fsharp/FSharp.Core/quotations.fsi b/src/fsharp/FSharp.Core/quotations.fsi index 01d8b1c4ebc..98d299d38f4 100644 --- a/src/fsharp/FSharp.Core/quotations.fsi +++ b/src/fsharp/FSharp.Core/quotations.fsi @@ -19,12 +19,18 @@ open System.Reflection [] type Var = /// The type associated with the variable + /// + /// member Type : Type /// The declared name of the variable + /// + /// member Name : string /// Indicates if the variable represents a mutable storage location + /// + /// member IsMutable: bool /// Creates a new variable with the given name, type and mutability @@ -34,6 +40,8 @@ type Var = /// Indicates if the variable represents a mutable storage location. Default is false. /// /// The created variable. + /// + /// new : name:string * typ:Type * ?isMutable : bool -> Var /// Fetches or create a new variable with the given name and type from a global pool of shared variables @@ -43,6 +51,8 @@ type Var = /// The type associated with the variable. /// /// The retrieved or created variable. + /// + /// static member Global : name:string * typ:Type -> Var interface System.IComparable @@ -60,16 +70,24 @@ type Expr = /// The function to map variables into expressions. /// /// The expression with the given substitutions. + /// + /// member Substitute : substitution:(Var -> Expr option) -> Expr /// Gets the free expression variables of an expression as a list. /// A sequence of the free variables in the expression. + /// + /// member GetFreeVars : unit -> seq /// Returns type of an expression. + /// + /// member Type : Type /// Returns the custom attributes of an expression. + /// + /// member CustomAttributes : Expr list override Equals : obj:obj -> bool @@ -79,6 +97,8 @@ type Expr = /// The target expression. /// /// The resulting expression. + /// + /// static member AddressOf : target:Expr -> Expr /// Builds an expression that represents setting the value held at a particular address. @@ -87,6 +107,8 @@ type Expr = /// The value to set at the address. /// /// The resulting expression. + /// + /// static member AddressSet : target:Expr * value:Expr -> Expr /// Builds an expression that represents the application of a first class function value to a single argument. @@ -95,6 +117,8 @@ type Expr = /// The argument to the function. /// /// The resulting expression. + /// + /// static member Application: functionExpr:Expr * argument:Expr -> Expr /// Builds an expression that represents the application of a first class function value to multiple arguments @@ -103,6 +127,8 @@ type Expr = /// The list of lists of arguments to the function. /// /// The resulting expression. + /// + /// static member Applications: functionExpr:Expr * arguments:list> -> Expr /// Builds an expression that represents a call to an static method or module-bound function @@ -111,6 +137,8 @@ type Expr = /// The list of arguments to the method. /// /// The resulting expression. + /// + /// static member Call : methodInfo:MethodInfo * arguments:list -> Expr /// Builds an expression that represents a call to an instance method associated with an object @@ -120,6 +148,8 @@ type Expr = /// The list of arguments to the method. /// /// The resulting expression. + /// + /// static member Call : obj:Expr * methodInfo:MethodInfo * arguments:list -> Expr /// Builds an expression that represents a call to an static method or module-bound function @@ -130,6 +160,8 @@ type Expr = /// The list of arguments to the method. /// /// The resulting expression. + /// + /// static member CallWithWitnesses: methodInfo: MethodInfo * methodInfoWithWitnesses: MethodInfo * witnesses: Expr list * arguments: Expr list -> Expr /// Builds an expression that represents a call to an instance method associated with an object @@ -141,6 +173,8 @@ type Expr = /// The list of arguments to the method. /// /// The resulting expression. + /// + /// static member CallWithWitnesses: obj:Expr * methodInfo:MethodInfo * methodInfoWithWitnesses: MethodInfo * witnesses: Expr list * arguments:Expr list -> Expr /// Builds an expression that represents the coercion of an expression to a type @@ -149,6 +183,8 @@ type Expr = /// The target type. /// /// The resulting expression. + /// + /// static member Coerce : source:Expr * target:Type -> Expr /// Builds 'if ... then ... else' expressions. @@ -158,6 +194,8 @@ type Expr = /// The else sub-expression. /// /// The resulting expression. + /// + /// static member IfThenElse : guard:Expr * thenExpr:Expr * elseExpr:Expr -> Expr /// Builds a 'for i = ... to ... do ...' expression that represent loops over integer ranges @@ -168,6 +206,8 @@ type Expr = /// The sub-expression representing the body of the loop. /// /// The resulting expression. + /// + /// static member ForIntegerRangeLoop: loopVariable:Var * start:Expr * endExpr:Expr * body:Expr -> Expr /// Builds an expression that represents the access of a static field @@ -175,6 +215,8 @@ type Expr = /// The description of the field to access. /// /// The resulting expression. + /// + /// static member FieldGet: fieldInfo:FieldInfo -> Expr /// Builds an expression that represents the access of a field of an object @@ -183,6 +225,8 @@ type Expr = /// The description of the field to access. /// /// The resulting expression. + /// + /// static member FieldGet: obj:Expr * fieldInfo:FieldInfo -> Expr /// Builds an expression that represents writing to a static field @@ -191,6 +235,8 @@ type Expr = /// The value to the set to the field. /// /// The resulting expression. + /// + /// static member FieldSet: fieldInfo:FieldInfo * value:Expr -> Expr /// Builds an expression that represents writing to a field of an object @@ -200,6 +246,8 @@ type Expr = /// The value to set to the field. /// /// The resulting expression. + /// + /// static member FieldSet: obj:Expr * fieldInfo:FieldInfo * value:Expr -> Expr /// Builds an expression that represents the construction of an F# function value @@ -208,6 +256,8 @@ type Expr = /// The body of the function. /// /// The resulting expression. + /// + /// static member Lambda : parameter:Var * body:Expr -> Expr /// Builds expressions associated with 'let' constructs @@ -217,6 +267,8 @@ type Expr = /// The sub-expression where the binding is in scope. /// /// The resulting expression. + /// + /// static member Let : letVariable:Var * letExpr:Expr * body:Expr -> Expr /// Builds recursive expressions associated with 'let rec' constructs @@ -225,6 +277,8 @@ type Expr = /// The sub-expression where the bindings are in scope. /// /// The resulting expression. + /// + /// static member LetRecursive : bindings:(Var * Expr) list * body:Expr -> Expr /// Builds an expression that represents the invocation of an object constructor @@ -233,22 +287,26 @@ type Expr = /// The list of arguments to the constructor. /// /// The resulting expression. + /// + /// static member NewObject: constructorInfo:ConstructorInfo * arguments:Expr list -> Expr - /// Builds an expression that represents the invocation of a default object constructor /// /// The type on which the constructor is invoked. /// /// The resulting expression. + /// + /// static member DefaultValue: expressionType:Type -> Expr - /// Builds an expression that represents the creation of an F# tuple value /// /// The list of elements of the tuple. /// /// The resulting expression. + /// + /// static member NewTuple: elements:Expr list -> Expr /// Builds an expression that represents the creation of an F# tuple value @@ -257,6 +315,8 @@ type Expr = /// The list of elements of the tuple. /// /// The resulting expression. + /// + /// static member NewStructTuple: asm:Assembly * elements:Expr list -> Expr /// Builds record-construction expressions @@ -265,6 +325,8 @@ type Expr = /// The list of elements of the record. /// /// The resulting expression. + /// + /// static member NewRecord: recordType:Type * elements:Expr list -> Expr /// Builds an expression that represents the creation of an array value initialized with the given elements @@ -273,6 +335,8 @@ type Expr = /// The list of elements of the array. /// /// The resulting expression. + /// + /// static member NewArray: elementType:Type * elements:Expr list -> Expr /// Builds an expression that represents the creation of a delegate value for the given type @@ -282,6 +346,8 @@ type Expr = /// The body of the function. /// /// The resulting expression. + /// + /// static member NewDelegate: delegateType:Type * parameters:Var list * body:Expr -> Expr /// Builds an expression that represents the creation of a union case value @@ -290,6 +356,8 @@ type Expr = /// The list of arguments for the case. /// /// The resulting expression. + /// + /// static member NewUnionCase: unionCase:UnionCaseInfo * arguments:Expr list -> Expr /// Builds an expression that represents reading a property of an object @@ -299,6 +367,8 @@ type Expr = /// List of indices for the property if it is an indexed property. /// /// The resulting expression. + /// + /// static member PropertyGet: obj:Expr * property:PropertyInfo * ?indexerArgs: Expr list -> Expr /// Builds an expression that represents reading a static property @@ -307,6 +377,8 @@ type Expr = /// List of indices for the property if it is an indexed property. /// /// The resulting expression. + /// + /// static member PropertyGet: property:PropertyInfo * ?indexerArgs: Expr list -> Expr /// Builds an expression that represents writing to a property of an object @@ -317,6 +389,8 @@ type Expr = /// List of indices for the property if it is an indexed property. /// /// The resulting expression. + /// + /// static member PropertySet: obj:Expr * property:PropertyInfo * value:Expr * ?indexerArgs: Expr list -> Expr /// Builds an expression that represents writing to a static property @@ -326,6 +400,8 @@ type Expr = /// List of indices for the property if it is an indexed property. /// /// The resulting expression. + /// + /// static member PropertySet: property:PropertyInfo * value:Expr * ?indexerArgs: Expr list -> Expr /// Builds an expression that represents a nested typed or raw quotation literal @@ -334,6 +410,8 @@ type Expr = /// /// The resulting expression. [] + /// + /// static member Quote: inner:Expr -> Expr /// Builds an expression that represents a nested raw quotation literal @@ -341,6 +419,8 @@ type Expr = /// The expression being quoted. /// /// The resulting expression. + /// + /// static member QuoteRaw: inner:Expr -> Expr /// Builds an expression that represents a nested typed quotation literal @@ -348,6 +428,8 @@ type Expr = /// The expression being quoted. /// /// The resulting expression. + /// + /// static member QuoteTyped: inner:Expr -> Expr /// Builds an expression that represents the sequential execution of one expression followed by another @@ -356,6 +438,8 @@ type Expr = /// The second expression. /// /// The resulting expression. + /// + /// static member Sequential: first:Expr * second:Expr -> Expr /// Builds an expression that represents a try/with construct for exception filtering and catching. @@ -367,6 +451,8 @@ type Expr = /// The expression evaluated when an exception is caught. /// /// The resulting expression. + /// + /// static member TryWith: body:Expr * filterVar:Var * filterBody:Expr * catchVar:Var * catchBody:Expr -> Expr /// Builds an expression that represents a try/finally construct @@ -375,6 +461,8 @@ type Expr = /// The final part of the expression to be evaluated. /// /// The resulting expression. + /// + /// static member TryFinally: body:Expr * compensation:Expr -> Expr /// Builds an expression that represents getting a field of a tuple @@ -383,6 +471,8 @@ type Expr = /// The index of the tuple element to get. /// /// The resulting expression. + /// + /// static member TupleGet: tuple:Expr * index:int -> Expr @@ -392,6 +482,8 @@ type Expr = /// The target type. /// /// The resulting expression. + /// + /// static member TypeTest: source:Expr * target:Type -> Expr /// Builds an expression that represents a test of a value is of a particular union case @@ -400,6 +492,8 @@ type Expr = /// The description of the union case. /// /// The resulting expression. + /// + /// static member UnionCaseTest: source:Expr * unionCase:UnionCaseInfo -> Expr /// Builds an expression that represents a constant value of a particular type @@ -408,6 +502,8 @@ type Expr = /// The type of the object. /// /// The resulting expression. + /// + /// static member Value : value:obj * expressionType:Type -> Expr /// Builds an expression that represents a constant value @@ -415,6 +511,8 @@ type Expr = /// The typed value. /// /// The resulting expression. + /// + /// static member Value : value:'T -> Expr /// Builds an expression that represents a constant value, arising from a variable of the given name @@ -423,6 +521,8 @@ type Expr = /// The name of the variable. /// /// The resulting expression. + /// + /// static member ValueWithName : value:'T * name: string -> Expr /// Builds an expression that represents a constant value of a particular type, arising from a variable of the given name @@ -432,6 +532,8 @@ type Expr = /// The name of the variable. /// /// The resulting expression. + /// + /// static member ValueWithName : value:obj * expressionType:Type * name: string -> Expr /// Builds an expression that represents a value and its associated reflected definition as a quotation @@ -440,9 +542,10 @@ type Expr = /// The definition of the value being quoted. /// /// The resulting expression. + /// + /// static member WithValue: value: 'T * definition: Expr<'T> -> Expr<'T> - /// Builds an expression that represents a value and its associated reflected definition as a quotation /// /// The untyped object. @@ -450,6 +553,8 @@ type Expr = /// The definition of the value being quoted. /// /// The resulting expression. + /// + /// static member WithValue: value: obj * expressionType:Type * definition: Expr -> Expr /// Builds an expression that represents a variable @@ -457,6 +562,8 @@ type Expr = /// The input variable. /// /// The resulting expression. + /// + /// static member Var : variable:Var -> Expr /// Builds an expression that represents setting a mutable variable @@ -465,6 +572,8 @@ type Expr = /// The value to set. /// /// The resulting expression. + /// + /// static member VarSet : variable:Var * value:Expr -> Expr /// Builds an expression that represents a while loop @@ -473,11 +582,10 @@ type Expr = /// The body of the while loop. /// /// The resulting expression. + /// + /// static member WhileLoop : guard:Expr * body:Expr -> Expr - //---------------- - - /// Returns a new typed expression given an underlying runtime-typed expression. /// A type annotation is usually required to use this function, and /// using an incorrect type annotation may result in a later runtime exception. @@ -485,6 +593,8 @@ type Expr = /// The expression to cast. /// /// The resulting typed expression. + /// + /// static member Cast : source:Expr -> Expr<'T> /// Try and find a stored reflection definition for the given method. Stored reflection @@ -493,6 +603,8 @@ type Expr = /// The description of the method to find. /// /// The reflection definition or None if a match could not be found. + /// + /// static member TryGetReflectedDefinition : methodBase:MethodBase -> Expr option /// This function is called automatically when quotation syntax (<@ @>) and other sources of @@ -504,6 +616,8 @@ type Expr = /// The serialized form of the quoted expression. /// /// The resulting expression. + /// + /// static member Deserialize : qualifyingType:System.Type * spliceTypes:list * spliceExprs:list * bytes:byte[] -> Expr /// This function is called automatically when quotation syntax (<@ @>) and other sources of @@ -516,6 +630,8 @@ type Expr = /// The serialized form of the quoted expression. /// /// The resulting expression. + /// + /// static member Deserialize40 : qualifyingType:Type * referencedTypes:Type[] * spliceTypes:Type[] * spliceExprs:Expr[] * bytes:byte[] -> Expr /// Permits interactive environments such as F# Interactive @@ -525,6 +641,8 @@ type Expr = /// The assembly associated with the resource. /// The unique name for the resources being added. /// The serialized resource to register with the environment. + /// + /// static member RegisterReflectedDefinitions: assembly:Assembly * resource:string * serializedValue:byte[] -> unit /// Permits interactive environments such as F# Interactive @@ -535,6 +653,8 @@ type Expr = /// The unique name for the resources being added. /// The type definitions referenced. /// The serialized resource to register with the environment. + /// + /// static member RegisterReflectedDefinitions: assembly:Assembly * resource:string * serializedValue:byte[] * referencedTypes:Type[] -> unit /// Fetches or creates a new variable with the given name and type from a global pool of shared variables @@ -543,6 +663,8 @@ type Expr = /// The variable name. /// /// The created of fetched typed global variable. + /// + /// static member GlobalVar<'T> : name:string -> Expr<'T> /// Format the expression as a string @@ -552,7 +674,6 @@ type Expr = /// The formatted string. member ToString : full: bool -> string - /// Type-carrying quoted expressions. Expressions are generated either /// by quotations in source text or programatically and [] @@ -560,9 +681,10 @@ and [] Expr<'T> = inherit Expr /// Gets the raw expression associated with this type-carrying expression + /// + /// member Raw : Expr - [] /// Contains a set of primitive F# active patterns to analyze F# expression objects module Patterns = @@ -572,6 +694,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the sub-expression of the input AddressOf expression + /// + /// [] val (|AddressOf|_|) : input:Expr -> Expr option @@ -580,6 +704,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the target and value expressions of the input expression + /// + /// [] val (|AddressSet|_|) : input:Expr -> (Expr * Expr) option @@ -588,6 +714,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the function and argument of the input expression + /// + /// [] val (|Application|_|) : input:Expr -> (Expr * Expr) option @@ -596,6 +724,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the object, method and argument sub-expressions of the input expression + /// + /// [] val (|Call|_|) : input:Expr -> (Expr option * MethodInfo * Expr list) option @@ -604,6 +734,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the object, method, witness-argument and argument sub-expressions of the input expression + /// + /// [] val (|CallWithWitnesses|_|) : input:Expr -> (Expr option * MethodInfo * MethodInfo * Expr list * Expr list) option @@ -612,6 +744,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the source expression and target type of the input expression + /// + /// [] val (|Coerce|_|) : input:Expr -> (Expr * Type) option @@ -620,6 +754,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the object and field of the input expression + /// + /// [] val (|FieldGet|_|) : input:Expr -> (Expr option * FieldInfo) option @@ -628,6 +764,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the object, field and value of the input expression + /// + /// [] val (|FieldSet|_|) : input:Expr -> (Expr option * FieldInfo * Expr) option @@ -636,6 +774,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the value, start, finish and body of the input expression + /// + /// [] val (|ForIntegerRangeLoop|_|) : input:Expr -> (Var * Expr * Expr * Expr) option @@ -644,6 +784,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the guard and body of the input expression + /// + /// [] val (|WhileLoop|_|) : input:Expr -> (Expr * Expr) option @@ -652,6 +794,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the condition, then-branch and else-branch of the input expression + /// + /// [] val (|IfThenElse|_|) : input:Expr -> (Expr * Expr * Expr) option @@ -660,6 +804,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the variable and body of the input expression + /// + /// [] val (|Lambda|_|) : input:Expr -> (Var * Expr) option @@ -668,6 +814,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the variable, binding expression and body of the input expression + /// + /// [] val (|Let|_|) : input:Expr -> (Var * Expr * Expr) option @@ -676,6 +824,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the bindings and body of the input expression + /// + /// [] val (|LetRecursive|_|) : input:Expr -> ((Var * Expr) list * Expr) option @@ -684,6 +834,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the element type and values of the input expression + /// + /// [] val (|NewArray|_|) : input:Expr -> (Type * Expr list) option @@ -692,6 +844,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the relevant type of the input expression + /// + /// [] val (|DefaultValue|_|) : input:Expr -> Type option @@ -700,6 +854,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the delegate type, argument parameters and body of the input expression + /// + /// [] val (|NewDelegate|_|) : input:Expr -> (Type * Var list * Expr) option @@ -708,6 +864,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the constructor and arguments of the input expression + /// + /// [] val (|NewObject|_|) : input:Expr -> (ConstructorInfo * Expr list) option @@ -716,6 +874,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the record type and field values of the input expression + /// + /// [] val (|NewRecord|_|) : input:Expr -> (Type * Expr list) option @@ -724,6 +884,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the union case and field values of the input expression + /// + /// [] val (|NewUnionCase|_|) : input:Expr -> (UnionCaseInfo * Expr list) option @@ -732,6 +894,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the element expressions of the input expression + /// + /// [] val (|NewTuple|_|) : input:Expr -> (Expr list) option @@ -740,6 +904,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the element expressions of the input expression + /// + /// [] val (|NewStructTuple|_|) : input:Expr -> (Expr list) option @@ -748,6 +914,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the object, property and indexer arguments of the input expression + /// + /// [] val (|PropertyGet|_|) : input:Expr -> (Expr option * PropertyInfo * Expr list) option @@ -756,6 +924,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the object, property, indexer arguments and setter value of the input expression + /// + /// [] val (|PropertySet|_|) : input:Expr -> (Expr option * PropertyInfo * Expr list * Expr) option @@ -764,6 +934,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the nested quotation expression of the input expression + /// + /// [] [] val (|Quote|_|) : input:Expr -> Expr option @@ -773,6 +945,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the nested quotation expression of the input expression + /// + /// [] val (|QuoteRaw|_|) : input:Expr -> Expr option @@ -781,6 +955,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the nested quotation expression of the input expression + /// + /// [] val (|QuoteTyped|_|) : input:Expr -> Expr option @@ -789,6 +965,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the two sub-expressions of the input expression + /// + /// [] val (|Sequential|_|) : input:Expr -> (Expr * Expr) option @@ -797,6 +975,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the body, exception variable, filter expression and catch expression of the input expression + /// + /// [] val (|TryWith|_|) : input:Expr -> (Expr * Var * Expr * Var * Expr) option @@ -805,6 +985,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the body and handler parts of the try/finally expression + /// + /// [] val (|TryFinally|_|) : input:Expr -> (Expr * Expr) option @@ -813,6 +995,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the expression and tuple field being accessed + /// + /// [] val (|TupleGet|_|) : input:Expr -> (Expr * int) option @@ -821,6 +1005,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the expression and type being tested + /// + /// [] val (|TypeTest|_|) : input:Expr -> (Expr * Type) option @@ -829,6 +1015,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the expression and union case being tested + /// + /// [] val (|UnionCaseTest|_|) : input:Expr -> (Expr * UnionCaseInfo) option @@ -837,6 +1025,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the boxed value and its static type + /// + /// [] val (|Value|_|) : input:Expr -> (obj * Type) option @@ -845,6 +1035,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the boxed value, its static type and its name + /// + /// [] val (|ValueWithName|_|) : input:Expr -> (obj * Type * string) option @@ -853,6 +1045,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the boxed value, its static type and its definition + /// + /// [] val (|WithValue|_|) : input:Expr -> (obj * Type * Expr) option @@ -861,6 +1055,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the variable of the input expression + /// + /// [] val (|Var|_|) : input:Expr -> Var option @@ -869,6 +1065,8 @@ module Patterns = /// The input expression to match against. /// /// When successful, the pattern binds the variable and value expression of the input expression + /// + /// [] val (|VarSet|_|) : input:Expr -> (Var * Expr) option @@ -881,6 +1079,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the curried variables and body of the input expression + /// + /// [] val (|Lambdas|_|) : input:Expr -> (Var list list * Expr) option @@ -889,6 +1089,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the function and curried arguments of the input expression + /// + /// [] val (|Applications|_|) : input:Expr -> (Expr * Expr list list) option @@ -897,6 +1099,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the left and right parts of the input expression + /// + /// [] val (|AndAlso|_|) : input:Expr -> (Expr * Expr) option @@ -905,6 +1109,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the left and right parts of the input expression + /// + /// [] val (|OrElse|_|) : input:Expr -> (Expr * Expr) option @@ -913,6 +1119,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern does not bind any results + /// + /// [] val (|Unit|_|) : input:Expr -> unit option @@ -921,6 +1129,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Bool|_|) : input:Expr -> bool option @@ -929,6 +1139,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|String|_|) : input:Expr -> string option @@ -937,6 +1149,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Single|_|) : input:Expr -> float32 option @@ -945,6 +1159,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Double|_|) : input:Expr -> float option @@ -953,6 +1169,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Char|_|) : input:Expr -> char option @@ -961,6 +1179,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|SByte|_|) : input:Expr -> sbyte option @@ -969,6 +1189,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Byte|_|) : input:Expr -> byte option @@ -977,6 +1199,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Int16|_|) : input:Expr -> int16 option @@ -985,6 +1209,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|UInt16|_|) : input:Expr -> uint16 option @@ -993,6 +1219,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Int32|_|) : input:Expr -> int32 option @@ -1001,6 +1229,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|UInt32|_|) : input:Expr -> uint32 option @@ -1009,6 +1239,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Int64|_|) : input:Expr -> int64 option @@ -1017,6 +1249,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|UInt64|_|) : input:Expr -> uint64 option @@ -1025,6 +1259,8 @@ module DerivedPatterns = /// The input expression to match against. /// /// When successful, the pattern binds the constant value from the input expression + /// + /// [] val (|Decimal|_|) : input:Expr -> decimal option @@ -1038,6 +1274,8 @@ module DerivedPatterns = /// The optional target object (present if the target is an /// instance method), the generic type instantiation (non-empty if the target is a generic /// instantiation), and the arguments to the function or method. + /// + /// [] val (|SpecificCall|_|) : templateParameter:Expr -> (Expr -> (Expr option * list * list) option) @@ -1046,6 +1284,8 @@ module DerivedPatterns = /// The description of the method. /// /// The expression of the method definition if found, or None. + /// + /// [] val (|MethodWithReflectedDefinition|_|) : methodBase:MethodBase -> Expr option @@ -1054,6 +1294,8 @@ module DerivedPatterns = /// The description of the property. /// /// The expression of the method definition if found, or None. + /// + /// [] val (|PropertyGetterWithReflectedDefinition|_|) : propertyInfo:PropertyInfo -> Expr option @@ -1062,6 +1304,8 @@ module DerivedPatterns = /// The description of the property. /// /// The expression of the method definition if found, or None. + /// + /// [] val (|PropertySetterWithReflectedDefinition|_|) : propertyInfo:PropertyInfo -> Expr option @@ -1074,6 +1318,8 @@ module ExprShape = /// The input expression. /// /// The decomposed Var, Lambda, or ConstApp. + /// + /// [] val (|ShapeVar|ShapeLambda|ShapeCombination|) : input:Expr -> Choice] type UnionCaseInfo = /// The name of the case. + /// + /// member Name : string + /// The type in which the case occurs. + /// + /// member DeclaringType: Type /// Returns the custom attributes associated with the case. /// An array of custom attributes. + /// + /// member GetCustomAttributes: unit -> obj[] + /// Returns the custom attributes associated with the case matching the given attribute type. /// The type of attributes to return. /// /// An array of custom attributes. + /// + /// member GetCustomAttributes: attributeType:System.Type -> obj[] /// Returns the custom attributes data associated with the case. /// An list of custom attribute data items. + /// + /// member GetCustomAttributesData: unit -> System.Collections.Generic.IList /// The fields associated with the case, represented by a PropertyInfo. /// The fields associated with the case. + /// + /// member GetFields: unit -> PropertyInfo [] /// The integer tag for the case. + /// + /// member Tag: int - [] /// Contains operations associated with constructing and analyzing values associated with F# types /// such as records, unions and tuples. @@ -57,7 +72,10 @@ type FSharpValue = /// The PropertyInfo describing the field to read. /// /// Thrown when the input is not a record value. + /// /// The field from the record. + /// + /// static member GetRecordField: record:obj * info:PropertyInfo -> obj /// Precompute a function for reading a particular field from a record. @@ -73,6 +91,8 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// /// A function to read the specified field from the record. + /// + /// static member PreComputeRecordFieldReader : info:PropertyInfo -> (obj -> obj) /// Creates an instance of a record type. @@ -86,6 +106,8 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// /// The created record. + /// + /// static member MakeRecord: recordType:Type * values:obj [] * ?bindingFlags:BindingFlags -> obj /// Reads all the fields from a record value. @@ -97,6 +119,8 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// /// The array of fields from the record. + /// + /// static member GetRecordFields: record:obj * ?bindingFlags:BindingFlags -> obj[] /// Precompute a function for reading all the fields from a record. The fields are returned in the @@ -116,6 +140,8 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// /// An optimized reader for the given record type. + /// + /// static member PreComputeRecordReader : recordType:Type * ?bindingFlags:BindingFlags -> (obj -> obj[]) /// Precompute a function for constructing a record value. @@ -129,6 +155,8 @@ type FSharpValue = /// Thrown when the input type is not a record type. /// /// A function to construct records of the given type. + /// + /// static member PreComputeRecordConstructor : recordType:Type * ?bindingFlags:BindingFlags -> (obj[] -> obj) /// Get a ConstructorInfo for a record type @@ -137,6 +165,8 @@ type FSharpValue = /// Optional binding flags. /// /// A ConstructorInfo for the given record type. + /// + /// static member PreComputeRecordConstructorInfo: recordType:Type * ?bindingFlags:BindingFlags -> ConstructorInfo /// Create a union case value. @@ -146,6 +176,8 @@ type FSharpValue = /// Optional binding flags. /// /// The constructed union case. + /// + /// static member MakeUnion: unionCase:UnionCaseInfo * args:obj [] * ?bindingFlags:BindingFlags -> obj /// Identify the union case and its fields for an object @@ -162,6 +194,8 @@ type FSharpValue = /// Thrown when the input type is not a union case value. /// /// The description of the union case and its fields. + /// + /// static member GetUnionFields: value:obj * unionType:Type * ?bindingFlags:BindingFlags -> UnionCaseInfo * obj [] /// Assumes the given type is a union type. @@ -175,6 +209,8 @@ type FSharpValue = /// Optional binding flags. /// /// An optimized function to read the tags of the given union type. + /// + /// static member PreComputeUnionTagReader : unionType:Type * ?bindingFlags:BindingFlags -> (obj -> int) /// Precompute a property or static method for reading an integer representing the case tag of a union type. @@ -183,6 +219,8 @@ type FSharpValue = /// Optional binding flags. /// /// The description of the union case reader. + /// + /// static member PreComputeUnionTagMemberInfo : unionType:Type * ?bindingFlags:BindingFlags -> MemberInfo /// Precompute a function for reading all the fields for a particular discriminator case of a union type @@ -193,6 +231,8 @@ type FSharpValue = /// Optional binding flags. /// /// A function to for reading the fields of the given union case. + /// + /// static member PreComputeUnionReader : unionCase:UnionCaseInfo * ?bindingFlags:BindingFlags -> (obj -> obj[]) /// Precompute a function for constructing a discriminated union value for a particular union case. @@ -201,6 +241,8 @@ type FSharpValue = /// Optional binding flags. /// /// A function for constructing values of the given union case. + /// + /// static member PreComputeUnionConstructor : unionCase:UnionCaseInfo * ?bindingFlags:BindingFlags -> (obj[] -> obj) /// A method that constructs objects of the given case @@ -209,6 +251,8 @@ type FSharpValue = /// Optional binding flags. /// /// The description of the constructor of the given union case. + /// + /// static member PreComputeUnionConstructorInfo: unionCase:UnionCaseInfo * ?bindingFlags:BindingFlags -> MethodInfo /// Reads all the fields from a value built using an instance of an F# exception declaration @@ -221,6 +265,8 @@ type FSharpValue = /// Thrown when the input type is not an F# exception. /// /// The fields from the given exception. + /// + /// static member GetExceptionFields: exn:obj * ?bindingFlags:BindingFlags -> obj[] /// Creates an instance of a tuple type @@ -233,6 +279,8 @@ type FSharpValue = /// Thrown if no elements are given. /// /// An instance of the tuple type with the given elements. + /// + /// static member MakeTuple: tupleElements:obj[] * tupleType:Type -> obj /// Reads a field from a tuple value. @@ -243,6 +291,8 @@ type FSharpValue = /// The index of the field to read. /// /// The value of the field. + /// + /// static member GetTupleField: tuple:obj * index:int -> obj /// Reads all fields from a tuple. @@ -254,6 +304,8 @@ type FSharpValue = /// Thrown when the input is not a tuple value. /// /// An array of the fields from the given tuple. + /// + /// static member GetTupleFields: tuple:obj -> obj [] /// Precompute a function for reading the values of a particular tuple type @@ -266,7 +318,9 @@ type FSharpValue = /// Thrown when the given type is not a tuple type. /// /// A function to read values of the given tuple type. - static member PreComputeTupleReader : tupleType:Type -> (obj -> obj[]) + /// + /// + static member PreComputeTupleReader: tupleType:Type -> (obj -> obj[]) /// Gets information that indicates how to read a field of a tuple /// @@ -274,6 +328,8 @@ type FSharpValue = /// The index of the tuple element to describe. /// /// The description of the tuple element and an optional type and index if the tuple is big. + /// + /// static member PreComputeTuplePropertyInfo: tupleType:Type * index:int -> PropertyInfo * (Type * int) option /// Precompute a function for reading the values of a particular tuple type @@ -286,7 +342,9 @@ type FSharpValue = /// Thrown when the given type is not a tuple type. /// /// A function to read a particular tuple type. - static member PreComputeTupleConstructor : tupleType:Type -> (obj[] -> obj) + /// + /// + static member PreComputeTupleConstructor: tupleType:Type -> (obj[] -> obj) /// Gets a method that constructs objects of the given tuple type. /// For small tuples, no additional type will be returned. @@ -302,6 +360,8 @@ type FSharpValue = /// /// The description of the tuple type constructor and an optional extra type /// for large tuples. + /// + /// static member PreComputeTupleConstructorInfo: tupleType:Type -> ConstructorInfo * Type option /// Builds a typed function from object from a dynamic function implementation @@ -310,7 +370,9 @@ type FSharpValue = /// The untyped lambda of the function implementation. /// /// A typed function from the given dynamic implementation. - static member MakeFunction : functionType:Type * implementation:(obj -> obj) -> obj + /// + /// + static member MakeFunction: functionType:Type * implementation:(obj -> obj) -> obj [] /// Contains operations associated with constructing and analyzing F# types such as records, unions and tuples @@ -324,6 +386,8 @@ type FSharpType = /// Optional binding flags. /// /// An array of descriptions of the properties of the record type. + /// + /// static member GetRecordFields: recordType:Type * ?bindingFlags:BindingFlags -> PropertyInfo[] /// Gets the cases of a union type. @@ -336,8 +400,9 @@ type FSharpType = /// Thrown when the input type is not a union type. /// /// An array of descriptions of the cases of the given union type. + /// + /// static member GetUnionCases: unionType:Type * ?bindingFlags:BindingFlags -> UnionCaseInfo[] - /// Return true if the typ is a representation of an F# record type /// @@ -345,6 +410,8 @@ type FSharpType = /// Optional binding flags. /// /// True if the type check succeeds. + /// + /// static member IsRecord: typ:Type * ?bindingFlags:BindingFlags -> bool /// Returns true if the typ is a representation of an F# union type or the runtime type of a value of that type @@ -353,6 +420,8 @@ type FSharpType = /// Optional binding flags. /// /// True if the type check succeeds. + /// + /// static member IsUnion: typ:Type * ?bindingFlags:BindingFlags -> bool /// Reads all the fields from an F# exception declaration, in declaration order @@ -365,6 +434,8 @@ type FSharpType = /// Thrown if the given type is not an exception. /// /// An array containing the PropertyInfo of each field in the exception. + /// + /// static member GetExceptionFields: exceptionType:Type * ?bindingFlags:BindingFlags -> PropertyInfo[] /// Returns true if the typ is a representation of an F# exception declaration @@ -373,6 +444,8 @@ type FSharpType = /// Optional binding flags. /// /// True if the type check is an F# exception. + /// + /// static member IsExceptionRepresentation: exceptionType:Type * ?bindingFlags:BindingFlags -> bool /// Returns a representing the F# function type with the given domain and range @@ -381,6 +454,8 @@ type FSharpType = /// The output type of the function. /// /// The function type with the given domain and range. + /// + /// static member MakeFunctionType: domain:Type * range:Type -> Type /// Returns a representing an F# tuple type with the given element types @@ -388,6 +463,8 @@ type FSharpType = /// An array of types for the tuple elements. /// /// The type representing the tuple containing the input elements. + /// + /// static member MakeTupleType: types:Type[] -> Type /// Returns a representing an F# tuple type with the given element types @@ -396,6 +473,8 @@ type FSharpType = /// An array of types for the tuple elements. /// /// The type representing the tuple containing the input elements. + /// + /// static member MakeTupleType: asm:Assembly * types:Type[] -> Type /// Returns a representing an F# struct tuple type with the given element types @@ -404,6 +483,8 @@ type FSharpType = /// An array of types for the tuple elements. /// /// The type representing the struct tuple containing the input elements. + /// + /// static member MakeStructTupleType: asm:Assembly * types:Type[] -> Type /// Return true if the typ is a representation of an F# tuple type @@ -411,6 +492,8 @@ type FSharpType = /// The type to check. /// /// True if the type check succeeds. + /// + /// static member IsTuple : typ:Type -> bool /// Return true if the typ is a representation of an F# function type or the runtime type of a closure implementing an F# function type @@ -418,6 +501,8 @@ type FSharpType = /// The type to check. /// /// True if the type check succeeds. + /// + /// static member IsFunction : typ:Type -> bool /// Return true if the typ is a value corresponding to the compiled form of an F# module @@ -425,14 +510,17 @@ type FSharpType = /// The type to check. /// /// True if the type check succeeds. + /// + /// static member IsModule: typ:Type -> bool - /// Gets the tuple elements from the representation of an F# tuple type. /// /// The input tuple type. /// /// An array of the types contained in the given tuple type. + /// + /// static member GetTupleElements : tupleType:Type -> Type[] /// Gets the domain and range types from an F# function type or from the runtime type of a closure implementing an F# type @@ -440,6 +528,8 @@ type FSharpType = /// The input function type. /// /// A tuple of the domain and range types of the input function. + /// + /// static member GetFunctionElements : functionType:Type -> Type * Type [] @@ -457,7 +547,10 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a record type. /// /// The created record. + /// + /// static member MakeRecord: recordType:Type * values:obj [] * ?allowAccessToPrivateRepresentation : bool -> obj + /// Reads all the fields from a record value. /// /// Assumes the given input is a record value. If not, is raised. @@ -468,6 +561,8 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a record type. /// /// The array of fields from the record. + /// + /// static member GetRecordFields: record:obj * ?allowAccessToPrivateRepresentation : bool -> obj[] /// Precompute a function for reading all the fields from a record. The fields are returned in the @@ -487,7 +582,10 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a record type. /// /// An optimized reader for the given record type. + /// + /// static member PreComputeRecordReader : recordType:Type * ?allowAccessToPrivateRepresentation : bool -> (obj -> obj[]) + /// Precompute a function for constructing a record value. /// /// Assumes the given type is a RecordType. @@ -499,6 +597,8 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a record type. /// /// A function to construct records of the given type. + /// + /// static member PreComputeRecordConstructor : recordType:Type * ?allowAccessToPrivateRepresentation : bool -> (obj[] -> obj) /// Get a ConstructorInfo for a record type @@ -507,6 +607,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// A ConstructorInfo for the given record type. + /// + /// static member PreComputeRecordConstructorInfo: recordType:Type * ?allowAccessToPrivateRepresentation : bool-> ConstructorInfo /// Create a union case value. @@ -516,6 +618,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// The constructed union case. + /// + /// static member MakeUnion: unionCase:UnionCaseInfo * args:obj [] * ?allowAccessToPrivateRepresentation : bool-> obj /// Identify the union case and its fields for an object @@ -533,6 +637,8 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a union case value. /// /// The description of the union case and its fields. + /// + /// static member GetUnionFields: value:obj * unionType:Type * ?allowAccessToPrivateRepresentation : bool -> UnionCaseInfo * obj [] /// Assumes the given type is a union type. @@ -546,6 +652,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// An optimized function to read the tags of the given union type. + /// + /// static member PreComputeUnionTagReader : unionType:Type * ?allowAccessToPrivateRepresentation : bool -> (obj -> int) /// Precompute a property or static method for reading an integer representing the case tag of a union type. @@ -554,6 +662,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// The description of the union case reader. + /// + /// static member PreComputeUnionTagMemberInfo : unionType:Type * ?allowAccessToPrivateRepresentation : bool -> MemberInfo /// Precompute a function for reading all the fields for a particular discriminator case of a union type @@ -564,6 +674,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// A function to for reading the fields of the given union case. + /// + /// static member PreComputeUnionReader : unionCase:UnionCaseInfo * ?allowAccessToPrivateRepresentation : bool -> (obj -> obj[]) /// Precompute a function for constructing a discriminated union value for a particular union case. @@ -572,6 +684,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// A function for constructing values of the given union case. + /// + /// static member PreComputeUnionConstructor : unionCase:UnionCaseInfo * ?allowAccessToPrivateRepresentation : bool -> (obj[] -> obj) /// A method that constructs objects of the given case @@ -580,6 +694,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// The description of the constructor of the given union case. + /// + /// static member PreComputeUnionConstructorInfo: unionCase:UnionCaseInfo * ?allowAccessToPrivateRepresentation : bool -> MethodInfo /// Reads all the fields from a value built using an instance of an F# exception declaration @@ -592,6 +708,8 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not an F# exception. /// /// The fields from the given exception. + /// + /// static member GetExceptionFields: exn:obj * ?allowAccessToPrivateRepresentation : bool -> obj[] type FSharpType with @@ -603,6 +721,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// An array of descriptions of the properties of the record type. + /// + /// static member GetRecordFields: recordType:Type * ?allowAccessToPrivateRepresentation : bool -> PropertyInfo[] /// Gets the cases of a union type. @@ -615,15 +735,18 @@ module FSharpReflectionExtensions = /// Thrown when the input type is not a union type. /// /// An array of descriptions of the cases of the given union type. + /// + /// static member GetUnionCases: unionType:Type * ?allowAccessToPrivateRepresentation : bool -> UnionCaseInfo[] - /// Return true if the typ is a representation of an F# record type /// /// The type to check. /// Optional flag that denotes accessibility of the private representation. /// /// True if the type check succeeds. + /// + /// static member IsRecord: typ:Type * ?allowAccessToPrivateRepresentation : bool -> bool /// Returns true if the typ is a representation of an F# union type or the runtime type of a value of that type @@ -632,6 +755,8 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// True if the type check succeeds. + /// + /// static member IsUnion: typ:Type * ?allowAccessToPrivateRepresentation : bool -> bool /// Reads all the fields from an F# exception declaration, in declaration order @@ -644,6 +769,8 @@ module FSharpReflectionExtensions = /// Thrown if the given type is not an exception. /// /// An array containing the PropertyInfo of each field in the exception. + /// + /// static member GetExceptionFields: exceptionType:Type * ?allowAccessToPrivateRepresentation : bool -> PropertyInfo[] /// Returns true if the exceptionType is a representation of an F# exception declaration @@ -652,13 +779,10 @@ module FSharpReflectionExtensions = /// Optional flag that denotes accessibility of the private representation. /// /// True if the type check is an F# exception. + /// + /// static member IsExceptionRepresentation: exceptionType:Type * ?allowAccessToPrivateRepresentation : bool -> bool - -namespace Microsoft.FSharp.Reflection - -open Microsoft.FSharp.Core - module internal ReflectionUtils = type BindingFlags = System.Reflection.BindingFlags val toBindingFlags : allowAccessToNonPublicMembers : bool -> BindingFlags \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/result.fsi b/src/fsharp/FSharp.Core/result.fsi index 52e23db5d13..956b6c80988 100644 --- a/src/fsharp/FSharp.Core/result.fsi +++ b/src/fsharp/FSharp.Core/result.fsi @@ -11,10 +11,13 @@ namespace Microsoft.FSharp.Core module Result = /// map f inp evaluates to match inp with Error e -> Error e | Ok x -> Ok (f x). + /// /// A function to apply to the OK result value. /// The input result. /// /// A result of the input value after applying the mapping function, or Error if the input is Error. + /// + /// [] val map : mapping:('T -> 'U) -> result:Result<'T, 'TError> -> Result<'U, 'TError> @@ -24,6 +27,8 @@ namespace Microsoft.FSharp.Core /// The input result. /// /// A result of the error value after applying the mapping function, or Ok if the input is Ok. + /// + /// [] val mapError: mapping:('TError -> 'U) -> result:Result<'T, 'TError> -> Result<'T, 'U> @@ -34,5 +39,7 @@ namespace Microsoft.FSharp.Core /// The input result. /// /// A result of the output type of the binder. + /// + /// [] val bind: binder:('T -> Result<'U, 'TError>) -> result:Result<'T, 'TError> -> Result<'U, 'TError> diff --git a/src/fsharp/FSharp.Core/seq.fsi b/src/fsharp/FSharp.Core/seq.fsi index 90191d915f7..7a948e91ac3 100644 --- a/src/fsharp/FSharp.Core/seq.fsi +++ b/src/fsharp/FSharp.Core/seq.fsi @@ -2,1684 +2,1848 @@ namespace Microsoft.FSharp.Collections - open System - open System.Collections - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - - /// Contains operations for working with values of type . - [] - [] - module Seq = - - /// Returns a new sequence that contains all pairings of elements from the first and second sequences. - /// - /// The first sequence. - /// The second sequence. - /// - /// The result sequence. - /// - /// - /// - /// ([1; 2], [3; 4]) ||> Seq.allPairs - /// - /// Evaluates to - /// - /// seq [(1, 3); (1, 4); (2, 3); (2, 4)] - /// - /// - /// - /// Thrown when either of the input sequences is null. - [] - val allPairs: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2> - - /// Wraps the two given enumerations as a single concatenated - /// enumeration. - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed - /// concurrently. - /// - /// The first sequence. - /// The second sequence. - /// - /// The result sequence. - /// - /// - /// - /// ([1; 2], [3; 4]) ||> Seq.append - /// - /// Evaluates to seq [1; 2; 3; 4] - /// - /// - /// Thrown when either of the two provided sequences is - /// null. - [] - val append: source1:seq<'T> -> source2:seq<'T> -> seq<'T> - - /// Returns the average of the elements in the sequence. - /// - /// The elements are averaged using the + operator, DivideByInt method and Zero property - /// associated with the element type. - /// - /// The input sequence. - /// - /// The average. - /// - /// - /// - /// [1.0; 2.0; 3.0] |> Seq.average - /// - /// Evaluates to 2.0 - /// - /// - /// - /// - /// [] |> Seq.average - /// - /// Throws ArgumentException - /// - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence has zero elements. - [] - val inline average : source:seq<(^T)> -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member DivideByInt : ^T * int -> ^T) - and ^T : (static member Zero : ^T) - - /// Returns the average of the results generated by applying the function to each element - /// of the sequence. - /// - /// The elements are averaged using the + operator, DivideByInt method and Zero property - /// associated with the generated type. - /// - /// A function applied to transform each element of the sequence. - /// The input sequence. - /// - /// The average. - /// - /// - /// - /// type Foo = { Bar: float } - /// - /// [{Bar = 2.0}; {Bar = 4.0}] |> Seq.averageBy (fun foo -> foo.Bar) - /// - /// Evaluates to 3.0 - /// - /// - /// - /// - /// type Foo = { Bar: float } - /// [] |> Seq.averageBy (fun foo -> foo.Bar) - /// - /// Throws ArgumentException - /// - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence has zero elements. - [] - val inline averageBy : projection:('T -> ^U) -> source:seq<'T> -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member DivideByInt : ^U * int -> ^U) - and ^U : (static member Zero : ^U) - - /// Returns a sequence that corresponds to a cached version of the input sequence. - /// - /// - /// The result sequence will have the same elements as the input sequence. The result - /// can be enumerated multiple times. The input sequence will be enumerated at most - /// once and only as far as is necessary. Caching a sequence is typically useful when repeatedly - /// evaluating items in the original sequence is computationally expensive or if - /// iterating the sequence causes side-effects that the user does not want to be - /// repeated multiple times. - /// - /// Enumeration of the result sequence is thread safe in the sense that multiple independent IEnumerator - /// values may be used simultaneously from different threads (accesses to - /// the internal lookaside table are thread safe). Each individual IEnumerator - /// is not typically thread safe and should not be accessed concurrently. - /// - /// Once enumeration of the input sequence has started, - /// it's enumerator will be kept live by this object until the enumeration has completed. - /// At that point, the enumerator will be disposed. - /// - /// The enumerator may be disposed and underlying cache storage released by - /// converting the returned sequence object to type IDisposable, and calling the Dispose method - /// on this object. The sequence object may then be re-enumerated and a fresh enumerator will - /// be used. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// - /// - /// let fibSeq =(0, 1) |> Seq.unfold (fun (a,b) -> Some(a + b, (b, a + b))) - /// - /// let fibSeq3 = fibSeq |> Seq.take 3 |> Seq.cache - /// fibSeq3 - /// - /// Evaluates to seq [1; 2; 3], - /// and it will not do the calculation again when called. - /// - /// - /// Thrown when the input sequence is null. - [] - val cache: source:seq<'T> -> seq<'T> - - /// Wraps a loosely-typed System.Collections sequence as a typed sequence. - /// - /// The use of this function usually requires a type annotation. - /// An incorrect type annotation may result in runtime type - /// errors. - /// Individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// - /// - /// ([1; 2; 3] :> IEnumerable) |> Seq.cast<int> - /// - /// Evaluates to seq [1; 2; 3], explicitly typed as int seq - /// - /// - /// Thrown when the input sequence is null. - [] - val cast: source:IEnumerable -> seq<'T> - - /// Applies the given function to each element of the list. Return - /// the list comprised of the results "x" for each element where - /// the function returns Some(x). - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not - /// be accessed concurrently. - /// - /// A function to transform items of type T into options of type U. - /// The input sequence of type T. - /// - /// The result sequence. - /// - /// - /// - /// [Some 1; None; Some 2] |> Seq.choose id - /// - /// Evaluates to seq [1; 2] - /// - /// - /// - /// - /// [1; 2; 3] |> Seq.choose (fun n -> if n % 2 = 0 then Some n else None) - /// - /// Evaluates to seq [2] - /// - /// - /// Thrown when the input sequence is null. - [] - val choose: chooser:('T -> 'U option) -> source:seq<'T> -> seq<'U> - - /// Divides the input sequence into chunks of size at most chunkSize. - /// - /// The maximum size of each chunk. - /// The input sequence. - /// - /// The sequence divided into chunks. - /// - /// - /// - /// [1; 2; 3] |> Seq.chunkBySize 2 - /// - /// Evaluates to seq [[|1; 2|]; [|3|]] - /// - /// - /// - /// - /// [1; 2; 3] |> Seq.chunkBySize -2 - /// - /// Throws ArgumentException - /// - /// - /// Thrown when the input sequence is null. - /// Thrown when chunkSize is not positive. - [] - val chunkBySize: chunkSize:int -> source:seq<'T> -> seq<'T[]> - - /// Applies the given function to each element of the sequence and concatenates all the - /// results. - /// - /// Remember sequence is lazy, effects are delayed until it is enumerated. - /// - /// A function to transform elements of the input sequence into the sequences - /// that will then be concatenated. - /// The input sequence. - /// - /// The result sequence. - /// - /// - /// - /// type Foo = { Bar: int seq } - /// [[{Bar = [1; 2]}; {Bar = [3; 4]}] |> Seq.collect (fun foo -> foo.Bar) - /// - /// Evaluates to seq [1; 2; 3; 4] - /// - /// - /// - /// - /// [[1; 2]; [3; 4]] |> Seq.collect id - /// - /// Evaluates to seq [1; 2; 3; 4] - /// - /// - /// Thrown when the input sequence is null. - [] - val collect: mapping:('T -> 'Collection) -> source:seq<'T> -> seq<'U> when 'Collection :> seq<'U> - - /// Compares two sequences using the given comparison function, element by element. - /// - /// A function that takes an element from each sequence and returns an int. - /// If it evaluates to a non-zero value iteration is stopped and that value is returned. - /// The first input sequence. - /// The second input sequence. - /// - /// Returns the first non-zero result from the comparison function. If the end of a sequence - /// is reached it returns a -1 if the first sequence is shorter and a 1 if the second sequence - /// is shorter. - /// - /// - /// - /// ([1; 2], [1; 2]) - /// ||> Seq.compareWith (fun a b -> a.CompareTo(b)) - /// - /// Evaluates to 0 - /// - /// - /// - /// - /// ([1; 2], [1; 3]) - /// ||> Seq.compareWith (fun a b -> a.CompareTo(b)) - /// - /// Evaluates to -1 - /// - /// - /// - /// - /// ([1; 3], [1; 2]) - /// ||> Seq.compareWith (fun a b -> a.CompareTo(b)) - /// - /// Evaluates to 1 - /// - /// - /// - /// - /// ([1; 2], [1]) - /// ||> Seq.compareWith (fun a b -> a.CompareTo(b)) - /// - /// Evaluates to 1 - /// - /// - /// - /// - /// ([1], [1; 2]) - /// ||> Seq.compareWith (fun a b -> a.CompareTo(b)) - /// - /// Evaluates to -1 - /// - /// - /// Thrown when either of the input sequences - /// is null. - [] - val compareWith: comparer:('T -> 'T -> int) -> source1:seq<'T> -> source2:seq<'T> -> int - - /// Combines the given enumeration-of-enumerations as a single concatenated - /// enumeration. - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// - /// The input enumeration-of-enumerations. - /// - /// The result sequence. - /// - /// - /// - /// [[1; 2]; [3]; [4; 5]] |> Seq.concat - /// - /// Evaluates to seq [1; 2; 3; 4; 5] - /// - /// - /// Thrown when the input sequence is null. - [] - val concat: sources:seq<'Collection> -> seq<'T> when 'Collection :> seq<'T> - - /// Tests if the sequence contains the specified element. - /// - /// The value to locate in the input sequence. - /// The input sequence. - /// - /// True if the input sequence contains the specified element; false otherwise. - /// - /// - /// - /// [1; 2] |> Seq.contains 2 // evaluates to true - /// [1; 2] |> Seq.contains 5 // evaluates to false - /// - /// - /// - /// Thrown when the input sequence is null. - [] - val inline contains: value:'T -> source:seq<'T> -> bool when 'T : equality - - /// Applies a key-generating function to each element of a sequence and returns a sequence yielding unique - /// keys and their number of occurrences in the original sequence. - /// - /// Note that this function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. The function makes no assumption on the ordering of the original - /// sequence. - /// - /// A function transforming each item of the input sequence into a key to be - /// compared against the others. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// - /// - /// - /// type Foo = { Bar: string } - /// - /// [{Bar = "a"}; {Bar = "b"}; {Bar = "a"}] - /// |> Seq.countBy (fun foo -> foo.Bar) - /// - /// Evaluates to seq [("a", 2); ("b", 1)] - /// - [] - val countBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * int> when 'Key : equality - - /// Returns a sequence that is built from the given delayed specification of a - /// sequence. - /// - /// The input function is evaluated each time an IEnumerator for the sequence - /// is requested. - /// - /// The generating function for the sequence. - /// The result sequence. - /// - /// - /// - /// Seq.delay (fun () -> Seq.ofList [1; 2; 3]) - /// - /// Evaluates to seq [1; 2; 3], executing - /// the generator function every time is consumed. - /// - [] - val delay: generator:(unit -> seq<'T>) -> seq<'T> - - /// Returns a sequence that contains no duplicate entries according to generic hash and - /// equality comparisons on the entries. - /// If an element occurs multiple times in the sequence then the later occurrences are discarded. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// - /// - /// - /// [1; 1; 2; 3] |> Seq.distinct - /// - /// Evaluates to seq [1; 2; 3] - /// - [] - val distinct: source:seq<'T> -> seq<'T> when 'T : equality - - /// Returns a sequence that contains no duplicate entries according to the - /// generic hash and equality comparisons on the keys returned by the given key-generating function. - /// If an element occurs multiple times in the sequence then the later occurrences are discarded. - /// - /// A function transforming the sequence items into comparable keys. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// - /// - /// - /// [{Bar = 1 };{Bar = 1}; {Bar = 2}; {Bar = 3}] - /// |> Seq.distinctBy (fun foo -> foo.Bar) - /// - /// Evaluates to seq [{ Bar = 1 }; { Bar = 2 }; { Bar = 3 }] - /// - [] - val distinctBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : equality - - /// Splits the input sequence into at most count chunks. - /// This function returns a sequence that digests the whole initial sequence as soon as that - /// sequence is iterated. As a result this function should not be used with large or infinite sequences. - /// The maximum number of chunks. - /// The input sequence. - /// - /// The sequence split into chunks. - /// Thrown when the input sequence is null. - /// Thrown when count is not positive. - /// This function consumes the whole input sequence before yielding the first element of the result sequence. - [] - val splitInto: count:int -> source:seq<'T> -> seq<'T[]> - - /// Creates an empty sequence. - /// - /// An empty sequence. - [] - [] - val empty<'T> : seq<'T> - - /// Returns a new sequence with the distinct elements of the second sequence which do not appear in the first sequence, - /// using generic hash and equality comparisons to compare values. - /// - /// Note that this function returns a sequence that digests the whole of the first input sequence as soon as - /// the result sequence is iterated. As a result this function should not be used with - /// large or infinite sequences in the first parameter. The function makes no assumption on the ordering of the first input - /// sequence. - /// - /// A sequence whose elements that also occur in the second sequence will cause those elements to be - /// removed from the returned sequence. - /// A sequence whose elements that are not also in first will be returned. - /// - /// A sequence that contains the set difference of the elements of two sequences. - /// - /// Thrown when either of the two input sequences is null. - [] - val except: itemsToExclude:seq<'T> -> source:seq<'T> -> seq<'T> when 'T : equality - - /// Tests if any element of the sequence satisfies the given predicate. - /// - /// The predicate is applied to the elements of the input sequence. If any application - /// returns true then the overall result is true and no further elements are tested. - /// Otherwise, false is returned. - /// - /// A function to test each item of the input sequence. - /// The input sequence. - /// - /// True if any result from the predicate is true; false otherwise. - /// - /// Thrown when the input sequence is null. - [] - val exists: predicate:('T -> bool) -> source:seq<'T> -> bool - - /// Tests if any pair of corresponding elements of the input sequences satisfies the given predicate. - /// - /// The predicate is applied to matching elements in the two sequences up to the lesser of the - /// two lengths of the collections. If any application returns true then the overall result is - /// true and no further elements are tested. Otherwise, false is returned. If one sequence is shorter than - /// the other then the remaining elements of the longer sequence are ignored. - /// - /// A function to test each pair of items from the input sequences. - /// The first input sequence. - /// The second input sequence. - /// - /// True if any result from the predicate is true; false otherwise. - /// - /// Thrown when either of the two input sequences is null. - [] - val exists2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool - - /// Returns a new collection containing only the elements of the collection - /// for which the given predicate returns "true". This is a synonym for Seq.where. - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// - /// Remember sequence is lazy, effects are delayed until it is enumerated. - /// - /// A function to test whether each item in the input sequence should be included in the output. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val filter: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> - - /// Returns a new collection containing only the elements of the collection - /// for which the given predicate returns "true". - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// - /// Remember sequence is lazy, effects are delayed until it is enumerated. - /// - /// A synonym for Seq.filter. - /// - /// A function to test whether each item in the input sequence should be included in the output. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val where: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> - - /// Returns the first element for which the given function returns True. - /// - /// A function to test whether an item in the sequence should be returned. - /// The input sequence. - /// - /// The first element for which the predicate returns True. - /// - /// Thrown if no element returns true when - /// evaluated by the predicate - /// Thrown when the input sequence is null - [] - val find: predicate:('T -> bool) -> source:seq<'T> -> 'T - - /// Returns the last element for which the given function returns True. - /// - /// This function digests the whole initial sequence as soon as it is called. As a - /// result this function should not be used with large or infinite sequences. - /// A function to test whether an item in the sequence should be returned. - /// The input sequence. - /// - /// The last element for which the predicate returns True. - /// Thrown if no element returns true when - /// evaluated by the predicate - /// Thrown when the input sequence is null - /// This function consumes the whole input sequence before returning the result. - [] - val findBack: predicate:('T -> bool) -> source:seq<'T> -> 'T - - /// Returns the index of the first element for which the given function returns True. - /// - /// A function to test whether the index of a particular element should be returned. - /// The input sequence. - /// - /// The index of the first element for which the predicate returns True. - /// - /// Thrown if no element returns true when - /// evaluated by the predicate - /// Thrown when the input sequence is null - [] - val findIndex: predicate:('T -> bool) -> source:seq<'T> -> int - - /// Returns the index of the last element for which the given function returns True. - /// - /// This function digests the whole initial sequence as soon as it is called. As a - /// result this function should not be used with large or infinite sequences. - /// - /// A function to test whether the index of a particular element should be returned. - /// The input sequence. - /// - /// The index of the last element for which the predicate returns True. - /// - /// Thrown if no element returns true when - /// evaluated by the predicate - /// Thrown when the input sequence is null - [] - val findIndexBack: predicate:('T -> bool) -> source:seq<'T> -> int - - /// Applies a function to each element of the collection, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN - /// then computes f (... (f s i0)...) iN - /// - /// A function that updates the state with each element from the sequence. - /// The initial state. - /// The input sequence. - /// - /// The state object after the folding function is applied to each element of the sequence. - /// - /// Thrown when the input sequence is null. - [] - val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> 'State - - /// Applies a function to corresponding elements of two collections, threading an accumulator argument - /// through the computation. - /// - /// The two sequences need not have equal lengths: - /// when one sequence is exhausted any remaining elements in the other sequence are ignored. - /// If the input function is f and the elements are i0...iN and j0...jN - /// then computes f (... (f s i0 j0)...) iN jN. - /// - /// The function to update the state given the input elements. - /// The initial state. - /// The first input sequence. - /// The second input sequence. - /// - /// The final state value. - /// Thrown when the either of the input sequences is null. - [] - val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> source1:seq<'T1> -> source2:seq<'T2> -> 'State - - /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN - /// then computes f i0 (... (f iN s)...) - /// - /// The function to update the state given the input elements. - /// The input sequence. - /// The initial state. - /// - /// The state object after the folding function is applied to each element of the sequence. - /// Thrown when the input sequence is null. - /// - /// This function consumes the whole input sequence before returning the result. - [] - val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> 'State - - /// Applies a function to corresponding elements of two collections, starting from the end of the shorter collection, - /// threading an accumulator argument through the computation. The two sequences need not have equal lengths. - /// If the input function is f and the elements are i0...iN and j0...jM, N < M - /// then computes f i0 j0 (... (f iN jN s)...). - /// - /// The function to update the state given the input elements. - /// The first input sequence. - /// The second input sequence. - /// The initial state. - /// - /// The final state value. - /// - /// Thrown when the either of the input sequences is null. - [] - val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> source1:seq<'T1> -> source2:seq<'T2> -> state:'State -> 'State - - /// Tests if all elements of the sequence satisfy the given predicate. - /// - /// The predicate is applied to the elements of the input sequence. If any application - /// returns false then the overall result is false and no further elements are tested. - /// Otherwise, true is returned. - /// - /// A function to test an element of the input sequence. - /// The input sequence. - /// - /// True if every element of the sequence satisfies the predicate; false otherwise. - /// - /// Thrown when the input sequence is null. - [] - val forall: predicate:('T -> bool) -> source:seq<'T> -> bool - - /// Tests the all pairs of elements drawn from the two sequences satisfy the - /// given predicate. If one sequence is shorter than - /// the other then the remaining elements of the longer sequence are ignored. - /// - /// A function to test pairs of elements from the input sequences. - /// The first input sequence. - /// The second input sequence. - /// - /// True if all pairs satisfy the predicate; false otherwise. - /// - /// Thrown when either of the input sequences is null. - [] - val forall2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool - - /// Applies a key-generating function to each element of a sequence and yields a sequence of - /// unique keys. Each unique key contains a sequence of all elements that match - /// to this key. - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. The function makes no assumption on the ordering of the original - /// sequence. - /// - /// A function that transforms an element of the sequence into a comparable key. - /// The input sequence. - /// - /// The result sequence. - [] - val groupBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * seq<'T>> when 'Key : equality - - /// Returns the first element of the sequence. - /// - /// The input sequence. - /// - /// The first element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input does not have any elements. - [] - val head: source:seq<'T> -> 'T - - /// Returns the first element of the sequence, or None if the sequence is empty. - /// - /// The input sequence. - /// - /// The first element of the sequence or None. - /// - /// Thrown when the input sequence is null. - [] - val tryHead: source:seq<'T> -> 'T option - - /// Returns the last element of the sequence. - /// - /// The input sequence. - /// - /// The last element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input does not have any elements. - [] - val last: source:seq<'T> -> 'T - - /// Returns the last element of the sequence. - /// Return None if no such element exists. - /// - /// The input sequence. - /// - /// The last element of the sequence or None. - /// - /// Thrown when the input sequence is null. - [] - val tryLast: source:seq<'T> -> 'T option - - /// Returns the only element of the sequence. - /// - /// The input sequence. - /// - /// The only element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input does not have precisely one element. - [] - val exactlyOne: source:seq<'T> -> 'T - - /// Returns the only element of the sequence or None if sequence is empty or contains more than one element. - /// - /// The input sequence. - /// - /// The only element of the sequence or None. - /// - /// Thrown when the input sequence is null. - [] - val tryExactlyOne: source:seq<'T> -> 'T option - - /// Returns true if the sequence contains no elements, false otherwise. - /// - /// The input sequence. - /// - /// True if the sequence is empty; false otherwise. - /// - /// Thrown when the input sequence is null. - [] - val isEmpty: source:seq<'T> -> bool - - /// Builds a new collection whose elements are the corresponding elements of the input collection - /// paired with the integer index (from 0) of each element. - /// - /// The input sequence. - /// - /// The result sequence. - /// Thrown when the input sequence is null. - [] - val indexed: source:seq<'T> -> seq - - /// Generates a new sequence which, when iterated, will return successive - /// elements by calling the given function, up to the given count. Each element is saved after its - /// initialization. The function is passed the index of the item being - /// generated. - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// - /// The maximum number of items to generate for the sequence. - /// A function that generates an item in the sequence from a given index. - /// - /// The result sequence. - /// - /// Thrown when count is negative. - [] - val init: count:int -> initializer:(int -> 'T) -> seq<'T> - - /// Generates a new sequence which, when iterated, will return successive - /// elements by calling the given function. The results of calling the function - /// will not be saved, that is the function will be reapplied as necessary to - /// regenerate the elements. The function is passed the index of the item being - /// generated. - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// Iteration can continue up to Int32.MaxValue. - /// - /// A function that generates an item in the sequence from a given index. - /// - /// The result sequence. - [] - val initInfinite: initializer:(int -> 'T) -> seq<'T> - - /// Computes the element at the specified index in the collection. - /// - /// The index of the element to retrieve. - /// The input sequence. - /// - /// The element at the specified index of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the index is negative or the input sequence does not contain enough elements. - [] - val item: index:int -> source:seq<'T> -> 'T - - /// Applies the given function to each element of the collection. - /// - /// A function to apply to each element of the sequence. - /// The input sequence. - /// - /// Thrown when the input sequence is null. - [] - val iter: action:('T -> unit) -> source:seq<'T> -> unit - - /// Applies the given function to each element of the collection. The integer passed to the - /// function indicates the index of element. - /// - /// A function to apply to each element of the sequence that can also access the current index. - /// The input sequence. - /// - /// Thrown when the input sequence is null. - [] - val iteri: action:(int -> 'T -> unit) -> source:seq<'T> -> unit - - /// Applies the given function to two collections simultaneously. If one sequence is shorter than - /// the other then the remaining elements of the longer sequence are ignored. - /// - /// A function to apply to each pair of elements from the input sequences. - /// The first input sequence. - /// The second input sequence. - /// - /// Thrown when either of the input sequences is null. - [] - val iter2: action:('T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit - - /// Applies the given function to two collections simultaneously. If one sequence is shorter than - /// the other then the remaining elements of the longer sequence are ignored. The integer passed to the - /// function indicates the index of element. - /// - /// A function to apply to each pair of elements from the input sequences along with their index. - /// The first input sequence. - /// The second input sequence. - /// - /// Thrown when either of the input sequences is null. - [] - val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit - - /// Returns the length of the sequence - /// - /// The input sequence. - /// - /// The length of the sequence. - /// - /// Thrown when the input sequence is null. - [] - val length: source:seq<'T> -> int - - /// Builds a new collection whose elements are the results of applying the given function - /// to each of the elements of the collection. The given function will be applied - /// as elements are demanded using the MoveNext method on enumerators retrieved from the - /// object. - /// - /// The returned sequence may be passed between threads safely. However, - /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. - /// - /// A function to transform items from the input sequence. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U> - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than - /// the other then the remaining elements of the longer sequence are ignored. - /// - /// A function to transform pairs of items from the input sequences. - /// The first input sequence. - /// The second input sequence. - /// - /// The result sequence. - /// - /// Thrown when either of the input sequences is null. - [] - val map2: mapping:('T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> - - /// Combines map and fold. Builds a new collection whose elements are the results of applying the given function - /// to each of the elements of the collection. The function is also used to accumulate a final value. - /// - /// This function digests the whole initial sequence as soon as it is called. As a result this function should - /// not be used with large or infinite sequences. - /// - /// The function to transform elements from the input collection and accumulate the final value. - /// The initial state. - /// The input collection. - /// - /// Thrown when the input collection is null. - /// - /// The collection of transformed elements, and the final accumulated value. - [] - val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:seq<'T> -> seq<'Result> * 'State - - /// Combines map and foldBack. Builds a new collection whose elements are the results of applying the given function - /// to each of the elements of the collection. The function is also used to accumulate a final value. - /// - /// This function digests the whole initial sequence as soon as it is called. As a result this function should - /// not be used with large or infinite sequences. - /// - /// The function to transform elements from the input collection and accumulate the final value. - /// The input collection. - /// The initial state. - /// - /// Thrown when the input collection is null. - /// - /// The collection of transformed elements, and the final accumulated value. - [] - val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:seq<'T> -> state:'State -> seq<'Result> * 'State - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding triples of elements from the three sequences. If one input sequence if shorter than - /// the others then the remaining elements of the longer sequences are ignored. - /// - /// The function to transform triples of elements from the input sequences. - /// The first input sequence. - /// The second input sequence. - /// The third input sequence. - /// - /// The result sequence. - /// - /// Thrown when any of the input sequences is null. - [] - val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'U> - - /// Builds 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 (from 0) of element being transformed. - /// - /// A function to transform items from the input sequence that also supplies the current index. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val mapi: mapping:(int -> 'T -> 'U) -> source:seq<'T> -> seq<'U> - - /// Builds a new collection whose elements are the results of applying the given function - /// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than - /// the other then the remaining elements of the longer sequence are ignored. The integer index passed to the - /// function indicates the index (from 0) of element being transformed. - /// - /// A function to transform pairs of items from the input sequences that also supplies the current index. - /// The first input sequence. - /// The second input sequence. - /// - /// The result sequence. - /// - /// Thrown when either of the input sequences is null. - [] - val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> - - /// Returns the greatest of all elements of the sequence, compared via Operators.max - /// - /// The input sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - /// - /// The largest element of the sequence. - [] - val inline max : source:seq<'T> -> 'T when 'T : comparison - - /// Returns the greatest of all elements of the sequence, compared via Operators.max on the function result. - /// - /// A function to transform items from the input sequence into comparable keys. - /// The input sequence. - /// - /// The largest element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - [] - val inline maxBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison - - /// Returns the lowest of all elements of the sequence, compared via Operators.min. - /// - /// The input sequence. - /// - /// The smallest element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - [] - val inline min : source:seq<'T> -> 'T when 'T : comparison - - /// Returns the lowest of all elements of the sequence, compared via Operators.min on the function result. - /// - /// A function to transform items from the input sequence into comparable keys. - /// The input sequence. - /// - /// The smallest element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - [] - val inline minBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison - - /// Computes the nth element in the collection. - /// - /// The index of element to retrieve. - /// The input sequence. - /// - /// The nth element of the sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the index is negative or the input sequence does not contain enough elements. - [] - [] - val nth: index:int -> source:seq<'T> -> 'T - - [] - /// Views the given array as a sequence. - /// - /// The input array. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - val ofArray: source:'T[] -> seq<'T> - - [] - /// Views the given list as a sequence. - /// - /// The input list. - /// - /// The result sequence. - val ofList: source:'T list -> seq<'T> - - /// Returns a sequence of each element in the input sequence and its predecessor, with the - /// exception of the first element which is only returned as the predecessor of the second element. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val pairwise: source:seq<'T> -> seq<'T * 'T> - - /// Returns a sequence with all elements permuted according to the - /// specified permutation. - /// - /// This function consumes the whole input sequence before yielding the first element of the result sequence. - /// - /// The function that maps input indices to output indices. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when indexMap does not produce a valid permutation. - [] - val permute: indexMap:(int -> int) -> source:seq<'T> -> seq<'T> - - /// Applies the given function to successive elements, returning the first - /// x where the function returns "Some(x)". - /// - /// A function to transform each item of the input sequence into an option of the output type. - /// The input sequence. - /// - /// The selected element. - /// - /// Thrown when the input sequence is null. - /// Thrown when every item of the sequence - /// evaluates to None when the given function is applied. - [] - val pick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U - - /// Builds a new sequence object that delegates to the given sequence object. This ensures - /// the original sequence cannot be rediscovered and mutated by a type cast. For example, - /// if given an array the returned sequence will return the elements of the array, but - /// you cannot cast the returned sequence object to an array. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val readonly : source:seq<'T> -> seq<'T> - - /// Applies a function to each element of the sequence, threading an accumulator argument - /// through the computation. Begin by applying the function to the first two elements. - /// Then feed this result into the function along with the third element and so on. - /// Return the final result. - /// - /// A function that takes in the current accumulated result and the next - /// element of the sequence to produce the next accumulated result. - /// The input sequence. - /// - /// The final result of the reduction function. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - [] - val reduce: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T - - /// Creates a sequence by replicating the given initial value. - /// - /// The number of elements to replicate. - /// The value to replicate - /// - /// The generated sequence. - [] - val replicate: count:int -> initial:'T -> seq<'T> - - /// Applies a function to each element of the sequence, starting from the end, threading an accumulator argument - /// through the computation. If the input function is f and the elements are i0...iN - /// then computes f i0 (...(f iN-1 iN)). - /// - /// A function that takes in the next-to-last element of the sequence and the - /// current accumulated result to produce the next accumulated result. - /// The input sequence. - /// - /// The final result of the reductions. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - /// - /// This function consumes the whole input sequence before returning the result. - [] - val reduceBack: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T - - /// Returns a new sequence with the elements in reverse order. - /// - /// The input sequence. - /// - /// The reversed sequence. - /// - /// Thrown when the input sequence is null. - /// - /// This function consumes the whole input sequence before yielding the first element of the reversed sequence. - [] - val rev: source:seq<'T> -> seq<'T> - - /// Like fold, but computes on-demand and returns the sequence of intermediary and final results. - /// - /// A function that updates the state with each element from the sequence. - /// The initial state. - /// The input sequence. - /// - /// The resulting sequence of computed states. - /// - /// Thrown when the input sequence is null. - [] - val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> seq<'State> - - /// Like foldBack, but returns the sequence of intermediary and final results. - /// - /// This function returns a sequence that digests the whole initial sequence as soon as that - /// sequence is iterated. As a result this function should not be used with large or infinite sequences. - /// - /// - /// A function that updates the state with each element from the sequence. - /// The input sequence. - /// The initial state. - /// - /// The resulting sequence of computed states. - /// - /// Thrown when the input sequence is null. - [] - val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> seq<'State> - - /// Returns a sequence that yields one item only. - /// - /// The input item. - /// - /// The result sequence of one item. - [] - val singleton: value:'T -> seq<'T> - - /// Returns a sequence that skips N elements of the underlying sequence and then yields the - /// remaining elements of the sequence. - /// - /// The number of items to skip. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when count exceeds the number of elements - /// in the sequence. - [] - val skip: count:int -> source:seq<'T> -> seq<'T> - - /// Returns a sequence that, when iterated, skips elements of the underlying sequence while the - /// given predicate returns True, and then yields the remaining elements of the sequence. - /// - /// A function that evaluates an element of the sequence to a boolean value. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val skipWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> - - /// Yields a sequence ordered by keys. - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. - /// - /// The function makes no assumption on the ordering of the original - /// sequence and uses a stable sort, that is the original order of equal elements is preserved. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val sort : source:seq<'T> -> seq<'T> when 'T : comparison - - /// Yields a sequence ordered using the given comparison function. - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. - /// - /// The function makes no assumption on the ordering of the original - /// sequence and uses a stable sort, that is the original order of equal elements is preserved. - /// - /// The function to compare the collection elements. - /// The input sequence. - /// - /// The result sequence. - [] - val sortWith : comparer:('T -> 'T -> int) -> source:seq<'T> -> seq<'T> - - /// Applies a key-generating function to each element of a sequence and yield a sequence ordered - /// by keys. The keys are compared using generic comparison as implemented by . - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. - /// - /// The function makes no assumption on the ordering of the original - /// sequence and uses a stable sort, that is the original order of equal elements is preserved. - /// - /// A function to transform items of the input sequence into comparable keys. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison - - /// Yields a sequence ordered descending by keys. - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. The function makes no assumption on the ordering of the original - /// sequence. - /// - /// This is a stable sort, that is the original order of equal elements is preserved. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val inline sortDescending : source:seq<'T> -> seq<'T> when 'T : comparison - - /// Applies a key-generating function to each element of a sequence and yield a sequence ordered - /// descending by keys. The keys are compared using generic comparison as implemented by . - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. The function makes no assumption on the ordering of the original - /// sequence. - /// - /// This is a stable sort, that is the original order of equal elements is preserved. - /// - /// A function to transform items of the input sequence into comparable keys. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val inline sortByDescending : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison - - /// Returns the sum of the elements in the sequence. - /// - /// The elements are summed using the + operator and Zero property associated with the generated type. - /// - /// The input sequence. - /// - /// The computed sum. - [] - val inline sum : source:seq<(^T)> -> ^T - when ^T : (static member ( + ) : ^T * ^T -> ^T) - and ^T : (static member Zero : ^T) - - /// Returns the sum of the results generated by applying the function to each element of the sequence. - /// - /// The generated elements are summed using the + operator and Zero property associated with the generated type. - /// - /// A function to transform items from the input sequence into the type that will be summed. - /// The input sequence. - /// - /// The computed sum. - [] - val inline sumBy : projection:('T -> ^U) -> source:seq<'T> -> ^U - when ^U : (static member ( + ) : ^U * ^U -> ^U) - and ^U : (static member Zero : ^U) - - /// Returns a sequence that skips 1 element of the underlying sequence and then yields the - /// remaining elements of the sequence. - /// - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - [] - val tail: source:seq<'T> -> seq<'T> - - /// Returns the first N elements of the sequence. - /// - /// Throws InvalidOperationException - /// if the count exceeds the number of elements in the sequence. Seq.truncate - /// returns as many items as the sequence contains instead of throwing an exception. - /// - /// The number of items to take. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - /// Thrown when the input sequence is empty. - /// Thrown when count exceeds the number of elements - /// in the sequence. - [] - val take: count:int -> source:seq<'T> -> seq<'T> - - /// Returns a sequence that, when iterated, yields elements of the underlying sequence while the - /// given predicate returns True, and then returns no further elements. - /// - /// A function that evaluates to false when no more items should be returned. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val takeWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> - - /// Builds an array from the given collection. - /// - /// The input sequence. - /// - /// The result array. - /// - /// Thrown when the input sequence is null. - [] - val toArray: source:seq<'T> -> 'T[] - - /// Builds a list from the given collection. - /// - /// The input sequence. - /// - /// The result list. - /// - /// Thrown when the input sequence is null. - [] - val toList: source:seq<'T> -> 'T list - - /// Returns the first element for which the given function returns True. - /// Return None if no such element exists. - /// - /// A function that evaluates to a Boolean when given an item in the sequence. - /// The input sequence. - /// - /// The found element or None. - /// - /// Thrown when the input sequence is null. - [] - val tryFind: predicate:('T -> bool) -> source:seq<'T> -> 'T option - - /// Returns the last element for which the given function returns True. - /// Return None if no such element exists. - /// - /// This function digests the whole initial sequence as soon as it is called. As a - /// result this function should not be used with large or infinite sequences. - /// - /// A function that evaluates to a Boolean when given an item in the sequence. - /// The input sequence. - /// - /// The found element or None. - /// - /// Thrown when the input sequence is null. - [] - val tryFindBack: predicate:('T -> bool) -> source:seq<'T> -> 'T option - - /// Returns the index of the first element in the sequence - /// that satisfies the given predicate. Return None if no such element exists. - /// - /// A function that evaluates to a Boolean when given an item in the sequence. - /// The input sequence. - /// - /// The found index or None. - /// - /// Thrown when the input sequence is null. - [] - val tryFindIndex : predicate:('T -> bool) -> source:seq<'T> -> int option - - /// Tries to find the nth element in the sequence. - /// Returns None if index is negative or the input sequence does not contain enough elements. - /// - /// The index of element to retrieve. - /// The input sequence. - /// - /// The nth element of the sequence or None. - /// Thrown when the input sequence is null. - [] - val tryItem: index:int -> source:seq<'T> -> 'T option - - /// Returns the index of the last element in the sequence - /// that satisfies the given predicate. Return None if no such element exists. - /// - /// This function digests the whole initial sequence as soon as it is called. As a - /// result this function should not be used with large or infinite sequences. - /// - /// A function that evaluates to a Boolean when given an item in the sequence. - /// The input sequence. - /// - /// The found index or None. - /// - /// Thrown when the input sequence is null. - [] - val tryFindIndexBack : predicate:('T -> bool) -> source:seq<'T> -> int option - - /// Applies the given function to successive elements, returning the first - /// result where the function returns "Some(x)". - /// - /// A function that transforms items from the input sequence into options. - /// The input sequence. - /// - /// The chosen element or None. - /// - /// Thrown when the input sequence is null. - [] - val tryPick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U option - - /// Returns the transpose of the given sequence of sequences. - /// - /// This function returns a sequence that digests the whole initial sequence as soon as - /// that sequence is iterated. As a result this function should not be used with - /// large or infinite sequences. - /// - /// The input sequence. - /// - /// The transposed sequence. - /// - /// Thrown when the input sequence is null. - [] - val transpose: source:seq<'Collection> -> seq> when 'Collection :> seq<'T> - - /// Returns a sequence that when enumerated returns at most N elements. - /// - /// The maximum number of items to enumerate. - /// The input sequence. - /// - /// The result sequence. - /// - /// Thrown when the input sequence is null. - [] - val truncate: count:int -> source:seq<'T> -> seq<'T> - - /// Returns a sequence that contains the elements generated by the given computation. - /// The given initial state argument is passed to the element generator. - /// For each IEnumerator elements in the stream are generated on-demand by applying the element - /// generator, until a None value is returned by the element generator. Each call to the element - /// generator returns a new residual state. - /// - /// The stream will be recomputed each time an IEnumerator is requested and iterated for the Seq. - /// - /// A function that takes in the current state and returns an option tuple of the next - /// element of the sequence and the next state value. - /// The initial state value. - /// - /// The result sequence. - [] - val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T> - - /// Returns a sequence that yields sliding windows containing elements drawn from the input - /// sequence. Each window is returned as a fresh array. - /// - /// The number of elements in each window. - /// The input sequence. - /// - /// The result sequence. - /// Thrown when the input sequence is null. - /// Thrown when windowSize is not positive. - [] - val windowed: windowSize:int -> source:seq<'T> -> seq<'T[]> - - /// Combines the two sequences into a list of pairs. The two sequences need not have equal lengths: - /// when one sequence is exhausted any remaining elements in the other - /// sequence are ignored. - /// - /// The first input sequence. - /// The second input sequence. - /// - /// The result sequence. - /// - /// Thrown when either of the input sequences is null. - [] - val zip: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2> - - /// Combines the three sequences into a list of triples. The sequences need not have equal lengths: - /// when one sequence is exhausted any remaining elements in the other - /// sequences are ignored. - /// - /// The first input sequence. - /// The second input sequence. - /// The third input sequence. - /// - /// The result sequence. - /// - /// Thrown when any of the input sequences is null. - [] - val zip3: source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'T1 * 'T2 * 'T3> - - /// Return a new sequence with the item at a given index removed. - /// - /// The index of the item to be removed. - /// The input sequence. - /// - /// - /// - /// seq { 0; 1; 2 } |> Seq.removeAt 1 // evaluates to seq { 0; 2 } - /// - /// - /// - /// The result sequence. - /// - /// Thrown when index is outside 0..source.Length - 1 - [] - val removeAt: index: int -> source: seq<'T> -> seq<'T> +open System +open System.Collections +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections - /// Return a new sequence with the number of items starting at a given index removed. - /// - /// The index of the item to be removed. - /// The number of items to remove. - /// The input sequence. - /// - /// - /// - /// seq { 0; 1; 2; 3 } |> Seq.removeManyAt 1 2 // evaluates to seq { 0; 3 } - /// - /// - /// - /// The result sequence. - /// - /// Thrown when index is outside 0..source.Length - count - [] - val removeManyAt: index: int -> count: int -> source: seq<'T> -> seq<'T> +/// Contains operations for working with values of type . +[] +[] +module Seq = + + /// Returns a new sequence that contains all pairings of elements from the first and second sequences. + /// + /// The first sequence. + /// The second sequence. + /// + /// The result sequence. + /// + /// Thrown when either of the input sequences is null. + /// + /// + /// + /// ([1; 2], [3; 4]) ||> Seq.allPairs + /// + /// Evaluates to + /// + /// seq [(1, 3); (1, 4); (2, 3); (2, 4)] + /// + /// + [] + val allPairs: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2> + + /// Wraps the two given enumerations as a single concatenated + /// enumeration. + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed + /// concurrently. + /// + /// The first sequence. + /// The second sequence. + /// + /// The result sequence. + /// + /// Thrown when either of the two provided sequences is + /// null. + /// + /// + /// + /// ([1; 2], [3; 4]) ||> Seq.append + /// + /// Evaluates to seq [1; 2; 3; 4] + /// + [] + val append: source1:seq<'T> -> source2:seq<'T> -> seq<'T> + + /// Returns the average of the elements in the sequence. + /// + /// The elements are averaged using the + operator, DivideByInt method and Zero property + /// associated with the element type. + /// + /// The input sequence. + /// + /// The average. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence has zero elements. + /// + /// + /// + /// [1.0; 2.0; 3.0] |> Seq.average + /// + /// Evaluates to 2.0 + /// + /// + /// + /// + /// [] |> Seq.average + /// + /// Throws ArgumentException + /// + [] + val inline average : source:seq<(^T)> -> ^T + when ^T : (static member ( + ) : ^T * ^T -> ^T) + and ^T : (static member DivideByInt : ^T * int -> ^T) + and ^T : (static member Zero : ^T) + + /// Returns the average of the results generated by applying the function to each element + /// of the sequence. + /// + /// The elements are averaged using the + operator, DivideByInt method and Zero property + /// associated with the generated type. + /// + /// A function applied to transform each element of the sequence. + /// The input sequence. + /// + /// The average. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence has zero elements. + /// + /// + /// + /// type Foo = { Bar: float } + /// + /// [{Bar = 2.0}; {Bar = 4.0}] |> Seq.averageBy (fun foo -> foo.Bar) + /// + /// Evaluates to 3.0 + /// + /// + /// + /// + /// type Foo = { Bar: float } + /// [] |> Seq.averageBy (fun foo -> foo.Bar) + /// + /// Throws ArgumentException + /// + [] + val inline averageBy : projection:('T -> ^U) -> source:seq<'T> -> ^U + when ^U : (static member ( + ) : ^U * ^U -> ^U) + and ^U : (static member DivideByInt : ^U * int -> ^U) + and ^U : (static member Zero : ^U) + + /// Returns a sequence that corresponds to a cached version of the input sequence. + /// + /// + /// The result sequence will have the same elements as the input sequence. The result + /// can be enumerated multiple times. The input sequence will be enumerated at most + /// once and only as far as is necessary. Caching a sequence is typically useful when repeatedly + /// evaluating items in the original sequence is computationally expensive or if + /// iterating the sequence causes side-effects that the user does not want to be + /// repeated multiple times. + /// + /// Enumeration of the result sequence is thread safe in the sense that multiple independent IEnumerator + /// values may be used simultaneously from different threads (accesses to + /// the internal lookaside table are thread safe). Each individual IEnumerator + /// is not typically thread safe and should not be accessed concurrently. + /// + /// Once enumeration of the input sequence has started, + /// it's enumerator will be kept live by this object until the enumeration has completed. + /// At that point, the enumerator will be disposed. + /// + /// The enumerator may be disposed and underlying cache storage released by + /// converting the returned sequence object to type IDisposable, and calling the Dispose method + /// on this object. The sequence object may then be re-enumerated and a fresh enumerator will + /// be used. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// let fibSeq =(0, 1) |> Seq.unfold (fun (a,b) -> Some(a + b, (b, a + b))) + /// + /// let fibSeq3 = fibSeq |> Seq.take 3 |> Seq.cache + /// fibSeq3 + /// + /// Evaluates to seq [1; 2; 3], + /// and it will not do the calculation again when called. + /// + [] + val cache: source:seq<'T> -> seq<'T> + + /// Wraps a loosely-typed System.Collections sequence as a typed sequence. + /// + /// The use of this function usually requires a type annotation. + /// An incorrect type annotation may result in runtime type + /// errors. + /// Individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// ([1; 2; 3] :> IEnumerable) |> Seq.cast<int> + /// + /// Evaluates to seq [1; 2; 3], explicitly typed as int seq + /// + [] + val cast: source:IEnumerable -> seq<'T> + + /// Applies the given function to each element of the list. Return + /// the list comprised of the results "x" for each element where + /// the function returns Some(x). + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not + /// be accessed concurrently. + /// + /// A function to transform items of type T into options of type U. + /// The input sequence of type T. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// [Some 1; None; Some 2] |> Seq.choose id + /// + /// Evaluates to seq [1; 2] + /// + /// + /// + /// + /// [1; 2; 3] |> Seq.choose (fun n -> if n % 2 = 0 then Some n else None) + /// + /// Evaluates to seq [2] + /// + [] + val choose: chooser:('T -> 'U option) -> source:seq<'T> -> seq<'U> + + /// Divides the input sequence into chunks of size at most chunkSize. + /// + /// The maximum size of each chunk. + /// The input sequence. + /// + /// The sequence divided into chunks. + /// + /// Thrown when the input sequence is null. + /// Thrown when chunkSize is not positive. + /// + /// + /// + /// [1; 2; 3] |> Seq.chunkBySize 2 + /// + /// Evaluates to seq [[|1; 2|]; [|3|]] + /// + /// + /// + /// + /// [1; 2; 3] |> Seq.chunkBySize -2 + /// + /// Throws ArgumentException + /// + [] + val chunkBySize: chunkSize:int -> source:seq<'T> -> seq<'T[]> + + /// Applies the given function to each element of the sequence and concatenates all the + /// results. + /// + /// Remember sequence is lazy, effects are delayed until it is enumerated. + /// + /// A function to transform elements of the input sequence into the sequences + /// that will then be concatenated. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// type Foo = { Bar: int seq } + /// [[{Bar = [1; 2]}; {Bar = [3; 4]}] |> Seq.collect (fun foo -> foo.Bar) + /// + /// Evaluates to seq [1; 2; 3; 4] + /// + /// + /// + /// + /// [[1; 2]; [3; 4]] |> Seq.collect id + /// + /// Evaluates to seq [1; 2; 3; 4] + /// + [] + val collect: mapping:('T -> 'Collection) -> source:seq<'T> -> seq<'U> when 'Collection :> seq<'U> + + /// Compares two sequences using the given comparison function, element by element. + /// + /// A function that takes an element from each sequence and returns an int. + /// If it evaluates to a non-zero value iteration is stopped and that value is returned. + /// The first input sequence. + /// The second input sequence. + /// + /// Returns the first non-zero result from the comparison function. If the end of a sequence + /// is reached it returns a -1 if the first sequence is shorter and a 1 if the second sequence + /// is shorter. + /// + /// Thrown when either of the input sequences + /// is null. + /// + /// + /// + /// ([1; 2], [1; 2]) ||> Seq.compareWith (fun a b -> a.CompareTo(b)) + /// + /// Evaluates to 0 + /// + /// + /// + /// + /// ([1; 2], [1; 3]) ||> Seq.compareWith (fun a b -> a.CompareTo(b)) + /// + /// Evaluates to -1 + /// + /// + /// + /// + /// ([1; 3], [1; 2]) ||> Seq.compareWith (fun a b -> a.CompareTo(b)) + /// + /// Evaluates to 1 + /// + /// + /// + /// + /// ([1; 2], [1]) ||> Seq.compareWith (fun a b -> a.CompareTo(b)) + /// + /// Evaluates to 1 + /// + /// + /// + /// + /// ([1], [1; 2]) ||> Seq.compareWith (fun a b -> a.CompareTo(b)) + /// + /// Evaluates to -1 + /// + [] + val compareWith: comparer:('T -> 'T -> int) -> source1:seq<'T> -> source2:seq<'T> -> int + + /// Combines the given enumeration-of-enumerations as a single concatenated + /// enumeration. + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// + /// The input enumeration-of-enumerations. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// [[1; 2]; [3]; [4; 5]] |> Seq.concat + /// + /// Evaluates to seq [1; 2; 3; 4; 5] + /// + [] + val concat: sources:seq<'Collection> -> seq<'T> when 'Collection :> seq<'T> + + /// Tests if the sequence contains the specified element. + /// + /// The value to locate in the input sequence. + /// The input sequence. + /// + /// True if the input sequence contains the specified element; false otherwise. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// [1; 2] |> Seq.contains 2 // evaluates to true + /// [1; 2] |> Seq.contains 5 // evaluates to false + /// + /// + [] + val inline contains: value:'T -> source:seq<'T> -> bool when 'T : equality + + /// Applies a key-generating function to each element of a sequence and returns a sequence yielding unique + /// keys and their number of occurrences in the original sequence. + /// + /// Note that this function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. The function makes no assumption on the ordering of the original + /// sequence. + /// + /// A function transforming each item of the input sequence into a key to be + /// compared against the others. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// type Foo = { Bar: string } + /// + /// [{Bar = "a"}; {Bar = "b"}; {Bar = "a"}] + /// |> Seq.countBy (fun foo -> foo.Bar) + /// + /// Evaluates to seq [("a", 2); ("b", 1)] + /// + [] + val countBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * int> when 'Key : equality + + /// Returns a sequence that is built from the given delayed specification of a + /// sequence. + /// + /// The input function is evaluated each time an IEnumerator for the sequence + /// is requested. + /// + /// The generating function for the sequence. + /// The result sequence. + /// + /// + /// + /// Seq.delay (fun () -> Seq.ofList [1; 2; 3]) + /// + /// Evaluates to seq [1; 2; 3], executing + /// the generator function every time is consumed. + /// + [] + val delay: generator:(unit -> seq<'T>) -> seq<'T> + + /// Returns a sequence that contains no duplicate entries according to generic hash and + /// equality comparisons on the entries. + /// If an element occurs multiple times in the sequence then the later occurrences are discarded. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// [1; 1; 2; 3] |> Seq.distinct + /// + /// Evaluates to seq [1; 2; 3] + /// + [] + val distinct: source:seq<'T> -> seq<'T> when 'T : equality + + /// Returns a sequence that contains no duplicate entries according to the + /// generic hash and equality comparisons on the keys returned by the given key-generating function. + /// If an element occurs multiple times in the sequence then the later occurrences are discarded. + /// + /// A function transforming the sequence items into comparable keys. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + /// + /// [{Bar = 1 };{Bar = 1}; {Bar = 2}; {Bar = 3}] + /// |> Seq.distinctBy (fun foo -> foo.Bar) + /// + /// Evaluates to seq [{ Bar = 1 }; { Bar = 2 }; { Bar = 3 }] + /// + [] + val distinctBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : equality + + /// Splits the input sequence into at most count chunks. + /// This function returns a sequence that digests the whole initial sequence as soon as that + /// sequence is iterated. As a result this function should not be used with large or infinite sequences. + /// The maximum number of chunks. + /// The input sequence. + /// + /// The sequence split into chunks. + /// + /// Thrown when the input sequence is null. + /// Thrown when count is not positive. + /// + /// This function consumes the whole input sequence before yielding the first element of the result sequence. + /// + /// + [] + val splitInto: count:int -> source:seq<'T> -> seq<'T[]> + + /// Creates an empty sequence. + /// + /// An empty sequence. + /// + /// + [] + [] + val empty<'T> : seq<'T> + + /// Returns a new sequence with the distinct elements of the second sequence which do not appear in the first sequence, + /// using generic hash and equality comparisons to compare values. + /// + /// Note that this function returns a sequence that digests the whole of the first input sequence as soon as + /// the result sequence is iterated. As a result this function should not be used with + /// large or infinite sequences in the first parameter. The function makes no assumption on the ordering of the first input + /// sequence. + /// + /// A sequence whose elements that also occur in the second sequence will cause those elements to be + /// removed from the returned sequence. + /// A sequence whose elements that are not also in first will be returned. + /// + /// A sequence that contains the set difference of the elements of two sequences. + /// + /// Thrown when either of the two input sequences is null. + /// + /// + [] + val except: itemsToExclude:seq<'T> -> source:seq<'T> -> seq<'T> when 'T : equality + + /// Tests if any element of the sequence satisfies the given predicate. + /// + /// The predicate is applied to the elements of the input sequence. If any application + /// returns true then the overall result is true and no further elements are tested. + /// Otherwise, false is returned. + /// + /// A function to test each item of the input sequence. + /// The input sequence. + /// + /// True if any result from the predicate is true; false otherwise. + /// + /// Thrown when the input sequence is null. + [] + val exists: predicate:('T -> bool) -> source:seq<'T> -> bool + + /// Tests if any pair of corresponding elements of the input sequences satisfies the given predicate. + /// + /// The predicate is applied to matching elements in the two sequences up to the lesser of the + /// two lengths of the collections. If any application returns true then the overall result is + /// true and no further elements are tested. Otherwise, false is returned. If one sequence is shorter than + /// the other then the remaining elements of the longer sequence are ignored. + /// + /// A function to test each pair of items from the input sequences. + /// The first input sequence. + /// The second input sequence. + /// + /// True if any result from the predicate is true; false otherwise. + /// + /// Thrown when either of the two input sequences is null. + /// + /// + [] + val exists2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool + + /// Returns a new collection containing only the elements of the collection + /// for which the given predicate returns "true". This is a synonym for Seq.where. + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// + /// Remember sequence is lazy, effects are delayed until it is enumerated. + /// + /// A function to test whether each item in the input sequence should be included in the output. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val filter: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + + /// Returns a new collection containing only the elements of the collection + /// for which the given predicate returns "true". + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// + /// Remember sequence is lazy, effects are delayed until it is enumerated. + /// + /// A synonym for Seq.filter. + /// + /// A function to test whether each item in the input sequence should be included in the output. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val where: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + + /// Returns the first element for which the given function returns True. + /// + /// A function to test whether an item in the sequence should be returned. + /// The input sequence. + /// + /// The first element for which the predicate returns True. + /// + /// Thrown if no element returns true when + /// evaluated by the predicate + /// Thrown when the input sequence is null + /// + /// + [] + val find: predicate:('T -> bool) -> source:seq<'T> -> 'T + + /// Returns the last element for which the given function returns True. + /// + /// This function digests the whole initial sequence as soon as it is called. As a + /// result this function should not be used with large or infinite sequences. + /// A function to test whether an item in the sequence should be returned. + /// The input sequence. + /// + /// The last element for which the predicate returns True. + /// Thrown if no element returns true when + /// evaluated by the predicate + /// Thrown when the input sequence is null + /// This function consumes the whole input sequence before returning the result. + /// + /// + [] + val findBack: predicate:('T -> bool) -> source:seq<'T> -> 'T + + /// Returns the index of the first element for which the given function returns True. + /// + /// A function to test whether the index of a particular element should be returned. + /// The input sequence. + /// + /// The index of the first element for which the predicate returns True. + /// + /// Thrown if no element returns true when + /// evaluated by the predicate + /// Thrown when the input sequence is null + /// + /// + [] + val findIndex: predicate:('T -> bool) -> source:seq<'T> -> int + + /// Returns the index of the last element for which the given function returns True. + /// + /// This function digests the whole initial sequence as soon as it is called. As a + /// result this function should not be used with large or infinite sequences. + /// + /// A function to test whether the index of a particular element should be returned. + /// The input sequence. + /// + /// The index of the last element for which the predicate returns True. + /// + /// Thrown if no element returns true when + /// evaluated by the predicate + /// Thrown when the input sequence is null + /// + /// + [] + val findIndexBack: predicate:('T -> bool) -> source:seq<'T> -> int + + /// Applies a function to each element of the collection, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN + /// then computes f (... (f s i0)...) iN + /// + /// A function that updates the state with each element from the sequence. + /// The initial state. + /// The input sequence. + /// + /// The state object after the folding function is applied to each element of the sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> 'State + + /// Applies a function to corresponding elements of two collections, threading an accumulator argument + /// through the computation. + /// + /// The two sequences need not have equal lengths: + /// when one sequence is exhausted any remaining elements in the other sequence are ignored. + /// If the input function is f and the elements are i0...iN and j0...jN + /// then computes f (... (f s i0 j0)...) iN jN. + /// + /// The function to update the state given the input elements. + /// The initial state. + /// The first input sequence. + /// The second input sequence. + /// + /// The final state value. + /// Thrown when the either of the input sequences is null. + /// + /// + [] + val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> source1:seq<'T1> -> source2:seq<'T2> -> 'State + + /// Applies a function to each element of the collection, starting from the end, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN + /// then computes f i0 (... (f iN s)...) + /// + /// The function to update the state given the input elements. + /// The input sequence. + /// The initial state. + /// + /// The state object after the folding function is applied to each element of the sequence. + /// Thrown when the input sequence is null. + /// + /// This function consumes the whole input sequence before returning the result. + /// + /// + [] + val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> 'State + + /// Applies a function to corresponding elements of two collections, starting from the end of the shorter collection, + /// threading an accumulator argument through the computation. The two sequences need not have equal lengths. + /// If the input function is f and the elements are i0...iN and j0...jM, N < M + /// then computes f i0 j0 (... (f iN jN s)...). + /// + /// The function to update the state given the input elements. + /// The first input sequence. + /// The second input sequence. + /// The initial state. + /// + /// The final state value. + /// + /// Thrown when the either of the input sequences is null. + /// + /// + [] + val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> source1:seq<'T1> -> source2:seq<'T2> -> state:'State -> 'State + + /// Tests if all elements of the sequence satisfy the given predicate. + /// + /// The predicate is applied to the elements of the input sequence. If any application + /// returns false then the overall result is false and no further elements are tested. + /// Otherwise, true is returned. + /// + /// A function to test an element of the input sequence. + /// The input sequence. + /// + /// True if every element of the sequence satisfies the predicate; false otherwise. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val forall: predicate:('T -> bool) -> source:seq<'T> -> bool + + /// Tests the all pairs of elements drawn from the two sequences satisfy the + /// given predicate. If one sequence is shorter than + /// the other then the remaining elements of the longer sequence are ignored. + /// + /// A function to test pairs of elements from the input sequences. + /// The first input sequence. + /// The second input sequence. + /// + /// True if all pairs satisfy the predicate; false otherwise. + /// + /// Thrown when either of the input sequences is null. + /// + /// + [] + val forall2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool + + /// Applies a key-generating function to each element of a sequence and yields a sequence of + /// unique keys. Each unique key contains a sequence of all elements that match + /// to this key. + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. The function makes no assumption on the ordering of the original + /// sequence. + /// + /// A function that transforms an element of the sequence into a comparable key. + /// The input sequence. + /// + /// The result sequence. + /// + /// + [] + val groupBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * seq<'T>> when 'Key : equality + + /// Returns the first element of the sequence. + /// + /// The input sequence. + /// + /// The first element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input does not have any elements. + /// + /// + [] + val head: source:seq<'T> -> 'T + + /// Returns the first element of the sequence, or None if the sequence is empty. + /// + /// The input sequence. + /// + /// The first element of the sequence or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryHead: source:seq<'T> -> 'T option + + /// Returns the last element of the sequence. + /// + /// The input sequence. + /// + /// The last element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input does not have any elements. + /// + /// + [] + val last: source:seq<'T> -> 'T + + /// Returns the last element of the sequence. + /// Return None if no such element exists. + /// + /// The input sequence. + /// + /// The last element of the sequence or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryLast: source:seq<'T> -> 'T option + + /// Returns the only element of the sequence. + /// + /// The input sequence. + /// + /// The only element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input does not have precisely one element. + /// + /// + [] + val exactlyOne: source:seq<'T> -> 'T + + /// Returns the only element of the sequence or None if sequence is empty or contains more than one element. + /// + /// The input sequence. + /// + /// The only element of the sequence or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryExactlyOne: source:seq<'T> -> 'T option + + /// Returns true if the sequence contains no elements, false otherwise. + /// + /// The input sequence. + /// + /// True if the sequence is empty; false otherwise. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val isEmpty: source:seq<'T> -> bool + + /// Builds a new collection whose elements are the corresponding elements of the input collection + /// paired with the integer index (from 0) of each element. + /// + /// The input sequence. + /// + /// The result sequence. + /// Thrown when the input sequence is null. + /// + /// + [] + val indexed: source:seq<'T> -> seq + + /// Generates a new sequence which, when iterated, will return successive + /// elements by calling the given function, up to the given count. Each element is saved after its + /// initialization. The function is passed the index of the item being + /// generated. + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// + /// The maximum number of items to generate for the sequence. + /// A function that generates an item in the sequence from a given index. + /// + /// The result sequence. + /// + /// Thrown when count is negative. + /// + /// + [] + val init: count:int -> initializer:(int -> 'T) -> seq<'T> - /// Return a new sequence with the item at a given index set to the new value. - /// - /// The index of the item to be replaced. - /// The new value. - /// The input sequence. - /// - /// - /// - /// seq { 0; 1; 2 } |> Seq.updateAt 1 9 // evaluates to seq { 0; 9; 2 } - /// - /// - /// - /// The result sequence. - /// - /// Thrown when index is outside 0..source.Length - 1 - [] - val updateAt: index: int -> value: 'T -> source: seq<'T> -> seq<'T> + /// Generates a new sequence which, when iterated, will return successive + /// elements by calling the given function. The results of calling the function + /// will not be saved, that is the function will be reapplied as necessary to + /// regenerate the elements. The function is passed the index of the item being + /// generated. + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// Iteration can continue up to Int32.MaxValue. + /// + /// A function that generates an item in the sequence from a given index. + /// + /// The result sequence. + /// + /// + [] + val initInfinite: initializer:(int -> 'T) -> seq<'T> + + /// Computes the element at the specified index in the collection. + /// + /// The index of the element to retrieve. + /// The input sequence. + /// + /// The element at the specified index of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the index is negative or the input sequence does not contain enough elements. + /// + /// + [] + val item: index:int -> source:seq<'T> -> 'T + + /// Applies the given function to each element of the collection. + /// + /// A function to apply to each element of the sequence. + /// The input sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val iter: action:('T -> unit) -> source:seq<'T> -> unit + + /// Applies the given function to each element of the collection. The integer passed to the + /// function indicates the index of element. + /// + /// A function to apply to each element of the sequence that can also access the current index. + /// The input sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val iteri: action:(int -> 'T -> unit) -> source:seq<'T> -> unit + + /// Applies the given function to two collections simultaneously. If one sequence is shorter than + /// the other then the remaining elements of the longer sequence are ignored. + /// + /// A function to apply to each pair of elements from the input sequences. + /// The first input sequence. + /// The second input sequence. + /// + /// Thrown when either of the input sequences is null. + /// + /// + [] + val iter2: action:('T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit + + /// Applies the given function to two collections simultaneously. If one sequence is shorter than + /// the other then the remaining elements of the longer sequence are ignored. The integer passed to the + /// function indicates the index of element. + /// + /// A function to apply to each pair of elements from the input sequences along with their index. + /// The first input sequence. + /// The second input sequence. + /// + /// Thrown when either of the input sequences is null. + /// + /// + [] + val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit + + /// Returns the length of the sequence + /// + /// The input sequence. + /// + /// The length of the sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val length: source:seq<'T> -> int + + /// Builds a new collection whose elements are the results of applying the given function + /// to each of the elements of the collection. The given function will be applied + /// as elements are demanded using the MoveNext method on enumerators retrieved from the + /// object. + /// + /// The returned sequence may be passed between threads safely. However, + /// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. + /// + /// A function to transform items from the input sequence. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U> + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than + /// the other then the remaining elements of the longer sequence are ignored. + /// + /// A function to transform pairs of items from the input sequences. + /// The first input sequence. + /// The second input sequence. + /// + /// The result sequence. + /// + /// Thrown when either of the input sequences is null. + /// + /// + [] + val map2: mapping:('T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> + + /// Combines map and fold. Builds a new collection whose elements are the results of applying the given function + /// to each of the elements of the collection. The function is also used to accumulate a final value. + /// + /// This function digests the whole initial sequence as soon as it is called. As a result this function should + /// not be used with large or infinite sequences. + /// + /// The function to transform elements from the input collection and accumulate the final value. + /// The initial state. + /// The input collection. + /// + /// Thrown when the input collection is null. + /// + /// The collection of transformed elements, and the final accumulated value. + /// + /// + [] + val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:seq<'T> -> seq<'Result> * 'State + + /// Combines map and foldBack. Builds a new collection whose elements are the results of applying the given function + /// to each of the elements of the collection. The function is also used to accumulate a final value. + /// + /// This function digests the whole initial sequence as soon as it is called. As a result this function should + /// not be used with large or infinite sequences. + /// + /// The function to transform elements from the input collection and accumulate the final value. + /// The input collection. + /// The initial state. + /// + /// Thrown when the input collection is null. + /// + /// The collection of transformed elements, and the final accumulated value. + /// + /// + [] + val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:seq<'T> -> state:'State -> seq<'Result> * 'State + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding triples of elements from the three sequences. If one input sequence if shorter than + /// the others then the remaining elements of the longer sequences are ignored. + /// + /// The function to transform triples of elements from the input sequences. + /// The first input sequence. + /// The second input sequence. + /// The third input sequence. + /// + /// The result sequence. + /// + /// Thrown when any of the input sequences is null. + /// + /// + [] + val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'U> + + /// Builds 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 (from 0) of element being transformed. + /// + /// A function to transform items from the input sequence that also supplies the current index. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val mapi: mapping:(int -> 'T -> 'U) -> source:seq<'T> -> seq<'U> + + /// Builds a new collection whose elements are the results of applying the given function + /// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than + /// the other then the remaining elements of the longer sequence are ignored. The integer index passed to the + /// function indicates the index (from 0) of element being transformed. + /// + /// A function to transform pairs of items from the input sequences that also supplies the current index. + /// The first input sequence. + /// The second input sequence. + /// + /// The result sequence. + /// + /// Thrown when either of the input sequences is null. + /// + /// + [] + val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U> + + /// Returns the greatest of all elements of the sequence, compared via Operators.max + /// + /// The input sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// The largest element of the sequence. + /// + /// + [] + val inline max : source:seq<'T> -> 'T when 'T : comparison + + /// Returns the greatest of all elements of the sequence, compared via Operators.max on the function result. + /// + /// A function to transform items from the input sequence into comparable keys. + /// The input sequence. + /// + /// The largest element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// + [] + val inline maxBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison + + /// Returns the lowest of all elements of the sequence, compared via Operators.min. + /// + /// The input sequence. + /// + /// The smallest element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// + [] + val inline min : source:seq<'T> -> 'T when 'T : comparison + + /// Returns the lowest of all elements of the sequence, compared via Operators.min on the function result. + /// + /// A function to transform items from the input sequence into comparable keys. + /// The input sequence. + /// + /// The smallest element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// + [] + val inline minBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison + + /// Computes the nth element in the collection. + /// + /// The index of element to retrieve. + /// The input sequence. + /// + /// The nth element of the sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the index is negative or the input sequence does not contain enough elements. + /// + /// + [] + [] + val nth: index:int -> source:seq<'T> -> 'T + + /// + /// + [] + /// Views the given array as a sequence. + /// + /// The input array. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + val ofArray: source:'T[] -> seq<'T> + + /// + /// + [] + /// Views the given list as a sequence. + /// + /// The input list. + /// + /// The result sequence. + val ofList: source:'T list -> seq<'T> + + /// Returns a sequence of each element in the input sequence and its predecessor, with the + /// exception of the first element which is only returned as the predecessor of the second element. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val pairwise: source:seq<'T> -> seq<'T * 'T> + + /// Returns a sequence with all elements permuted according to the + /// specified permutation. + /// + /// This function consumes the whole input sequence before yielding the first element of the result sequence. + /// + /// The function that maps input indices to output indices. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when indexMap does not produce a valid permutation. + /// + /// + [] + val permute: indexMap:(int -> int) -> source:seq<'T> -> seq<'T> + + /// Applies the given function to successive elements, returning the first + /// x where the function returns "Some(x)". + /// + /// A function to transform each item of the input sequence into an option of the output type. + /// The input sequence. + /// + /// The selected element. + /// + /// Thrown when the input sequence is null. + /// Thrown when every item of the sequence + /// evaluates to None when the given function is applied. + /// + /// + [] + val pick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U + + /// Builds a new sequence object that delegates to the given sequence object. This ensures + /// the original sequence cannot be rediscovered and mutated by a type cast. For example, + /// if given an array the returned sequence will return the elements of the array, but + /// you cannot cast the returned sequence object to an array. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val readonly : source:seq<'T> -> seq<'T> + + /// Applies a function to each element of the sequence, threading an accumulator argument + /// through the computation. Begin by applying the function to the first two elements. + /// Then feed this result into the function along with the third element and so on. + /// Return the final result. + /// + /// A function that takes in the current accumulated result and the next + /// element of the sequence to produce the next accumulated result. + /// The input sequence. + /// + /// The final result of the reduction function. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// + [] + val reduce: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T + + /// Creates a sequence by replicating the given initial value. + /// + /// The number of elements to replicate. + /// The value to replicate + /// + /// The generated sequence. + /// + /// + [] + val replicate: count:int -> initial:'T -> seq<'T> + + /// Applies a function to each element of the sequence, starting from the end, threading an accumulator argument + /// through the computation. If the input function is f and the elements are i0...iN + /// then computes f i0 (...(f iN-1 iN)). + /// + /// A function that takes in the next-to-last element of the sequence and the + /// current accumulated result to produce the next accumulated result. + /// The input sequence. + /// + /// The final result of the reductions. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// This function consumes the whole input sequence before returning the result. + /// + /// + [] + val reduceBack: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T + + /// Returns a new sequence with the elements in reverse order. + /// + /// The input sequence. + /// + /// The reversed sequence. + /// + /// Thrown when the input sequence is null. + /// + /// This function consumes the whole input sequence before yielding the first element of the reversed sequence. + /// + /// + [] + val rev: source:seq<'T> -> seq<'T> + + /// Like fold, but computes on-demand and returns the sequence of intermediary and final results. + /// + /// A function that updates the state with each element from the sequence. + /// The initial state. + /// The input sequence. + /// + /// The resulting sequence of computed states. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> seq<'State> + + /// Like foldBack, but returns the sequence of intermediary and final results. + /// + /// This function returns a sequence that digests the whole initial sequence as soon as that + /// sequence is iterated. As a result this function should not be used with large or infinite sequences. + /// + /// + /// A function that updates the state with each element from the sequence. + /// The input sequence. + /// The initial state. + /// + /// The resulting sequence of computed states. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> source:seq<'T> -> state:'State -> seq<'State> + + /// Returns a sequence that yields one item only. + /// + /// The input item. + /// + /// The result sequence of one item. + /// + /// + [] + val singleton: value:'T -> seq<'T> + + /// Returns a sequence that skips N elements of the underlying sequence and then yields the + /// remaining elements of the sequence. + /// + /// The number of items to skip. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when count exceeds the number of elements + /// in the sequence. + /// + /// + [] + val skip: count:int -> source:seq<'T> -> seq<'T> + + /// Returns a sequence that, when iterated, skips elements of the underlying sequence while the + /// given predicate returns True, and then yields the remaining elements of the sequence. + /// + /// A function that evaluates an element of the sequence to a boolean value. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val skipWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + + /// Yields a sequence ordered by keys. + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. + /// + /// The function makes no assumption on the ordering of the original + /// sequence and uses a stable sort, that is the original order of equal elements is preserved. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val sort : source:seq<'T> -> seq<'T> when 'T : comparison + + /// Yields a sequence ordered using the given comparison function. + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. + /// + /// The function makes no assumption on the ordering of the original + /// sequence and uses a stable sort, that is the original order of equal elements is preserved. + /// + /// The function to compare the collection elements. + /// The input sequence. + /// + /// The result sequence. + /// + /// + [] + val sortWith : comparer:('T -> 'T -> int) -> source:seq<'T> -> seq<'T> + + /// Applies a key-generating function to each element of a sequence and yield a sequence ordered + /// by keys. The keys are compared using generic comparison as implemented by . + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. + /// + /// The function makes no assumption on the ordering of the original + /// sequence and uses a stable sort, that is the original order of equal elements is preserved. + /// + /// A function to transform items of the input sequence into comparable keys. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison + + /// Yields a sequence ordered descending by keys. + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. The function makes no assumption on the ordering of the original + /// sequence. + /// + /// This is a stable sort, that is the original order of equal elements is preserved. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val inline sortDescending : source:seq<'T> -> seq<'T> when 'T : comparison + + /// Applies a key-generating function to each element of a sequence and yield a sequence ordered + /// descending by keys. The keys are compared using generic comparison as implemented by . + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. The function makes no assumption on the ordering of the original + /// sequence. + /// + /// This is a stable sort, that is the original order of equal elements is preserved. + /// + /// A function to transform items of the input sequence into comparable keys. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val inline sortByDescending : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison + + /// Returns the sum of the elements in the sequence. + /// + /// The elements are summed using the + operator and Zero property associated with the generated type. + /// + /// The input sequence. + /// + /// The computed sum. + /// + /// + [] + val inline sum : source:seq<(^T)> -> ^T + when ^T : (static member ( + ) : ^T * ^T -> ^T) + and ^T : (static member Zero : ^T) + + /// Returns the sum of the results generated by applying the function to each element of the sequence. + /// + /// The generated elements are summed using the + operator and Zero property associated with the generated type. + /// + /// A function to transform items from the input sequence into the type that will be summed. + /// The input sequence. + /// + /// The computed sum. + /// + /// + [] + val inline sumBy : projection:('T -> ^U) -> source:seq<'T> -> ^U + when ^U : (static member ( + ) : ^U * ^U -> ^U) + and ^U : (static member Zero : ^U) + + /// Returns a sequence that skips 1 element of the underlying sequence and then yields the + /// remaining elements of the sequence. + /// + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// + /// + [] + val tail: source:seq<'T> -> seq<'T> + + /// Returns the first N elements of the sequence. + /// + /// Throws InvalidOperationException + /// if the count exceeds the number of elements in the sequence. Seq.truncate + /// returns as many items as the sequence contains instead of throwing an exception. + /// + /// The number of items to take. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// Thrown when the input sequence is empty. + /// Thrown when count exceeds the number of elements + /// in the sequence. + /// + /// + [] + val take: count:int -> source:seq<'T> -> seq<'T> + + /// Returns a sequence that, when iterated, yields elements of the underlying sequence while the + /// given predicate returns True, and then returns no further elements. + /// + /// A function that evaluates to false when no more items should be returned. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val takeWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T> + + /// Builds an array from the given collection. + /// + /// The input sequence. + /// + /// The result array. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val toArray: source:seq<'T> -> 'T[] + + /// Builds a list from the given collection. + /// + /// The input sequence. + /// + /// The result list. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val toList: source:seq<'T> -> 'T list + + /// Returns the first element for which the given function returns True. + /// Return None if no such element exists. + /// + /// A function that evaluates to a Boolean when given an item in the sequence. + /// The input sequence. + /// + /// The found element or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryFind: predicate:('T -> bool) -> source:seq<'T> -> 'T option + + /// Returns the last element for which the given function returns True. + /// Return None if no such element exists. + /// + /// This function digests the whole initial sequence as soon as it is called. As a + /// result this function should not be used with large or infinite sequences. + /// + /// A function that evaluates to a Boolean when given an item in the sequence. + /// The input sequence. + /// + /// The found element or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryFindBack: predicate:('T -> bool) -> source:seq<'T> -> 'T option + + /// Returns the index of the first element in the sequence + /// that satisfies the given predicate. Return None if no such element exists. + /// + /// A function that evaluates to a Boolean when given an item in the sequence. + /// The input sequence. + /// + /// The found index or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryFindIndex : predicate:('T -> bool) -> source:seq<'T> -> int option + + /// Tries to find the nth element in the sequence. + /// Returns None if index is negative or the input sequence does not contain enough elements. + /// + /// The index of element to retrieve. + /// The input sequence. + /// + /// The nth element of the sequence or None. + /// Thrown when the input sequence is null. + /// + /// + [] + val tryItem: index:int -> source:seq<'T> -> 'T option + + /// Returns the index of the last element in the sequence + /// that satisfies the given predicate. Return None if no such element exists. + /// + /// This function digests the whole initial sequence as soon as it is called. As a + /// result this function should not be used with large or infinite sequences. + /// + /// A function that evaluates to a Boolean when given an item in the sequence. + /// The input sequence. + /// + /// The found index or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryFindIndexBack : predicate:('T -> bool) -> source:seq<'T> -> int option + + /// Applies the given function to successive elements, returning the first + /// result where the function returns "Some(x)". + /// + /// A function that transforms items from the input sequence into options. + /// The input sequence. + /// + /// The chosen element or None. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val tryPick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U option + + /// Returns the transpose of the given sequence of sequences. + /// + /// This function returns a sequence that digests the whole initial sequence as soon as + /// that sequence is iterated. As a result this function should not be used with + /// large or infinite sequences. + /// + /// The input sequence. + /// + /// The transposed sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val transpose: source:seq<'Collection> -> seq> when 'Collection :> seq<'T> + + /// Returns a sequence that when enumerated returns at most N elements. + /// + /// The maximum number of items to enumerate. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when the input sequence is null. + /// + /// + [] + val truncate: count:int -> source:seq<'T> -> seq<'T> + + /// Returns a sequence that contains the elements generated by the given computation. + /// The given initial state argument is passed to the element generator. + /// For each IEnumerator elements in the stream are generated on-demand by applying the element + /// generator, until a None value is returned by the element generator. Each call to the element + /// generator returns a new residual state. + /// + /// The stream will be recomputed each time an IEnumerator is requested and iterated for the Seq. + /// + /// A function that takes in the current state and returns an option tuple of the next + /// element of the sequence and the next state value. + /// The initial state value. + /// + /// The result sequence. + /// + /// + [] + val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T> + + /// Returns a sequence that yields sliding windows containing elements drawn from the input + /// sequence. Each window is returned as a fresh array. + /// + /// The number of elements in each window. + /// The input sequence. + /// + /// The result sequence. + /// Thrown when the input sequence is null. + /// Thrown when windowSize is not positive. + /// + /// + [] + val windowed: windowSize:int -> source:seq<'T> -> seq<'T[]> + + /// Combines the two sequences into a list of pairs. The two sequences need not have equal lengths: + /// when one sequence is exhausted any remaining elements in the other + /// sequence are ignored. + /// + /// The first input sequence. + /// The second input sequence. + /// + /// The result sequence. + /// + /// Thrown when either of the input sequences is null. + /// + /// + [] + val zip: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2> + + /// Combines the three sequences into a list of triples. The sequences need not have equal lengths: + /// when one sequence is exhausted any remaining elements in the other + /// sequences are ignored. + /// + /// The first input sequence. + /// The second input sequence. + /// The third input sequence. + /// + /// The result sequence. + /// + /// Thrown when any of the input sequences is null. + /// + /// + [] + val zip3: source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'T1 * 'T2 * 'T3> - /// Return a new sequence with a new item inserted before the given index. - /// - /// The index where the item should be inserted. - /// The value to insert. - /// The input sequence. - /// - /// - /// - /// seq { 0; 1; 2 } |> Seq.insertAt 1 9 // evaluates to seq { 0; 9; 1; 2 } - /// - /// - /// - /// The result sequence. - /// - /// Thrown when index is below 0 or greater than source.Length. - [] - val insertAt: index: int -> value: 'T -> source: seq<'T> -> seq<'T> - - /// Return a new sequence with new items inserted before the given index. - /// - /// The index where the items should be inserted. - /// The values to insert. - /// The input sequence. - /// - /// - /// - /// seq { 0; 1; 2 } |> Seq.insertManyAt 1 [8; 9] // evaluates to seq { 0; 8; 9; 1; 2 } - /// - /// - /// - /// The result sequence. - /// - /// Thrown when index is below 0 or greater than source.Length. - [] - val insertManyAt: index: int -> values: seq<'T> -> source: seq<'T> -> seq<'T> + /// Return a new sequence with the item at a given index removed. + /// + /// The index of the item to be removed. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when index is outside 0..source.Length - 1 + /// + /// + /// + /// seq { 0; 1; 2 } |> Seq.removeAt 1 // evaluates to seq { 0; 2 } + /// + /// + [] + val removeAt: index: int -> source: seq<'T> -> seq<'T> + + /// Return a new sequence with the number of items starting at a given index removed. + /// + /// The index of the item to be removed. + /// The number of items to remove. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when index is outside 0..source.Length - count + /// + /// + /// + /// seq { 0; 1; 2; 3 } |> Seq.removeManyAt 1 2 // evaluates to seq { 0; 3 } + /// + /// + [] + val removeManyAt: index: int -> count: int -> source: seq<'T> -> seq<'T> + + /// Return a new sequence with the item at a given index set to the new value. + /// + /// The index of the item to be replaced. + /// The new value. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when index is outside 0..source.Length - 1 + /// + /// + /// + /// seq { 0; 1; 2 } |> Seq.updateAt 1 9 // evaluates to seq { 0; 9; 2 } + /// + /// + [] + val updateAt: index: int -> value: 'T -> source: seq<'T> -> seq<'T> + + /// Return a new sequence with a new item inserted before the given index. + /// + /// The index where the item should be inserted. + /// The value to insert. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when index is below 0 or greater than source.Length. + /// + /// + /// + /// seq { 0; 1; 2 } |> Seq.insertAt 1 9 // evaluates to seq { 0; 9; 1; 2 } + /// + /// + [] + val insertAt: index: int -> value: 'T -> source: seq<'T> -> seq<'T> + + /// Return a new sequence with new items inserted before the given index. + /// + /// The index where the items should be inserted. + /// The values to insert. + /// The input sequence. + /// + /// The result sequence. + /// + /// Thrown when index is below 0 or greater than source.Length. + /// + /// + /// + /// seq { 0; 1; 2 } |> Seq.insertManyAt 1 [8; 9] // evaluates to seq { 0; 8; 9; 1; 2 } + /// + /// + [] + val insertManyAt: index: int -> values: seq<'T> -> source: seq<'T> -> seq<'T> diff --git a/src/fsharp/FSharp.Core/set.fsi b/src/fsharp/FSharp.Core/set.fsi index 53f1d725abb..68506895666 100644 --- a/src/fsharp/FSharp.Core/set.fsi +++ b/src/fsharp/FSharp.Core/set.fsi @@ -2,414 +2,503 @@ 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 elements are ordered by F# generic comparison. By default - /// comparison is the F# structural comparison function or uses implementations of the IComparable interface on element values. - /// - /// See the module for further operations on sets. - /// - /// All members of this class are thread-safe and may be used concurrently from multiple threads. - [] - [] - type Set<[]'T when 'T : comparison> = - - /// Create a set containing elements drawn from the given sequence. - /// The input sequence. - /// - /// The result set. - new : elements:seq<'T> -> 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. - /// - /// The value to add to the set. - /// - /// The result set. - 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. - /// - /// The value to remove from the set. - /// - /// The result set. - 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. - /// - /// The value to check. - /// - /// True if the set contains value. - member Contains : value:'T -> bool - - /// A useful shortcut for Set.isEmpty. See the Set module for further operations on sets. - member IsEmpty : bool - - /// Returns a new set with the elements of the second set removed from the first. - /// - /// The first input set. - /// The second input set. - /// - /// A set containing elements of the first set that are not contained in the second set. - static member (-) : set1:Set<'T> * set2:Set<'T> -> Set<'T> - - /// Compute the union of the two sets. - /// - /// The first input set. - /// The second input set. - /// - /// The union of the two input sets. - static member (+) : set1:Set<'T> * set2:Set<'T> -> Set<'T> - - - /// Evaluates to "true" if all elements of the first set are in the second. - /// - /// The set to test against. - /// - /// True if this set is a subset of otherSet. - member IsSubsetOf: otherSet:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the first set are in the second, and at least - /// one element of the second is not in the first. - /// - /// The set to test against. - /// - /// True if this set is a proper subset of otherSet. - member IsProperSubsetOf: otherSet:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the second set are in the first. - /// - /// The set to test against. - /// - /// True if this set is a superset of otherSet. - member IsSupersetOf: otherSet:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the second set are in the first, and at least - /// one element of the first is not in the second. - /// - /// The set to test against. - /// - /// True if this set is a proper superset of otherSet. - member IsProperSupersetOf: otherSet: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 - - interface ICollection<'T> - interface IEnumerable<'T> - interface System.Collections.IEnumerable - interface System.IComparable - interface IReadOnlyCollection<'T> - override Equals : obj -> bool +open System +open System.Collections.Generic +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections + +/// Immutable sets based on binary trees, where elements are ordered by F# generic comparison. By default +/// comparison is the F# structural comparison function or uses implementations of the IComparable interface on element values. +/// +/// See the module for further operations on sets. +/// +/// All members of this class are thread-safe and may be used concurrently from multiple threads. +[] +[] +type Set<[]'T when 'T : comparison> = + + /// Create a set containing elements drawn from the given sequence. + /// The input sequence. + /// + /// The result set. + /// + /// + new : elements:seq<'T> -> 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. + /// + /// The value to add to the set. + /// + /// The result set. + /// + /// + 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. + /// + /// The value to remove from the set. + /// + /// The result set. + /// + /// + 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. + /// + /// The value to check. + /// + /// True if the set contains value. + /// + /// + member Contains : value:'T -> bool + + /// A useful shortcut for Set.isEmpty. See the Set module for further operations on sets. + /// + /// + member IsEmpty : bool + + /// Returns a new set with the elements of the second set removed from the first. + /// + /// The first input set. + /// The second input set. + /// + /// A set containing elements of the first set that are not contained in the second set. + /// + /// + static member (-) : set1:Set<'T> * set2:Set<'T> -> Set<'T> + /// Compute the union of the two sets. + /// + /// The first input set. + /// The second input set. + /// + /// The union of the two input sets. + /// + /// + static member (+) : set1:Set<'T> * set2:Set<'T> -> Set<'T> + + /// Evaluates to "true" if all elements of the first set are in the second. + /// + /// The set to test against. + /// + /// True if this set is a subset of otherSet. + /// + /// + member IsSubsetOf: otherSet:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the first set are in the second, and at least + /// one element of the second is not in the first. + /// + /// The set to test against. + /// + /// True if this set is a proper subset of otherSet. + /// + /// + member IsProperSubsetOf: otherSet:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the second set are in the first. + /// + /// The set to test against. + /// + /// True if this set is a superset of otherSet. + /// + /// + member IsSupersetOf: otherSet:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the second set are in the first, and at least + /// one element of the first is not in the second. + /// + /// The set to test against. + /// + /// True if this set is a proper superset of otherSet. + /// + /// + member IsProperSupersetOf: otherSet: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 + + interface ICollection<'T> + interface IEnumerable<'T> + interface System.Collections.IEnumerable + interface System.IComparable + interface IReadOnlyCollection<'T> + override Equals : obj -> bool namespace Microsoft.FSharp.Collections - - open System - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - [] - [] - - /// Contains operations for working with values of type . - module Set = - - /// The empty set for the type 'T. - [] - [] - val empty<'T> : Set<'T> when 'T : comparison - - /// The set containing the given element. - /// - /// The value for the set to contain. - /// - /// The set containing value. - [] - val singleton: value:'T -> Set<'T> - - /// Returns a new set with an element added to the set. No exception is raised if - /// the set already contains the given element. - /// - /// The value to add. - /// The input set. - /// - /// A new set containing value. - [] - val add: value:'T -> set:Set<'T> -> Set<'T> - - /// Evaluates to "true" if the given element is in the given set. - /// - /// The element to test. - /// The input set. - /// - /// True if element is in set. - [] - val contains: element:'T -> set:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the first set are in the second - /// - /// The potential subset. - /// The set to test against. - /// - /// True if set1 is a subset of set2. - [] - val isSubset: set1: Set<'T> -> set2:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the first set are in the second, and at least - /// one element of the second is not in the first. - /// - /// The potential subset. - /// The set to test against. - /// - /// True if set1 is a proper subset of set2. - [] - val isProperSubset: set1: Set<'T> -> set2:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the second set are in the first. - /// - /// The potential superset. - /// The set to test against. - /// - /// True if set1 is a superset of set2. - [] - val isSuperset: set1: Set<'T> -> set2:Set<'T> -> bool - - /// Evaluates to "true" if all elements of the second set are in the first, and at least - /// one element of the first is not in the second. - /// - /// The potential superset. - /// The set to test against. - /// - /// True if set1 is a proper superset of set2. - [] - val isProperSuperset: set1: Set<'T> -> set2:Set<'T> -> bool - - - /// Returns the number of elements in the set. Same as size. - /// - /// The input set. - /// - /// The number of elements in the set. - [] - val count: set:Set<'T> -> int - - /// Tests if any element of the collection satisfies the given predicate. - /// If the input function is predicate and the elements are i0...iN - /// then computes p i0 or ... or p iN. - /// - /// The function to test set elements. - /// The input set. - /// - /// True if any element of set satisfies predicate. - [] - val exists: predicate:('T -> bool) -> set:Set<'T> -> bool - - /// Returns a new collection containing only the elements of the collection - /// for which the given predicate returns True. - /// - /// The function to test set elements. - /// The input set. - /// - /// The set containing only the elements for which predicate returns true. - [] - val filter: predicate:('T -> bool) -> set:Set<'T> -> Set<'T> - - /// Returns a new collection containing the results of applying the - /// given function to each element of the input set. - /// - /// The function to transform elements of the input set. - /// The input set. - /// - /// A set containing the transformed elements. - [] - val map: mapping:('T -> 'U) -> set:Set<'T> -> Set<'U> - - /// Applies the given accumulating function to all the elements of the set - /// - /// The accumulating function. - /// The initial state. - /// The input set. - /// - /// The final state. - [] - val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> set:Set<'T> -> 'State when 'T : comparison - - /// Applies the given accumulating function to all the elements of the set. - /// - /// The accumulating function. - /// The input set. - /// The initial state. - /// - /// The final state. - [] - val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> set:Set<'T> -> state:'State -> 'State when 'T : comparison - - /// Tests 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. - /// - /// The function to test set elements. - /// The input set. - /// - /// True if all elements of set satisfy predicate. - [] - val forall: predicate:('T -> bool) -> set:Set<'T> -> bool - - /// Computes the intersection of the two sets. - /// - /// The first input set. - /// The second input set. - /// - /// The intersection of set1 and set2. - [] - val intersect: set1:Set<'T> -> set2:Set<'T> -> Set<'T> - - /// Computes the intersection of a sequence of sets. The sequence must be non-empty. - /// - /// The sequence of sets to intersect. - /// - /// The intersection of the input sets. - [] - val intersectMany: sets:seq> -> Set<'T> - - /// Computes the union of the two sets. - /// - /// The first input set. - /// The second input set. - /// - /// The union of set1 and set2. - [] - val union: set1:Set<'T> -> set2:Set<'T> -> Set<'T> - - /// Computes the union of a sequence of sets. - /// - /// The sequence of sets to union. - /// - /// The union of the input sets. - [] - val unionMany: sets:seq> -> Set<'T> - - /// Returns "true" if the set is empty. - /// - /// The input set. - /// - /// True if set is empty. - [] - val isEmpty: set:Set<'T> -> bool - - /// Applies the given function to each element of the set, in order according - /// to the comparison function. - /// - /// The function to apply to each element. - /// The input set. - [] - val iter: action:('T -> unit) -> set:Set<'T> -> unit - - /// Splits the set into two sets containing the elements for which the given predicate - /// returns true and false respectively. - /// - /// The function to test set elements. - /// The input set. - /// - /// A pair of sets with the first containing the elements for which predicate returns - /// true and the second containing the elements for which predicate returns false. - [] - val partition: predicate:('T -> bool) -> set:Set<'T> -> (Set<'T> * Set<'T>) - - /// Returns a new set with the given element removed. No exception is raised if - /// the set doesn't contain the given element. - /// - /// The element to remove. - /// The input set. - /// - /// The input set with value removed. - [] - val remove: value: 'T -> set:Set<'T> -> Set<'T> - - /// Returns the lowest element in the set according to the ordering being used for the set. - /// - /// The input set. - /// - /// The min value from the set. - [] - val minElement: set:Set<'T> -> 'T - - /// Returns the highest element in the set according to the ordering being used for the set. - /// - /// The input set. - /// - /// The max value from the set. - [] - val maxElement: set:Set<'T> -> 'T - - /// Builds a set that contains the same elements as the given list. - /// - /// The input list. - /// - /// A set containing the elements form the input list. - [] - val ofList: elements:'T list -> Set<'T> - - /// Builds a list that contains the elements of the set in order. - /// - /// The input set. - /// - /// An ordered list of the elements of set. - [] - val toList: set:Set<'T> -> 'T list - - /// Builds a set that contains the same elements as the given array. - /// - /// The input array. - /// - /// A set containing the elements of array. - [] - val ofArray: array:'T[] -> Set<'T> - - /// Builds an array that contains the elements of the set in order. - /// - /// The input set. - /// - /// An ordered array of the elements of set. - [] - val toArray: set:Set<'T> -> 'T[] - - /// Returns an ordered view of the collection as an enumerable object. - /// - /// The input set. - /// - /// An ordered sequence of the elements of set. - [] - val toSeq: set:Set<'T> -> seq<'T> - - /// Builds a new collection from the given enumerable object. - /// - /// The input sequence. - /// - /// The set containing elements. - [] - val ofSeq: elements:seq<'T> -> Set<'T> - - /// Returns a new set with the elements of the second set removed from the first. - /// - /// The first input set. - /// The set whose elements will be removed from set1. - /// - /// The set with the elements of set2 removed from set1. - [] - val difference: set1:Set<'T> -> set2:Set<'T> -> Set<'T> + +open System +open System.Collections.Generic +open Microsoft.FSharp.Core +open Microsoft.FSharp.Collections + +[] +[] + +/// Contains operations for working with values of type . +module Set = + + /// The empty set for the type 'T. + /// + /// + [] + [] + val empty<'T> : Set<'T> when 'T : comparison + + /// The set containing the given element. + /// + /// The value for the set to contain. + /// + /// The set containing value. + /// + /// + [] + val singleton: value:'T -> Set<'T> + + /// Returns a new set with an element added to the set. No exception is raised if + /// the set already contains the given element. + /// + /// The value to add. + /// The input set. + /// + /// A new set containing value. + /// + /// + [] + val add: value:'T -> set:Set<'T> -> Set<'T> + + /// Evaluates to "true" if the given element is in the given set. + /// + /// The element to test. + /// The input set. + /// + /// True if element is in set. + /// + /// + [] + val contains: element:'T -> set:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the first set are in the second + /// + /// The potential subset. + /// The set to test against. + /// + /// True if set1 is a subset of set2. + /// + /// + [] + val isSubset: set1: Set<'T> -> set2:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the first set are in the second, and at least + /// one element of the second is not in the first. + /// + /// The potential subset. + /// The set to test against. + /// + /// True if set1 is a proper subset of set2. + /// + /// + [] + val isProperSubset: set1: Set<'T> -> set2:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the second set are in the first. + /// + /// The potential superset. + /// The set to test against. + /// + /// True if set1 is a superset of set2. + /// + /// + [] + val isSuperset: set1: Set<'T> -> set2:Set<'T> -> bool + + /// Evaluates to "true" if all elements of the second set are in the first, and at least + /// one element of the first is not in the second. + /// + /// The potential superset. + /// The set to test against. + /// + /// True if set1 is a proper superset of set2. + /// + /// + [] + val isProperSuperset: set1: Set<'T> -> set2:Set<'T> -> bool + + + /// Returns the number of elements in the set. Same as size. + /// + /// The input set. + /// + /// The number of elements in the set. + /// + /// + [] + val count: set:Set<'T> -> int + + /// Tests if any element of the collection satisfies the given predicate. + /// If the input function is predicate and the elements are i0...iN + /// then computes p i0 or ... or p iN. + /// + /// The function to test set elements. + /// The input set. + /// + /// True if any element of set satisfies predicate. + /// + /// + [] + val exists: predicate:('T -> bool) -> set:Set<'T> -> bool + + /// Returns a new collection containing only the elements of the collection + /// for which the given predicate returns True. + /// + /// The function to test set elements. + /// The input set. + /// + /// The set containing only the elements for which predicate returns true. + /// + /// + [] + val filter: predicate:('T -> bool) -> set:Set<'T> -> Set<'T> + + /// Returns a new collection containing the results of applying the + /// given function to each element of the input set. + /// + /// The function to transform elements of the input set. + /// The input set. + /// + /// A set containing the transformed elements. + /// + /// + [] + val map: mapping:('T -> 'U) -> set:Set<'T> -> Set<'U> + + /// Applies the given accumulating function to all the elements of the set + /// + /// The accumulating function. + /// The initial state. + /// The input set. + /// + /// The final state. + /// + /// + [] + val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> set:Set<'T> -> 'State when 'T : comparison + + /// Applies the given accumulating function to all the elements of the set. + /// + /// The accumulating function. + /// The input set. + /// The initial state. + /// + /// The final state. + /// + /// + [] + val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> set:Set<'T> -> state:'State -> 'State when 'T : comparison + + /// Tests 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. + /// + /// The function to test set elements. + /// The input set. + /// + /// True if all elements of set satisfy predicate. + /// + /// + [] + val forall: predicate:('T -> bool) -> set:Set<'T> -> bool + + /// Computes the intersection of the two sets. + /// + /// The first input set. + /// The second input set. + /// + /// The intersection of set1 and set2. + /// + /// + [] + val intersect: set1:Set<'T> -> set2:Set<'T> -> Set<'T> + + /// Computes the intersection of a sequence of sets. The sequence must be non-empty. + /// + /// The sequence of sets to intersect. + /// + /// The intersection of the input sets. + /// + /// + [] + val intersectMany: sets:seq> -> Set<'T> + + /// Computes the union of the two sets. + /// + /// The first input set. + /// The second input set. + /// + /// The union of set1 and set2. + /// + /// + [] + val union: set1:Set<'T> -> set2:Set<'T> -> Set<'T> + + /// Computes the union of a sequence of sets. + /// + /// The sequence of sets to union. + /// + /// The union of the input sets. + /// + /// + [] + val unionMany: sets:seq> -> Set<'T> + + /// Returns "true" if the set is empty. + /// + /// The input set. + /// + /// True if set is empty. + /// + /// + [] + val isEmpty: set:Set<'T> -> bool + + /// Applies the given function to each element of the set, in order according + /// to the comparison function. + /// + /// The function to apply to each element. + /// The input set. + /// + /// + [] + val iter: action:('T -> unit) -> set:Set<'T> -> unit + + /// Splits the set into two sets containing the elements for which the given predicate + /// returns true and false respectively. + /// + /// The function to test set elements. + /// The input set. + /// + /// A pair of sets with the first containing the elements for which predicate returns + /// true and the second containing the elements for which predicate returns false. + /// + /// + [] + val partition: predicate:('T -> bool) -> set:Set<'T> -> (Set<'T> * Set<'T>) + + /// Returns a new set with the given element removed. No exception is raised if + /// the set doesn't contain the given element. + /// + /// The element to remove. + /// The input set. + /// + /// The input set with value removed. + /// + /// + [] + val remove: value: 'T -> set:Set<'T> -> Set<'T> + + /// Returns the lowest element in the set according to the ordering being used for the set. + /// + /// The input set. + /// + /// The min value from the set. + /// + /// + [] + val minElement: set:Set<'T> -> 'T + + /// Returns the highest element in the set according to the ordering being used for the set. + /// + /// The input set. + /// + /// The max value from the set. + /// + /// + [] + val maxElement: set:Set<'T> -> 'T + + /// Builds a set that contains the same elements as the given list. + /// + /// The input list. + /// + /// A set containing the elements form the input list. + /// + /// + [] + val ofList: elements:'T list -> Set<'T> + + /// Builds a list that contains the elements of the set in order. + /// + /// The input set. + /// + /// An ordered list of the elements of set. + /// + /// + [] + val toList: set:Set<'T> -> 'T list + + /// Builds a set that contains the same elements as the given array. + /// + /// The input array. + /// + /// A set containing the elements of array. + /// + /// + [] + val ofArray: array:'T[] -> Set<'T> + + /// Builds an array that contains the elements of the set in order. + /// + /// The input set. + /// + /// An ordered array of the elements of set. + /// + /// + [] + val toArray: set:Set<'T> -> 'T[] + + /// Returns an ordered view of the collection as an enumerable object. + /// + /// The input set. + /// + /// An ordered sequence of the elements of set. + /// + /// + [] + val toSeq: set:Set<'T> -> seq<'T> + + /// Builds a new collection from the given enumerable object. + /// + /// The input sequence. + /// + /// The set containing elements. + /// + /// + [] + val ofSeq: elements:seq<'T> -> Set<'T> + + /// Returns a new set with the elements of the second set removed from the first. + /// + /// The first input set. + /// The set whose elements will be removed from set1. + /// + /// The set with the elements of set2 removed from set1. + /// + /// + [] + val difference: set1:Set<'T> -> set2:Set<'T> -> Set<'T> diff --git a/src/fsharp/FSharp.Core/string.fsi b/src/fsharp/FSharp.Core/string.fsi index a77d4cbb160..0bae31c3cb1 100644 --- a/src/fsharp/FSharp.Core/string.fsi +++ b/src/fsharp/FSharp.Core/string.fsi @@ -30,6 +30,7 @@ namespace Microsoft.FSharp.Core /// The following samples shows how to interspace spaces in a text /// /// let input = "Stefan says: Hi!" + /// /// input |> String.collect (sprintf "%c ") /// /// The sample evaluates to "S t e f a n s a y s : H i ! " @@ -57,13 +58,16 @@ namespace Microsoft.FSharp.Core /// /// /// let input1 = ["Stefan"; "says:"; "Hello"; "there!"] + /// /// input1 |> String.concat " " // evaluates "Stefan says: Hello there!" /// /// let input2 = [0..9] |> List.map string + /// /// input2 |> String.concat "" // evaluates "0123456789" /// input2 |> String.concat ", " // evaluates "0, 1, 2, 3, 4, 5, 6, 7, 8, 9" /// /// let input3 = ["No comma"] + /// /// input3 |> String.concat "," // evaluates "No comma" /// /// @@ -104,6 +108,7 @@ namespace Microsoft.FSharp.Core /// open System /// /// let input = "0 1 2 3 4 5 6 7 8 9 a A m M" + /// /// input |> String.filter Uri.IsHexDigit // evaluates "123456789aA" /// /// @@ -145,6 +150,7 @@ namespace Microsoft.FSharp.Core /// be concatenated with the others. /// /// The constructed string. + /// /// Thrown when count is negative. /// /// Enumerate digits ASCII codes @@ -229,7 +235,9 @@ namespace Microsoft.FSharp.Core /// Changing case to upper for all characters in the input string /// /// open System + /// /// let input = "Hello there!" + /// /// input |> String.map Char.ToUpper // evaluates "HELLO THERE!" /// /// @@ -249,10 +257,13 @@ namespace Microsoft.FSharp.Core /// open System /// /// let alternateCase indx chr = - /// if 0 = indx % 2 - /// then Char.ToUpper chr - /// else Char.ToLower chr + /// if 0 = indx % 2 then + /// Char.ToUpper chr + /// else + /// Char.ToLower chr + /// /// let input = "Hello there!" + /// /// input |> String.mapi alternateCase // evaluates "HeLlO ThErE!" /// /// diff --git a/src/fsharp/FSharp.Core/tasks.fsi b/src/fsharp/FSharp.Core/tasks.fsi index e5ad31910ce..ec2dea983b3 100644 --- a/src/fsharp/FSharp.Core/tasks.fsi +++ b/src/fsharp/FSharp.Core/tasks.fsi @@ -164,6 +164,8 @@ namespace Microsoft.FSharp.Control /// /// Builds a task using computation expression syntax. /// + /// + /// [] val task: TaskBuilder @@ -177,6 +179,8 @@ namespace Microsoft.FSharp.Control /// If created on a background thread (where is null) it is executed immeidately /// immediately on that thread. /// + /// + /// [] val backgroundTask: BackgroundTaskBuilder diff --git a/src/fsharp/utils/sformat.fsi b/src/fsharp/utils/sformat.fsi index 868cafa1b75..31de2b6b39a 100644 --- a/src/fsharp/utils/sformat.fsi +++ b/src/fsharp/utils/sformat.fsi @@ -350,14 +350,6 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl /// The ShowIEnumerable is set the printing process will force the evaluation of IEnumerable objects /// to a small, finite depth, as determined by the printing parameters. /// This may lead to additional computation being performed during printing. - /// - /// - /// From F# Interactive the default settings can be adjusted using, for example, - ///
-    ///   open FSharp.Compiler.Interactive.Settings;;
-    ///   setPrintWidth 120;;
-    /// 
- ///
[] type internal FormatOptions = { FloatingPointFormat: string