From cb219a88aec11aabe36b37869e5413601b1606a0 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 13 Mar 2017 20:06:20 +1100 Subject: [PATCH 001/120] Added ISeq module --- .../SurfaceArea.net40.fs | 193 ++ src/fsharp/FSharp.Core/FSharp.Core.fsproj | 6 + src/fsharp/FSharp.Core/iseq.fs | 1725 +++++++++++++++++ src/fsharp/FSharp.Core/iseq.fsi | 362 ++++ 4 files changed, 2286 insertions(+) create mode 100644 src/fsharp/FSharp.Core/iseq.fs create mode 100644 src/fsharp/FSharp.Core/iseq.fsi diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 7db771e825d..17083f1f7ae 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -280,6 +280,199 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) +Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: TResult Fold[TResult,TState](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]]) +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Activity`2 Compose[V](IOutOfBand, Int32, Activity`2) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 +Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+NoValue +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] +Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Distinct[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Empty[T]() +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Except[T](System.Collections.Generic.IEnumerable`1[T], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Indexed[a](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], ISeq`1, ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfArray[T](T[]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Min[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], ISeq`1) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 204f628733d..207cf5b3861 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -104,6 +104,12 @@ Collections/seqcore.fs + + Collections/iseq.fsi + + + Collections/iseq.fs + Collections/seq.fsi diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs new file mode 100644 index 00000000000..d99e39639cd --- /dev/null +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -0,0 +1,1725 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.FSharp.Collections + + open System + open System.Diagnostics + open System.Collections + open System.Collections.Generic + open System.Reflection + open Microsoft.FSharp.Core + open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators + open Microsoft.FSharp.Core.Operators + open Microsoft.FSharp.Core.CompilerServices + open Microsoft.FSharp.Control + open Microsoft.FSharp.Collections + open Microsoft.FSharp.Primitives.Basics + + [] + module ISeq = + open IEnumerator + + module Core = + [] + type NoValue = struct end + + [] + type Value<'a> = + val mutable _1 : 'a + new (a:'a) = { _1 = a } + + [] + type Values<'a,'b> = + val mutable _1 : 'a + val mutable _2 : 'b + new (a:'a, b: 'b) = { _1 = a; _2 = b } + + [] + type Values<'a,'b,'c> = + val mutable _1 : 'a + val mutable _2 : 'b + val mutable _3 : 'c + new (a:'a, b:'b, c:'c) = { _1 = a; _2 = b; _3 = c } + + type PipeIdx = int + + type IOutOfBand = + abstract StopFurtherProcessing : PipeIdx -> unit + + [] + type Activity() = + abstract ChainComplete : stopTailCall:byref * PipeIdx -> unit + abstract ChainDispose : stopTailCall:byref -> unit + + [] + type Activity<'T,'U> () = + inherit Activity() + abstract ProcessNext : input:'T -> bool + + [] + type Transform<'T,'U,'State> = + inherit Activity<'T,'U> + + new (next:Activity, initState:'State) = { + inherit Activity<'T,'U> () + State = initState + Next = next + } + + val mutable State : 'State + val Next : Activity + + override this.ChainComplete (stopTailCall, terminatingIdx) = + this.Next.ChainComplete (&stopTailCall, terminatingIdx) + override this.ChainDispose stopTailCall = + this.Next.ChainDispose (&stopTailCall) + + [] + type TransformWithPostProcessing<'T,'U,'State>(next:Activity, initState:'State) = + inherit Transform<'T,'U,'State>(next, initState) + + abstract OnComplete : PipeIdx -> unit + abstract OnDispose : unit -> unit + + override this.ChainComplete (stopTailCall, terminatingIdx) = + this.OnComplete terminatingIdx + this.Next.ChainComplete (&stopTailCall, terminatingIdx) + override this.ChainDispose stopTailCall = + try this.OnDispose () + finally this.Next.ChainDispose (&stopTailCall) + + [] + type Folder<'T,'Result,'State> = + inherit Activity<'T,'T> + + val mutable Result : 'Result + val mutable State : 'State + + val mutable HaltedIdx : int + member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx + interface IOutOfBand with + member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx + + new (initalResult,initState) = { + inherit Activity<'T,'T>() + State = initState + HaltedIdx = 0 + Result = initalResult + } + + override this.ChainComplete (_,_) = () + override this.ChainDispose _ = () + + [] + type FolderWithPostProcessing<'T,'Result,'State>(initResult,initState) = + inherit Folder<'T,'Result,'State>(initResult,initState) + + abstract OnComplete : PipeIdx -> unit + abstract OnDispose : unit -> unit + + override this.ChainComplete (stopTailCall, terminatingIdx) = + this.OnComplete terminatingIdx + override this.ChainDispose _ = + this.OnDispose () + + [] + type TransformFactory<'T,'U> () = + abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + type ISeq<'T> = + inherit IEnumerable<'T> + abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result,'State> : f:(PipeIdx->Folder<'T,'Result,'State>) -> 'Result + + open Core + + module internal TailCall = + // used for performance reasons; these are not recursive calls, so should be safe + // ** it should be noted that potential changes to the f# compiler may render this function + // ineffictive ** + let inline avoid boolean = match boolean with true -> true | false -> false + + module internal Upcast = + // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality + // is fixed with the compiler then these functions can be removed. + let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) + let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) + let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) + let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) + let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) + + let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_,_>) pipeIdx = + factory.Compose (Upcast.outOfBand folder) pipeIdx folder + + let inline valueComparer<'T when 'T : equality> ()= + let c = HashIdentity.Structural<'T> + { new IEqualityComparer> with + member __.GetHashCode o = c.GetHashCode o._1 + member __.Equals (lhs,rhs) = c.Equals (lhs._1, rhs._1) } + + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = + inherit TransformFactory<'T,'V>() + + override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + + static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + upcast ComposedFactory(first, second) + + and IdentityFactory<'T> private () = + inherit TransformFactory<'T,'T> () + static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static member Instance = singleton + + and ISkipable = + // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip + // and it can only do it at the start of a sequence + abstract CanSkip : unit -> bool + + type SeqProcessNextStates = + | InProcess = 0 + | NotStarted = 1 + | Finished = 2 + + type Result<'T>() = + inherit Folder<'T,'T,NoValue>(Unchecked.defaultof<'T>,Unchecked.defaultof) + + member val SeqState = SeqProcessNextStates.NotStarted with get, set + + override this.ProcessNext (input:'T) : bool = + this.Result <- input + true + + module Fold = + type IIterate<'T> = + abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result,'State> -> consumer:Activity<'T,'U> -> unit + + [] + type enumerable<'T> (enumerable:IEnumerable<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + use enumerator = enumerable.GetEnumerator () + let rec iterate () = + if enumerator.MoveNext () then + consumer.ProcessNext enumerator.Current |> ignore + if outOfBand.HaltedIdx = 0 then + iterate () + iterate () + + [] + type Array<'T> (array:array<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + let array = array + let rec iterate idx = + if idx < array.Length then + consumer.ProcessNext array.[idx] |> ignore + if outOfBand.HaltedIdx = 0 then + iterate (idx+1) + iterate 0 + + [] + type resizeArray<'T> (array:ResizeArray<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + let array = array + let rec iterate idx = + if idx < array.Count then + consumer.ProcessNext array.[idx] |> ignore + if outOfBand.HaltedIdx = 0 then + iterate (idx+1) + iterate 0 + + [] + type List<'T> (alist:list<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + let rec iterate lst = + match lst with + | hd :: tl -> + consumer.ProcessNext hd |> ignore + if outOfBand.HaltedIdx = 0 then + iterate tl + | _ -> () + iterate alist + + [] + type unfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + let generator = generator + let rec iterate current = + match generator current with + | Some (item, next) -> + consumer.ProcessNext item |> ignore + if outOfBand.HaltedIdx = 0 then + iterate next + | _ -> () + iterate state + + [] + type init<'T> (f:int->'T, terminatingIdx:int) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + let terminatingIdx = terminatingIdx + let f = f + + let firstIdx = + match box consumer with + | :? ISkipable as skipping -> + let rec skip idx = + if idx = terminatingIdx || outOfBand.HaltedIdx <> 0 then + terminatingIdx + elif skipping.CanSkip () then + skip (idx+1) + else + idx + skip -1 + | _ -> -1 + + let rec iterate idx = + if idx < terminatingIdx then + consumer.ProcessNext (f (idx+1)) |> ignore + if outOfBand.HaltedIdx = 0 then + iterate (idx+1) + else + idx + else + idx + + let finalIdx = iterate firstIdx + if outOfBand.HaltedIdx = 0 && finalIdx = System.Int32.MaxValue then + raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + + let execute (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = + let mutable stopTailCall = () + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + executeOn.Iterate result consumer + consumer.ChainComplete (&stopTailCall, result.HaltedIdx) + result.Result + finally + consumer.ChainDispose (&stopTailCall) + + let executeThin (createFolder:PipeIdx->Folder<'T,'Result,'State>) (executeOn:#IIterate<'T>) = + let mutable stopTailCall = () + let result = createFolder 1 + try + executeOn.Iterate result result + result.ChainComplete (&stopTailCall, result.HaltedIdx) + result.Result + finally + result.ChainDispose (&stopTailCall) + + module Enumerable = + type Empty<'T>() = + let current () = failwith "library implementation error: Current should never be called" + interface IEnumerator<'T> with + member __.Current = current () + interface IEnumerator with + member __.Current = current () + member __.MoveNext () = false + member __.Reset (): unit = noReset () + interface IDisposable with + member __.Dispose () = () + + type EmptyEnumerators<'T>() = + static let element : IEnumerator<'T> = upcast (new Empty<'T> ()) + static member Element = element + + [] + type EnumeratorBase<'T>(result:Result<'T>, activity:Activity) = + interface IDisposable with + member __.Dispose () : unit = + let mutable stopTailCall = () + activity.ChainDispose (&stopTailCall) + + interface IEnumerator with + member this.Current : obj = box ((Upcast.enumerator this)).Current + member __.MoveNext () = failwith "library implementation error: derived class should implement (should be abstract)" + member __.Reset () : unit = noReset () + + interface IEnumerator<'T> with + member __.Current = + if result.SeqState = SeqProcessNextStates.InProcess then result.Result + else + match result.SeqState with + | SeqProcessNextStates.NotStarted -> notStarted() + | SeqProcessNextStates.Finished -> alreadyFinished() + | _ -> failwith "library implementation error: all states should have been handled" + + and [] EnumerableBase<'T> () = + let derivedClassShouldImplement () = + failwith "library implementation error: derived class should implement (should be abstract)" + + abstract member Append : (ISeq<'T>) -> ISeq<'T> + + default this.Append source = Upcast.seq (AppendEnumerable [this; source]) + + interface IEnumerable with + member this.GetEnumerator () : IEnumerator = + let genericEnumerable = Upcast.enumerable this + let genericEnumerator = genericEnumerable.GetEnumerator () + Upcast.enumeratorNonGeneric genericEnumerator + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () + + interface ISeq<'T> with + member __.PushTransform _ = derivedClassShouldImplement () + member __.Fold _ = derivedClassShouldImplement () + + and Enumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let rec moveNext () = + if (result.HaltedIdx = 0) && source.MoveNext () then + if activity.ProcessNext source.Current then + true + else + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + interface IDisposable with + member __.Dispose () = + try + source.Dispose () + finally + let mutable stopTailCall = () + activity.ChainDispose (&stopTailCall) + + and Enumerable<'T,'U>(enumerable:IEnumerable<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new Enumerator<'T,'U>(enumerable.GetEnumerator(), createFold current result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new Enumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f current pipeIdx (Fold.enumerable enumerable) + + and EnumerableThin<'T>(enumerable:IEnumerable<'T>) = + inherit EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () = enumerable.GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new Enumerable<'T,'U>(enumerable, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.enumerable enumerable) + + and SeqDelayed<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new SeqDelayed<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + (delayed()).Fold f + + and ConcatEnumerator<'T, 'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>) = + let mutable state = SeqProcessNextStates.NotStarted + let main = sources.GetEnumerator () + + let mutable active = EmptyEnumerators.Element + + let rec moveNext () = + if active.MoveNext () then + true + elif main.MoveNext () then + active.Dispose () + active <- main.Current.GetEnumerator () + moveNext () + else + state <- SeqProcessNextStates.Finished + false + + interface IEnumerator<'T> with + member __.Current = + if state = SeqProcessNextStates.InProcess then active.Current + else + match state with + | SeqProcessNextStates.NotStarted -> notStarted() + | SeqProcessNextStates.Finished -> alreadyFinished() + | _ -> failwith "library implementation error: all states should have been handled" + + interface IEnumerator with + member this.Current = box ((Upcast.enumerator this)).Current + member __.MoveNext () = + state <- SeqProcessNextStates.InProcess + moveNext () + member __.Reset () = noReset () + + interface IDisposable with + member __.Dispose () = + main.Dispose () + active.Dispose () + + and AppendEnumerable<'T> (sources:list>) = + inherit EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = + Upcast.enumerator (new ConcatEnumerator<_,_> (sources |> List.rev)) + + override this.Append source = + Upcast.seq (AppendEnumerable (source::sources)) + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (Enumerable<'T,'V>(this, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.enumerable this) + + and ConcatEnumerable<'T, 'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>) = + inherit EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = + Upcast.enumerator (new ConcatEnumerator<_,_> (sources)) + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (Enumerable<'T,'V>(this, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.enumerable this) + + let create enumerable current = + Upcast.seq (Enumerable (enumerable, current, 1)) + + module EmptyEnumerable = + type Enumerable<'T> () = + inherit Enumerable.EnumerableBase<'T>() + + static let singleton = Enumerable<'T>() :> ISeq<'T> + static member Instance = singleton + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = IEnumerator.Empty<'T>() + + override this.Append source = + Upcast.seq (Enumerable.EnumerableThin<'T> source) + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (Enumerable.Enumerable<'T,'V>(this, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.enumerable this) + + module Array = + type Enumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit Enumerable.EnumeratorBase<'U>(result, activity) + + let mutable idx = 0 + + let rec moveNext () = + if (result.HaltedIdx = 0) && idx < array.Length then + idx <- idx+1 + if activity.ProcessNext array.[idx-1] then + true + else + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type Enumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit Enumerable.EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new Enumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new Enumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f transformFactory pipeIdx (Fold.Array array) + + module ResizeArray = + type Enumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit Enumerable.EnumeratorBase<'U>(result, activity) + + let mutable idx = 0 + + let rec moveNext () = + if (result.HaltedIdx = 0) && idx < array.Count then + idx <- idx+1 + if activity.ProcessNext array.[idx-1] then + true + else + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type Enumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit Enumerable.EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new Enumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new Enumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f transformFactory pipeIdx (Fold.resizeArray resizeArray) + + module List = + type Enumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit Enumerable.EnumeratorBase<'U>(result, activity) + + let mutable list = alist + + let rec moveNext current = + match result.HaltedIdx, current with + | 0, head::tail -> + if activity.ProcessNext head then + list <- tail + true + else + moveNext tail + | _ -> + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext list + + type Enumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit Enumerable.EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new Enumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new Enumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f transformFactory pipeIdx (Fold.List alist) + + let create alist current = + Upcast.seq (Enumerable(alist, current, 1)) + + module Unfold = + type Enumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = + inherit Enumerable.EnumeratorBase<'U>(result, activity) + + let mutable current = state + + let rec moveNext () = + match result.HaltedIdx, generator current with + | 0, Some (item, nextState) -> + current <- nextState + if activity.ProcessNext item then + true + else + moveNext () + | _ -> false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type Enumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit Enumerable.EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new Enumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new Enumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f transformFactory pipeIdx (Fold.unfold (generator, state)) + + module Init = + // The original implementation of "init" delayed the calculation of Current, and so it was possible + // to do MoveNext without it's value being calculated. + // I can imagine only two scenerios where that is possibly sane, although a simple solution is readily + // at hand in both cases. The first is that of an expensive generator function, where you skip the + // first n elements. The simple solution would have just been to have a map ((+) n) as the first operation + // instead. The second case would be counting elements, but that is only of use if you're not filtering + // or mapping or doing anything else (as that would cause Current to be evaluated!) and + // so you already know what the count is!! Anyway, someone thought it was a good idea, so + // I have had to add an extra function that is used in Skip to determine if we are touching + // Current or not. + + let getTerminatingIdx (count:Nullable) = + // we are offset by 1 to allow for values going up to System.Int32.MaxValue + // System.Int32.MaxValue is an illegal value for the "infinite" sequence + if count.HasValue then + count.Value - 1 + else + System.Int32.MaxValue + + type Enumerator<'T,'U>(count:Nullable, f:int->'T, activity:Activity<'T,'U>, result:Result<'U>) = + inherit Enumerable.EnumeratorBase<'U>(result, activity) + + let isSkipping = + match box activity with + | :? ISkipable as skip -> skip.CanSkip + | _ -> fun () -> false + + let terminatingIdx = + getTerminatingIdx count + + let mutable maybeSkipping = true + let mutable idx = -1 + + let rec moveNext () = + if result.HaltedIdx = 0 && idx < terminatingIdx then + idx <- idx + 1 + + if maybeSkipping then + // Skip can only is only checked at the start of the sequence, so once + // triggered, we stay triggered. + maybeSkipping <- isSkipping () + + if maybeSkipping then + moveNext () + elif activity.ProcessNext (f idx) then + true + else + moveNext () + elif result.HaltedIdx = 0 && idx = System.Int32.MaxValue then + raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + else + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type Enumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit Enumerable.EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new Enumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new Enumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result,'State> (createResult:PipeIdx->Folder<'U,'Result,'State>) = + let terminatingIdx = getTerminatingIdx count + Fold.execute createResult transformFactory pipeIdx (Fold.init (f, terminatingIdx)) + + let upto lastOption f = + match lastOption with + | Some b when b<0 -> failwith "library implementation error: upto can never be called with a negative value" + | _ -> + let unstarted = -1 // index value means unstarted (and no valid index) + let completed = -2 // index value means completed (and no valid index) + let unreachable = -3 // index is unreachable from 0,1,2,3,... + let finalIndex = match lastOption with + | Some b -> b // here b>=0, a valid end value. + | None -> unreachable // run "forever", well as far as Int32.MaxValue since indexing with a bounded type. + // The Current value for a valid index is "f i". + // Lazy<_> values are used as caches, to store either the result or an exception if thrown. + // These "Lazy<_>" caches are created only on the first call to current and forced immediately. + // The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. + // For example, the full enumeration of Seq.initInfinite in the tests. + // state + let index = ref unstarted + // a Lazy node to cache the result/exception + let current = ref (Unchecked.defaultof<_>) + let setIndex i = index := i; current := (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. + let getCurrent() = + if !index = unstarted then notStarted() + if !index = completed then alreadyFinished() + match box !current with + | null -> current := Lazy<_>.Create(fun () -> f !index) + | _ -> () + // forced or re-forced immediately. + (!current).Force() + { new IEnumerator<'U> with + member x.Current = getCurrent() + interface IEnumerator with + member x.Current = box (getCurrent()) + member x.MoveNext() = + if !index = completed then + false + elif !index = unstarted then + setIndex 0 + true + else ( + if !index = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + if !index = finalIndex then + false + else + setIndex (!index + 1) + true + ) + member this.Reset() = noReset() + interface System.IDisposable with + member x.Dispose () = () } + + type EnumerableDecider<'T>(count:Nullable, f:int->'T, pipeIdx:PipeIdx) = + inherit Enumerable.EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = + // we defer back to the original implementation as, as it's quite idiomatic in it's decision + // to calculate Current in a lazy fashion. I doubt anyone is really using this functionality + // in the way presented, but it's possible. + upto (if count.HasValue then Some (count.Value-1) else None) f + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (Enumerable<'T,'V>(count, f, next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.enumerable (Upcast.enumerable this)) + + [] + let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = + Upcast.seq (ResizeArray.Enumerable (source, IdentityFactory.Instance, 1)) + + [] + let ofArray (source:array<'T>) : ISeq<'T> = + checkNonNull "source" source + Upcast.seq (Array.Enumerable (source, IdentityFactory.Instance, 1)) + + [] + let ofList (source:list<'T>) : ISeq<'T> = + Upcast.seq (List.Enumerable (source, IdentityFactory.Instance, 1)) + + [] + let ofSeq (source:seq<'T>) : ISeq<'T> = + match source with + | :? ISeq<'T> as seq -> seq + | :? array<'T> as array -> ofArray array + | :? list<'T> as list -> ofList list + | null -> nullArg "source" + | _ -> Upcast.seq (Enumerable.EnumerableThin<'T> source) + + [] + let inline average (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'T,int> (LanguagePrimitives.GenericZero, 0) with + override this.ProcessNext value = + this.Result <- Checked.(+) this.Result value + this.State <- this.State + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State = 0 then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + this.Result <- LanguagePrimitives.DivideByInt<'T> this.Result this.State + override this.OnDispose () = () }) + + [] + let inline averageBy (f:'T->'U) (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'U,int>(LanguagePrimitives.GenericZero,0) with + override this.ProcessNext value = + this.Result <- Checked.(+) this.Result (f value) + this.State <- this.State + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State = 0 then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + this.Result <- LanguagePrimitives.DivideByInt<'U> this.Result this.State + override this.OnDispose () = () }) + + [] + let empty<'T> = EmptyEnumerable.Enumerable<'T>.Instance + + [] + let exactlyOne (source:ISeq<'T>) : 'T = + source.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>, Values(true, false)) with + override this.ProcessNext value = + if this.State._1 then + this.State._1 <- false + this.Result <- value + else + this.State._2 <- true + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State._1 then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + elif this.State._2 then + invalidArg "source" (SR.GetString SR.inputSequenceTooLong) + override this.OnDispose () = () }) + + [] + let inline fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:ISeq<'T>) : 'State = + source.Fold (fun _ -> + upcast { new Folder<'T,'State,NoValue>(seed,Unchecked.defaultof) with + override this.ProcessNext value = + this.Result <- f this.Result value + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline fold2<'T1,'T2,'State> (folder:'State->'T1->'T2->'State) (state:'State) (source1:ISeq<'T1>) (source2: ISeq<'T2>) = + source1.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<_,'State,IEnumerator<'T2>>(state,source2.GetEnumerator()) with + override this.ProcessNext value = + if this.State.MoveNext() then + this.Result <- folder this.Result value this.State.Current + else + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = () + override this.OnDispose () = this.State.Dispose () }) + + [] + let unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = + Upcast.seq (new Unfold.Enumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) + + [] + let initInfinite<'T> (f:int->'T) : ISeq<'T> = + Upcast.seq (new Init.EnumerableDecider<'T>(Nullable (), f, 1)) + + [] + let init<'T> (count:int) (f:int->'T) : ISeq<'T> = + if count < 0 then invalidArgInputMustBeNonNegative "count" count + elif count = 0 then empty else + Upcast.seq (new Init.EnumerableDecider<'T>(Nullable count, f, 1)) + + [] + let inline iter f (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new Folder<'T,unit,NoValue> ((),Unchecked.defaultof) with + override this.ProcessNext value = + f value + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline iter2 (f:'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = + source1.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<'T,unit,IEnumerator<'U>> ((),source2.GetEnumerator()) with + override this.ProcessNext value = + if this.State.MoveNext() then + f value this.State.Current + else + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = () + override this.OnDispose () = this.State.Dispose () }) + + [] + let inline iteri2 (f:int->'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = + source1.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(-1,source2.GetEnumerator())) with + override this.ProcessNext value = + if this.State._2.MoveNext() then + f this.State._1 value this.State._2.Current + this.State._1 <- this.State._1 + 1 + Unchecked.defaultof<_> + else + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> + override this.OnComplete _ = () + override this.OnDispose () = this.State._2.Dispose () }) + + [] + let tryHead (source:ISeq<'T>) = + source.Fold (fun pipeIdx -> + upcast { new Folder<'T, Option<'T>,NoValue> (None,Unchecked.defaultof) with + override this.ProcessNext value = + this.Result <- Some value + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let head (source:ISeq<_>) = + match tryHead source with + | None -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + | Some x -> x + + [] + let inline iteri f (source:ISeq<'T>) = + source.Fold (fun _ -> + { new Folder<'T,unit,int> ((),0) with + override this.ProcessNext value = + f this.State value + this.State <- this.State + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with + override this.ProcessNext (input:'T) : bool = + this.State.Value.Add input && TailCall.avoid (next.ProcessNext input) }} + + [] + let inline exists f (source:ISeq<'T>) = + source.Fold (fun pipeIdx -> + upcast { new Folder<'T, bool,NoValue> (false,Unchecked.defaultof) with + override this.ProcessNext value = + if f value then + this.Result <- true + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline exists2 (predicate:'T->'U->bool) (source1:ISeq<'T>) (source2: ISeq<'U>) : bool = + source1.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(false,source2.GetEnumerator()) with + override this.ProcessNext value = + if this.State.MoveNext() then + if predicate value this.State.Current then + this.Result <- true + this.StopFurtherProcessing pipeIdx + else + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = () + override this.OnDispose () = this.State.Dispose () }) + + [] + let inline contains element (source:ISeq<'T>) = + source.Fold (fun pipeIdx -> + upcast { new Folder<'T, bool,NoValue> (false,Unchecked.defaultof) with + override this.ProcessNext value = + if element = value then + this.Result <- true + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline forall predicate (source:ISeq<'T>) = + source.Fold (fun pipeIdx -> + upcast { new Folder<'T, bool,NoValue> (true,Unchecked.defaultof) with + override this.ProcessNext value = + if not (predicate value) then + this.Result <- false + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline forall2 predicate (source1:ISeq<'T>) (source2:ISeq<'U>) : bool = + source1.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(true,source2.GetEnumerator()) with + override this.ProcessNext value = + if this.State.MoveNext() then + if not (predicate value this.State.Current) then + this.Result <- false + this.StopFurtherProcessing pipeIdx + else + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = () + override this.OnDispose () = this.State.Dispose () }) + + [] + let inline filter<'T> (f:'T->bool) (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + override __.ProcessNext input = + if f input then TailCall.avoid (next.ProcessNext input) + else false } } + + [] + let inline map<'T,'U> (f:'T->'U) (source:ISeq<'T>) : ISeq<'U> = + source.PushTransform { new TransformFactory<'T,'U>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + override __.ProcessNext input = + TailCall.avoid (next.ProcessNext (f input)) } } + + [] + let inline mapi f (source:ISeq<_>) = + source.PushTransform { new TransformFactory<'T,'U>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,int>(next, -1) with + override this.ProcessNext (input:'T) : bool = + this.State <- this.State + 1 + TailCall.avoid (next.ProcessNext (f this.State input)) } } + + [] + let inline map2<'T,'U,'V> (map:'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = + source1.PushTransform { new TransformFactory<'T,'V>() with + override __.Compose outOfBand pipeIdx (next:Activity<'V,'W>) = + upcast { new TransformWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with + override this.ProcessNext input = + if this.State.MoveNext () then + TailCall.avoid (next.ProcessNext (map input this.State.Current)) + else + outOfBand.StopFurtherProcessing pipeIdx + false + override this.OnComplete _ = () + override this.OnDispose () = this.State.Dispose () }} + + [] + let inline mapi2<'T,'U,'V> (map:int->'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = + source1.PushTransform { new TransformFactory<'T,'V>() with + override __.Compose<'W> outOfBand pipeIdx next = + upcast { new TransformWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with + override this.ProcessNext t = + let idx : byref<_> = &this.State._1 + let u = this.State._2 + if u.MoveNext () then + idx <- idx + 1 + TailCall.avoid (next.ProcessNext (map idx t u.Current)) + else + outOfBand.StopFurtherProcessing pipeIdx + false + override this.OnDispose () = this.State._2.Dispose () + override this.OnComplete _ = () }} + + [] + let inline map3<'T,'U,'V,'W>(map:'T->'U->'V->'W) (source1:ISeq<'T>) (source2:ISeq<'U>) (source3:ISeq<'V>) : ISeq<'W> = + source1.PushTransform { new TransformFactory<'T,'W>() with + override __.Compose<'X> outOfBand pipeIdx next = + upcast { new TransformWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with + override this.ProcessNext t = + let u = this.State._1 + let v = this.State._2 + if u.MoveNext() && v.MoveNext () then + TailCall.avoid (next.ProcessNext (map t u.Current v.Current)) + else + outOfBand.StopFurtherProcessing pipeIdx + false + override this.OnComplete _ = () + override this.OnDispose () = + this.State._1.Dispose () + this.State._2.Dispose () }} + + [] + let inline compareWith (f:'T->'T->int) (source1:ISeq<'T>) (source2:ISeq<'T>) : int = + source1.Fold (fun pipeIdx -> + upcast { new FolderWithPostProcessing<'T,int,IEnumerator<'T>>(0,source2.GetEnumerator()) with + override this.ProcessNext value = + if not (this.State.MoveNext()) then + this.Result <- 1 + this.StopFurtherProcessing pipeIdx + else + let c = f value this.State.Current + if c <> 0 then + this.Result <- c + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) + override this.OnComplete _ = + if this.Result = 0 && this.State.MoveNext() then + this.Result <- -1 + override this.OnDispose () = this.State.Dispose () }) + + [] + let inline choose (f:'T->option<'U>) (source:ISeq<'T>) : ISeq<'U> = + source.PushTransform { new TransformFactory<'T,'U>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + override __.ProcessNext input = + match f input with + | Some value -> TailCall.avoid (next.ProcessNext value) + | None -> false } } + + [] + let inline distinct (source:ISeq<'T>) : ISeq<'T> when 'T:equality = + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with + override this.ProcessNext (input:'T) : bool = + this.State.Add input && TailCall.avoid (next.ProcessNext input) }} + + [] + let inline distinctBy (keyf:'T->'Key) (source:ISeq<'T>) :ISeq<'T> when 'Key:equality = + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with + override this.ProcessNext (input:'T) : bool = + this.State.Add (keyf input) && TailCall.avoid (next.ProcessNext input) }} + + [] + let inline max (source:ISeq<'T>) : 'T when 'T:comparison = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + override this.ProcessNext value = + if this.State then + this.State <- false + this.Result <- value + elif value > this.Result then + this.Result <- value + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + override this.OnDispose () = () }) + + [] + let inline maxBy (f:'T->'U) (source:ISeq<'T>) : 'T when 'U:comparison = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof<'U>)) with + override this.ProcessNext value = + match this.State._1, f value with + | true, valueU -> + this.State._1 <- false + this.State._2 <- valueU + this.Result <- value + | false, valueU when valueU > this.State._2 -> + this.State._2 <- valueU + this.Result <- value + | _ -> () + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State._1 then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + override this.OnDispose () = () }) + + [] + let inline min (source:ISeq<'T>) : 'T when 'T:comparison = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + override this.ProcessNext value = + if this.State then + this.State <- false + this.Result <- value + elif value < this.Result then + this.Result <- value + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + override this.OnDispose () = () }) + + [] + let inline minBy (f:'T->'U) (source:ISeq<'T>) : 'T = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof< 'U>)) with + override this.ProcessNext value = + match this.State._1, f value with + | true, valueU -> + this.State._1 <- false + this.State._2 <- valueU + this.Result <- value + | false, valueU when valueU < this.State._2 -> + this.State._2 <- valueU + this.Result <- value + | _ -> () + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State._1 then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + override this.OnDispose () = () }) + + [] + let pairwise (source:ISeq<'T>) : ISeq<'T*'T> = + source.PushTransform { new TransformFactory<'T,'T * 'T>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with + // member this.isFirst = this.State._1 + // member this.lastValue = this.State._2 + override this.ProcessNext (input:'T) : bool = + if this.State._1 then + this.State._2 <- input + this.State._1 <- false + false + else + let currentPair = this.State._2, input + this.State._2 <- input + TailCall.avoid (next.ProcessNext currentPair) }} + + [] + let inline reduce (f:'T->'T->'T) (source: ISeq<'T>) : 'T = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + override this.ProcessNext value = + if this.State then + this.State <- false + this.Result <- value + else + this.Result <- f this.Result value + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + if this.State then + invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + override this.OnDispose () = () }) + + [] + let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = + source.PushTransform { new TransformFactory<'T,'State>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,'State>(next, initialState) with + override this.ProcessNext (input:'T) : bool = + this.State <- folder this.State input + TailCall.avoid (next.ProcessNext this.State) } } + + [] + let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + let mutable this = Unchecked.defaultof> + let skipper = + { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with + // member this.count = this.State + override this.ProcessNext (input:'T) : bool = + if this.State < skipCount then + this.State <- this.State + 1 + false + else + TailCall.avoid (next.ProcessNext input) + + override this.OnComplete _ = + if this.State < skipCount then + let x = skipCount - this.State + invalidOpFmt "{0}\ntried to skip {1} {2} past the end of the seq" + [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] + override this.OnDispose () = () + + interface ISkipable with + member __.CanSkip () = + if this.State < skipCount then + this.State <- this.State + 1 + true + else + false } + this <- skipper + upcast this } + + [] + let inline skipWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,bool>(next,true) with + // member this.skip = this.State + override this.ProcessNext (input:'T) : bool = + if this.State then + this.State <- predicate input + if this.State then + false + else + TailCall.avoid (next.ProcessNext input) + else + TailCall.avoid (next.ProcessNext input) }} + + [] + let inline sum (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new Folder<'T,'T,NoValue> (LanguagePrimitives.GenericZero,Unchecked.defaultof) with + override this.ProcessNext value = + this.Result <- Checked.(+) this.Result value + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline sumBy (f:'T->'U) (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new Folder<'T,'U,NoValue> (LanguagePrimitives.GenericZero<'U>,Unchecked.defaultof) with + override this.ProcessNext value = + this.Result <- Checked.(+) this.Result (f value) + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + member __.Compose outOfBand pipelineIdx next = + upcast { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with + // member this.count = this.State + override this.ProcessNext (input:'T) : bool = + if this.State < takeCount then + this.State <- this.State + 1 + if this.State = takeCount then + outOfBand.StopFurtherProcessing pipelineIdx + TailCall.avoid (next.ProcessNext input) + else + outOfBand.StopFurtherProcessing pipelineIdx + false + + override this.OnComplete terminatingIdx = + if terminatingIdx < pipelineIdx && this.State < takeCount then + let x = takeCount - this.State + invalidOpFmt "tried to take {0} {1} past the end of the seq" + [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] + override this.OnDispose () = () }} + + [] + let inline takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + member __.Compose outOfBand pipeIdx next = + upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + override __.ProcessNext (input:'T) : bool = + if predicate input then + TailCall.avoid (next.ProcessNext input) + else + outOfBand.StopFurtherProcessing pipeIdx + false }} + + [] + let tail (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + member __.Compose _ _ next = + upcast { new TransformWithPostProcessing<'T,'V,bool>(next,true) with + // member this.isFirst = this.State + override this.ProcessNext (input:'T) : bool = + if this.State then + this.State <- false + false + else + TailCall.avoid (next.ProcessNext input) + override this.OnComplete _ = + if this.State then + invalidArg "source" (SR.GetString SR.notEnoughElements) + override this.OnDispose () = () }} + + [] + let truncate (truncateCount:int) (source:ISeq<'T>) : ISeq<'T> = + source.PushTransform { new TransformFactory<'T,'T>() with + member __.Compose outOfBand pipeIdx next = + upcast { new Transform<'T,'U,int>(next,(*count*)0) with + // member this.count = this.State + override this.ProcessNext (input:'T) : bool = + if this.State < truncateCount then + this.State <- this.State + 1 + if this.State = truncateCount then + outOfBand.StopFurtherProcessing pipeIdx + TailCall.avoid (next.ProcessNext input) + else + outOfBand.StopFurtherProcessing pipeIdx + false }} + + [] + let indexed source = + mapi (fun i x -> i,x) source + + [] + let tryItem index (source:ISeq<'T>) = + if index < 0 then None else + source |> skip index |> tryHead + + [] + let inline tryPick f (source:ISeq<'T>) = + source.Fold (fun pipeIdx -> + upcast { new Folder<'T, Option<'U>,NoValue> (None,Unchecked.defaultof) with + override this.ProcessNext value = + match f value with + | (Some _) as some -> + this.Result <- some + this.StopFurtherProcessing pipeIdx + | None -> () + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline tryFind f (source:ISeq<'T>) = + source.Fold (fun pipeIdx -> + upcast { new Folder<'T, Option<'T>,NoValue> (None,Unchecked.defaultof) with + override this.ProcessNext value = + if f value then + this.Result <- Some value + this.StopFurtherProcessing pipeIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let inline tryFindIndex (predicate:'T->bool) (source:ISeq<'T>) : int option = + source.Fold (fun pipeIdx -> + { new Folder<'T, Option, int>(None, 0) with + // member this.index = this.State + override this.ProcessNext value = + if predicate value then + this.Result <- Some this.State + this.StopFurtherProcessing pipeIdx + else + this.State <- this.State + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let tryLast (source:ISeq<'T>) : 'T option = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,option<'T>,Values>(None,Values(true, Unchecked.defaultof<'T>)) with + // member this.noItems = this.State._1 + // memebr this.last = this.State._2 + override this.ProcessNext value = + if this.State._1 then + this.State._1 <- false + this.State._2 <- value + Unchecked.defaultof<_> (* return value unused in Fold context *) + override this.OnComplete _ = + if not this.State._1 then + this.Result <- Some this.State._2 + override this.OnDispose () = () }) + + [] + let last (source:ISeq<_>) = + match tryLast source with + | None -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + | Some x -> x + + [] + let windowed (windowSize:int) (source:ISeq<'T>) : ISeq<'T[]> = + if windowSize <= 0 then + invalidArgFmt "windowSize" "{0}\nwindowSize = {1}" [|SR.GetString SR.inputMustBePositive; windowSize|] + + source.PushTransform { new TransformFactory<'T,'T[]>() with + member __.Compose outOfBand pipeIdx next = + upcast { + new Transform<'T,'U,Values<'T[],int,int>>(next,Values<'T[],int,int>(Array.zeroCreateUnchecked windowSize, 0, windowSize-1)) with + override this.ProcessNext (input:'T) : bool = + let circularBuffer = this.State._1 + let idx : byref<_> = &this.State._2 + let priming : byref<_> = &this.State._3 + + circularBuffer.[idx] <- input + + idx <- idx + 1 + if idx = windowSize then + idx <- 0 + + if priming > 0 then + priming <- priming - 1 + false + elif windowSize < 32 then + let idx = idx + let window :'T [] = Array.init windowSize (fun i -> circularBuffer.[(idx+i) % windowSize]: 'T) + TailCall.avoid (next.ProcessNext window) + else + let window = Array.zeroCreateUnchecked windowSize + Array.Copy (circularBuffer, idx, window, 0, windowSize - idx) + Array.Copy (circularBuffer, 0, window, windowSize - idx, idx) + TailCall.avoid (next.ProcessNext window) }} + + [] + let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = + Upcast.seq (Enumerable.ConcatEnumerable sources) + + [] + let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = + match source1 with + | :? Enumerable.EnumerableBase<'T> as s -> s.Append source2 + | _ -> Upcast.seq (new Enumerable.AppendEnumerable<_>([source2; source1])) + + [] + let delay (delayed:unit->ISeq<'T>) = + Upcast.seq (Enumerable.SeqDelayed (delayed, 1)) + + module internal GroupBy = + let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,ISeq<'Key*ISeq<'T>>,_>(Unchecked.defaultof<_>,Dictionary comparer) with + override this.ProcessNext v = + let safeKey = keyf v + match this.State.TryGetValue safeKey with + | false, _ -> + let prev = ResizeArray () + this.State.[safeKey] <- prev + prev.Add v + | true, prev -> prev.Add v + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + let maxWastage = 4 + for value in this.State.Values do + if value.Capacity - value.Count > maxWastage then value.TrimExcess () + + this.Result <- + this.State + |> ofSeq + |> map (fun kv -> getKey kv.Key, ofResizeArrayUnchecked kv.Value) + + override this.OnDispose () = () }) + + let inline byVal (keyf:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl HashIdentity.Structural<'Key> keyf id source) + + let inline byRef (keyf:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl (valueComparer<'Key> ()) (keyf >> Value) (fun v -> v._1) source) + + [] + let inline groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (keyf:'T->'Key) (source:ISeq<'T>) = + GroupBy.byVal keyf source + + [] + let inline groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (keyf:'T->'Key) (source:ISeq<'T>) = + GroupBy.byRef keyf source + + module CountBy = + let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,ISeq<'Key*int>,_>(Unchecked.defaultof<_>,Dictionary comparer) with + override this.ProcessNext v = + let safeKey = keyf v + this.State.[safeKey] <- + match this.State.TryGetValue safeKey with + | true, prev -> prev + 1 + | false, _ -> 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.OnComplete _ = + this.Result <- + this.State + |> ofSeq + |> map (fun group -> getKey group.Key, group.Value) + + override this.OnDispose () = () }) + + let inline byVal (keyf:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl HashIdentity.Structural<'Key> keyf id source) + + let inline byRef (keyf:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl (valueComparer<'Key> ()) (keyf >> Value) (fun v -> v._1) source) + + [] + let inline countByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T -> 'Key) (source:ISeq<'T>) = + CountBy.byVal projection source + + [] + let inline countByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T -> 'Key) (source:ISeq<'T>) = + CountBy.byRef projection source + + [] + let length (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new Folder<'T,int,NoValue>(0,Unchecked.defaultof<_>) with + override this.ProcessNext v = + this.Result <- this.Result + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + let toArray (source:ISeq<'T>) = + source.Fold (fun _ -> + upcast { new FolderWithPostProcessing<'T,array<'T>,_>(Unchecked.defaultof<_>,ResizeArray ()) with + override this.ProcessNext v = + this.State.Add v + Unchecked.defaultof<_> (* return value unused in Fold context *) + override this.OnComplete _ = + this.Result <- this.State.ToArray () + override this.OnDispose () = () }) + + [] + let sortBy keyf source = + delay (fun () -> + let array = source |> toArray + Array.stableSortInPlaceBy keyf array + ofArray array) + + [] + let sort source = + delay (fun () -> + let array = source |> toArray + Array.stableSortInPlace array + ofArray array) + + [] + let sortWith f source = + delay (fun () -> + let array = source |> toArray + Array.stableSortInPlaceWith f array + ofArray array) + + [] + let rev source = + delay (fun () -> + let array = source |> toArray + Array.Reverse array + ofArray array) + + [] + let permute f (source:ISeq<_>) = + delay (fun () -> + source + |> toArray + |> Array.permute f + |> ofArray) + + [] + let scanBack<'T,'State> f (source:ISeq<'T>) (acc:'State) : ISeq<'State> = + delay (fun () -> + let array = source |> toArray + Array.scanSubRight f array 0 (array.Length - 1) acc + |> ofArray) + + let inline foldArraySubRight f (arr: 'T[]) start fin acc = + let mutable state = acc + for i = fin downto start do + state <- f arr.[i] state + state + + [] + let inline foldBack<'T,'State> f (source: ISeq<'T>) (x:'State) = + let arr = toArray source + let len = arr.Length + foldArraySubRight f arr 0 (len - 1) x + + [] + let zip source1 source2 = + map2 (fun x y -> x,y) source1 source2 + + [] + let inline foldBack2<'T1,'T2,'State> f (source1:ISeq<'T1>) (source2:ISeq<'T2>) (x:'State) = + let zipped = zip source1 source2 + foldBack ((<||) f) zipped x + + [] + let inline reduceBack f (source:ISeq<'T>) = + let arr = toArray source + match arr.Length with + | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + | len -> foldArraySubRight f arr 0 (len - 2) arr.[len - 1] diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi new file mode 100644 index 00000000000..8f030782f15 --- /dev/null +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.FSharp.Collections + + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + + [] + module ISeq = + module Core = + [] + type NoValue = struct end + + /// Values is a mutable struct. It can be embedded within the folder type + /// if two values are required for the calculation. + [] + type Value<'a> = + new : a:'a -> Value<'a> + val mutable _1: 'a + + /// Values is a mutable struct. It can be embedded within the folder type + /// if two values are required for the calculation. + [] + type Values<'a,'b> = + new : a:'a * b:'b -> Values<'a,'b> + val mutable _1: 'a + val mutable _2: 'b + + /// Values is a mutable struct. It can be embedded within the folder type + /// if three values are required for the calculation. + [] + type Values<'a,'b,'c> = + new : a:'a * b:'b * c:'c -> Values<'a,'b,'c> + val mutable _1: 'a + val mutable _2: 'b + val mutable _3: 'c + + /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the + /// source of the chain. + type PipeIdx = int + + type IOutOfBand = + abstract StopFurtherProcessing : PipeIdx -> unit + + /// Activity is the root class for chains of activities. It is in a non-generic + /// form so that it can be used by subsequent activities + [] + type Activity = + /// OnComplete is used to determine if the object has been processed correctly, + /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take + /// operation which didn't have a source at least as large as was required). It is + /// not called in the case of an exception being thrown whilst the stream is still + /// being processed. + abstract ChainComplete : stopTailCall:byref*PipeIdx -> unit + /// OnDispose is used to cleanup the stream. It is always called at the last operation + /// after the enumeration has completed. + abstract ChainDispose : stopTailCall:byref -> unit + + /// Activity is the base class of all elements within the pipeline + [] + type Activity<'T,'U> = + inherit Activity + new : unit -> Activity<'T,'U> + abstract member ProcessNext : input:'T -> bool + + [] + type Transform<'T,'U,'State> = + inherit Activity<'T,'U> + new : next:Activity * 'State -> Transform<'T,'U,'State> + val mutable State : 'State + val private Next : Activity + + [] + type TransformWithPostProcessing<'T,'U,'State> = + inherit Transform<'T,'U,'State> + new : next:Activity * 'State -> TransformWithPostProcessing<'T,'U,'State> + abstract OnComplete : PipeIdx -> unit + abstract OnDispose : unit -> unit + + /// Folder is a base class to assist with fold-like operations. It's intended usage + /// is as a base class for an object expression that will be used from within + /// the Fold function. + [] + type Folder<'T,'Result,'State> = + inherit Activity<'T,'T> + new : 'Result*'State -> Folder<'T,'Result,'State> + interface IOutOfBand + val mutable State : 'State + val mutable Result : 'Result + val mutable HaltedIdx : int + member StopFurtherProcessing : PipeIdx -> unit + + [] + type FolderWithPostProcessing<'T,'Result,'State> = + inherit Folder<'T,'Result,'State> + new : 'Result*'State -> FolderWithPostProcessing<'T,'Result,'State> + abstract OnDispose : unit -> unit + abstract OnComplete : PipeIdx -> unit + + [] + type TransformFactory<'T,'U> = + new : unit -> TransformFactory<'T,'U> + abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + type ISeq<'T> = + inherit System.Collections.Generic.IEnumerable<'T> + abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result,'State> : f:(PipeIdx->Folder<'T,'Result,'State>) -> 'Result + + open Core + + [] + val ofResizeArrayUnchecked : ResizeArray<'T> -> ISeq<'T> + + [] + val ofList : list<'T> -> ISeq<'T> + + [] + val ofArray : array<'T> -> ISeq<'T> + + [] + val ofSeq : seq<'T> -> ISeq<'T> + + [] + val inline average : source: ISeq< ^T> -> ^T + when 'T:(static member Zero : ^T) + and 'T:(static member (+) : ^T * ^T -> ^T) + and ^T:(static member DivideByInt : ^T * int -> ^T) + + [] + val inline averageBy : f:('T -> ^U) -> source:ISeq< 'T > -> ^U + when ^U:(static member Zero : ^U) + and ^U:(static member (+) : ^U * ^U -> ^U) + and ^U:(static member DivideByInt : ^U * int -> ^U) + + [] + val empty<'T> : ISeq<'T> + + [] + val exactlyOne : ISeq<'T> -> 'T + + [] + val inline fold<'T,'State> : f:('State->'T->'State) -> seed:'State -> source:ISeq<'T> -> 'State + + [] + val inline fold2<'T1,'T2,'State> : folder:('State->'T1->'T2->'State) -> state:'State -> source1: ISeq<'T1> -> source2: ISeq<'T2> -> 'State + + [] + val unfold : generator:('State -> option<'T*'State>) -> state:'State -> ISeq<'T> + + [] + val initInfinite : f:(int -> 'T) -> ISeq<'T> + + [] + val init : count:int -> f:(int -> 'T) -> ISeq<'T> + + [] + val inline iter : f:('T -> unit) -> source:ISeq<'T> -> unit + + [] + val inline iter2 : f:('T->'U->unit) -> source1 : ISeq<'T> -> source2 : ISeq<'U> -> unit + + [] + val inline iteri2 : f:(int->'T->'U->unit) -> source1:ISeq<'T> -> source2:ISeq<'U> -> unit + + [] + val tryHead : ISeq<'T> -> option<'T> + + [] + val head: source:ISeq<'T> -> 'T + + [] + val inline iteri : f:(int -> 'T -> unit) -> source:ISeq<'T> -> unit + + [] + val inline except : itemsToExclude:seq<'T> -> source:ISeq<'T> -> ISeq<'T> when 'T:equality + + [] + val inline exists : f:('T -> bool) -> source:ISeq<'T> -> bool + + [] + val inline exists2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool + + [] + val inline contains : element:'T -> source:ISeq<'T> -> bool when 'T : equality + + [] + val inline forall : f:('T -> bool) -> source:ISeq<'T> -> bool + + [] + val inline forall2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool + + [] + val inline filter : f:('T -> bool) -> source:ISeq<'T> -> ISeq<'T> + + [] + val inline map : f:('T -> 'U) -> source:ISeq<'T> -> ISeq<'U> + + [] + val inline mapi : f:(int->'a->'b) -> source: ISeq<'a> -> ISeq<'b> + + [] + val inline map2<'T,'U,'V> : map:('T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> + + [] + val inline mapi2<'T,'U,'V> : map:(int -> 'T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> + + [] + val inline map3<'T,'U,'V,'W> : map:('T->'U->'V->'W) -> source1:ISeq<'T> -> source2:ISeq<'U> -> source3:ISeq<'V> -> ISeq<'W> + + [] + val inline compareWith : f:('T->'T->int) -> source1 :ISeq<'T> -> source2:ISeq<'T> -> int + + [] + val inline choose : f:('a->option<'b>) -> source: ISeq<'a> -> ISeq<'b> + + [] + val inline distinct : source:ISeq<'T> -> ISeq<'T> when 'T:equality + + [] + val inline distinctBy : keyf:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key:equality + + [] + val inline max : source:ISeq<'T> -> 'T when 'T:comparison + + [] + val inline maxBy : f:('T->'U) -> source:ISeq<'T> -> 'T when 'U:comparison + + [] + val inline min : source:ISeq<'T> -> 'T when 'T:comparison + + [] + val inline minBy : f:('T->'U) -> source:ISeq<'T> -> 'T when 'U:comparison + + [] + val pairwise : source:ISeq<'T> -> ISeq<'T * 'T> + + [] + val inline reduce : f:('T->'T->'T) -> source:ISeq<'T> -> 'T + + [] + val inline scan : folder:('State->'T->'State) -> initialState:'State -> source:ISeq<'T> -> ISeq<'State> + + [] + val skip : skipCount:int -> source:ISeq<'T> -> ISeq<'T> + + [] + val inline skipWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> + + [] + val inline sum : source:ISeq<'T> -> 'T + when 'T:(static member Zero : ^T) + and 'T:(static member (+) : ^T * ^T -> ^T) + + [] + val inline sumBy : f :('T -> ^U) -> source:ISeq<'T> -> ^U + when ^U:(static member Zero : ^U) + and ^U:(static member (+) : ^U * ^U -> ^U) + + [] + val take : takeCount:int -> source:ISeq<'T> -> ISeq<'T> + + [] + val inline takeWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> + + [] + val tail : source:ISeq<'T> -> ISeq<'T> + + [] + val truncate : truncateCount:int -> source:ISeq<'T> -> ISeq<'T> + + [] + val indexed : source: ISeq<'a> -> ISeq + + [] + val tryItem : index:int -> source:ISeq<'T> -> option<'T> + + [] + val inline tryPick : f:('T -> option<'U>) -> source:ISeq<'T> -> option<'U> + + [] + val inline tryFind : f:('T -> bool) -> source:ISeq<'T> -> option<'T> + + [] + val inline tryFindIndex: predicate:('T->bool) -> source:ISeq<'T> -> option + + [] + val last: source:ISeq<'T> -> 'T + + [] + val tryLast : source:ISeq<'T> -> option<'T> + + [] + val windowed : windowSize:int -> source:ISeq<'T> -> ISeq> + + [] + val concat : sources:ISeq<'Collection> -> ISeq<'T> when 'Collection :> ISeq<'T> + + [] + val append: source1:ISeq<'T> -> source2:ISeq<'T> -> ISeq<'T> + + [] + val delay : (unit -> ISeq<'T>) -> ISeq<'T> + + [] + val inline groupByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : struct + + [] + val inline groupByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : not struct + + [] + val inline countByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : struct + + [] + val inline countByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : not struct + + [] + val length: source:ISeq<'T> -> int + + [] + val toArray: source:ISeq<'T> -> array<'T> + + [] + val sortBy : projection:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison + + [] + val sort : source:ISeq<'T> -> ISeq<'T> when 'T : comparison + + [] + val sortWith : comparer:('T->'T->int) -> source:ISeq<'T> -> ISeq<'T> + + [] + val rev: source:ISeq<'T> -> ISeq<'T> + + [] + val permute: indexMap:(int->int) -> source:ISeq<'T> -> ISeq<'T> + + [] + val scanBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> ISeq<'State> + + [] + val zip: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> + + [] + val inline reduceBack: reduction:('T->'T->'T) -> source:ISeq<'T> -> 'T + + [] + val inline foldBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> 'State + + [] + val inline foldBack2<'T1,'T2,'State> : folder:('T1->'T2->'State->'State) -> source1:ISeq<'T1> -> source2:ISeq<'T2> -> state:'State -> 'State + + module internal GroupBy = + val inline byVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality + val inline byRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality + + module internal CountBy = + val inline byVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality + val inline byRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality From 3173bdcaa003148c9d1ce900ebda6422affcf91f Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 14 Mar 2017 19:21:52 +1100 Subject: [PATCH 002/120] Updated remaining SurfaceArea files --- .../SurfaceArea.coreclr.fs | 193 +++++++++++++++++ .../fsharpqa/Source/Misc/LongSourceFile01.fs | 194 ++++++++++++++++++ 2 files changed, 387 insertions(+) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs index c762979fd6f..60e3528c6c7 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs @@ -293,6 +293,199 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) +Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: TResult Fold[TResult,TState](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]]) +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Activity`2 Compose[V](IOutOfBand, Int32, Activity`2) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 +Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+NoValue +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] +Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Distinct[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Empty[T]() +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Except[T](System.Collections.Generic.IEnumerable`1[T], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Indexed[a](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], ISeq`1, ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfArray[T](T[]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Min[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], ISeq`1) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index 970a5f77ff6..5cffea80004 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -247,6 +247,200 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) +Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: TResult Fold[TResult,TState](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]]) +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Activity`2 Compose[V](IOutOfBand, Int32, Activity`2) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 +Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+NoValue +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] +Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Distinct[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Empty[T]() +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Except[T](System.Collections.Generic.IEnumerable`1[T], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Indexed[a](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], ISeq`1, ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfArray[T](T[]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Min[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], ISeq`1) +Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) Microsoft.FSharp.Collections.ListModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) From 960d6ff7793b99100885b39d3943c7ea24e51706 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 15 Mar 2017 20:38:33 +1100 Subject: [PATCH 003/120] Copied Seq tests and converted to ISeq Due to missing functionality, this process will probably be done again some time, but this is just a rough sketch to get some tests up and running --- .../FSharp.Core.Unittests.fsproj | 5 + .../ISeqModule.fs | 1165 +++++++++++ .../ISeqModule2.fs | 1839 +++++++++++++++++ .../ISeqProperties.fs | 39 + 4 files changed, 3048 insertions(+) create mode 100644 src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs create mode 100644 src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs create mode 100644 src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj b/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj index 379990b793b..8ae4897387b 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj @@ -93,6 +93,11 @@ + + + + + diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs new file mode 100644 index 00000000000..02866848084 --- /dev/null +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs @@ -0,0 +1,1165 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections + +open System +open NUnit.Framework + +open FSharp.Core.Unittests.LibraryTestFx + +// Various tests for the: +// Microsoft.FSharp.Collections.seq type + +(* +[Test Strategy] +Make sure each method works on: +* Integer ISeq (value type) +* String ISeq (reference type) +* Empty ISeq (0 elements) +* Null ISeq (null) +*) + +[] +type ISeqModule() = + + [] + member this.AllPairs() = + + // integer ISeq + let resultInt = Seq.allPairs (seq [1..7]) (seq [11..17]) + let expectedInt = + seq { for i in 1..7 do + for j in 11..17 do + yield i, j } + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr = Seq.allPairs (seq ["str3";"str4"]) (seq ["str1";"str2"]) + let expectedStr = seq ["str3","str1";"str3","str2";"str4","str1";"str4","str2"] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + VerifySeqsEqual ISeq.empty <| Seq.allPairs ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty <| Seq.allPairs { 1..7 } ISeq.empty + VerifySeqsEqual ISeq.empty <| Seq.allPairs ISeq.empty { 1..7 } + + // null ISeq + CheckThrowsArgumentNullException(fun() -> Seq.allPairs null null |> ignore) + CheckThrowsArgumentNullException(fun() -> Seq.allPairs null (seq [1..7]) |> ignore) + CheckThrowsArgumentNullException(fun() -> Seq.allPairs (seq [1..7]) null |> ignore) + () + + [] + member this.CachedSeq_Clear() = + + let evaluatedItems : int list ref = ref [] + let cachedSeq = + ISeq.initInfinite (fun i -> evaluatedItems := i :: !evaluatedItems; i) + |> Seq.cache + |> ISeq.ofSeq + + // Verify no items have been evaluated from the ISeq yet + Assert.AreEqual(List.length !evaluatedItems, 0) + + // Force evaluation of 10 elements + ISeq.take 10 cachedSeq + |> Seq.toList + |> ignore + + // verify ref clear switch length + Assert.AreEqual(List.length !evaluatedItems, 10) + + // Force evaluation of 10 elements + ISeq.take 10 cachedSeq + |> Seq.toList + |> ignore + + // Verify ref clear switch length (should be cached) + Assert.AreEqual(List.length !evaluatedItems, 10) + + + // Clear + (box cachedSeq :?> System.IDisposable) .Dispose() + + // Force evaluation of 10 elements + ISeq.take 10 cachedSeq + |> Seq.toList + |> ignore + + // Verify length of evaluatedItemList is 20 + Assert.AreEqual(List.length !evaluatedItems, 20) + () + + [] + member this.Append() = + + // empty ISeq + let emptySeq1 = ISeq.empty + let emptySeq2 = ISeq.empty + let appendEmptySeq = ISeq.append emptySeq1 emptySeq2 + let expectResultEmpty = ISeq.empty + + VerifySeqsEqual expectResultEmpty appendEmptySeq + + // Integer ISeq + let integerSeq1 = seq [0..4] |> ISeq.ofSeq + let integerSeq2 = seq [5..9] |> ISeq.ofSeq + + let appendIntergerSeq = ISeq.append integerSeq1 integerSeq2 + + let expectResultInteger = seq { for i in 0..9 -> i} + + VerifySeqsEqual expectResultInteger appendIntergerSeq + + + // String ISeq + let stringSeq1 = seq ["1";"2"] |> ISeq.ofSeq + let stringSeq2 = seq ["3";"4"] |> ISeq.ofSeq + + let appendStringSeq = ISeq.append stringSeq1 stringSeq2 + + let expectedResultString = seq ["1";"2";"3";"4"] + + VerifySeqsEqual expectedResultString appendStringSeq + + // null ISeq + let nullSeq1 = seq [null;null] |> ISeq.ofSeq + let nullSeq2 = seq [null;null] |> ISeq.ofSeq + + let appendNullSeq = ISeq.append nullSeq1 nullSeq2 + + let expectedResultNull = seq [ null;null;null;null] + + VerifySeqsEqual expectedResultNull appendNullSeq + + () + + [] + member this.replicate() = + // replicate should create multiple copies of the given value + Assert.IsTrue(Seq.isEmpty <| Seq.replicate 0 null) + Assert.IsTrue(Seq.isEmpty <| Seq.replicate 0 1) + Assert.AreEqual(null, ISeq.head <| (Seq.replicate 1 null |> ISeq.ofSeq)) + Assert.AreEqual(["1";"1"],Seq.replicate 2 "1" |> Seq.toList) + + CheckThrowsArgumentException (fun () -> Seq.replicate -1 null |> ignore) + + + [] + member this.Average() = + // empty ISeq + let emptySeq = ISeq.empty + + CheckThrowsArgumentException (fun () -> ISeq.average emptySeq |> ignore) + + + // double ISeq + let doubleSeq = seq [1.0;2.2;2.5;4.3] |> ISeq.ofSeq + + let averageDouble = ISeq.average doubleSeq + + Assert.IsFalse( averageDouble <> 2.5) + + // float32 ISeq + let floatSeq = seq [ 2.0f;4.4f;5.0f;8.6f] |> ISeq.ofSeq + + let averageFloat = ISeq.average floatSeq + + Assert.IsFalse( averageFloat <> 5.0f) + + // decimal ISeq + let decimalSeq = seq [ 0M;19M;19.03M] |> ISeq.ofSeq + + let averageDecimal = ISeq.average decimalSeq + + Assert.IsFalse( averageDecimal <> 12.676666666666666666666666667M ) + + // null ISeq + //let nullSeq : ISeq.Core.ISeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.average nullSeq |> ignore) + () + + + [] + member this.AverageBy() = + // empty ISeq + let emptySeq = ISeq.empty + + CheckThrowsArgumentException (fun () -> ISeq.averageBy (fun x -> x+1.0) emptySeq |> ignore) + + // double ISeq + let doubleSeq = seq [1.0;2.2;2.5;4.3] |> ISeq.ofSeq + + let averageDouble = ISeq.averageBy (fun x -> x-2.0) doubleSeq + + Assert.IsFalse( averageDouble <> 0.5 ) + + // float32 ISeq + let floatSeq = seq [ 2.0f;4.4f;5.0f;8.6f] |> ISeq.ofSeq + + let averageFloat = ISeq.averageBy (fun x -> x*3.3f) floatSeq + + Assert.IsFalse( averageFloat <> 16.5f ) + + // decimal ISeq + let decimalSeq = seq [ 0M;19M;19.03M] |> ISeq.ofSeq + + let averageDecimal = ISeq.averageBy (fun x -> x/10.7M) decimalSeq + + Assert.IsFalse( averageDecimal <> 1.1847352024922118380062305296M ) + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.averageBy (fun (x:double)->x+4.0) nullSeq |> ignore) + () + + [] + member this.Cache() = + // empty ISeq + let emptySeq = ISeq.empty + + let cacheEmpty = Seq.cache emptySeq + + let expectedResultEmpty = ISeq.empty + + VerifySeqsEqual expectedResultEmpty cacheEmpty + + // double ISeq + let doubleSeq = seq [1.0;2.2;2.5;4.3] |> ISeq.ofSeq + + let cacheDouble = Seq.cache doubleSeq + + VerifySeqsEqual doubleSeq cacheDouble + + + // float32 ISeq + let floatSeq = seq [ 2.0f;4.4f;5.0f;8.6f] + + let cacheFloat = Seq.cache floatSeq + + VerifySeqsEqual floatSeq cacheFloat + + // decimal ISeq + let decimalSeq = seq [ 0M; 19M; 19.03M] + + let cacheDecimal = Seq.cache decimalSeq + + VerifySeqsEqual decimalSeq cacheDecimal + + // null ISeq + let nullSeq = seq [null] + + let cacheNull = Seq.cache nullSeq + + VerifySeqsEqual nullSeq cacheNull + () + + [] + member this.Case() = + + // integer ISeq + let integerArray = [|1;2|] + let integerSeq = Seq.cast integerArray + + let expectedIntegerSeq = seq [1;2] + + VerifySeqsEqual expectedIntegerSeq integerSeq + + // string ISeq + let stringArray = [|"a";"b"|] + let stringSeq = Seq.cast stringArray + + let expectedStringSeq = seq["a";"b"] + + VerifySeqsEqual expectedStringSeq stringSeq + + // empty ISeq + let emptySeq = Seq.cast ISeq.empty + let expectedEmptySeq = ISeq.empty + + VerifySeqsEqual expectedEmptySeq ISeq.empty + + // null ISeq + let nullArray = [|null;null|] + let NullSeq = Seq.cast nullArray + let expectedNullSeq = seq [null;null] + + VerifySeqsEqual expectedNullSeq NullSeq + + CheckThrowsExn(fun () -> + let strings = + integerArray + |> Seq.cast + for o in strings do ()) + + CheckThrowsExn(fun () -> + let strings = + integerArray + |> Seq.cast + :> System.Collections.IEnumerable // without this upcast the for loop throws, so it should with this upcast too + for o in strings do ()) + + () + + [] + member this.Choose() = + + // int ISeq + let intSeq = seq [1..20] |> ISeq.ofSeq + let funcInt x = if (x%5=0) then Some x else None + let intChoosed = ISeq.choose funcInt intSeq + let expectedIntChoosed = seq { for i = 1 to 4 do yield i*5} + + + + VerifySeqsEqual expectedIntChoosed intChoosed + + // string ISeq + let stringSrc = seq ["list";"List"] |> ISeq.ofSeq + let funcString x = match x with + | "list"-> Some x + | "List" -> Some x + | _ -> None + let strChoosed = ISeq.choose funcString stringSrc + let expectedStrChoose = seq ["list";"List"] + + VerifySeqsEqual expectedStrChoose strChoosed + + // empty ISeq + let emptySeq = ISeq.empty + let emptyChoosed = ISeq.choose funcInt emptySeq + + let expectedEmptyChoose = ISeq.empty + + VerifySeqsEqual expectedEmptyChoose emptySeq + + + // null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.choose funcInt nullSeq |> ignore) + () + + [] + member this.ChunkBySize() = + + let verify expected actual = + ISeq.zip (expected |> ISeq.ofSeq) (actual |> ISeq.ofSeq) + |> ISeq.iter ((<||) VerifySeqsEqual) + + // int ISeq + verify [[1..4];[5..8]] <| Seq.chunkBySize 4 {1..8} + verify [[1..4];[5..8];[9..10]] <| Seq.chunkBySize 4 {1..10} + verify [[1]; [2]; [3]; [4]] <| Seq.chunkBySize 1 {1..4} + + Seq.chunkBySize 2 (ISeq.initInfinite id) + |> ISeq.ofSeq + |> ISeq.take 3 + |> verify [[0;1];[2;3];[4;5]] + + Seq.chunkBySize 1 (ISeq.initInfinite id) + |> ISeq.ofSeq + |> ISeq.take 5 + |> verify [[0];[1];[2];[3];[4]] + + // string ISeq + verify [["a"; "b"];["c";"d"];["e"]] <| Seq.chunkBySize 2 ["a";"b";"c";"d";"e"] + + // empty ISeq + verify ISeq.empty <| Seq.chunkBySize 3 ISeq.empty + + // null ISeq + let nullSeq:seq<_> = null + CheckThrowsArgumentNullException (fun () -> Seq.chunkBySize 3 nullSeq |> ignore) + + // invalidArg + CheckThrowsArgumentException (fun () -> Seq.chunkBySize 0 {1..10} |> ignore) + CheckThrowsArgumentException (fun () -> Seq.chunkBySize -1 {1..10} |> ignore) + + () + + [] + member this.SplitInto() = + + let verify expected actual = + ISeq.zip (expected |> ISeq.ofSeq) (actual |> ISeq.ofSeq) + |> ISeq.iter ((<||) VerifySeqsEqual) + + // int ISeq + Seq.splitInto 3 {1..10} |> verify (seq [ {1..4}; {5..7}; {8..10} ]) + Seq.splitInto 3 {1..11} |> verify (seq [ {1..4}; {5..8}; {9..11} ]) + Seq.splitInto 3 {1..12} |> verify (seq [ {1..4}; {5..8}; {9..12} ]) + + Seq.splitInto 4 {1..5} |> verify (seq [ [1..2]; [3]; [4]; [5] ]) + Seq.splitInto 20 {1..4} |> verify (seq [ [1]; [2]; [3]; [4] ]) + + // string ISeq + Seq.splitInto 3 ["a";"b";"c";"d";"e"] |> verify ([ ["a"; "b"]; ["c";"d"]; ["e"] ]) + + // empty ISeq + VerifySeqsEqual [] <| Seq.splitInto 3 [] + + // null ISeq + let nullSeq:seq<_> = null + CheckThrowsArgumentNullException (fun () -> Seq.splitInto 3 nullSeq |> ignore) + + // invalidArg + CheckThrowsArgumentException (fun () -> Seq.splitInto 0 [1..10] |> ignore) + CheckThrowsArgumentException (fun () -> Seq.splitInto -1 [1..10] |> ignore) + + () + + [] + member this.Compare() = + + // int ISeq + let intSeq1 = seq [1;3;7;9] |> ISeq.ofSeq + let intSeq2 = seq [2;4;6;8] |> ISeq.ofSeq + let funcInt x y = if (x>y) then x else 0 + let intcompared = ISeq.compareWith funcInt intSeq1 intSeq2 + + Assert.IsFalse( intcompared <> 7 ) + + // string ISeq + let stringSeq1 = seq ["a"; "b"] |> ISeq.ofSeq + let stringSeq2 = seq ["c"; "d"] |> ISeq.ofSeq + let funcString x y = match (x,y) with + | "a", "c" -> 0 + | "b", "d" -> 1 + |_ -> -1 + let strcompared = ISeq.compareWith funcString stringSeq1 stringSeq2 + Assert.IsFalse( strcompared <> 1 ) + + // empty ISeq + let emptySeq = ISeq.empty + let emptycompared = ISeq.compareWith funcInt emptySeq emptySeq + + Assert.IsFalse( emptycompared <> 0 ) + + // null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt nullSeq emptySeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt emptySeq nullSeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt nullSeq nullSeq |> ignore) + + () + + [] + member this.Concat() = + // integer ISeq + let seqInt = + seq { for i in 0..9 do + yield seq {for j in 0..9 do + yield i*10+j} |> ISeq.ofSeq } |> ISeq.ofSeq + let conIntSeq = ISeq.concat seqInt + let expectedIntSeq = seq { for i in 0..99 do yield i} + + VerifySeqsEqual expectedIntSeq conIntSeq + + // string ISeq + let strSeq = + seq { for a in 'a' .. 'b' do + for b in 'a' .. 'b' do + yield seq [a; b] |> ISeq.ofSeq }|> ISeq.ofSeq + + let conStrSeq = ISeq.concat strSeq + let expectedStrSeq = seq ['a';'a';'a';'b';'b';'a';'b';'b';] + VerifySeqsEqual expectedStrSeq conStrSeq + + // Empty ISeq + let emptySeqs = seq [seq[ ISeq.empty;ISeq.empty]|> ISeq.ofSeq;seq[ ISeq.empty;ISeq.empty]|> ISeq.ofSeq]|> ISeq.ofSeq + let conEmptySeq = ISeq.concat emptySeqs + let expectedEmptySeq =seq { for i in 1..4 do yield ISeq.empty} + + VerifySeqsEqual expectedEmptySeq conEmptySeq + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.concat nullSeq |> ignore) + + () + + [] + member this.CountBy() = + // integer ISeq + let funcIntCount_by (x:int) = x%3 + let seqInt = + seq { for i in 0..9 do + yield i} + let countIntSeq = Seq.countBy funcIntCount_by seqInt + + let expectedIntSeq = seq [0,4;1,3;2,3] + + VerifySeqsEqual expectedIntSeq countIntSeq + + // string ISeq + let funcStrCount_by (s:string) = s.IndexOf("key") + let strSeq = seq [ "key";"blank key";"key";"blank blank key"] + + let countStrSeq = Seq.countBy funcStrCount_by strSeq + let expectedStrSeq = seq [0,2;6,1;12,1] + VerifySeqsEqual expectedStrSeq countStrSeq + + // Empty ISeq + let emptySeq = ISeq.empty + let countEmptySeq = Seq.countBy funcIntCount_by emptySeq + let expectedEmptySeq =seq [] + + VerifySeqsEqual expectedEmptySeq countEmptySeq + + // null ISeq + let nullSeq = null + + CheckThrowsArgumentNullException (fun () -> Seq.countBy funcIntCount_by nullSeq |> ignore) + () + + [] + member this.Distinct() = + + // integer ISeq + let IntDistinctSeq = + seq { for i in 0..9 do + yield i % 3 } |> ISeq.ofSeq + + let DistinctIntSeq = ISeq.distinct IntDistinctSeq + + let expectedIntSeq = seq [0;1;2] + + VerifySeqsEqual expectedIntSeq DistinctIntSeq + + // string ISeq + let strDistinctSeq = seq ["elementDup"; "ele1"; "ele2"; "elementDup"] |> ISeq.ofSeq + + let DistnctStrSeq = ISeq.distinct strDistinctSeq + let expectedStrSeq = seq ["elementDup"; "ele1"; "ele2"] |> ISeq.ofSeq + VerifySeqsEqual expectedStrSeq DistnctStrSeq + + // Empty ISeq + let emptySeq = ISeq.empty + let distinctEmptySeq = ISeq.distinct emptySeq + let expectedEmptySeq = seq [] |> ISeq.ofSeq + + VerifySeqsEqual expectedEmptySeq distinctEmptySeq + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException(fun () -> ISeq.distinct nullSeq |> ignore) + () + + [] + member this.DistinctBy () = + // integer ISeq + let funcInt x = x % 3 + let IntDistinct_bySeq = + seq { for i in 0..9 do + yield i } |> ISeq.ofSeq + + let distinct_byIntSeq = ISeq.distinctBy funcInt IntDistinct_bySeq + + let expectedIntSeq = seq [0;1;2] |> ISeq.ofSeq + + VerifySeqsEqual expectedIntSeq distinct_byIntSeq + + // string ISeq + let funcStrDistinct (s:string) = s.IndexOf("key") + let strSeq = seq [ "key"; "blank key"; "key dup"; "blank key dup"] |> ISeq.ofSeq + + let DistnctStrSeq = ISeq.distinctBy funcStrDistinct strSeq + let expectedStrSeq = seq ["key"; "blank key"] |> ISeq.ofSeq + VerifySeqsEqual expectedStrSeq DistnctStrSeq + + // Empty ISeq + let emptySeq = ISeq.empty + let distinct_byEmptySeq = ISeq.distinctBy funcInt emptySeq + let expectedEmptySeq = seq [] |> ISeq.ofSeq + + VerifySeqsEqual expectedEmptySeq distinct_byEmptySeq + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException(fun () -> ISeq.distinctBy funcInt nullSeq |> ignore) + () + + [] + member this.Except() = + // integer ISeq + let intSeq1 = seq { yield! {1..100} + yield! {1..100} } |> ISeq.ofSeq + let intSeq2 = {1..10} |> ISeq.ofSeq + let expectedIntSeq = {11..100} |> ISeq.ofSeq + + VerifySeqsEqual expectedIntSeq <| ISeq.except intSeq2 intSeq1 + + // string ISeq + let strSeq1 = seq ["a"; "b"; "c"; "d"; "a"] |> ISeq.ofSeq + let strSeq2 = seq ["b"; "c"] |> ISeq.ofSeq + let expectedStrSeq = seq ["a"; "d"] |> ISeq.ofSeq + + VerifySeqsEqual expectedStrSeq <| ISeq.except strSeq2 strSeq1 + + // double ISeq + // Sequences with nan do not behave, due to the F# generic equality comparisons +// let floatSeq1 = seq [1.0; 1.0; System.Double.MaxValue; nan; nan] +// +// VerifySeqsEqual [1.0; System.Double.MaxValue; nan; nan] <| ISeq.except [] floatSeq1 +// VerifySeqsEqual [1.0; System.Double.MaxValue] <| ISeq.except [nan] floatSeq1 + + // empty ISeq + let emptyIntSeq = ISeq.empty + VerifySeqsEqual {1..100} <| ISeq.except emptyIntSeq intSeq1 + VerifySeqsEqual emptyIntSeq <| ISeq.except intSeq1 emptyIntSeq + VerifySeqsEqual emptyIntSeq <| ISeq.except emptyIntSeq emptyIntSeq + VerifySeqsEqual emptyIntSeq <| ISeq.except intSeq1 intSeq1 + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException(fun () -> ISeq.except nullSeq emptyIntSeq |> ignore) + //CheckThrowsArgumentNullException(fun () -> ISeq.except emptyIntSeq nullSeq |> ignore) + //CheckThrowsArgumentNullException(fun () -> ISeq.except nullSeq nullSeq |> ignore) + + () + + [] + member this.Exists() = + + // Integer ISeq + let funcInt x = (x % 2 = 0) + let IntexistsSeq = + seq { for i in 0..9 do + yield i} |> ISeq.ofSeq + + let ifExistInt = ISeq.exists funcInt IntexistsSeq + + Assert.IsTrue( ifExistInt) + + // String ISeq + let funcStr (s:string) = s.Contains("key") + let strSeq = seq ["key"; "blank key"] |> ISeq.ofSeq + + let ifExistStr = ISeq.exists funcStr strSeq + + Assert.IsTrue( ifExistStr) + + // Empty ISeq + let emptySeq = ISeq.empty + let ifExistsEmpty = ISeq.exists funcInt emptySeq + + Assert.IsFalse( ifExistsEmpty) + + + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.exists funcInt nullSeq |> ignore) + () + + [] + member this.Exists2() = + // Integer ISeq + let funcInt x y = (x+y)%3=0 + let Intexists2Seq1 = seq [1;3;7] |> ISeq.ofSeq + let Intexists2Seq2 = seq [1;6;3] |> ISeq.ofSeq + + let ifExist2Int = ISeq.exists2 funcInt Intexists2Seq1 Intexists2Seq2 + Assert.IsTrue( ifExist2Int) + + // String ISeq + let funcStr s1 s2 = ((s1 + s2) = "CombinedString") + let strSeq1 = seq [ "Combined"; "Not Combined"] |> ISeq.ofSeq + let strSeq2 = seq ["String"; "Other String"] |> ISeq.ofSeq + let ifexists2Str = ISeq.exists2 funcStr strSeq1 strSeq2 + Assert.IsTrue(ifexists2Str) + + // Empty ISeq + let emptySeq = ISeq.empty + let ifexists2Empty = ISeq.exists2 funcInt emptySeq emptySeq + Assert.IsFalse( ifexists2Empty) + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> ISeq.exists2 funcInt nullSeq nullSeq |> ignore) + () + + + [] + member this.Filter() = + // integer ISeq + let funcInt x = if (x % 5 = 0) then true else false + let IntSeq = + seq { for i in 1..20 do + yield i } |> ISeq.ofSeq + + let filterIntSeq = ISeq.filter funcInt IntSeq + + let expectedfilterInt = seq [ 5;10;15;20] + + VerifySeqsEqual expectedfilterInt filterIntSeq + + // string ISeq + let funcStr (s:string) = s.Contains("Expected Content") + let strSeq = seq [ "Expected Content"; "Not Expected"; "Expected Content"; "Not Expected"] |> ISeq.ofSeq + + let filterStrSeq = ISeq.filter funcStr strSeq + + let expectedfilterStr = seq ["Expected Content"; "Expected Content"] |> ISeq.ofSeq + + VerifySeqsEqual expectedfilterStr filterStrSeq + // Empty ISeq + let emptySeq = ISeq.empty + let filterEmptySeq = ISeq.filter funcInt emptySeq + + let expectedEmptySeq =seq [] + + VerifySeqsEqual expectedEmptySeq filterEmptySeq + + + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.filter funcInt nullSeq |> ignore) + () + + [] + member this.Find() = + + // integer ISeq + let funcInt x = if (x % 5 = 0) then true else false + let IntSeq = + seq { for i in 1..20 do + yield i } |> ISeq.ofSeq + + let findInt = Seq.find funcInt IntSeq + Assert.AreEqual(findInt, 5) + + // string ISeq + let funcStr (s:string) = s.Contains("Expected Content") + let strSeq = seq [ "Expected Content";"Not Expected"] |> ISeq.ofSeq + + let findStr = Seq.find funcStr strSeq + Assert.AreEqual(findStr, "Expected Content") + + // Empty ISeq + let emptySeq = ISeq.empty + + CheckThrowsKeyNotFoundException(fun () -> Seq.find funcInt emptySeq |> ignore) + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> Seq.find funcInt nullSeq |> ignore) + () + + [] + member this.FindBack() = + // integer ISeq + let funcInt x = x % 5 = 0 + Assert.AreEqual(20, Seq.findBack funcInt <| seq { 1..20 }) + Assert.AreEqual(15, Seq.findBack funcInt <| seq { 1..19 }) + Assert.AreEqual(5, Seq.findBack funcInt <| seq { 5..9 }) + + // string ISeq + let funcStr (s:string) = s.Contains("Expected") + let strSeq = seq [ "Not Expected"; "Expected Content"] |> ISeq.ofSeq + let findStr = Seq.findBack funcStr strSeq + Assert.AreEqual("Expected Content", findStr) + + // Empty ISeq + let emptySeq = ISeq.empty + CheckThrowsKeyNotFoundException(fun () -> Seq.findBack funcInt emptySeq |> ignore) + + // Not found + let emptySeq = ISeq.empty + CheckThrowsKeyNotFoundException(fun () -> seq { 1..20 } |> Seq.findBack (fun _ -> false) |> ignore) + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> Seq.findBack funcInt nullSeq |> ignore) + () + + [] + member this.FindIndex() = + + // integer ISeq + let digits = [1 .. 100] |> ISeq.ofList + let idx = digits |> Seq.findIndex (fun i -> i.ToString().Length > 1) + Assert.AreEqual(idx, 9) + + // empty ISeq + CheckThrowsKeyNotFoundException(fun () -> Seq.findIndex (fun i -> true) ISeq.empty |> ignore) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.findIndex (fun i -> true) null |> ignore) + () + + [] + member this.Permute() = + let mapIndex i = (i + 1) % 4 + + // integer seq + let intSeq = seq { 1..4 }|> ISeq.ofSeq + let resultInt = ISeq.permute mapIndex intSeq + VerifySeqsEqual (seq [4;1;2;3]) resultInt + + // string seq + let resultStr = ISeq.permute mapIndex ([|"Lists"; "are"; "commonly"; "list" |] |> ISeq.ofSeq) + VerifySeqsEqual (seq ["list"; "Lists"; "are"; "commonly" ]) resultStr + + // empty seq + let resultEpt = ISeq.permute mapIndex ([||] |> ISeq.ofSeq) + VerifySeqsEqual ISeq.empty resultEpt + + //// null seq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> ISeq.permute mapIndex nullSeq |> ignore) + + // argument exceptions + CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 10) ([0..9]|> ISeq.ofSeq) |> ISeq.iter ignore) + CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 0) ([0..9]|> ISeq.ofSeq) |> ISeq.iter ignore) + () + + [] + member this.FindIndexBack() = + // integer ISeq + let digits = seq { 1..100 }|> ISeq.ofSeq + let idx = digits |> Seq.findIndexBack (fun i -> i.ToString().Length = 1) + Assert.AreEqual(idx, 8) + + // string ISeq + let funcStr (s:string) = s.Contains("Expected") + let strSeq = seq [ "Not Expected"; "Expected Content" ] |> ISeq.ofSeq + let findStr = Seq.findIndexBack funcStr strSeq + Assert.AreEqual(1, findStr) + + // empty ISeq + CheckThrowsKeyNotFoundException(fun () -> Seq.findIndexBack (fun i -> true) ISeq.empty |> ignore) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.findIndexBack (fun i -> true) null |> ignore) + () + + [] + member this.Pick() = + + let digits = [| 1 .. 10 |] |> ISeq.ofArray + let result = Seq.pick (fun i -> if i > 5 then Some(i.ToString()) else None) digits + Assert.AreEqual(result, "6") + + // Empty seq (Bugged, 4173) + CheckThrowsKeyNotFoundException (fun () -> Seq.pick (fun i -> Some('a')) ([| |] : int[]) |> ignore) + + // Null + CheckThrowsArgumentNullException (fun () -> Seq.pick (fun i -> Some(i + 0)) null |> ignore) + () + + [] + member this.Fold() = + let funcInt x y = x+y + + let IntSeq = + seq { for i in 1..10 do + yield i} |> ISeq.ofSeq + + let foldInt = ISeq.fold funcInt 1 IntSeq + if foldInt <> 56 then Assert.Fail() + + // string ISeq + let funcStr (x:string) (y:string) = x+y + let strSeq = seq ["B"; "C"; "D" ; "E"] |> ISeq.ofSeq + let foldStr = ISeq.fold funcStr "A" strSeq + + if foldStr <> "ABCDE" then Assert.Fail() + + + // Empty ISeq + let emptySeq = ISeq.empty + let foldEmpty = ISeq.fold funcInt 1 emptySeq + if foldEmpty <> 1 then Assert.Fail() + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.fold funcInt 1 nullSeq |> ignore) + () + + + + [] + member this.Fold2() = + Assert.AreEqual([(3,5); (2,3); (1,1)],ISeq.fold2 (fun acc x y -> (x,y)::acc) [] (seq [ 1..3 ] |> ISeq.ofSeq) (seq [1..2..6] |> ISeq.ofSeq)) + + // integer List + let funcInt x y z = x + y + z + let resultInt = ISeq.fold2 funcInt 9 (seq [ 1..10 ] |> ISeq.ofSeq) (seq [1..2..20] |> ISeq.ofSeq) + Assert.AreEqual(164, resultInt) + + // string List + let funcStr x y z = x + y + z + let resultStr = ISeq.fold2 funcStr "*" (["a"; "b"; "c" ; "d" ] |> ISeq.ofSeq) (["A"; "B"; "C" ; "D" ] |> ISeq.ofSeq) + Assert.AreEqual("*aAbBcCdD", resultStr) + + // empty List + let emptyArr = [ ] |> ISeq.ofSeq + let resultEpt = ISeq.fold2 funcInt 5 emptyArr emptyArr + Assert.AreEqual(5, resultEpt) + + Assert.AreEqual(0,ISeq.fold2 funcInt 0 ISeq.empty (seq [1] |> ISeq.ofSeq)) + Assert.AreEqual(-1,ISeq.fold2 funcInt -1 (seq [1] |> ISeq.ofSeq) ISeq.empty) + + Assert.AreEqual(2,ISeq.fold2 funcInt 0 (seq [1;2] |> ISeq.ofSeq) (seq [1] |> ISeq.ofSeq)) + Assert.AreEqual(4,ISeq.fold2 funcInt 0 (seq [1] |> ISeq.ofSeq) (seq [3;6] |> ISeq.ofSeq)) + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 nullSeq (seq [1] |> ISeq.ofSeq) |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 (seq [1] |> ISeq.ofSeq) nullSeq |> ignore) + () + + [] + member this.FoldBack() = + // int ISeq + let funcInt x y = x-y + let IntSeq = seq { 1..4 } |> ISeq.ofSeq + let foldInt = ISeq.foldBack funcInt IntSeq 6 + Assert.AreEqual((1-(2-(3-(4-6)))), foldInt) + + // string ISeq + let funcStr (x:string) (y:string) = y.Remove(0,x.Length) + let strSeq = seq [ "A"; "B"; "C"; "D" ] |> ISeq.ofSeq + let foldStr = ISeq.foldBack funcStr strSeq "ABCDE" + Assert.AreEqual("E", foldStr) + + // single element + let funcStr2 elem acc = sprintf "%s%s" elem acc + let strSeq2 = seq [ "A" ] |> ISeq.ofSeq + let foldStr2 = ISeq.foldBack funcStr2 strSeq2 "X" + Assert.AreEqual("AX", foldStr2) + + // Empty ISeq + let emptySeq = ISeq.empty + let foldEmpty = ISeq.foldBack funcInt emptySeq 1 + Assert.AreEqual(1, foldEmpty) + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack funcInt nullSeq 1 |> ignore) + + // Validate that foldBack with the cons operator and the empty list returns a copy of the sequence + let cons x y = x :: y + let identityFoldr = ISeq.foldBack cons IntSeq [] + Assert.AreEqual([1;2;3;4], identityFoldr) + + () + + [] + member this.foldBack2() = + // int ISeq + let funcInt x y z = x + y + z + let intSeq = seq { 1..10 } |> ISeq.ofSeq + let resultInt = ISeq.foldBack2 funcInt intSeq (seq { 1..2..20 } |> ISeq.ofSeq) 9 + Assert.AreEqual(164, resultInt) + + // string ISeq + let funcStr = sprintf "%s%s%s" + let strSeq = seq [ "A"; "B"; "C"; "D" ] |> ISeq.ofSeq + let resultStr = ISeq.foldBack2 funcStr strSeq (seq [ "a"; "b"; "c"; "d"] |> ISeq.ofSeq) "*" + Assert.AreEqual("AaBbCcDd*", resultStr) + + // single element + let strSeqSingle = seq [ "X" ] |> ISeq.ofSeq + Assert.AreEqual("XAZ", ISeq.foldBack2 funcStr strSeqSingle strSeq "Z") + Assert.AreEqual("AXZ", ISeq.foldBack2 funcStr strSeq strSeqSingle "Z") + Assert.AreEqual("XYZ", ISeq.foldBack2 funcStr strSeqSingle (seq [ "Y" ] |> ISeq.ofSeq) "Z") + + // empty ISeq + let emptySeq = ISeq.empty + Assert.AreEqual(1, ISeq.foldBack2 funcInt emptySeq emptySeq 1) + Assert.AreEqual(1, ISeq.foldBack2 funcInt emptySeq intSeq 1) + Assert.AreEqual(1, ISeq.foldBack2 funcInt intSeq emptySeq 1) + + // infinite ISeq + let infiniteSeq = ISeq.initInfinite (fun i -> 2 * i + 1) + Assert.AreEqual(164, ISeq.foldBack2 funcInt intSeq infiniteSeq 9) + Assert.AreEqual(164, ISeq.foldBack2 funcInt infiniteSeq intSeq 9) + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt nullSeq intSeq 1 |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt intSeq nullSeq 1 |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt nullSeq nullSeq 1 |> ignore) + + () + + [] + member this.ForAll() = + + let funcInt x = if x%2 = 0 then true else false + let IntSeq = + seq { for i in 1..10 do + yield i*2} |> ISeq.ofSeq + let for_allInt = ISeq.forall funcInt IntSeq + + if for_allInt <> true then Assert.Fail() + + + // string ISeq + let funcStr (x:string) = x.Contains("a") + let strSeq = seq ["a"; "ab"; "abc" ; "abcd"] |> ISeq.ofSeq + let for_allStr = ISeq.forall funcStr strSeq + + if for_allStr <> true then Assert.Fail() + + + // Empty ISeq + let emptySeq = ISeq.empty + let for_allEmpty = ISeq.forall funcInt emptySeq + + if for_allEmpty <> true then Assert.Fail() + + //// null ISeq + //let nullSeq = null + //CheckThrowsArgumentNullException (fun () -> ISeq.forall funcInt nullSeq |> ignore) + () + + [] + member this.ForAll2() = + + let funcInt x y = if (x+y)%2 = 0 then true else false + let IntSeq = + seq { for i in 1..10 do + yield i} |> ISeq.ofSeq + + let for_all2Int = ISeq.forall2 funcInt IntSeq IntSeq + + if for_all2Int <> true then Assert.Fail() + + // string ISeq + let funcStr (x:string) (y:string) = (x+y).Length = 5 + let strSeq1 = seq ["a"; "ab"; "abc" ; "abcd"] |> ISeq.ofSeq + let strSeq2 = seq ["abcd"; "abc"; "ab" ; "a"] |> ISeq.ofSeq + let for_all2Str = ISeq.forall2 funcStr strSeq1 strSeq2 + + if for_all2Str <> true then Assert.Fail() + + // Empty ISeq + let emptySeq = ISeq.empty + let for_all2Empty = ISeq.forall2 funcInt emptySeq emptySeq + + if for_all2Empty <> true then Assert.Fail() + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.forall2 funcInt nullSeq nullSeq |> ignore) + + [] + member this.GroupBy() = + + let funcInt x = x%5 + + let IntSeq = + seq { for i in 0 .. 9 do + yield i } |> ISeq.ofSeq + + let group_byInt = ISeq.groupByVal funcInt IntSeq |> ISeq.map (fun (i, v) -> i, Seq.toList v) + + let expectedIntSeq = + seq { for i in 0..4 do + yield i, [i; i+5] } |> ISeq.ofSeq + + VerifySeqsEqual group_byInt expectedIntSeq + + // string ISeq + let funcStr (x:string) = x.Length + let strSeq = seq ["length7"; "length 8"; "length7" ; "length 9"] |> ISeq.ofSeq + + let group_byStr = ISeq.groupByVal funcStr strSeq |> ISeq.map (fun (i, v) -> i, Seq.toList v) + let expectedStrSeq = + seq { + yield 7, ["length7"; "length7"] + yield 8, ["length 8"] + yield 9, ["length 9"] } |> ISeq.ofSeq + + VerifySeqsEqual expectedStrSeq group_byStr + + // Empty ISeq + let emptySeq = ISeq.empty + let group_byEmpty = ISeq.groupByVal funcInt emptySeq + let expectedEmptySeq = seq [] + + VerifySeqsEqual expectedEmptySeq group_byEmpty + + //// null ISeq + //let nullSeq = null + //let group_byNull = ISeq.groupByVal funcInt nullSeq + //CheckThrowsArgumentNullException (fun () -> ISeq.iter (fun _ -> ()) group_byNull) + () + + [] + member this.DisposalOfUnstartedEnumerator() = + let run = ref false + let f() = seq { + try + () + finally + run := true + } + + f().GetEnumerator().Dispose() + Assert.IsFalse(!run) + + [] + member this.WeirdLocalNames() = + + let f pc = seq { + yield pc + yield (pc+1) + yield (pc+2) + } + + let l = f 3 |> Seq.toList + Assert.AreEqual([3;4;5], l) + + let f i = seq { + let pc = i*2 + yield pc + yield (pc+1) + yield (pc+2) + } + let l = f 3 |> Seq.toList + Assert.AreEqual([6;7;8], l) + + [] + member this.Contains() = + + // Integer ISeq + let intSeq = seq { 0..9 } |> ISeq.ofSeq + + let ifContainsInt = ISeq.contains 5 intSeq + + Assert.IsTrue(ifContainsInt) + + // String ISeq + let strSeq = seq ["key"; "blank key"] |> ISeq.ofSeq + + let ifContainsStr = ISeq.contains "key" strSeq + + Assert.IsTrue(ifContainsStr) + + // Empty ISeq + let emptySeq = ISeq.empty + let ifContainsEmpty = ISeq.contains 5 emptySeq + + Assert.IsFalse(ifContainsEmpty) + + //// null ISeq + //let nullSeq = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.contains 5 nullSeq |> ignore) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs new file mode 100644 index 00000000000..36d8839f107 --- /dev/null +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs @@ -0,0 +1,1839 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections + +open System +open NUnit.Framework + +open FSharp.Core.Unittests.LibraryTestFx + +type ISeqWindowedTestInput<'t> = + { + InputSeq : seq<'t> + WindowSize : int + ExpectedSeq : seq<'t[]> + Exception : Type option + } + +[] +type ISeqModule2() = + + [] + member this.Hd() = + + let IntSeq = + seq { for i in 0 .. 9 do + yield i } |> ISeq.ofSeq + + if ISeq.head IntSeq <> 0 then Assert.Fail() + + // string ISeq + let strSeq = seq ["first"; "second"; "third"] |> ISeq.ofSeq + if ISeq.head strSeq <> "first" then Assert.Fail() + + // Empty ISeq + let emptySeq = ISeq.empty + CheckThrowsArgumentException ( fun() -> ISeq.head emptySeq) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.head nullSeq) + () + + [] + member this.TryHead() = + // int ISeq + let IntSeq = + seq { for i in 0 .. 9 -> i } |> ISeq.ofSeq + + let intResult = ISeq.tryHead IntSeq + + // string ISeq + let strResult = ISeq.tryHead (seq ["first"; "second"; "third"] |> ISeq.ofSeq) + Assert.AreEqual("first", strResult.Value) + + // Empty ISeq + let emptyResult = ISeq.tryHead ISeq.empty + Assert.AreEqual(None, emptyResult) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.head nullSeq) + () + + [] + member this.Tl() = + // integer seq + let resultInt = ISeq.tail <| (seq { 1..10 } |> ISeq.ofSeq) + Assert.AreEqual(Array.ofSeq (seq { 2..10 } |> ISeq.ofSeq), Array.ofSeq resultInt) + + // string seq + let resultStr = ISeq.tail <| (seq { yield "a"; yield "b"; yield "c"; yield "d" } |> ISeq.ofSeq) + Assert.AreEqual(Array.ofSeq (seq { yield "b"; yield "c" ; yield "d" } |> ISeq.ofSeq), Array.ofSeq resultStr) + + // 1-element seq + let resultStr2 = ISeq.tail <| (seq { yield "a" } |> ISeq.ofSeq) + Assert.AreEqual(Array.ofSeq (ISeq.empty ), Array.ofSeq resultStr2) + + //CheckThrowsArgumentNullException(fun () -> ISeq.tail null |> ignore) + CheckThrowsArgumentException(fun () -> ISeq.tail ISeq.empty |> ISeq.iter (fun _ -> failwith "Should not be reached")) + () + + [] + member this.Last() = + + let IntSeq = + seq { for i in 0 .. 9 do + yield i } |> ISeq.ofSeq + + if ISeq.last IntSeq <> 9 then Assert.Fail() + + // string ISeq + let strSeq = seq ["first"; "second"; "third"] |> ISeq.ofSeq + if ISeq.last strSeq <> "third" then Assert.Fail() + + // Empty ISeq + let emptySeq = ISeq.empty + CheckThrowsArgumentException ( fun() -> ISeq.last emptySeq) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.last nullSeq) + () + + [] + member this.TryLast() = + + let IntSeq = + seq { for i in 0 .. 9 -> i } |> ISeq.ofSeq + + let intResult = ISeq.tryLast IntSeq + Assert.AreEqual(9, intResult.Value) + + // string ISeq + let strResult = ISeq.tryLast (seq ["first"; "second"; "third"] |> ISeq.ofSeq) + Assert.AreEqual("third", strResult.Value) + + // Empty ISeq + let emptyResult = ISeq.tryLast ISeq.empty + Assert.IsTrue(emptyResult.IsNone) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.tryLast nullSeq |> ignore) + () + + [] + member this.ExactlyOne() = + + let IntSeq = + seq { for i in 7 .. 7 do + yield i } |> ISeq.ofSeq + + if ISeq.exactlyOne IntSeq <> 7 then Assert.Fail() + + // string ISeq + let strSeq = seq ["second"] |> ISeq.ofSeq + if ISeq.exactlyOne strSeq <> "second" then Assert.Fail() + + // Empty ISeq + let emptySeq = ISeq.empty + CheckThrowsArgumentException ( fun() -> ISeq.exactlyOne emptySeq) + + // non-singleton ISeq + let emptySeq = ISeq.empty + CheckThrowsArgumentException ( fun() -> ISeq.exactlyOne ([ 0 .. 1 ] |> ISeq.ofSeq) |> ignore ) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.exactlyOne nullSeq) + () + + + [] + member this.Init() = + + let funcInt x = x + let init_finiteInt = ISeq.init 9 funcInt + let expectedIntSeq = seq [ 0..8] |> ISeq.ofSeq + + VerifySeqsEqual expectedIntSeq init_finiteInt + + + // string ISeq + let funcStr x = x.ToString() + let init_finiteStr = ISeq.init 5 funcStr + let expectedStrSeq = seq ["0";"1";"2";"3";"4"] |> ISeq.ofSeq + + VerifySeqsEqual expectedStrSeq init_finiteStr + + //// null ISeq + //let funcNull x = null + //let init_finiteNull = ISeq.init 3 funcNull + //let expectedNullSeq = seq [ null;null;null] |> ISeq.ofSeq + + //VerifySeqsEqual expectedNullSeq init_finiteNull + () + + [] + member this.InitInfinite() = + + let funcInt x = x + let init_infiniteInt = ISeq.initInfinite funcInt + let resultint = Seq.find (fun x -> x =100) init_infiniteInt + + Assert.AreEqual(100,resultint) + + + // string ISeq + let funcStr x = x.ToString() + let init_infiniteStr = ISeq.initInfinite funcStr + let resultstr = Seq.find (fun x -> x = "100") init_infiniteStr + + Assert.AreEqual("100",resultstr) + + + [] + member this.IsEmpty() = + + //seq int + let seqint = seq [1;2;3] |> ISeq.ofSeq + let is_emptyInt = Seq.isEmpty seqint + + Assert.IsFalse(is_emptyInt) + + //seq str + let seqStr = seq["first";"second"] + let is_emptyStr = Seq.isEmpty seqStr + + Assert.IsFalse(is_emptyInt) + + //seq empty + let seqEmpty = ISeq.empty + let is_emptyEmpty = Seq.isEmpty seqEmpty + Assert.IsTrue(is_emptyEmpty) + + //seq null + let seqnull:seq<'a> = null + CheckThrowsArgumentNullException (fun () -> Seq.isEmpty seqnull |> ignore) + () + + [] + member this.Iter() = + //seq int + let seqint = seq [ 1..3] |> ISeq.ofSeq + let cacheint = ref 0 + + let funcint x = cacheint := !cacheint + x + ISeq.iter funcint seqint + Assert.AreEqual(6,!cacheint) + + //seq str + let seqStr = seq ["first";"second"] |> ISeq.ofSeq + let cachestr =ref "" + let funcstr x = cachestr := !cachestr+x + ISeq.iter funcstr seqStr + + Assert.AreEqual("firstsecond",!cachestr) + + // empty array + let emptyseq = ISeq.empty + let resultEpt = ref 0 + ISeq.iter (fun x -> Assert.Fail()) emptyseq + + // null seqay + //let nullseq:seq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.iter funcint nullseq |> ignore) + () + + [] + member this.Iter2() = + + //seq int + let seqint = seq [ 1..3] |> ISeq.ofSeq + let cacheint = ref 0 + + let funcint x y = cacheint := !cacheint + x+y + ISeq.iter2 funcint seqint seqint + Assert.AreEqual(12,!cacheint) + + //seq str + let seqStr = seq ["first";"second"]|> ISeq.ofSeq + let cachestr =ref "" + let funcstr x y = cachestr := !cachestr+x+y + ISeq.iter2 funcstr seqStr seqStr + + Assert.AreEqual("firstfirstsecondsecond",!cachestr) + + // empty array + let emptyseq = ISeq.empty + let resultEpt = ref 0 + ISeq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq + + //// null seqay + //let nullseq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.iter2 funcint nullseq nullseq |> ignore) + + () + + [] + member this.Iteri() = + + // seq int + let seqint = seq [ 1..10] |> ISeq.ofSeq + let cacheint = ref 0 + + let funcint x y = cacheint := !cacheint + x+y + ISeq.iteri funcint seqint + Assert.AreEqual(100,!cacheint) + + // seq str + let seqStr = seq ["first";"second"]|> ISeq.ofSeq + let cachestr =ref 0 + let funcstr (x:int) (y:string) = cachestr := !cachestr+ x + y.Length + ISeq.iteri funcstr seqStr + + Assert.AreEqual(12,!cachestr) + + // empty array + let emptyseq = ISeq.empty + let resultEpt = ref 0 + ISeq.iteri funcint emptyseq + Assert.AreEqual(0,!resultEpt) + + //// null seqay + //let nullseq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.iteri funcint nullseq |> ignore) + () + + [] + member this.Iteri2() = + + //seq int + let seqint = seq [ 1..3] |> ISeq.ofSeq + let cacheint = ref 0 + + let funcint x y z = cacheint := !cacheint + x + y + z + ISeq.iteri2 funcint seqint seqint + Assert.AreEqual(15,!cacheint) + + //seq str + let seqStr = seq ["first";"second"]|> ISeq.ofSeq + let cachestr = ref 0 + let funcstr (x:int) (y:string) (z:string) = cachestr := !cachestr + x + y.Length + z.Length + ISeq.iteri2 funcstr seqStr seqStr + + Assert.AreEqual(23,!cachestr) + + // empty seq + let emptyseq = ISeq.empty + let resultEpt = ref 0 + ISeq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq + + //// null seq + //let nullseq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.iteri2 funcint nullseq nullseq |> ignore) + + // len1 <> len2 + let shorterSeq = seq { 1..3 } |> ISeq.ofSeq + let longerSeq = seq { 2..2..100 } |> ISeq.ofSeq + + let testSeqLengths seq1 seq2 = + let cache = ref 0 + let f x y z = cache := !cache + x + y + z + ISeq.iteri2 f seq1 seq2 + !cache + + Assert.AreEqual(21, testSeqLengths shorterSeq longerSeq) + Assert.AreEqual(21, testSeqLengths longerSeq shorterSeq) + + () + + [] + member this.Length() = + + // integer seq + let resultInt = ISeq.length ({1..8}|> ISeq.ofSeq) + if resultInt <> 8 then Assert.Fail() + + // string ISeq + let resultStr = ISeq.length (seq ["Lists"; "are"; "commonly" ; "list" ]|> ISeq.ofSeq) + if resultStr <> 4 then Assert.Fail() + + // empty ISeq + let resultEpt = ISeq.length ISeq.empty + if resultEpt <> 0 then Assert.Fail() + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.length nullSeq |> ignore) + + () + + [] + member this.Map() = + + // integer ISeq + let funcInt x = + match x with + | _ when x % 2 = 0 -> 10*x + | _ -> x + + let resultInt = ISeq.map funcInt ({ 1..10 }|> ISeq.ofSeq) + let expectedint = seq [1;20;3;40;5;60;7;80;9;100] + + VerifySeqsEqual expectedint resultInt + + // string ISeq + let funcStr (x:string) = x.ToLower() + let resultStr = ISeq.map funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ] |> ISeq.ofSeq) + let expectedSeq = seq ["lists"; "are"; "commonly" ; "list"] |> ISeq.ofSeq + + VerifySeqsEqual expectedSeq resultStr + + // empty ISeq + let resultEpt = ISeq.map funcInt ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.map funcStr nullSeq |> ignore) + + () + + [] + member this.Map2() = + // integer ISeq + let funcInt x y = x+y + let resultInt = ISeq.map2 funcInt ({ 1..10 }|> ISeq.ofSeq) ( {2..2..20} |> ISeq.ofSeq) + let expectedint = seq [3;6;9;12;15;18;21;24;27;30]|> ISeq.ofSeq + + VerifySeqsEqual expectedint resultInt + + // string ISeq + let funcStr (x:int) (y:string) = x+y.Length + let resultStr = ISeq.map2 funcStr (seq[3;6;9;11] |> ISeq.ofSeq) (seq ["Lists"; "Are"; "Commonly" ; "List" ] |> ISeq.ofSeq) + let expectedSeq = seq [8;9;17;15] + + VerifySeqsEqual expectedSeq resultStr + + // empty ISeq + let resultEpt = ISeq.map2 funcInt ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //let nullSeq:seq<'a> = null + //let validSeq = seq [1] + //CheckThrowsArgumentNullException (fun () -> ISeq.map2 funcInt nullSeq validSeq |> ignore) + + () + + [] + member this.Map3() = + // Integer seq + let funcInt a b c = (a + b) * c + let resultInt = ISeq.map3 funcInt ({ 1..8 }|> ISeq.ofSeq)( { 2..9 }|> ISeq.ofSeq)( { 3..10 }|> ISeq.ofSeq) + let expectedInt = seq [9; 20; 35; 54; 77; 104; 135; 170] + VerifySeqsEqual expectedInt resultInt + + // First seq is shorter + VerifySeqsEqual (seq [9; 20]) (ISeq.map3 funcInt ({ 1..2 }|> ISeq.ofSeq)( { 2..9 }|> ISeq.ofSeq)( { 3..10 }|> ISeq.ofSeq)) + // Second seq is shorter + VerifySeqsEqual (seq [9; 20; 35]) (ISeq.map3 funcInt ({ 1..8 }|> ISeq.ofSeq)( { 2..4 }|> ISeq.ofSeq)( { 3..10 }|> ISeq.ofSeq)) + // Third seq is shorter + VerifySeqsEqual (seq [9; 20; 35; 54]) (ISeq.map3 funcInt ({ 1..8 }|> ISeq.ofSeq) ( { 2..6 }|> ISeq.ofSeq)( { 3..6 }|> ISeq.ofSeq)) + + // String seq + let funcStr a b c = a + b + c + let resultStr = ISeq.map3 funcStr (["A";"B";"C";"D"]|> ISeq.ofSeq) ( ["a";"b";"c";"d"]|> ISeq.ofSeq)( ["1";"2";"3";"4"]|> ISeq.ofSeq) + let expectedStr = seq ["Aa1";"Bb2";"Cc3";"Dd4"]|> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // Empty seq + let resultEmpty = ISeq.map3 funcStr ISeq.empty ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty resultEmpty + + //// Null seq + //let nullSeq = null : seq<_> + //let nonNullSeq = seq [1] + //CheckThrowsArgumentNullException (fun () -> ISeq.map3 funcInt nullSeq nonNullSeq nullSeq |> ignore) + + () + + [] + member this.MapFold() = + // integer ISeq + let funcInt acc x = if x % 2 = 0 then 10*x, acc + 1 else x, acc + let resultInt,resultIntAcc = Seq.mapFold funcInt 100 <| seq { 1..10 } + VerifySeqsEqual (seq [ 1;20;3;40;5;60;7;80;9;100 ]) resultInt + Assert.AreEqual(105, resultIntAcc) + + // string ISeq + let funcStr acc (x:string) = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x + let resultStr,resultStrAcc = Seq.mapFold funcStr "" <| seq [ "";"BB";"C";"" ] + VerifySeqsEqual (seq [ "empty";"bb";"c";"empty" ]) resultStr + Assert.AreEqual("BBC", resultStrAcc) + + // empty ISeq + let resultEpt,resultEptAcc = Seq.mapFold funcInt 100 ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + Assert.AreEqual(100, resultEptAcc) + + //// null ISeq + //let nullArr = null:seq + //CheckThrowsArgumentNullException (fun () -> Seq.mapFold funcStr "" nullArr |> ignore) + + () + + [] + member this.MapFoldBack() = + // integer ISeq + let funcInt x acc = if acc < 105 then 10*x, acc + 2 else x, acc + let resultInt,resultIntAcc = Seq.mapFoldBack funcInt (seq { 1..10 }) 100 + VerifySeqsEqual (seq [ 1;2;3;4;5;6;7;80;90;100 ]) resultInt + Assert.AreEqual(106, resultIntAcc) + + // string ISeq + let funcStr (x:string) acc = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x + let resultStr,resultStrAcc = Seq.mapFoldBack funcStr (seq [ "";"BB";"C";"" ]) "" + VerifySeqsEqual (seq [ "empty";"bb";"c";"empty" ]) resultStr + Assert.AreEqual("CBB", resultStrAcc) + + // empty ISeq + let resultEpt,resultEptAcc = Seq.mapFoldBack funcInt ISeq.empty 100 + VerifySeqsEqual ISeq.empty resultEpt + Assert.AreEqual(100, resultEptAcc) + + //// null ISeq + //let nullArr = null:seq + //CheckThrowsArgumentNullException (fun () -> Seq.mapFoldBack funcStr nullArr "" |> ignore) + + () + + member private this.MapWithSideEffectsTester (map : (int -> int) -> ISeq.Core.ISeq -> ISeq.Core.ISeq) expectExceptions = + let i = ref 0 + let f x = i := !i + 1; x*x + let e = (([1;2]|>ISeq.ofSeq) |> map f).GetEnumerator() + + if expectExceptions then + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2, !i) + if expectExceptions then + CheckThrowsInvalidOperationExn (fun _ -> e.Current |> ignore) + Assert.AreEqual(2, !i) + + + i := 0 + let e = (([]|> ISeq.ofSeq) |> map f).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + + member private this.MapWithExceptionTester (map : (int -> int) -> ISeq.Core.ISeq -> ISeq.Core.ISeq) = + let raiser x = if x > 0 then raise(NotSupportedException()) else x + let e = (map raiser ([0; 1]|> ISeq.ofSeq)).GetEnumerator() + Assert.IsTrue(e.MoveNext()) // should not throw + Assert.AreEqual(0, e.Current) + CheckThrowsNotSupportedException(fun _ -> e.MoveNext() |> ignore) + Assert.AreEqual(0, e.Current) // should not throw + + [] + member this.MapWithSideEffects () = + this.MapWithSideEffectsTester ISeq.map true + + [] + member this.MapWithException () = + this.MapWithExceptionTester ISeq.map + + + //[] + //member this.SingletonCollectWithSideEffects () = + // this.MapWithSideEffectsTester (fun f-> Seq.collect (f >> Seq.singleton)) true + + //[] + //member this.SingletonCollectWithException () = + // this.MapWithExceptionTester (fun f-> Seq.collect (f >> Seq.singleton)) + +//#if !FX_NO_LINQ +// [] +// member this.SystemLinqSelectWithSideEffects () = +// this.MapWithSideEffectsTester (fun f s -> System.Linq.Enumerable.Select(s, Func<_,_>(f))) false + +// [] +// member this.SystemLinqSelectWithException () = +// this.MapWithExceptionTester (fun f s -> System.Linq.Enumerable.Select(s, Func<_,_>(f))) +//#endif + + [] + member this.MapiWithSideEffects () = + let i = ref 0 + let f _ x = i := !i + 1; x*x + let e = (([1;2]|> ISeq.ofSeq) |> ISeq.mapi f).GetEnumerator() + + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2, !i) + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(2, !i) + + i := 0 + let e = (([]|> ISeq.ofSeq) |> ISeq.mapi f).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + [] + member this.Map2WithSideEffects () = + let i = ref 0 + let f x y = i := !i + 1; x*x + let e = (ISeq.map2 f ([1;2]|> ISeq.ofSeq) ([1;2]|> ISeq.ofSeq)).GetEnumerator() + + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2,!i) + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(2, !i) + + i := 0 + let e = (ISeq.map2 f ([]|> ISeq.ofSeq) ([]|> ISeq.ofSeq)).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + [] + member this.Mapi2WithSideEffects () = + let i = ref 0 + let f _ x y = i := !i + 1; x*x + let e = (ISeq.mapi2 f ([1;2]|> ISeq.ofSeq) ([1;2]|> ISeq.ofSeq)).GetEnumerator() + + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2,!i) + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(2, !i) + + i := 0 + let e = (ISeq.mapi2 f ([]|> ISeq.ofSeq) ([]|> ISeq.ofSeq)).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + [] + member this.Collect() = + // integer ISeq + let funcInt x = seq [x+1] + let resultInt = Seq.collect funcInt { 1..10 } + + let expectedint = seq {2..11} + + VerifySeqsEqual expectedint resultInt + +#if !FX_NO_CHAR_PARSE + // string ISeq + let funcStr (y:string) = y+"ist" + + let resultStr = Seq.collect funcStr (seq ["L"]) + + + let expectedSeq = seq ['L';'i';'s';'t'] + + VerifySeqsEqual expectedSeq resultStr +#endif + // empty ISeq + let resultEpt = Seq.collect funcInt ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //let nullSeq:seq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> Seq.collect funcInt nullSeq |> ignore) + + () + + [] + member this.Mapi() = + + // integer ISeq + let funcInt x y = x+y + let resultInt = ISeq.mapi funcInt ({ 10..2..20 } |> ISeq.ofSeq) + let expectedint = seq [10;13;16;19;22;25] + + VerifySeqsEqual expectedint resultInt + + // string ISeq + let funcStr (x:int) (y:string) =x+y.Length + + let resultStr = ISeq.mapi funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ] |> ISeq.ofSeq) + let expectedStr = seq [5;4;10;7] + + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.mapi funcInt ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //let nullSeq:seq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> ISeq.mapi funcInt nullSeq |> ignore) + + () + + [] + member this.Mapi2() = + // integer ISeq + let funcInt x y z = x+y+z + let resultInt = ISeq.mapi2 funcInt ({ 1..10 }|> ISeq.ofSeq)( {2..2..20}|> ISeq.ofSeq) + let expectedint = seq [3;7;11;15;19;23;27;31;35;39] + + VerifySeqsEqual expectedint resultInt + + // string ISeq + let funcStr (x:int) (y:int) (z:string) = x+y+z.Length + let resultStr = ISeq.mapi2 funcStr (seq[3;6;9;11]|> ISeq.ofSeq) (seq ["Lists"; "Are"; "Commonly" ; "List" ]|> ISeq.ofSeq) + let expectedSeq = seq [8;10;19;18] + + VerifySeqsEqual expectedSeq resultStr + + // empty ISeq + let resultEpt = ISeq.mapi2 funcInt ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //let nullSeq:seq<'a> = null + //let validSeq = seq [1] + //CheckThrowsArgumentNullException (fun () -> ISeq.mapi2 funcInt nullSeq validSeq |> ignore) + + // len1 <> len2 + let shorterSeq = seq { 1..10 }|> ISeq.ofSeq + let longerSeq = seq { 2..20 }|> ISeq.ofSeq + + let testSeqLengths seq1 seq2 = + let f x y z = x + y + z + ISeq.mapi2 f seq1 seq2 + + VerifySeqsEqual (seq [3;6;9;12;15;18;21;24;27;30]|> ISeq.ofSeq) (testSeqLengths shorterSeq longerSeq) + VerifySeqsEqual (seq [3;6;9;12;15;18;21;24;27;30]|> ISeq.ofSeq) (testSeqLengths longerSeq shorterSeq) + + [] + member this.Indexed() = + + // integer ISeq + let resultInt = ISeq.indexed ({ 10..2..20 }|> ISeq.ofSeq) + let expectedint = seq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)]|> ISeq.ofSeq + + VerifySeqsEqual expectedint resultInt + + // string ISeq + let resultStr = ISeq.indexed (seq ["Lists"; "Are"; "Commonly"; "List" ]|> ISeq.ofSeq) + let expectedStr = seq [(0,"Lists");(1,"Are");(2,"Commonly");(3,"List")]|> ISeq.ofSeq + + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.indexed ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.indexed nullSeq |> ignore) + + () + + [] + member this.Max() = + // integer ISeq + let resultInt = ISeq.max ({ 10..20 } |> ISeq.ofSeq) + + Assert.AreEqual(20,resultInt) + + // string ISeq + + let resultStr = ISeq.max (seq ["Lists"; "Are"; "MaxString" ; "List" ]|> ISeq.ofSeq) + Assert.AreEqual("MaxString",resultStr) + + // empty ISeq + CheckThrowsArgumentException(fun () -> ISeq.max ( ISeq.empty ) |> ignore) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.max nullSeq |> ignore) + + () + + [] + member this.MaxBy() = + + // integer ISeq + let funcInt x = x % 8 + let resultInt = ISeq.maxBy funcInt ({ 2..2..20 } |> ISeq.ofSeq) + Assert.AreEqual(6,resultInt) + + // string ISeq + let funcStr (x:string) =x.Length + let resultStr = ISeq.maxBy funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]|> ISeq.ofSeq) + Assert.AreEqual("Commonly",resultStr) + + // empty ISeq + CheckThrowsArgumentException (fun () -> ISeq.maxBy funcInt (ISeq.empty ) |> ignore) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.maxBy funcInt nullSeq |> ignore) + + () + + [] + member this.MinBy() = + + // integer ISeq + let funcInt x = x % 8 + let resultInt = ISeq.minBy funcInt ({ 2..2..20 } |> ISeq.ofSeq) + Assert.AreEqual(8,resultInt) + + // string ISeq + let funcStr (x:string) =x.Length + let resultStr = ISeq.minBy funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]|> ISeq.ofSeq) + Assert.AreEqual("Are",resultStr) + + // empty ISeq + CheckThrowsArgumentException (fun () -> ISeq.minBy funcInt (ISeq.empty ) |> ignore) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.minBy funcInt nullSeq |> ignore) + + () + + + [] + member this.Min() = + + // integer ISeq + let resultInt = ISeq.min ({ 10..20 } |> ISeq.ofSeq) + Assert.AreEqual(10,resultInt) + + // string ISeq + let resultStr = ISeq.min (seq ["Lists"; "Are"; "minString" ; "List" ]|> ISeq.ofSeq) + Assert.AreEqual("Are",resultStr) + + // empty ISeq + CheckThrowsArgumentException (fun () -> ISeq.min (ISeq.empty ) |> ignore) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.min nullSeq |> ignore) + + () + + [] + member this.Item() = + // integer ISeq + let resultInt = Seq.item 3 ({ 10..20 }|> ISeq.ofSeq) + Assert.AreEqual(13, resultInt) + + // string ISeq + let resultStr = Seq.item 2 (seq ["Lists"; "Are"; "Cool" ; "List" ]|> ISeq.ofSeq) + Assert.AreEqual("Cool", resultStr) + + // empty ISeq + CheckThrowsArgumentException(fun () -> Seq.item 0 (ISeq.empty ) |> ignore) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () ->Seq.item 3 nullSeq |> ignore) + + // Negative index + for i = -1 downto -10 do + CheckThrowsArgumentException (fun () -> Seq.item i { 10 .. 20 } |> ignore) + + // Out of range + for i = 11 to 20 do + CheckThrowsArgumentException (fun () -> Seq.item i { 10 .. 20 } |> ignore) + + [] + member this.``item should fail with correct number of missing elements``() = + try + Seq.item 0 (Array.zeroCreate 0) |> ignore + failwith "error expected" + with + | exn when exn.Message.Contains("seq was short by 1 element") -> () + + try + Seq.item 2 (Array.zeroCreate 0) |> ignore + failwith "error expected" + with + | exn when exn.Message.Contains("seq was short by 3 elements") -> () + + [] + member this.Of_Array() = + // integer ISeq + let resultInt = ISeq.ofArray [|1..10|] + let expectedInt = {1..10} + + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr = ISeq.ofArray [|"Lists"; "Are"; "ofArrayString" ; "List" |] + let expectedStr = seq ["Lists"; "Are"; "ofArrayString" ; "List" ] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.ofArray [| |] + VerifySeqsEqual resultEpt ISeq.empty + + () + + [] + member this.Of_List() = + // integer ISeq + let resultInt = ISeq.ofList [1..10] + let expectedInt = {1..10} + + VerifySeqsEqual expectedInt resultInt + + // string ISeq + + let resultStr =ISeq.ofList ["Lists"; "Are"; "ofListString" ; "List" ] + let expectedStr = seq ["Lists"; "Are"; "ofListString" ; "List" ] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.ofList [] + VerifySeqsEqual resultEpt ISeq.empty + () + + + [] + member this.Pairwise() = + // integer ISeq + let resultInt = ISeq.pairwise ({1..3}|>ISeq.ofSeq) + + let expectedInt = seq [1,2;2,3] + + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr =ISeq.pairwise (["str1"; "str2";"str3" ]|>ISeq.ofSeq) + let expectedStr = seq ["str1","str2";"str2","str3"]|>ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.pairwise ([] |>ISeq.ofSeq) + VerifySeqsEqual resultEpt ISeq.empty + + () + + [] + member this.Reduce() = + + // integer ISeq + let resultInt = ISeq.reduce (fun x y -> x/y) (seq [5*4*3*2; 4;3;2;1] |> ISeq.ofSeq) + Assert.AreEqual(5,resultInt) + + // string ISeq + let resultStr = ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) (seq ["ABCDE";"A"; "B"; "C" ; "D" ] |> ISeq.ofSeq) + Assert.AreEqual("E",resultStr) + + // empty ISeq + CheckThrowsArgumentException (fun () -> ISeq.reduce (fun x y -> x/y) ISeq.empty |> ignore) + + //// null ISeq + //let nullSeq : seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullSeq |> ignore) + () + + [] + member this.ReduceBack() = + // int ISeq + let funcInt x y = x - y + let IntSeq = seq { 1..4 } |> ISeq.ofSeq + let reduceInt = ISeq.reduceBack funcInt IntSeq + Assert.AreEqual((1-(2-(3-4))), reduceInt) + + // string ISeq + let funcStr (x:string) (y:string) = y.Remove(0,x.Length) + let strSeq = seq [ "A"; "B"; "C"; "D" ; "ABCDE" ] |> ISeq.ofSeq + let reduceStr = ISeq.reduceBack funcStr strSeq + Assert.AreEqual("E", reduceStr) + + // string ISeq + let funcStr2 elem acc = sprintf "%s%s" elem acc + let strSeq2 = seq [ "A" ] |> ISeq.ofSeq + let reduceStr2 = ISeq.reduceBack funcStr2 strSeq2 + Assert.AreEqual("A", reduceStr2) + + // Empty ISeq + CheckThrowsArgumentException (fun () -> ISeq.reduceBack funcInt ISeq.empty |> ignore) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.reduceBack funcInt nullSeq |> ignore) + + () + + [] + member this.Rev() = + // integer ISeq + let resultInt = ISeq.rev (seq [5;4;3;2;1] |> ISeq.ofSeq) + VerifySeqsEqual (seq[1;2;3;4;5]) resultInt + + // string ISeq + let resultStr = ISeq.rev (seq ["A"; "B"; "C" ; "D" ] |> ISeq.ofSeq) + VerifySeqsEqual (seq["D";"C";"B";"A"]) resultStr + + // empty ISeq + VerifySeqsEqual ISeq.empty (ISeq.rev ISeq.empty) + + //// null ISeq + //let nullSeq : seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.rev nullSeq |> ignore) + () + + [] + member this.Scan() = + // integer ISeq + let funcInt x y = x+y + let resultInt = ISeq.scan funcInt 9 ({1..10}|> ISeq.ofSeq) + let expectedInt = seq [9;10;12;15;19;24;30;37;45;54;64] |> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let funcStr x y = x+y + let resultStr =ISeq.scan funcStr "x" (["str1"; "str2";"str3" ]|> ISeq.ofSeq) + + let expectedStr = seq ["x";"xstr1"; "xstr1str2";"xstr1str2str3"]|> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.scan funcInt 5 ISeq.empty + + VerifySeqsEqual resultEpt (seq [ 5]) + + //// null ISeq + //let seqNull:seq<'a> = null + //CheckThrowsArgumentNullException(fun() -> ISeq.scan funcInt 5 seqNull |> ignore) + () + + [] + member this.ScanBack() = + // integer ISeq + let funcInt x y = x+y + let resultInt = ISeq.scanBack funcInt ({ 1..10 }|> ISeq.ofSeq) 9 + let expectedInt = seq [64;63;61;58;54;49;43;36;28;19;9] + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let funcStr x y = x+y + let resultStr = ISeq.scanBack funcStr (seq ["A";"B";"C";"D"]|> ISeq.ofSeq) "X" + let expectedStr = seq ["ABCDX";"BCDX";"CDX";"DX";"X"]|> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.scanBack funcInt ISeq.empty 5 + let expectedEpt = seq [5] + VerifySeqsEqual expectedEpt resultEpt + + //// null ISeq + //let seqNull:seq<'a> = null + //CheckThrowsArgumentNullException(fun() -> ISeq.scanBack funcInt seqNull 5 |> ignore) + + // exception cases + let funcEx x (s:'State) = raise <| new System.FormatException() : 'State + // calling scanBack with funcEx does not throw + let resultEx = ISeq.scanBack funcEx (seq {1..10} |> ISeq.ofSeq) 0 + // reading from resultEx throws + CheckThrowsFormatException(fun() -> ISeq.head resultEx |> ignore) + + // Result consumes entire input sequence as soon as it is accesses an element + let i = ref 0 + let funcState x s = (i := !i + x); x+s + let resultState = ISeq.scanBack funcState (seq {1..3} |> ISeq.ofSeq) 0 + Assert.AreEqual(0, !i) + use e = resultState.GetEnumerator() + Assert.AreEqual(6, !i) + + () + + [] + member this.Singleton() = + // integer ISeq + let resultInt = Seq.singleton 1 + + let expectedInt = seq [1] |> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr =Seq.singleton "str1" + let expectedStr = seq ["str1"] |> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + //// null ISeq + //let resultNull = Seq.singleton null + //let expectedNull = seq [null] + //VerifySeqsEqual expectedNull resultNull + () + + + [] + member this.Skip() = + + // integer ISeq + let resultInt = ISeq.skip 2 (seq [1;2;3;4] |> ISeq.ofSeq) + let expectedInt = seq [3;4] |> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr =ISeq.skip 2 (seq ["str1";"str2";"str3";"str4"] |> ISeq.ofSeq) + let expectedStr = seq ["str3";"str4"] |> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.skip 0 ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.skip 1 null |> ignore) + () + + [] + member this.Skip_While() = + + // integer ISeq + let funcInt x = (x < 3) + let resultInt = ISeq.skipWhile funcInt (seq [1;2;3;4;5;6] |> ISeq.ofSeq) + let expectedInt = seq [3;4;5;6] |> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let funcStr (x:string) = x.Contains(".") + let resultStr =ISeq.skipWhile funcStr (seq [".";"asdfasdf.asdfasdf";"";"";"";"";"";"";"";"";""] |> ISeq.ofSeq) + let expectedStr = seq ["";"";"";"";"";"";"";"";""] |> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.skipWhile funcInt ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.skipWhile funcInt null |> ignore) + () + + [] + member this.Sort() = + + // integer ISeq + let resultInt = ISeq.sort (seq [1;3;2;4;6;5;7] |> ISeq.ofSeq) + let expectedInt = {1..7} |> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + + let resultStr =ISeq.sort (seq ["str1";"str3";"str2";"str4"] |> ISeq.ofSeq) + let expectedStr = seq ["str1";"str2";"str3";"str4"] |> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.sort ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.sort null |> ignore) + () + + [] + member this.SortBy() = + + // integer ISeq + let funcInt x = Math.Abs(x-5) + let resultInt = ISeq.sortBy funcInt (seq [1;2;4;5;7] |> ISeq.ofSeq) + let expectedInt = seq [5;4;7;2;1] |> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let funcStr (x:string) = x.IndexOf("key") + let resultStr =ISeq.sortBy funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"] |> ISeq.ofSeq) + + let expectedStr = seq ["(key)str";"s(key)tr";"st(key)r";"str(key)"] |> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.sortBy funcInt ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.sortBy funcInt null |> ignore) + () + + [] + member this.SortDescending() = + + // integer ISeq + let resultInt = Seq.sortDescending (seq [1;3;2;Int32.MaxValue;4;6;Int32.MinValue;5;7;0]) + let expectedInt = seq{ + yield Int32.MaxValue; + yield! seq{ 7..-1..0 } + yield Int32.MinValue + } + VerifySeqsEqual expectedInt resultInt + + // string ISeq + + let resultStr = Seq.sortDescending (seq ["str1";null;"str3";"";"Str1";"str2";"str4"]) + let expectedStr = seq ["str4";"str3";"str2";"str1";"Str1";"";null] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = Seq.sortDescending ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + // tuple ISeq + let tupSeq = (seq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) + let resultTup = Seq.sortDescending tupSeq + let expectedTup = (seq[(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) + VerifySeqsEqual expectedTup resultTup + + // float ISeq + let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon + let floatSeq = seq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] + let resultFloat = Seq.sortDescending floatSeq + let expectedFloat = seq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] + VerifySeqsEqual expectedFloat resultFloat + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.sort null |> ignore) + () + + [] + member this.SortByDescending() = + + // integer ISeq + let funcInt x = Math.Abs(x-5) + let resultInt = Seq.sortByDescending funcInt (seq [1;2;4;5;7]) + let expectedInt = seq [1;2;7;4;5] + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let funcStr (x:string) = x.IndexOf("key") + let resultStr =Seq.sortByDescending funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) + + let expectedStr = seq ["str(key)";"st(key)r";"s(key)tr";"(key)str"] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = Seq.sortByDescending funcInt ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + // tuple ISeq + let tupSeq = (seq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) + let resultTup = Seq.sortByDescending snd tupSeq + let expectedTup = (seq[(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")]) + VerifySeqsEqual expectedTup resultTup + + // float ISeq + let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon + let floatSeq = seq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] + let resultFloat = Seq.sortByDescending id floatSeq + let expectedFloat = seq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] + VerifySeqsEqual expectedFloat resultFloat + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.sortByDescending funcInt null |> ignore) + () + + member this.SortWith() = + + // integer ISeq + let intComparer a b = compare (a%3) (b%3) + let resultInt = ISeq.sortWith intComparer (seq {0..10} |> ISeq.ofSeq) + let expectedInt = seq [0;3;6;9;1;4;7;10;2;5;8]|> ISeq.ofSeq + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr = ISeq.sortWith compare (seq ["str1";"str3";"str2";"str4"]|> ISeq.ofSeq) + let expectedStr = seq ["str1";"str2";"str3";"str4"]|> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.sortWith intComparer ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.sortWith intComparer null |> ignore) + + () + + [] + member this.Sum() = + + // integer ISeq + let resultInt = ISeq.sum (seq [1..10]|> ISeq.ofSeq) + Assert.AreEqual(55,resultInt) + + // float32 ISeq + let floatSeq = (seq [ 1.2f;3.5f;6.7f ])|> ISeq.ofSeq + let resultFloat = ISeq.sum floatSeq + if resultFloat <> 11.4f then Assert.Fail() + + // double ISeq + let doubleSeq = (seq [ 1.0;8.0 ])|> ISeq.ofSeq + let resultDouble = ISeq.sum doubleSeq + if resultDouble <> 9.0 then Assert.Fail() + + // decimal ISeq + let decimalSeq = (seq [ 0M;19M;19.03M ])|> ISeq.ofSeq + let resultDecimal = ISeq.sum decimalSeq + if resultDecimal <> 38.03M then Assert.Fail() + + + // empty float32 ISeq + let emptyFloatSeq = ISeq.empty + let resultEptFloat = ISeq.sum emptyFloatSeq + if resultEptFloat <> 0.0f then Assert.Fail() + + // empty double ISeq + let emptyDoubleSeq = ISeq.empty + let resultDouEmp = ISeq.sum emptyDoubleSeq + if resultDouEmp <> 0.0 then Assert.Fail() + + // empty decimal ISeq + let emptyDecimalSeq = ISeq.empty + let resultDecEmp = ISeq.sum emptyDecimalSeq + if resultDecEmp <> 0M then Assert.Fail() + + () + + [] + member this.SumBy() = + + // integer ISeq + let resultInt = ISeq.sumBy int (seq [1..10]|> ISeq.ofSeq) + Assert.AreEqual(55,resultInt) + + // float32 ISeq + let floatSeq = (seq [ 1.2f;3.5f;6.7f ])|> ISeq.ofSeq + let resultFloat = ISeq.sumBy float32 floatSeq + if resultFloat <> 11.4f then Assert.Fail() + + // double ISeq + let doubleSeq = (seq [ 1.0;8.0 ])|> ISeq.ofSeq + let resultDouble = ISeq.sumBy double doubleSeq + if resultDouble <> 9.0 then Assert.Fail() + + // decimal ISeq + let decimalSeq = (seq [ 0M;19M;19.03M ]) |> ISeq.ofSeq + let resultDecimal = ISeq.sumBy decimal decimalSeq + if resultDecimal <> 38.03M then Assert.Fail() + + // empty float32 ISeq + let emptyFloatSeq = ISeq.empty + let resultEptFloat = ISeq.sumBy float32 emptyFloatSeq + if resultEptFloat <> 0.0f then Assert.Fail() + + // empty double ISeq + let emptyDoubleSeq = ISeq.empty + let resultDouEmp = ISeq.sumBy double emptyDoubleSeq + if resultDouEmp <> 0.0 then Assert.Fail() + + // empty decimal ISeq + let emptyDecimalSeq = ISeq.empty + let resultDecEmp = ISeq.sumBy decimal emptyDecimalSeq + if resultDecEmp <> 0M then Assert.Fail() + + () + + [] + member this.Take() = + // integer ISeq + + let resultInt = ISeq.take 3 (seq [1;2;4;5;7]|> ISeq.ofSeq) + + let expectedInt = seq [1;2;4] + VerifySeqsEqual expectedInt resultInt + + // string ISeq + + let resultStr =ISeq.take 2(seq ["str1";"str2";"str3";"str4"]|> ISeq.ofSeq) + + let expectedStr = seq ["str1";"str2"] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.take 0 ISeq.empty + + VerifySeqsEqual resultEpt ISeq.empty + + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.take 1 null |> ignore) + () + + [] + member this.takeWhile() = + // integer ISeq + let funcInt x = (x < 6) + let resultInt = ISeq.takeWhile funcInt (seq [1;2;4;5;6;7]|> ISeq.ofSeq) + + let expectedInt = seq [1;2;4;5] + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let funcStr (x:string) = (x.Length < 4) + let resultStr =ISeq.takeWhile funcStr (seq ["a"; "ab"; "abc"; "abcd"; "abcde"]|> ISeq.ofSeq) + + let expectedStr = seq ["a"; "ab"; "abc"] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.takeWhile funcInt ISeq.empty + VerifySeqsEqual resultEpt ISeq.empty + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.takeWhile funcInt null |> ignore) + () + + [] + member this.ToArray() = + // integer ISeq + let resultInt = ISeq.toArray(seq [1;2;4;5;7]|> ISeq.ofSeq) + + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + // string ISeq + let resultStr =ISeq.toArray (seq ["str1";"str2";"str3"]|> ISeq.ofSeq) + + let expectedStr = [|"str1";"str2";"str3"|] + Assert.AreEqual(expectedStr,resultStr) + + // empty ISeq + let resultEpt = ISeq.toArray ISeq.empty + Assert.AreEqual([||],resultEpt) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.toArray null |> ignore) + () + + [] + member this.ToArrayFromICollection() = + let inputCollection = ResizeArray(seq [1;2;4;5;7]) + let resultInt = ISeq.toArray(inputCollection|> ISeq.ofSeq) + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToArrayEmptyInput() = + let resultInt = ISeq.toArray(ISeq.empty) + let expectedInt = Array.empty + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToArrayFromArray() = + let resultInt = ISeq.toArray([|1;2;4;5;7|]|> ISeq.ofSeq) + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToArrayFromList() = + let resultInt = ISeq.toArray([1;2;4;5;7]|> ISeq.ofSeq) + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToList() = + // integer ISeq + let resultInt = Seq.toList (seq [1;2;4;5;7]) + let expectedInt = [1;2;4;5;7] + Assert.AreEqual(expectedInt,resultInt) + + // string ISeq + let resultStr =Seq.toList (seq ["str1";"str2";"str3"]) + let expectedStr = ["str1";"str2";"str3"] + Assert.AreEqual(expectedStr,resultStr) + + // empty ISeq + let resultEpt = Seq.toList ISeq.empty + Assert.AreEqual([],resultEpt) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.toList null |> ignore) + () + + [] + member this.Truncate() = + // integer ISeq + let resultInt = ISeq.truncate 3 (seq [1;2;4;5;7]|> ISeq.ofSeq) + let expectedInt = [1;2;4] + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr =ISeq.truncate 2 (seq ["str1";"str2";"str3"]|> ISeq.ofSeq) + let expectedStr = ["str1";"str2"] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.truncate 0 ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.truncate 1 null |> ignore) + + // negative count + VerifySeqsEqual ISeq.empty <| ISeq.truncate -1 (seq [1;2;4;5;7]|> ISeq.ofSeq) + VerifySeqsEqual ISeq.empty <| ISeq.truncate System.Int32.MinValue (seq [1;2;4;5;7]|> ISeq.ofSeq) + + () + + [] + member this.tryFind() = + // integer ISeq + let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (seq [1;2;4;5;7]|> ISeq.ofSeq) + Assert.AreEqual(Some(2), resultInt) + + // integer ISeq - None + let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (seq [1;3;5;7]|> ISeq.ofSeq) + Assert.AreEqual(None, resultInt) + + // string ISeq + let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (seq ["str1";"str2";"str3"]|> ISeq.ofSeq) + Assert.AreEqual(Some("str2"),resultStr) + + // string ISeq - None + let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (seq ["str1";"str4";"str3"] |> ISeq.ofSeq) + Assert.AreEqual(None,resultStr) + + + // empty ISeq + let resultEpt = ISeq.tryFind (fun x -> (x%2=0)) ISeq.empty + Assert.AreEqual(None,resultEpt) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.tryFind (fun x -> (x%2=0)) null |> ignore) + () + + [] + member this.TryFindBack() = + // integer ISeq + let resultInt = Seq.tryFindBack (fun x -> (x%2=0)) (seq [1;2;4;5;7]) + Assert.AreEqual(Some 4, resultInt) + + // integer ISeq - None + let resultInt = Seq.tryFindBack (fun x -> (x%2=0)) (seq [1;3;5;7]) + Assert.AreEqual(None, resultInt) + + // string ISeq + let resultStr = Seq.tryFindBack (fun (x:string) -> x.Contains("2")) (seq ["str1";"str2";"str2x";"str3"]) + Assert.AreEqual(Some "str2x", resultStr) + + // string ISeq - None + let resultStr = Seq.tryFindBack (fun (x:string) -> x.Contains("2")) (seq ["str1";"str4";"str3"]) + Assert.AreEqual(None, resultStr) + + // empty ISeq + let resultEpt = Seq.tryFindBack (fun x -> (x%2=0)) ISeq.empty + Assert.AreEqual(None, resultEpt) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.tryFindBack (fun x -> (x%2=0)) null |> ignore) + () + + [] + member this.TryFindIndex() = + + // integer ISeq + let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) ([8; 9; 10] |> ISeq.ofSeq) + Assert.AreEqual(Some(2), resultInt) + + // integer ISeq - None + let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) ([9;3;11]|> ISeq.ofSeq) + Assert.AreEqual(None, resultInt) + + // string ISeq + let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (["str1"; "str2"; "str3"]|> ISeq.ofSeq) + Assert.AreEqual(Some(1),resultStr) + + // string ISeq - None + let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (["str1"; "str4"; "str3"]|> ISeq.ofSeq) + Assert.AreEqual(None,resultStr) + + + // empty ISeq + let resultEpt = ISeq.tryFindIndex (fun x -> (x%2=0)) ISeq.empty + Assert.AreEqual(None, resultEpt) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.tryFindIndex (fun x -> (x % 2 = 0)) null |> ignore) + () + + [] + member this.TryFindIndexBack() = + + // integer ISeq + let resultInt = Seq.tryFindIndexBack (fun x -> (x % 5 = 0)) [5; 9; 10; 12] + Assert.AreEqual(Some(2), resultInt) + + // integer ISeq - None + let resultInt = Seq.tryFindIndexBack (fun x -> (x % 5 = 0)) [9;3;11] + Assert.AreEqual(None, resultInt) + + // string ISeq + let resultStr = Seq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) ["str1"; "str2"; "str2x"; "str3"] + Assert.AreEqual(Some(2), resultStr) + + // string ISeq - None + let resultStr = Seq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) ["str1"; "str4"; "str3"] + Assert.AreEqual(None, resultStr) + + // empty ISeq + let resultEpt = Seq.tryFindIndexBack (fun x -> (x%2=0)) ISeq.empty + Assert.AreEqual(None, resultEpt) + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.tryFindIndexBack (fun x -> (x % 2 = 0)) null |> ignore) + () + + [] + member this.Unfold() = + // integer ISeq + + let resultInt = ISeq.unfold (fun x -> if x = 1 then Some(7,2) else None) 1 + + VerifySeqsEqual (seq [7]) resultInt + + // string ISeq + let resultStr =ISeq.unfold (fun (x:string) -> if x.Contains("unfold") then Some("a","b") else None) "unfold" + VerifySeqsEqual (seq ["a"]) resultStr + () + + + [] + member this.Windowed() = + + let testWindowed config = + try + config.InputSeq + |> ISeq.ofSeq + |> ISeq.windowed config.WindowSize + |> VerifySeqsEqual config.ExpectedSeq + with + | _ when Option.isNone config.Exception -> Assert.Fail() + | e when e.GetType() = (Option.get config.Exception) -> () + | _ -> Assert.Fail() + + { + InputSeq = seq [1..10] + WindowSize = 1 + ExpectedSeq = seq { for i in 1..10 do yield [| i |] } + Exception = None + } |> testWindowed + { + InputSeq = seq [1..10] + WindowSize = 5 + ExpectedSeq = seq { for i in 1..6 do yield [| i; i+1; i+2; i+3; i+4 |] } + Exception = None + } |> testWindowed + { + InputSeq = seq [1..10] + WindowSize = 10 + ExpectedSeq = seq { yield [| 1 .. 10 |] } + Exception = None + } |> testWindowed + { + InputSeq = seq [1..10] + WindowSize = 25 + ExpectedSeq = ISeq.empty + Exception = None + } |> testWindowed + { + InputSeq = seq ["str1";"str2";"str3";"str4"] + WindowSize = 2 + ExpectedSeq = seq [ [|"str1";"str2"|];[|"str2";"str3"|];[|"str3";"str4"|]] + Exception = None + } |> testWindowed + { + InputSeq = ISeq.empty + WindowSize = 2 + ExpectedSeq = ISeq.empty + Exception = None + } |> testWindowed + { + InputSeq = null + WindowSize = 2 + ExpectedSeq = ISeq.empty + Exception = Some typeof + } |> testWindowed + { + InputSeq = seq [1..10] + WindowSize = 0 + ExpectedSeq = ISeq.empty + Exception = Some typeof + } |> testWindowed + + () + + [] + member this.Zip() = + + // integer ISeq + let resultInt = ISeq.zip (seq [1..7] |> ISeq.ofSeq) (seq [11..17] |> ISeq.ofSeq) + let expectedInt = + seq { for i in 1..7 do + yield i, i+10 } + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr =ISeq.zip (seq ["str3";"str4"] |> ISeq.ofSeq) (seq ["str1";"str2"] |> ISeq.ofSeq) + let expectedStr = seq ["str3","str1";"str4","str2"] |> ISeq.ofSeq + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = ISeq.zip ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.zip null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip null (seq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip (seq [1..7]) null |> ignore) + () + + [] + member this.Zip3() = + // integer ISeq + let resultInt = Seq.zip3 (seq [1..7]) (seq [11..17]) (seq [21..27]) + let expectedInt = + seq { for i in 1..7 do + yield i, (i + 10), (i + 20) } + VerifySeqsEqual expectedInt resultInt + + // string ISeq + let resultStr =Seq.zip3 (seq ["str1";"str2"]) (seq ["str11";"str12"]) (seq ["str21";"str22"]) + let expectedStr = seq ["str1","str11","str21";"str2","str12","str22" ] + VerifySeqsEqual expectedStr resultStr + + // empty ISeq + let resultEpt = Seq.zip3 ISeq.empty ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty resultEpt + + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> Seq.zip3 null null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> Seq.zip3 null (seq [1..7]) (seq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> Seq.zip3 (seq [1..7]) null (seq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> Seq.zip3 (seq [1..7]) (seq [1..7]) null |> ignore) + () + + [] + member this.tryPick() = + // integer ISeq + let resultInt = ISeq.tryPick (fun x-> if x = 1 then Some("got") else None) (seq [1..5]|> ISeq.ofSeq) + + Assert.AreEqual(Some("got"),resultInt) + + // string ISeq + let resultStr = ISeq.tryPick (fun x-> if x = "Are" then Some("got") else None) (seq ["Lists"; "Are"] |> ISeq.ofSeq) + Assert.AreEqual(Some("got"),resultStr) + + // empty ISeq + let resultEpt = ISeq.tryPick (fun x-> if x = 1 then Some("got") else None) ISeq.empty + Assert.IsNull(resultEpt) + + //// null ISeq + //let nullSeq : seq<'a> = null + //let funcNull x = Some(1) + + //CheckThrowsArgumentNullException(fun () -> ISeq.tryPick funcNull nullSeq |> ignore) + + () + + [] + member this.tryItem() = + // integer ISeq + let resultInt = ISeq.tryItem 3 ({ 10..20 }|> ISeq.ofSeq) + Assert.AreEqual(Some(13), resultInt) + + // string ISeq + let resultStr = ISeq.tryItem 2 (seq ["Lists"; "Are"; "Cool"; "List" ]|> ISeq.ofSeq) + Assert.AreEqual(Some("Cool"), resultStr) + + // empty ISeq + let resultEmpty = ISeq.tryItem 0 ISeq.empty + Assert.AreEqual(None, resultEmpty) + + //// null ISeq + //let nullSeq:seq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.tryItem 3 nullSeq |> ignore) + + // Negative index + let resultNegativeIndex = ISeq.tryItem -1 ({ 10..20 }|> ISeq.ofSeq) + Assert.AreEqual(None, resultNegativeIndex) + + // Index greater than length + let resultIndexGreater = ISeq.tryItem 31 ({ 10..20 }|> ISeq.ofSeq) + Assert.AreEqual(None, resultIndexGreater) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs new file mode 100644 index 00000000000..d37172bf0b9 --- /dev/null +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +module FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections.ISeqProperties + +open System +open System.Collections.Generic +open NUnit.Framework +open FsCheck +open Utils + +let sortByStable<'a when 'a : comparison> (xs : 'a []) = + let indexed = xs|> ISeq.ofSeq |> ISeq.indexed + let sorted = indexed |> ISeq.sortBy snd + isStable sorted + +[] +let ``ISeq.sortBy is stable`` () = + Check.QuickThrowOnFailure sortByStable + Check.QuickThrowOnFailure sortByStable + +let sortWithStable<'a when 'a : comparison> (xs : 'a []) = + let indexed = xs |> ISeq.ofSeq |> ISeq.indexed |> Seq.toList + let sorted = indexed |> ISeq.ofSeq |> ISeq.sortWith (fun x y -> compare (snd x) (snd y)) + isStable sorted + +[] +let ``ISeq.sortWithStable is stable`` () = + Check.QuickThrowOnFailure sortWithStable + Check.QuickThrowOnFailure sortWithStable + +let distinctByStable<'a when 'a : comparison> (xs : 'a []) = + let indexed = xs|> ISeq.ofSeq |> ISeq.indexed + let sorted = indexed |> ISeq.distinctBy snd + isStable sorted + +[] +let ``ISeq.distinctBy is stable`` () = + Check.QuickThrowOnFailure distinctByStable + Check.QuickThrowOnFailure distinctByStable From d684fa0a2fd8a76096b4e196f3e7890da7f25c56 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 17 Mar 2017 18:25:40 +1100 Subject: [PATCH 004/120] Fix ordering in append --- src/fsharp/FSharp.Core/iseq.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index d99e39639cd..b751745d80c 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -356,7 +356,7 @@ namespace Microsoft.FSharp.Collections abstract member Append : (ISeq<'T>) -> ISeq<'T> - default this.Append source = Upcast.seq (AppendEnumerable [this; source]) + default this.Append source = Upcast.seq (AppendEnumerable [source; this]) interface IEnumerable with member this.GetEnumerator () : IEnumerator = From b46e411c9df373361278ad85331fb7c1291e38e8 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 17 Mar 2017 18:33:12 +1100 Subject: [PATCH 005/120] mod test until cache is implemented --- .../FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs index 02866848084..48aa60e2af2 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs @@ -56,13 +56,12 @@ type ISeqModule() = let cachedSeq = ISeq.initInfinite (fun i -> evaluatedItems := i :: !evaluatedItems; i) |> Seq.cache - |> ISeq.ofSeq // Verify no items have been evaluated from the ISeq yet Assert.AreEqual(List.length !evaluatedItems, 0) // Force evaluation of 10 elements - ISeq.take 10 cachedSeq + Seq.take 10 cachedSeq |> Seq.toList |> ignore @@ -70,7 +69,7 @@ type ISeqModule() = Assert.AreEqual(List.length !evaluatedItems, 10) // Force evaluation of 10 elements - ISeq.take 10 cachedSeq + Seq.take 10 cachedSeq |> Seq.toList |> ignore @@ -82,7 +81,7 @@ type ISeqModule() = (box cachedSeq :?> System.IDisposable) .Dispose() // Force evaluation of 10 elements - ISeq.take 10 cachedSeq + Seq.take 10 cachedSeq |> Seq.toList |> ignore From 241e67e61f6d5e37f7dd6098e8a786ba6236e426 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 17 Mar 2017 19:03:31 +1100 Subject: [PATCH 006/120] Fix indexing for iteri2 --- src/fsharp/FSharp.Core/iseq.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index b751745d80c..2fa507ff3b3 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -970,7 +970,7 @@ namespace Microsoft.FSharp.Collections [] let inline iteri2 (f:int->'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(-1,source2.GetEnumerator())) with + upcast { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(0,source2.GetEnumerator())) with override this.ProcessNext value = if this.State._2.MoveNext() then f this.State._1 value this.State._2.Current From 1faecf867eaccb3e571896870abe34819e3d4c95 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 17 Mar 2017 19:25:05 +1100 Subject: [PATCH 007/120] fix scan to include initialState --- src/fsharp/FSharp.Core/iseq.fs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 2fa507ff3b3..853eb7f17bd 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1306,14 +1306,21 @@ namespace Microsoft.FSharp.Collections invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString override this.OnDispose () = () }) + [] + let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = + Upcast.seq (Enumerable.ConcatEnumerable sources) + [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = - source.PushTransform { new TransformFactory<'T,'State>() with - override __.Compose _ _ next = - upcast { new Transform<'T,'V,'State>(next, initialState) with - override this.ProcessNext (input:'T) : bool = - this.State <- folder this.State input - TailCall.avoid (next.ProcessNext this.State) } } + let head = ofSeq [| initialState |] + let tail = + source.PushTransform { new TransformFactory<'T,'State>() with + override __.Compose _ _ next = + upcast { new Transform<'T,'V,'State>(next, initialState) with + override this.ProcessNext (input:'T) : bool = + this.State <- folder this.State input + TailCall.avoid (next.ProcessNext this.State) } } + concat (ofSeq [| head ; tail |]) [] let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = @@ -1546,10 +1553,6 @@ namespace Microsoft.FSharp.Collections Array.Copy (circularBuffer, 0, window, windowSize - idx, idx) TailCall.avoid (next.ProcessNext window) }} - [] - let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - Upcast.seq (Enumerable.ConcatEnumerable sources) - [] let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = match source1 with From 3cf2d64557b34b286dd36e33c492616cc8e80a30 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 17 Mar 2017 19:47:13 +1100 Subject: [PATCH 008/120] fixed tryItem when index > size of input seq --- src/fsharp/FSharp.Core/iseq.fs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 853eb7f17bd..32e03c73240 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1461,7 +1461,29 @@ namespace Microsoft.FSharp.Collections [] let tryItem index (source:ISeq<'T>) = if index < 0 then None else - source |> skip index |> tryHead + source.PushTransform { new TransformFactory<'T,'T>() with + override __.Compose _ _ next = + let mutable this = Unchecked.defaultof> + let skipper = + { new Transform<'T,'U,int>(next,(*count*)0) with + // member this.count = this.State + override this.ProcessNext (input:'T) : bool = + if this.State < index then + this.State <- this.State + 1 + false + else + TailCall.avoid (next.ProcessNext input) + + interface ISkipable with + member __.CanSkip () = + if this.State < index then + this.State <- this.State + 1 + true + else + false } + this <- skipper + upcast this } + |> tryHead [] let inline tryPick f (source:ISeq<'T>) = From 19e67a6c0edd379257cc4a846700cd21205bab37 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 18 Mar 2017 15:24:25 +1100 Subject: [PATCH 009/120] Stubbed in remaining functions Took implementations from seq.fs --- .../SurfaceArea.coreclr.fs | 23 ++ .../SurfaceArea.net40.fs | 23 ++ src/fsharp/FSharp.Core/iseq.fs | 233 ++++++++++++++++++ src/fsharp/FSharp.Core/iseq.fsi | 69 ++++++ .../fsharpqa/Source/Misc/LongSourceFile01.fs | 23 ++ 5 files changed, 371 insertions(+) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs index 60e3528c6c7..2c5ceb43543 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs @@ -410,8 +410,14 @@ Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FS Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 AllPairs[T1,T2](ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cache[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cast[T](System.Collections.IEnumerable) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ChunkBySize[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) @@ -437,36 +443,52 @@ Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Replicate[T](Int32, T) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Singleton[T](T) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortDescending[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SplitInto[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip3[T1,T2,T3](ISeq`1, ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) @@ -476,6 +498,7 @@ Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.F Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 17083f1f7ae..68f68639609 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -397,8 +397,14 @@ Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FS Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 AllPairs[T1,T2](ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cache[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cast[T](System.Collections.IEnumerable) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ChunkBySize[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) @@ -424,36 +430,52 @@ Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Replicate[T](Int32, T) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Singleton[T](T) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortDescending[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SplitInto[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip3[T1,T2,T3](ISeq`1, ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) @@ -463,6 +485,7 @@ Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.F Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 32e03c73240..9d446d20806 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1748,3 +1748,236 @@ namespace Microsoft.FSharp.Collections match arr.Length with | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | len -> foldArraySubRight f arr 0 (len - 2) arr.[len - 1] + + [] + type CachedSeq<'T>(cleanup,res:seq<'T>) = + interface System.IDisposable with + member x.Dispose() = cleanup() + interface System.Collections.Generic.IEnumerable<'T> with + member x.GetEnumerator() = res.GetEnumerator() + interface System.Collections.IEnumerable with + member x.GetEnumerator() = (res :> System.Collections.IEnumerable).GetEnumerator() + member obj.Clear() = cleanup() + + [] + let cache (source:ISeq<'T>) : ISeq<'T> = + checkNonNull "source" source + // Wrap a seq to ensure that it is enumerated just once and only as far as is necessary. + // + // This code is required to be thread safe. + // The necessary calls should be called at most once (include .MoveNext() = false). + // The enumerator should be disposed (and dropped) when no longer required. + //------ + // The state is (prefix,enumerator) with invariants: + // * the prefix followed by elts from the enumerator are the initial sequence. + // * the prefix contains only as many elements as the longest enumeration so far. + let prefix = ResizeArray<_>() + let enumeratorR = ref None : IEnumerator<'T> option option ref // nested options rather than new type... + // None = Unstarted. + // Some(Some e) = Started. + // Some None = Finished. + let oneStepTo i = + // If possible, step the enumeration to prefix length i (at most one step). + // Be speculative, since this could have already happened via another thread. + if not (i < prefix.Count) then // is a step still required? + // If not yet started, start it (create enumerator). + match !enumeratorR with + | None -> enumeratorR := Some (Some (source.GetEnumerator())) + | Some _ -> () + match (!enumeratorR).Value with + | Some enumerator -> if enumerator.MoveNext() then + prefix.Add(enumerator.Current) + else + enumerator.Dispose() // Move failed, dispose enumerator, + enumeratorR := Some None // drop it and record finished. + | None -> () + let result = + unfold (fun i -> + // i being the next position to be returned + // A lock is needed over the reads to prefix.Count since the list may be being resized + // NOTE: we could change to a reader/writer lock here + lock enumeratorR (fun () -> + if i < prefix.Count then + Some (prefix.[i],i+1) + else + oneStepTo i + if i < prefix.Count then + Some (prefix.[i],i+1) + else + None)) 0 + let cleanup() = + lock enumeratorR (fun () -> + prefix.Clear() + begin match !enumeratorR with + | Some (Some e) -> IEnumerator.dispose e + | _ -> () + end + enumeratorR := None) + (new CachedSeq<_>(cleanup, result) |> ofSeq) + + [] + let collect f sources = map f sources |> concat + + [] + let allPairs (source1:ISeq<'T1>) (source2:ISeq<'T2>) : ISeq<'T1 * 'T2> = + checkNonNull "source1" source1 + checkNonNull "source2" source2 + let cached = cache source2 + source1 |> collect (fun x -> cached |> map (fun y -> x,y)) + + [] + let toList (source : ISeq<'T>) = + checkNonNull "source" source + Microsoft.FSharp.Primitives.Basics.List.ofSeq source + + [] + let replicate count x = + System.Linq.Enumerable.Repeat(x,count) |> ofSeq + + [] + let isEmpty (source : ISeq<'T>) = + checkNonNull "source" source + use ie = source.GetEnumerator() + not (ie.MoveNext()) + + [] + let cast (source: IEnumerable) : ISeq<'T> = + checkNonNull "source" source + mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) |> ofSeq + + [] + let chunkBySize chunkSize (source : ISeq<'T>) : ISeq<'T[]> = + checkNonNull "source" source + if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" + [|SR.GetString SR.inputMustBePositive; chunkSize|] + // seq { use e = source.GetEnumerator() + // let nextChunk() = + // let res = Array.zeroCreateUnchecked chunkSize + // res.[0] <- e.Current + // let i = ref 1 + // while !i < chunkSize && e.MoveNext() do + // res.[!i] <- e.Current + // i := !i + 1 + // if !i = chunkSize then + // res + // else + // res |> Array.subUnchecked 0 !i + // while e.MoveNext() do + // yield nextChunk() } |> ofSeq + raise (NotImplementedException ("TBD")) + + let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) |> ofSeq + + [] + let splitInto count (source:ISeq<'T>) : ISeq<'T[]> = + checkNonNull "source" source + if count <= 0 then invalidArgFmt "count" "{0}\ncount = {1}" + [|SR.GetString SR.inputMustBePositive; count|] + mkDelayedSeq (fun () -> + source |> toArray |> Array.splitInto count :> seq<_>) + + let inline indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) + + [] + let find f source = + checkNonNull "source" source + match tryFind f source with + | None -> indexNotFound() + | Some x -> x + + [] + let findIndex p (source:ISeq<_>) = + checkNonNull "source" source + use ie = source.GetEnumerator() + let rec loop i = + if ie.MoveNext() then + if p ie.Current then + i + else loop (i+1) + else + indexNotFound() + loop 0 + + [] + let findBack f source = + checkNonNull "source" source + source |> toArray |> Array.findBack f + + [] + let findIndexBack f source = + checkNonNull "source" source + source |> toArray |> Array.findIndexBack f + + [] + let pick f source = + checkNonNull "source" source + match tryPick f source with + | None -> indexNotFound() + | Some x -> x + + [] + [] + let readonly (source:seq<_>) = + checkNonNull "source" source + mkSeq (fun () -> source.GetEnumerator()) |> ofSeq + + [] + let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = + checkNonNull "source" source + let arr,state = source |> toArray |> Array.mapFold f acc + readonly arr, state + + [] + let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = + checkNonNull "source" source + let array = source |> toArray + let arr,state = Array.mapFoldBack f array acc + readonly arr, state + + let rec nth index (e : IEnumerator<'T>) = + if not (e.MoveNext()) then + let shortBy = index + 1 + invalidArgFmt "index" + "{0}\nseq was short by {1} {2}" + [|SR.GetString SR.notEnoughElements; shortBy; (if shortBy = 1 then "element" else "elements")|] + if index = 0 then e.Current + else nth (index-1) e + + [] + let item i (source : ISeq<'T>) = + checkNonNull "source" source + if i < 0 then invalidArgInputMustBeNonNegative "index" i + use e = source.GetEnumerator() + nth i e + + [] + let singleton x = mkSeq (fun () -> IEnumerator.Singleton x) |> ofSeq + + [] + let inline sortDescending source = + checkNonNull "source" source + let inline compareDescending a b = compare b a + sortWith compareDescending source + + [] + let inline sortByDescending keyf source = + checkNonNull "source" source + let inline compareDescending a b = compare (keyf b) (keyf a) + sortWith compareDescending source + + [] + let tryFindBack f (source : ISeq<'T>) = + checkNonNull "source" source + source |> toArray |> Array.tryFindBack f + + [] + let tryFindIndexBack f (source : ISeq<'T>) = + checkNonNull "source" source + source |> toArray |> Array.tryFindIndexBack f + + [] + let zip3 source1 source2 source3 = + checkNonNull "source1" source1 + checkNonNull "source2" source2 + checkNonNull "source3" source3 + map2 (fun x (y,z) -> x,y,z) source1 (zip source2 source3) diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 8f030782f15..7d3534ae768 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -360,3 +360,72 @@ namespace Microsoft.FSharp.Collections module internal CountBy = val inline byVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality val inline byRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality + + [] + val cache: source:ISeq<'T> -> ISeq<'T> + + [] + val collect: mapping:('T -> 'Collection) -> source:ISeq<'T> -> ISeq<'U> when 'Collection :> ISeq<'U> + + [] + val allPairs: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> + + [] + val toList: source:ISeq<'T> -> 'T list + + [] + val replicate: count:int -> initial:'T -> ISeq<'T> + + [] + val isEmpty: source:ISeq<'T> -> bool + + [] + val cast: source:IEnumerable -> ISeq<'T> + + [] + val chunkBySize: chunkSize:int -> source:ISeq<'T> -> ISeq<'T[]> + + [] + val splitInto: count:int -> source:ISeq<'T> -> ISeq<'T[]> + + [] + val find: predicate:('T -> bool) -> source:ISeq<'T> -> 'T + + [] + val findBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T + + [] + val findIndex: predicate:('T -> bool) -> source:ISeq<'T> -> int + + [] + val findIndexBack: predicate:('T -> bool) -> source:ISeq<'T> -> int + + [] + val pick: chooser:('T -> 'U option) -> source:ISeq<'T> -> 'U + + [] + val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:ISeq<'T> -> ISeq<'Result> * 'State + + [] + val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:ISeq<'T> -> state:'State -> ISeq<'Result> * 'State + + [] + val item: index:int -> source:ISeq<'T> -> 'T + + [] + val singleton: value:'T -> ISeq<'T> + + [] + val inline sortDescending : source:ISeq<'T> -> ISeq<'T> when 'T : comparison + + [] + val inline sortByDescending : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison + + [] + val tryFindBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T option + + [] + val tryFindIndexBack : predicate:('T -> bool) -> source:ISeq<'T> -> int option + + [] + val zip3: source1:ISeq<'T1> -> source2:ISeq<'T2> -> source3:ISeq<'T3> -> ISeq<'T1 * 'T2 * 'T3> diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index 5cffea80004..c144938159b 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -364,8 +364,14 @@ Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FS Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 AllPairs[T1,T2](ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cache[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cast[T](System.Collections.IEnumerable) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ChunkBySize[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) @@ -391,36 +397,52 @@ Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Replicate[T](Int32, T) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Singleton[T](T) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortDescending[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SplitInto[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip3[T1,T2,T3](ISeq`1, ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], ISeq`1, TState) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) @@ -430,6 +452,7 @@ Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.F Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) From a68ac4114d53c93518e00064667f22458431cf6e Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 18 Mar 2017 16:04:13 +1100 Subject: [PATCH 010/120] Expanded tests to cover previous missing ISeq functions --- .../ISeqModule.fs | 548 ++++++------- .../ISeqModule2.fs | 770 +++++++++--------- 2 files changed, 661 insertions(+), 657 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs index 48aa60e2af2..873fd4274e9 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs @@ -8,7 +8,7 @@ open NUnit.Framework open FSharp.Core.Unittests.LibraryTestFx // Various tests for the: -// Microsoft.FSharp.Collections.seq type +// Microsoft.FSharp.Collections.iseq type (* [Test Strategy] @@ -19,34 +19,37 @@ Make sure each method works on: * Null ISeq (null) *) +type iseq<'a> = ISeq.Core.ISeq<'a> + [] type ISeqModule() = + let iseq (x:seq<_>) = x |> ISeq.ofSeq [] member this.AllPairs() = // integer ISeq - let resultInt = Seq.allPairs (seq [1..7]) (seq [11..17]) + let resultInt = ISeq.allPairs (iseq [1..7]) (iseq [11..17]) let expectedInt = - seq { for i in 1..7 do - for j in 11..17 do - yield i, j } + iseq <| seq { for i in 1..7 do + for j in 11..17 do + yield i, j } VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr = Seq.allPairs (seq ["str3";"str4"]) (seq ["str1";"str2"]) - let expectedStr = seq ["str3","str1";"str3","str2";"str4","str1";"str4","str2"] + let resultStr = ISeq.allPairs (iseq ["str3";"str4"]) (iseq ["str1";"str2"]) + let expectedStr = iseq ["str3","str1";"str3","str2";"str4","str1";"str4","str2"] VerifySeqsEqual expectedStr resultStr // empty ISeq - VerifySeqsEqual ISeq.empty <| Seq.allPairs ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty <| Seq.allPairs { 1..7 } ISeq.empty - VerifySeqsEqual ISeq.empty <| Seq.allPairs ISeq.empty { 1..7 } + VerifySeqsEqual ISeq.empty <| ISeq.allPairs ISeq.empty ISeq.empty + VerifySeqsEqual ISeq.empty <| ISeq.allPairs (iseq { 1..7 }) ISeq.empty + VerifySeqsEqual ISeq.empty <| ISeq.allPairs ISeq.empty (iseq { 1..7 }) - // null ISeq - CheckThrowsArgumentNullException(fun() -> Seq.allPairs null null |> ignore) - CheckThrowsArgumentNullException(fun() -> Seq.allPairs null (seq [1..7]) |> ignore) - CheckThrowsArgumentNullException(fun() -> Seq.allPairs (seq [1..7]) null |> ignore) + //// null ISeq + //CheckThrowsArgumentNullException(fun() -> ISeq.allPairs null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.allPairs null (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.allPairs (iseq [1..7]) null |> ignore) () [] @@ -55,22 +58,22 @@ type ISeqModule() = let evaluatedItems : int list ref = ref [] let cachedSeq = ISeq.initInfinite (fun i -> evaluatedItems := i :: !evaluatedItems; i) - |> Seq.cache + |> ISeq.cache // Verify no items have been evaluated from the ISeq yet Assert.AreEqual(List.length !evaluatedItems, 0) // Force evaluation of 10 elements - Seq.take 10 cachedSeq - |> Seq.toList + ISeq.take 10 cachedSeq + |> ISeq.toList |> ignore // verify ref clear switch length Assert.AreEqual(List.length !evaluatedItems, 10) // Force evaluation of 10 elements - Seq.take 10 cachedSeq - |> Seq.toList + ISeq.take 10 cachedSeq + |> ISeq.toList |> ignore // Verify ref clear switch length (should be cached) @@ -81,8 +84,8 @@ type ISeqModule() = (box cachedSeq :?> System.IDisposable) .Dispose() // Force evaluation of 10 elements - Seq.take 10 cachedSeq - |> Seq.toList + ISeq.take 10 cachedSeq + |> ISeq.toList |> ignore // Verify length of evaluatedItemList is 20 @@ -101,33 +104,34 @@ type ISeqModule() = VerifySeqsEqual expectResultEmpty appendEmptySeq // Integer ISeq - let integerSeq1 = seq [0..4] |> ISeq.ofSeq - let integerSeq2 = seq [5..9] |> ISeq.ofSeq + let integerSeq1:iseq = iseq [0..4] + let integerSeq2:iseq = iseq [5..9] let appendIntergerSeq = ISeq.append integerSeq1 integerSeq2 - let expectResultInteger = seq { for i in 0..9 -> i} + let expectResultInteger = iseq <| seq { for i in 0..9 -> i} VerifySeqsEqual expectResultInteger appendIntergerSeq // String ISeq - let stringSeq1 = seq ["1";"2"] |> ISeq.ofSeq - let stringSeq2 = seq ["3";"4"] |> ISeq.ofSeq + let stringSeq1:iseq = iseq ["1";"2"] + let stringSeq2:iseq = iseq ["3";"4"] let appendStringSeq = ISeq.append stringSeq1 stringSeq2 - let expectedResultString = seq ["1";"2";"3";"4"] + let expectedResultString = iseq ["1";"2";"3";"4"] VerifySeqsEqual expectedResultString appendStringSeq // null ISeq - let nullSeq1 = seq [null;null] |> ISeq.ofSeq - let nullSeq2 = seq [null;null] |> ISeq.ofSeq + let nullSeq1 = iseq [null;null] + + let nullSeq2 =iseq [null;null] let appendNullSeq = ISeq.append nullSeq1 nullSeq2 - let expectedResultNull = seq [ null;null;null;null] + let expectedResultNull = iseq [ null;null;null;null] VerifySeqsEqual expectedResultNull appendNullSeq @@ -136,45 +140,45 @@ type ISeqModule() = [] member this.replicate() = // replicate should create multiple copies of the given value - Assert.IsTrue(Seq.isEmpty <| Seq.replicate 0 null) - Assert.IsTrue(Seq.isEmpty <| Seq.replicate 0 1) - Assert.AreEqual(null, ISeq.head <| (Seq.replicate 1 null |> ISeq.ofSeq)) - Assert.AreEqual(["1";"1"],Seq.replicate 2 "1" |> Seq.toList) + Assert.IsTrue(ISeq.isEmpty <| ISeq.replicate 0 null) + Assert.IsTrue(ISeq.isEmpty <| ISeq.replicate 0 1) + Assert.AreEqual(null, ISeq.head <| ISeq.replicate 1 null) + Assert.AreEqual(["1";"1"],ISeq.replicate 2 "1" |> ISeq.toList) - CheckThrowsArgumentException (fun () -> Seq.replicate -1 null |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.replicate -1 null |> ignore) [] member this.Average() = // empty ISeq - let emptySeq = ISeq.empty + let emptySeq:iseq = ISeq.empty CheckThrowsArgumentException (fun () -> ISeq.average emptySeq |> ignore) // double ISeq - let doubleSeq = seq [1.0;2.2;2.5;4.3] |> ISeq.ofSeq + let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] let averageDouble = ISeq.average doubleSeq Assert.IsFalse( averageDouble <> 2.5) // float32 ISeq - let floatSeq = seq [ 2.0f;4.4f;5.0f;8.6f] |> ISeq.ofSeq + let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] let averageFloat = ISeq.average floatSeq Assert.IsFalse( averageFloat <> 5.0f) // decimal ISeq - let decimalSeq = seq [ 0M;19M;19.03M] |> ISeq.ofSeq + let decimalSeq:iseq = iseq [ 0M;19M;19.03M] let averageDecimal = ISeq.average decimalSeq Assert.IsFalse( averageDecimal <> 12.676666666666666666666666667M ) - // null ISeq - //let nullSeq : ISeq.Core.ISeq = null + //// null ISeq + //let nullSeq:iseq = null //CheckThrowsArgumentNullException (fun () -> ISeq.average nullSeq |> ignore) () @@ -183,33 +187,33 @@ type ISeqModule() = [] member this.AverageBy() = // empty ISeq - let emptySeq = ISeq.empty + let emptySeq:iseq = ISeq.empty CheckThrowsArgumentException (fun () -> ISeq.averageBy (fun x -> x+1.0) emptySeq |> ignore) // double ISeq - let doubleSeq = seq [1.0;2.2;2.5;4.3] |> ISeq.ofSeq + let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] let averageDouble = ISeq.averageBy (fun x -> x-2.0) doubleSeq Assert.IsFalse( averageDouble <> 0.5 ) // float32 ISeq - let floatSeq = seq [ 2.0f;4.4f;5.0f;8.6f] |> ISeq.ofSeq + let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] let averageFloat = ISeq.averageBy (fun x -> x*3.3f) floatSeq Assert.IsFalse( averageFloat <> 16.5f ) // decimal ISeq - let decimalSeq = seq [ 0M;19M;19.03M] |> ISeq.ofSeq + let decimalSeq:iseq = iseq [ 0M;19M;19.03M] let averageDecimal = ISeq.averageBy (fun x -> x/10.7M) decimalSeq Assert.IsFalse( averageDecimal <> 1.1847352024922118380062305296M ) //// null ISeq - //let nullSeq = null + //let nullSeq:iseq = null //CheckThrowsArgumentNullException (fun () -> ISeq.averageBy (fun (x:double)->x+4.0) nullSeq |> ignore) () @@ -217,40 +221,40 @@ type ISeqModule() = [] member this.Cache() = // empty ISeq - let emptySeq = ISeq.empty + let emptySeq:iseq = ISeq.empty - let cacheEmpty = Seq.cache emptySeq + let cacheEmpty = ISeq.cache emptySeq let expectedResultEmpty = ISeq.empty VerifySeqsEqual expectedResultEmpty cacheEmpty // double ISeq - let doubleSeq = seq [1.0;2.2;2.5;4.3] |> ISeq.ofSeq + let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] - let cacheDouble = Seq.cache doubleSeq + let cacheDouble = ISeq.cache doubleSeq VerifySeqsEqual doubleSeq cacheDouble // float32 ISeq - let floatSeq = seq [ 2.0f;4.4f;5.0f;8.6f] + let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] - let cacheFloat = Seq.cache floatSeq + let cacheFloat = ISeq.cache floatSeq VerifySeqsEqual floatSeq cacheFloat // decimal ISeq - let decimalSeq = seq [ 0M; 19M; 19.03M] + let decimalSeq:iseq = iseq [ 0M; 19M; 19.03M] - let cacheDecimal = Seq.cache decimalSeq + let cacheDecimal = ISeq.cache decimalSeq VerifySeqsEqual decimalSeq cacheDecimal // null ISeq - let nullSeq = seq [null] + let nullSeq = iseq [null] - let cacheNull = Seq.cache nullSeq + let cacheNull = ISeq.cache nullSeq VerifySeqsEqual nullSeq cacheNull () @@ -260,43 +264,43 @@ type ISeqModule() = // integer ISeq let integerArray = [|1;2|] - let integerSeq = Seq.cast integerArray + let integerSeq = ISeq.cast integerArray - let expectedIntegerSeq = seq [1;2] + let expectedIntegerSeq = iseq [1;2] VerifySeqsEqual expectedIntegerSeq integerSeq // string ISeq let stringArray = [|"a";"b"|] - let stringSeq = Seq.cast stringArray + let stringSeq = ISeq.cast stringArray - let expectedStringSeq = seq["a";"b"] + let expectedStringSeq = iseq["a";"b"] VerifySeqsEqual expectedStringSeq stringSeq // empty ISeq - let emptySeq = Seq.cast ISeq.empty + let emptySeq = ISeq.cast ISeq.empty let expectedEmptySeq = ISeq.empty VerifySeqsEqual expectedEmptySeq ISeq.empty // null ISeq let nullArray = [|null;null|] - let NullSeq = Seq.cast nullArray - let expectedNullSeq = seq [null;null] + let NullSeq = ISeq.cast nullArray + let expectedNullSeq = iseq [null;null] VerifySeqsEqual expectedNullSeq NullSeq CheckThrowsExn(fun () -> let strings = integerArray - |> Seq.cast + |> ISeq.cast for o in strings do ()) CheckThrowsExn(fun () -> let strings = integerArray - |> Seq.cast + |> ISeq.cast :> System.Collections.IEnumerable // without this upcast the for loop throws, so it should with this upcast too for o in strings do ()) @@ -306,23 +310,23 @@ type ISeqModule() = member this.Choose() = // int ISeq - let intSeq = seq [1..20] |> ISeq.ofSeq + let intSeq = iseq [1..20] let funcInt x = if (x%5=0) then Some x else None let intChoosed = ISeq.choose funcInt intSeq - let expectedIntChoosed = seq { for i = 1 to 4 do yield i*5} + let expectedIntChoosed = iseq <| seq { for i = 1 to 4 do yield i*5} VerifySeqsEqual expectedIntChoosed intChoosed // string ISeq - let stringSrc = seq ["list";"List"] |> ISeq.ofSeq + let stringSrc = iseq ["list";"List"] let funcString x = match x with | "list"-> Some x | "List" -> Some x | _ -> None let strChoosed = ISeq.choose funcString stringSrc - let expectedStrChoose = seq ["list";"List"] + let expectedStrChoose = iseq ["list";"List"] VerifySeqsEqual expectedStrChoose strChoosed @@ -335,8 +339,8 @@ type ISeqModule() = VerifySeqsEqual expectedEmptyChoose emptySeq - // null ISeq - //let nullSeq = null + //// null ISeq + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.choose funcInt nullSeq |> ignore) () @@ -345,37 +349,35 @@ type ISeqModule() = member this.ChunkBySize() = let verify expected actual = - ISeq.zip (expected |> ISeq.ofSeq) (actual |> ISeq.ofSeq) + ISeq.zip expected actual |> ISeq.iter ((<||) VerifySeqsEqual) // int ISeq - verify [[1..4];[5..8]] <| Seq.chunkBySize 4 {1..8} - verify [[1..4];[5..8];[9..10]] <| Seq.chunkBySize 4 {1..10} - verify [[1]; [2]; [3]; [4]] <| Seq.chunkBySize 1 {1..4} + verify (iseq [[1..4];[5..8]]) <| ISeq.chunkBySize 4 (iseq {1..8}) + verify (iseq [[1..4];[5..8];[9..10]]) <| ISeq.chunkBySize 4 (iseq {1..10}) + verify (iseq [[1]; [2]; [3]; [4]]) <| ISeq.chunkBySize 1 (iseq {1..4}) - Seq.chunkBySize 2 (ISeq.initInfinite id) - |> ISeq.ofSeq + ISeq.chunkBySize 2 (ISeq.initInfinite id) |> ISeq.take 3 - |> verify [[0;1];[2;3];[4;5]] + |> verify (iseq [[0;1];[2;3];[4;5]]) - Seq.chunkBySize 1 (ISeq.initInfinite id) - |> ISeq.ofSeq + ISeq.chunkBySize 1 (ISeq.initInfinite id) |> ISeq.take 5 - |> verify [[0];[1];[2];[3];[4]] + |> verify (iseq [[0];[1];[2];[3];[4]]) // string ISeq - verify [["a"; "b"];["c";"d"];["e"]] <| Seq.chunkBySize 2 ["a";"b";"c";"d";"e"] + verify (iseq [["a"; "b"];["c";"d"];["e"]]) <| ISeq.chunkBySize 2 (iseq ["a";"b";"c";"d";"e"]) // empty ISeq - verify ISeq.empty <| Seq.chunkBySize 3 ISeq.empty + verify ISeq.empty <| ISeq.chunkBySize 3 ISeq.empty - // null ISeq - let nullSeq:seq<_> = null - CheckThrowsArgumentNullException (fun () -> Seq.chunkBySize 3 nullSeq |> ignore) + //// null ISeq + //let nullSeq:iseq<_> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.chunkBySize 3 nullSeq |> ignore) // invalidArg - CheckThrowsArgumentException (fun () -> Seq.chunkBySize 0 {1..10} |> ignore) - CheckThrowsArgumentException (fun () -> Seq.chunkBySize -1 {1..10} |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.chunkBySize 0 (iseq {1..10}) |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.chunkBySize -1 (iseq {1..10}) |> ignore) () @@ -383,30 +385,30 @@ type ISeqModule() = member this.SplitInto() = let verify expected actual = - ISeq.zip (expected |> ISeq.ofSeq) (actual |> ISeq.ofSeq) + ISeq.zip expected actual |> ISeq.iter ((<||) VerifySeqsEqual) // int ISeq - Seq.splitInto 3 {1..10} |> verify (seq [ {1..4}; {5..7}; {8..10} ]) - Seq.splitInto 3 {1..11} |> verify (seq [ {1..4}; {5..8}; {9..11} ]) - Seq.splitInto 3 {1..12} |> verify (seq [ {1..4}; {5..8}; {9..12} ]) + ISeq.splitInto 3 (iseq {1..10}) |> verify (iseq [ {1..4}; {5..7}; {8..10} ]) + ISeq.splitInto 3 (iseq {1..11}) |> verify (iseq [ {1..4}; {5..8}; {9..11} ]) + ISeq.splitInto 3 (iseq {1..12}) |> verify (iseq [ {1..4}; {5..8}; {9..12} ]) - Seq.splitInto 4 {1..5} |> verify (seq [ [1..2]; [3]; [4]; [5] ]) - Seq.splitInto 20 {1..4} |> verify (seq [ [1]; [2]; [3]; [4] ]) + ISeq.splitInto 4 (iseq {1..5}) |> verify (iseq [ [1..2]; [3]; [4]; [5] ]) + ISeq.splitInto 20 (iseq {1..4}) |> verify (iseq [ [1]; [2]; [3]; [4] ]) // string ISeq - Seq.splitInto 3 ["a";"b";"c";"d";"e"] |> verify ([ ["a"; "b"]; ["c";"d"]; ["e"] ]) + ISeq.splitInto 3 (iseq ["a";"b";"c";"d";"e"]) |> verify (iseq [ ["a"; "b"]; ["c";"d"]; ["e"] ]) // empty ISeq - VerifySeqsEqual [] <| Seq.splitInto 3 [] + VerifySeqsEqual [] <| ISeq.splitInto 3 (iseq []) - // null ISeq - let nullSeq:seq<_> = null - CheckThrowsArgumentNullException (fun () -> Seq.splitInto 3 nullSeq |> ignore) + //// null ISeq + //let nullSeq:iseq<_> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.splitInto 3 nullSeq |> ignore) // invalidArg - CheckThrowsArgumentException (fun () -> Seq.splitInto 0 [1..10] |> ignore) - CheckThrowsArgumentException (fun () -> Seq.splitInto -1 [1..10] |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.splitInto 0 (iseq [1..10]) |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.splitInto -1 (iseq [1..10]) |> ignore) () @@ -414,16 +416,16 @@ type ISeqModule() = member this.Compare() = // int ISeq - let intSeq1 = seq [1;3;7;9] |> ISeq.ofSeq - let intSeq2 = seq [2;4;6;8] |> ISeq.ofSeq + let intSeq1 = iseq [1;3;7;9] + let intSeq2 = iseq [2;4;6;8] let funcInt x y = if (x>y) then x else 0 let intcompared = ISeq.compareWith funcInt intSeq1 intSeq2 Assert.IsFalse( intcompared <> 7 ) // string ISeq - let stringSeq1 = seq ["a"; "b"] |> ISeq.ofSeq - let stringSeq2 = seq ["c"; "d"] |> ISeq.ofSeq + let stringSeq1 = iseq ["a"; "b"] + let stringSeq2 = iseq ["c"; "d"] let funcString x y = match (x,y) with | "a", "c" -> 0 | "b", "d" -> 1 @@ -437,8 +439,8 @@ type ISeqModule() = Assert.IsFalse( emptycompared <> 0 ) - // null ISeq - //let nullSeq = null + //// null ISeq + //let nullSeq:iseq = null //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt nullSeq emptySeq |> ignore) //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt emptySeq nullSeq |> ignore) @@ -450,33 +452,33 @@ type ISeqModule() = member this.Concat() = // integer ISeq let seqInt = - seq { for i in 0..9 do - yield seq {for j in 0..9 do - yield i*10+j} |> ISeq.ofSeq } |> ISeq.ofSeq + iseq <| seq { for i in 0..9 do + yield iseq <| seq {for j in 0..9 do + yield i*10+j}} let conIntSeq = ISeq.concat seqInt - let expectedIntSeq = seq { for i in 0..99 do yield i} + let expectedIntSeq = iseq <| seq { for i in 0..99 do yield i} VerifySeqsEqual expectedIntSeq conIntSeq // string ISeq let strSeq = - seq { for a in 'a' .. 'b' do - for b in 'a' .. 'b' do - yield seq [a; b] |> ISeq.ofSeq }|> ISeq.ofSeq + iseq <| seq { for a in 'a' .. 'b' do + for b in 'a' .. 'b' do + yield iseq [a; b] } let conStrSeq = ISeq.concat strSeq - let expectedStrSeq = seq ['a';'a';'a';'b';'b';'a';'b';'b';] + let expectedStrSeq = iseq ['a';'a';'a';'b';'b';'a';'b';'b';] VerifySeqsEqual expectedStrSeq conStrSeq // Empty ISeq - let emptySeqs = seq [seq[ ISeq.empty;ISeq.empty]|> ISeq.ofSeq;seq[ ISeq.empty;ISeq.empty]|> ISeq.ofSeq]|> ISeq.ofSeq + let emptySeqs = iseq [iseq[ ISeq.empty;ISeq.empty];iseq[ ISeq.empty;ISeq.empty]] let conEmptySeq = ISeq.concat emptySeqs - let expectedEmptySeq =seq { for i in 1..4 do yield ISeq.empty} + let expectedEmptySeq =iseq <| seq { for i in 1..4 do yield ISeq.empty} VerifySeqsEqual expectedEmptySeq conEmptySeq //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.concat nullSeq |> ignore) @@ -487,33 +489,33 @@ type ISeqModule() = // integer ISeq let funcIntCount_by (x:int) = x%3 let seqInt = - seq { for i in 0..9 do - yield i} - let countIntSeq = Seq.countBy funcIntCount_by seqInt + iseq <| seq { for i in 0..9 do + yield i} + let countIntSeq = ISeq.countByVal funcIntCount_by seqInt - let expectedIntSeq = seq [0,4;1,3;2,3] + let expectedIntSeq = iseq [0,4;1,3;2,3] VerifySeqsEqual expectedIntSeq countIntSeq // string ISeq let funcStrCount_by (s:string) = s.IndexOf("key") - let strSeq = seq [ "key";"blank key";"key";"blank blank key"] + let strSeq = iseq [ "key";"blank key";"key";"blank blank key"] - let countStrSeq = Seq.countBy funcStrCount_by strSeq - let expectedStrSeq = seq [0,2;6,1;12,1] + let countStrSeq = ISeq.countByVal funcStrCount_by strSeq + let expectedStrSeq = iseq [0,2;6,1;12,1] VerifySeqsEqual expectedStrSeq countStrSeq // Empty ISeq let emptySeq = ISeq.empty - let countEmptySeq = Seq.countBy funcIntCount_by emptySeq - let expectedEmptySeq =seq [] + let countEmptySeq = ISeq.countByVal funcIntCount_by emptySeq + let expectedEmptySeq =iseq [] VerifySeqsEqual expectedEmptySeq countEmptySeq - // null ISeq - let nullSeq = null + //// null ISeq + //let nullSeq:iseq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.countBy funcIntCount_by nullSeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.countBy funcIntCount_by nullSeq |> ignore) () [] @@ -521,31 +523,31 @@ type ISeqModule() = // integer ISeq let IntDistinctSeq = - seq { for i in 0..9 do - yield i % 3 } |> ISeq.ofSeq + iseq <| seq { for i in 0..9 do + yield i % 3 } let DistinctIntSeq = ISeq.distinct IntDistinctSeq - let expectedIntSeq = seq [0;1;2] + let expectedIntSeq = iseq [0;1;2] VerifySeqsEqual expectedIntSeq DistinctIntSeq // string ISeq - let strDistinctSeq = seq ["elementDup"; "ele1"; "ele2"; "elementDup"] |> ISeq.ofSeq + let strDistinctSeq = iseq ["elementDup"; "ele1"; "ele2"; "elementDup"] let DistnctStrSeq = ISeq.distinct strDistinctSeq - let expectedStrSeq = seq ["elementDup"; "ele1"; "ele2"] |> ISeq.ofSeq + let expectedStrSeq = iseq ["elementDup"; "ele1"; "ele2"] VerifySeqsEqual expectedStrSeq DistnctStrSeq // Empty ISeq - let emptySeq = ISeq.empty - let distinctEmptySeq = ISeq.distinct emptySeq - let expectedEmptySeq = seq [] |> ISeq.ofSeq + let emptySeq : iseq = ISeq.empty + let distinctEmptySeq : iseq = ISeq.distinct emptySeq + let expectedEmptySeq : iseq = iseq [] VerifySeqsEqual expectedEmptySeq distinctEmptySeq //// null ISeq - //let nullSeq = null + //let nullSeq:iseq = null //CheckThrowsArgumentNullException(fun () -> ISeq.distinct nullSeq |> ignore) () @@ -555,32 +557,32 @@ type ISeqModule() = // integer ISeq let funcInt x = x % 3 let IntDistinct_bySeq = - seq { for i in 0..9 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 0..9 do + yield i } let distinct_byIntSeq = ISeq.distinctBy funcInt IntDistinct_bySeq - let expectedIntSeq = seq [0;1;2] |> ISeq.ofSeq + let expectedIntSeq = iseq [0;1;2] VerifySeqsEqual expectedIntSeq distinct_byIntSeq // string ISeq let funcStrDistinct (s:string) = s.IndexOf("key") - let strSeq = seq [ "key"; "blank key"; "key dup"; "blank key dup"] |> ISeq.ofSeq + let strSeq = iseq [ "key"; "blank key"; "key dup"; "blank key dup"] let DistnctStrSeq = ISeq.distinctBy funcStrDistinct strSeq - let expectedStrSeq = seq ["key"; "blank key"] |> ISeq.ofSeq + let expectedStrSeq = iseq ["key"; "blank key"] VerifySeqsEqual expectedStrSeq DistnctStrSeq // Empty ISeq - let emptySeq = ISeq.empty - let distinct_byEmptySeq = ISeq.distinctBy funcInt emptySeq - let expectedEmptySeq = seq [] |> ISeq.ofSeq + let emptySeq : iseq = ISeq.empty + let distinct_byEmptySeq : iseq = ISeq.distinctBy funcInt emptySeq + let expectedEmptySeq : iseq = iseq [] VerifySeqsEqual expectedEmptySeq distinct_byEmptySeq //// null ISeq - //let nullSeq = null + //let nullSeq : iseq<'a> = null //CheckThrowsArgumentNullException(fun () -> ISeq.distinctBy funcInt nullSeq |> ignore) () @@ -588,23 +590,23 @@ type ISeqModule() = [] member this.Except() = // integer ISeq - let intSeq1 = seq { yield! {1..100} - yield! {1..100} } |> ISeq.ofSeq - let intSeq2 = {1..10} |> ISeq.ofSeq - let expectedIntSeq = {11..100} |> ISeq.ofSeq + let intSeq1 = iseq <| seq { yield! {1..100} + yield! {1..100} } + let intSeq2 = {1..10} + let expectedIntSeq = {11..100} VerifySeqsEqual expectedIntSeq <| ISeq.except intSeq2 intSeq1 // string ISeq - let strSeq1 = seq ["a"; "b"; "c"; "d"; "a"] |> ISeq.ofSeq - let strSeq2 = seq ["b"; "c"] |> ISeq.ofSeq - let expectedStrSeq = seq ["a"; "d"] |> ISeq.ofSeq + let strSeq1 = iseq ["a"; "b"; "c"; "d"; "a"] + let strSeq2 = iseq ["b"; "c"] + let expectedStrSeq = iseq ["a"; "d"] VerifySeqsEqual expectedStrSeq <| ISeq.except strSeq2 strSeq1 // double ISeq // Sequences with nan do not behave, due to the F# generic equality comparisons -// let floatSeq1 = seq [1.0; 1.0; System.Double.MaxValue; nan; nan] +// let floatSeq1 = iseq [1.0; 1.0; System.Double.MaxValue; nan; nan] // // VerifySeqsEqual [1.0; System.Double.MaxValue; nan; nan] <| ISeq.except [] floatSeq1 // VerifySeqsEqual [1.0; System.Double.MaxValue] <| ISeq.except [nan] floatSeq1 @@ -617,7 +619,7 @@ type ISeqModule() = VerifySeqsEqual emptyIntSeq <| ISeq.except intSeq1 intSeq1 //// null ISeq - //let nullSeq = null + //let nullSeq : iseq = null //CheckThrowsArgumentNullException(fun () -> ISeq.except nullSeq emptyIntSeq |> ignore) //CheckThrowsArgumentNullException(fun () -> ISeq.except emptyIntSeq nullSeq |> ignore) //CheckThrowsArgumentNullException(fun () -> ISeq.except nullSeq nullSeq |> ignore) @@ -630,8 +632,8 @@ type ISeqModule() = // Integer ISeq let funcInt x = (x % 2 = 0) let IntexistsSeq = - seq { for i in 0..9 do - yield i} |> ISeq.ofSeq + iseq <| seq { for i in 0..9 do + yield i} let ifExistInt = ISeq.exists funcInt IntexistsSeq @@ -639,7 +641,7 @@ type ISeqModule() = // String ISeq let funcStr (s:string) = s.Contains("key") - let strSeq = seq ["key"; "blank key"] |> ISeq.ofSeq + let strSeq = iseq ["key"; "blank key"] let ifExistStr = ISeq.exists funcStr strSeq @@ -654,7 +656,7 @@ type ISeqModule() = //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.exists funcInt nullSeq |> ignore) () @@ -663,16 +665,16 @@ type ISeqModule() = member this.Exists2() = // Integer ISeq let funcInt x y = (x+y)%3=0 - let Intexists2Seq1 = seq [1;3;7] |> ISeq.ofSeq - let Intexists2Seq2 = seq [1;6;3] |> ISeq.ofSeq + let Intexists2Seq1 = iseq [1;3;7] + let Intexists2Seq2 = iseq [1;6;3] let ifExist2Int = ISeq.exists2 funcInt Intexists2Seq1 Intexists2Seq2 Assert.IsTrue( ifExist2Int) // String ISeq let funcStr s1 s2 = ((s1 + s2) = "CombinedString") - let strSeq1 = seq [ "Combined"; "Not Combined"] |> ISeq.ofSeq - let strSeq2 = seq ["String"; "Other String"] |> ISeq.ofSeq + let strSeq1 = iseq [ "Combined"; "Not Combined"] + let strSeq2 = iseq ["String"; "Other String"] let ifexists2Str = ISeq.exists2 funcStr strSeq1 strSeq2 Assert.IsTrue(ifexists2Str) @@ -682,7 +684,7 @@ type ISeqModule() = Assert.IsFalse( ifexists2Empty) //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.exists2 funcInt nullSeq nullSeq |> ignore) () @@ -692,36 +694,36 @@ type ISeqModule() = // integer ISeq let funcInt x = if (x % 5 = 0) then true else false let IntSeq = - seq { for i in 1..20 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 1..20 do + yield i } let filterIntSeq = ISeq.filter funcInt IntSeq - let expectedfilterInt = seq [ 5;10;15;20] + let expectedfilterInt = iseq [ 5;10;15;20] VerifySeqsEqual expectedfilterInt filterIntSeq // string ISeq let funcStr (s:string) = s.Contains("Expected Content") - let strSeq = seq [ "Expected Content"; "Not Expected"; "Expected Content"; "Not Expected"] |> ISeq.ofSeq + let strSeq = iseq [ "Expected Content"; "Not Expected"; "Expected Content"; "Not Expected"] let filterStrSeq = ISeq.filter funcStr strSeq - let expectedfilterStr = seq ["Expected Content"; "Expected Content"] |> ISeq.ofSeq + let expectedfilterStr = iseq ["Expected Content"; "Expected Content"] VerifySeqsEqual expectedfilterStr filterStrSeq // Empty ISeq let emptySeq = ISeq.empty let filterEmptySeq = ISeq.filter funcInt emptySeq - let expectedEmptySeq =seq [] + let expectedEmptySeq =iseq [] VerifySeqsEqual expectedEmptySeq filterEmptySeq //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.filter funcInt nullSeq |> ignore) () @@ -732,54 +734,54 @@ type ISeqModule() = // integer ISeq let funcInt x = if (x % 5 = 0) then true else false let IntSeq = - seq { for i in 1..20 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 1..20 do + yield i } - let findInt = Seq.find funcInt IntSeq + let findInt = ISeq.find funcInt IntSeq Assert.AreEqual(findInt, 5) // string ISeq let funcStr (s:string) = s.Contains("Expected Content") - let strSeq = seq [ "Expected Content";"Not Expected"] |> ISeq.ofSeq + let strSeq = iseq [ "Expected Content";"Not Expected"] - let findStr = Seq.find funcStr strSeq + let findStr = ISeq.find funcStr strSeq Assert.AreEqual(findStr, "Expected Content") // Empty ISeq let emptySeq = ISeq.empty - CheckThrowsKeyNotFoundException(fun () -> Seq.find funcInt emptySeq |> ignore) + CheckThrowsKeyNotFoundException(fun () -> ISeq.find funcInt emptySeq |> ignore) - //// null ISeq - //let nullSeq = null - //CheckThrowsArgumentNullException (fun () -> Seq.find funcInt nullSeq |> ignore) + // null ISeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.find funcInt nullSeq |> ignore) () [] member this.FindBack() = // integer ISeq let funcInt x = x % 5 = 0 - Assert.AreEqual(20, Seq.findBack funcInt <| seq { 1..20 }) - Assert.AreEqual(15, Seq.findBack funcInt <| seq { 1..19 }) - Assert.AreEqual(5, Seq.findBack funcInt <| seq { 5..9 }) + Assert.AreEqual(20, ISeq.findBack funcInt <| (iseq <| seq { 1..20 })) + Assert.AreEqual(15, ISeq.findBack funcInt <| (iseq <| seq { 1..19 })) + Assert.AreEqual(5, ISeq.findBack funcInt <| (iseq <| seq { 5..9 })) // string ISeq let funcStr (s:string) = s.Contains("Expected") - let strSeq = seq [ "Not Expected"; "Expected Content"] |> ISeq.ofSeq - let findStr = Seq.findBack funcStr strSeq + let strSeq = iseq [ "Not Expected"; "Expected Content"] + let findStr = ISeq.findBack funcStr strSeq Assert.AreEqual("Expected Content", findStr) // Empty ISeq let emptySeq = ISeq.empty - CheckThrowsKeyNotFoundException(fun () -> Seq.findBack funcInt emptySeq |> ignore) + CheckThrowsKeyNotFoundException(fun () -> ISeq.findBack funcInt emptySeq |> ignore) // Not found let emptySeq = ISeq.empty - CheckThrowsKeyNotFoundException(fun () -> seq { 1..20 } |> Seq.findBack (fun _ -> false) |> ignore) + CheckThrowsKeyNotFoundException(fun () -> iseq <| seq { 1..20 } |> ISeq.findBack (fun _ -> false) |> ignore) //// null ISeq - //let nullSeq = null - //CheckThrowsArgumentNullException (fun () -> Seq.findBack funcInt nullSeq |> ignore) + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.findBack funcInt nullSeq |> ignore) () [] @@ -787,74 +789,74 @@ type ISeqModule() = // integer ISeq let digits = [1 .. 100] |> ISeq.ofList - let idx = digits |> Seq.findIndex (fun i -> i.ToString().Length > 1) + let idx = digits |> ISeq.findIndex (fun i -> i.ToString().Length > 1) Assert.AreEqual(idx, 9) // empty ISeq - CheckThrowsKeyNotFoundException(fun () -> Seq.findIndex (fun i -> true) ISeq.empty |> ignore) + CheckThrowsKeyNotFoundException(fun () -> ISeq.findIndex (fun i -> true) ISeq.empty |> ignore) //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.findIndex (fun i -> true) null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.findIndex (fun i -> true) null |> ignore) () [] member this.Permute() = let mapIndex i = (i + 1) % 4 - // integer seq - let intSeq = seq { 1..4 }|> ISeq.ofSeq + // integer iseq + let intSeq = iseq <| seq { 1..4 } let resultInt = ISeq.permute mapIndex intSeq - VerifySeqsEqual (seq [4;1;2;3]) resultInt + VerifySeqsEqual (iseq [4;1;2;3]) resultInt - // string seq - let resultStr = ISeq.permute mapIndex ([|"Lists"; "are"; "commonly"; "list" |] |> ISeq.ofSeq) - VerifySeqsEqual (seq ["list"; "Lists"; "are"; "commonly" ]) resultStr + // string iseq + let resultStr = ISeq.permute mapIndex (iseq [|"Lists"; "are"; "commonly"; "list" |]) + VerifySeqsEqual (iseq ["list"; "Lists"; "are"; "commonly" ]) resultStr - // empty seq - let resultEpt = ISeq.permute mapIndex ([||] |> ISeq.ofSeq) + // empty iseq + let resultEpt = ISeq.permute mapIndex (iseq [||]) VerifySeqsEqual ISeq.empty resultEpt - //// null seq - //let nullSeq = null + //// null iseq + //let nullSeq = null:string[] //CheckThrowsArgumentNullException (fun () -> ISeq.permute mapIndex nullSeq |> ignore) // argument exceptions - CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 10) ([0..9]|> ISeq.ofSeq) |> ISeq.iter ignore) - CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 0) ([0..9]|> ISeq.ofSeq) |> ISeq.iter ignore) + CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 10) (iseq [0..9]) |> ISeq.iter ignore) + CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 0) (iseq [0..9]) |> ISeq.iter ignore) () [] member this.FindIndexBack() = // integer ISeq - let digits = seq { 1..100 }|> ISeq.ofSeq - let idx = digits |> Seq.findIndexBack (fun i -> i.ToString().Length = 1) + let digits = iseq <| seq { 1..100 } + let idx = digits |> ISeq.findIndexBack (fun i -> i.ToString().Length = 1) Assert.AreEqual(idx, 8) // string ISeq let funcStr (s:string) = s.Contains("Expected") - let strSeq = seq [ "Not Expected"; "Expected Content" ] |> ISeq.ofSeq - let findStr = Seq.findIndexBack funcStr strSeq + let strSeq = iseq [ "Not Expected"; "Expected Content" ] + let findStr = ISeq.findIndexBack funcStr strSeq Assert.AreEqual(1, findStr) // empty ISeq - CheckThrowsKeyNotFoundException(fun () -> Seq.findIndexBack (fun i -> true) ISeq.empty |> ignore) + CheckThrowsKeyNotFoundException(fun () -> ISeq.findIndexBack (fun i -> true) ISeq.empty |> ignore) //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.findIndexBack (fun i -> true) null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.findIndexBack (fun i -> true) null |> ignore) () [] member this.Pick() = let digits = [| 1 .. 10 |] |> ISeq.ofArray - let result = Seq.pick (fun i -> if i > 5 then Some(i.ToString()) else None) digits + let result = ISeq.pick (fun i -> if i > 5 then Some(i.ToString()) else None) digits Assert.AreEqual(result, "6") - // Empty seq (Bugged, 4173) - CheckThrowsKeyNotFoundException (fun () -> Seq.pick (fun i -> Some('a')) ([| |] : int[]) |> ignore) + // Empty iseq (Bugged, 4173) + CheckThrowsKeyNotFoundException (fun () -> ISeq.pick (fun i -> Some('a')) (iseq ([| |] : int[])) |> ignore) - // Null - CheckThrowsArgumentNullException (fun () -> Seq.pick (fun i -> Some(i + 0)) null |> ignore) + //// Null + //CheckThrowsArgumentNullException (fun () -> ISeq.pick (fun i -> Some(i + 0)) null |> ignore) () [] @@ -862,15 +864,15 @@ type ISeqModule() = let funcInt x y = x+y let IntSeq = - seq { for i in 1..10 do - yield i} |> ISeq.ofSeq + iseq <| seq { for i in 1..10 do + yield i} let foldInt = ISeq.fold funcInt 1 IntSeq if foldInt <> 56 then Assert.Fail() // string ISeq let funcStr (x:string) (y:string) = x+y - let strSeq = seq ["B"; "C"; "D" ; "E"] |> ISeq.ofSeq + let strSeq = iseq ["B"; "C"; "D" ; "E"] let foldStr = ISeq.fold funcStr "A" strSeq if foldStr <> "ABCDE" then Assert.Fail() @@ -882,7 +884,7 @@ type ISeqModule() = if foldEmpty <> 1 then Assert.Fail() //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.fold funcInt 1 nullSeq |> ignore) () @@ -891,53 +893,53 @@ type ISeqModule() = [] member this.Fold2() = - Assert.AreEqual([(3,5); (2,3); (1,1)],ISeq.fold2 (fun acc x y -> (x,y)::acc) [] (seq [ 1..3 ] |> ISeq.ofSeq) (seq [1..2..6] |> ISeq.ofSeq)) + Assert.AreEqual([(3,5); (2,3); (1,1)],ISeq.fold2 (fun acc x y -> (x,y)::acc) [] (iseq [ 1..3 ]) (iseq [1..2..6])) // integer List let funcInt x y z = x + y + z - let resultInt = ISeq.fold2 funcInt 9 (seq [ 1..10 ] |> ISeq.ofSeq) (seq [1..2..20] |> ISeq.ofSeq) + let resultInt = ISeq.fold2 funcInt 9 (iseq [ 1..10 ]) (iseq [1..2..20]) Assert.AreEqual(164, resultInt) // string List let funcStr x y z = x + y + z - let resultStr = ISeq.fold2 funcStr "*" (["a"; "b"; "c" ; "d" ] |> ISeq.ofSeq) (["A"; "B"; "C" ; "D" ] |> ISeq.ofSeq) + let resultStr = ISeq.fold2 funcStr "*" (iseq ["a"; "b"; "c" ; "d" ]) (iseq ["A"; "B"; "C" ; "D" ] ) Assert.AreEqual("*aAbBcCdD", resultStr) // empty List - let emptyArr = [ ] |> ISeq.ofSeq - let resultEpt = ISeq.fold2 funcInt 5 emptyArr emptyArr + let emptyArr:int list = [ ] + let resultEpt = ISeq.fold2 funcInt 5 (iseq emptyArr) (iseq emptyArr) Assert.AreEqual(5, resultEpt) - Assert.AreEqual(0,ISeq.fold2 funcInt 0 ISeq.empty (seq [1] |> ISeq.ofSeq)) - Assert.AreEqual(-1,ISeq.fold2 funcInt -1 (seq [1] |> ISeq.ofSeq) ISeq.empty) + Assert.AreEqual(0,ISeq.fold2 funcInt 0 ISeq.empty (iseq [1])) + Assert.AreEqual(-1,ISeq.fold2 funcInt -1 (iseq [1]) ISeq.empty) - Assert.AreEqual(2,ISeq.fold2 funcInt 0 (seq [1;2] |> ISeq.ofSeq) (seq [1] |> ISeq.ofSeq)) - Assert.AreEqual(4,ISeq.fold2 funcInt 0 (seq [1] |> ISeq.ofSeq) (seq [3;6] |> ISeq.ofSeq)) + Assert.AreEqual(2,ISeq.fold2 funcInt 0 (iseq [1;2]) (iseq [1])) + Assert.AreEqual(4,ISeq.fold2 funcInt 0 (iseq [1]) (iseq [3;6])) //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 nullSeq (seq [1] |> ISeq.ofSeq) |> ignore) - //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 (seq [1] |> ISeq.ofSeq) nullSeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 nullSeq (iseq [1]) |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 (iseq [1]) nullSeq |> ignore) () [] member this.FoldBack() = // int ISeq let funcInt x y = x-y - let IntSeq = seq { 1..4 } |> ISeq.ofSeq + let IntSeq = iseq <| seq { 1..4 } let foldInt = ISeq.foldBack funcInt IntSeq 6 Assert.AreEqual((1-(2-(3-(4-6)))), foldInt) // string ISeq let funcStr (x:string) (y:string) = y.Remove(0,x.Length) - let strSeq = seq [ "A"; "B"; "C"; "D" ] |> ISeq.ofSeq + let strSeq = iseq [ "A"; "B"; "C"; "D" ] let foldStr = ISeq.foldBack funcStr strSeq "ABCDE" Assert.AreEqual("E", foldStr) // single element let funcStr2 elem acc = sprintf "%s%s" elem acc - let strSeq2 = seq [ "A" ] |> ISeq.ofSeq + let strSeq2 = iseq [ "A" ] let foldStr2 = ISeq.foldBack funcStr2 strSeq2 "X" Assert.AreEqual("AX", foldStr2) @@ -947,7 +949,7 @@ type ISeqModule() = Assert.AreEqual(1, foldEmpty) //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack funcInt nullSeq 1 |> ignore) // Validate that foldBack with the cons operator and the empty list returns a copy of the sequence @@ -961,21 +963,21 @@ type ISeqModule() = member this.foldBack2() = // int ISeq let funcInt x y z = x + y + z - let intSeq = seq { 1..10 } |> ISeq.ofSeq - let resultInt = ISeq.foldBack2 funcInt intSeq (seq { 1..2..20 } |> ISeq.ofSeq) 9 + let intSeq = iseq <| seq { 1..10 } + let resultInt = ISeq.foldBack2 funcInt intSeq (iseq <| seq { 1..2..20 }) 9 Assert.AreEqual(164, resultInt) // string ISeq let funcStr = sprintf "%s%s%s" - let strSeq = seq [ "A"; "B"; "C"; "D" ] |> ISeq.ofSeq - let resultStr = ISeq.foldBack2 funcStr strSeq (seq [ "a"; "b"; "c"; "d"] |> ISeq.ofSeq) "*" + let strSeq = iseq [ "A"; "B"; "C"; "D" ] + let resultStr = ISeq.foldBack2 funcStr strSeq (iseq [ "a"; "b"; "c"; "d"]) "*" Assert.AreEqual("AaBbCcDd*", resultStr) // single element - let strSeqSingle = seq [ "X" ] |> ISeq.ofSeq + let strSeqSingle = iseq [ "X" ] Assert.AreEqual("XAZ", ISeq.foldBack2 funcStr strSeqSingle strSeq "Z") Assert.AreEqual("AXZ", ISeq.foldBack2 funcStr strSeq strSeqSingle "Z") - Assert.AreEqual("XYZ", ISeq.foldBack2 funcStr strSeqSingle (seq [ "Y" ] |> ISeq.ofSeq) "Z") + Assert.AreEqual("XYZ", ISeq.foldBack2 funcStr strSeqSingle (iseq [ "Y" ]) "Z") // empty ISeq let emptySeq = ISeq.empty @@ -989,7 +991,7 @@ type ISeqModule() = Assert.AreEqual(164, ISeq.foldBack2 funcInt infiniteSeq intSeq 9) //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt nullSeq intSeq 1 |> ignore) //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt intSeq nullSeq 1 |> ignore) //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt nullSeq nullSeq 1 |> ignore) @@ -1001,8 +1003,8 @@ type ISeqModule() = let funcInt x = if x%2 = 0 then true else false let IntSeq = - seq { for i in 1..10 do - yield i*2} |> ISeq.ofSeq + iseq <| seq { for i in 1..10 do + yield i*2} let for_allInt = ISeq.forall funcInt IntSeq if for_allInt <> true then Assert.Fail() @@ -1010,7 +1012,7 @@ type ISeqModule() = // string ISeq let funcStr (x:string) = x.Contains("a") - let strSeq = seq ["a"; "ab"; "abc" ; "abcd"] |> ISeq.ofSeq + let strSeq = iseq ["a"; "ab"; "abc" ; "abcd"] let for_allStr = ISeq.forall funcStr strSeq if for_allStr <> true then Assert.Fail() @@ -1023,7 +1025,7 @@ type ISeqModule() = if for_allEmpty <> true then Assert.Fail() //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.forall funcInt nullSeq |> ignore) () @@ -1032,8 +1034,8 @@ type ISeqModule() = let funcInt x y = if (x+y)%2 = 0 then true else false let IntSeq = - seq { for i in 1..10 do - yield i} |> ISeq.ofSeq + iseq <| seq { for i in 1..10 do + yield i} let for_all2Int = ISeq.forall2 funcInt IntSeq IntSeq @@ -1041,8 +1043,8 @@ type ISeqModule() = // string ISeq let funcStr (x:string) (y:string) = (x+y).Length = 5 - let strSeq1 = seq ["a"; "ab"; "abc" ; "abcd"] |> ISeq.ofSeq - let strSeq2 = seq ["abcd"; "abc"; "ab" ; "a"] |> ISeq.ofSeq + let strSeq1 = iseq ["a"; "ab"; "abc" ; "abcd"] + let strSeq2 = iseq ["abcd"; "abc"; "ab" ; "a"] let for_all2Str = ISeq.forall2 funcStr strSeq1 strSeq2 if for_all2Str <> true then Assert.Fail() @@ -1054,7 +1056,7 @@ type ISeqModule() = if for_all2Empty <> true then Assert.Fail() //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.forall2 funcInt nullSeq nullSeq |> ignore) @@ -1064,47 +1066,47 @@ type ISeqModule() = let funcInt x = x%5 let IntSeq = - seq { for i in 0 .. 9 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 0 .. 9 do + yield i } - let group_byInt = ISeq.groupByVal funcInt IntSeq |> ISeq.map (fun (i, v) -> i, Seq.toList v) + let group_byInt = ISeq.groupByVal funcInt IntSeq |> ISeq.map (fun (i, v) -> i, ISeq.toList v) let expectedIntSeq = - seq { for i in 0..4 do - yield i, [i; i+5] } |> ISeq.ofSeq + iseq <| seq { for i in 0..4 do + yield i, [i; i+5] } VerifySeqsEqual group_byInt expectedIntSeq // string ISeq let funcStr (x:string) = x.Length - let strSeq = seq ["length7"; "length 8"; "length7" ; "length 9"] |> ISeq.ofSeq + let strSeq = iseq ["length7"; "length 8"; "length7" ; "length 9"] - let group_byStr = ISeq.groupByVal funcStr strSeq |> ISeq.map (fun (i, v) -> i, Seq.toList v) + let group_byStr = ISeq.groupByVal funcStr strSeq |> ISeq.map (fun (i, v) -> i, ISeq.toList v) let expectedStrSeq = - seq { + iseq <| seq { yield 7, ["length7"; "length7"] yield 8, ["length 8"] - yield 9, ["length 9"] } |> ISeq.ofSeq + yield 9, ["length 9"] } VerifySeqsEqual expectedStrSeq group_byStr // Empty ISeq let emptySeq = ISeq.empty let group_byEmpty = ISeq.groupByVal funcInt emptySeq - let expectedEmptySeq = seq [] + let expectedEmptySeq = iseq [] VerifySeqsEqual expectedEmptySeq group_byEmpty //// null ISeq - //let nullSeq = null - //let group_byNull = ISeq.groupByVal funcInt nullSeq + //let nullSeq:iseq<'a> = null + //let group_byNull = ISeq.groupBy funcInt nullSeq //CheckThrowsArgumentNullException (fun () -> ISeq.iter (fun _ -> ()) group_byNull) () [] member this.DisposalOfUnstartedEnumerator() = let run = ref false - let f() = seq { + let f() = iseq <| seq { try () finally @@ -1117,36 +1119,36 @@ type ISeqModule() = [] member this.WeirdLocalNames() = - let f pc = seq { + let f pc = iseq <| seq { yield pc yield (pc+1) yield (pc+2) } - let l = f 3 |> Seq.toList + let l = f 3 |> ISeq.toList Assert.AreEqual([3;4;5], l) - let f i = seq { + let f i = iseq <| seq { let pc = i*2 yield pc yield (pc+1) yield (pc+2) } - let l = f 3 |> Seq.toList + let l = f 3 |> ISeq.toList Assert.AreEqual([6;7;8], l) [] member this.Contains() = // Integer ISeq - let intSeq = seq { 0..9 } |> ISeq.ofSeq + let intSeq = iseq <| seq { 0..9 } let ifContainsInt = ISeq.contains 5 intSeq Assert.IsTrue(ifContainsInt) // String ISeq - let strSeq = seq ["key"; "blank key"] |> ISeq.ofSeq + let strSeq = iseq ["key"; "blank key"] let ifContainsStr = ISeq.contains "key" strSeq @@ -1159,6 +1161,6 @@ type ISeqModule() = Assert.IsFalse(ifContainsEmpty) //// null ISeq - //let nullSeq = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.contains 5 nullSeq |> ignore) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs index 36d8839f107..859a3a7f466 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs @@ -7,28 +7,31 @@ open NUnit.Framework open FSharp.Core.Unittests.LibraryTestFx +//type iseq<'a> = ISeq.Core.ISeq<'a> + type ISeqWindowedTestInput<'t> = { - InputSeq : seq<'t> + InputSeq : iseq<'t> WindowSize : int - ExpectedSeq : seq<'t[]> + ExpectedSeq : iseq<'t[]> Exception : Type option } [] type ISeqModule2() = + let iseq (x:seq<_>) = x |> ISeq.ofSeq [] member this.Hd() = let IntSeq = - seq { for i in 0 .. 9 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 0 .. 9 do + yield i } if ISeq.head IntSeq <> 0 then Assert.Fail() // string ISeq - let strSeq = seq ["first"; "second"; "third"] |> ISeq.ofSeq + let strSeq = iseq ["first"; "second"; "third"] if ISeq.head strSeq <> "first" then Assert.Fail() // Empty ISeq @@ -36,7 +39,7 @@ type ISeqModule2() = CheckThrowsArgumentException ( fun() -> ISeq.head emptySeq) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.head nullSeq) () @@ -44,12 +47,12 @@ type ISeqModule2() = member this.TryHead() = // int ISeq let IntSeq = - seq { for i in 0 .. 9 -> i } |> ISeq.ofSeq + iseq <| seq { for i in 0 .. 9 -> i } let intResult = ISeq.tryHead IntSeq // string ISeq - let strResult = ISeq.tryHead (seq ["first"; "second"; "third"] |> ISeq.ofSeq) + let strResult = ISeq.tryHead (iseq ["first"; "second"; "third"]) Assert.AreEqual("first", strResult.Value) // Empty ISeq @@ -57,23 +60,23 @@ type ISeqModule2() = Assert.AreEqual(None, emptyResult) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.head nullSeq) () [] member this.Tl() = - // integer seq - let resultInt = ISeq.tail <| (seq { 1..10 } |> ISeq.ofSeq) - Assert.AreEqual(Array.ofSeq (seq { 2..10 } |> ISeq.ofSeq), Array.ofSeq resultInt) + // integer iseq + let resultInt = ISeq.tail <| (iseq <| seq { 1..10 } ) + Assert.AreEqual(Array.ofSeq (iseq <| seq { 2..10 }), Array.ofSeq resultInt) - // string seq - let resultStr = ISeq.tail <| (seq { yield "a"; yield "b"; yield "c"; yield "d" } |> ISeq.ofSeq) - Assert.AreEqual(Array.ofSeq (seq { yield "b"; yield "c" ; yield "d" } |> ISeq.ofSeq), Array.ofSeq resultStr) + // string iseq + let resultStr = ISeq.tail <| (iseq <| seq { yield "a"; yield "b"; yield "c"; yield "d" }) + Assert.AreEqual(Array.ofSeq (iseq <| seq { yield "b"; yield "c" ; yield "d" }), Array.ofSeq resultStr) - // 1-element seq - let resultStr2 = ISeq.tail <| (seq { yield "a" } |> ISeq.ofSeq) - Assert.AreEqual(Array.ofSeq (ISeq.empty ), Array.ofSeq resultStr2) + // 1-element iseq + let resultStr2 = ISeq.tail <| (iseq <| seq { yield "a" }) + Assert.AreEqual(Array.ofSeq (ISeq.empty : iseq), Array.ofSeq resultStr2) //CheckThrowsArgumentNullException(fun () -> ISeq.tail null |> ignore) CheckThrowsArgumentException(fun () -> ISeq.tail ISeq.empty |> ISeq.iter (fun _ -> failwith "Should not be reached")) @@ -83,13 +86,13 @@ type ISeqModule2() = member this.Last() = let IntSeq = - seq { for i in 0 .. 9 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 0 .. 9 do + yield i } if ISeq.last IntSeq <> 9 then Assert.Fail() // string ISeq - let strSeq = seq ["first"; "second"; "third"] |> ISeq.ofSeq + let strSeq = iseq ["first"; "second"; "third"] if ISeq.last strSeq <> "third" then Assert.Fail() // Empty ISeq @@ -97,7 +100,7 @@ type ISeqModule2() = CheckThrowsArgumentException ( fun() -> ISeq.last emptySeq) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.last nullSeq) () @@ -105,13 +108,13 @@ type ISeqModule2() = member this.TryLast() = let IntSeq = - seq { for i in 0 .. 9 -> i } |> ISeq.ofSeq + iseq <| seq { for i in 0 .. 9 -> i } let intResult = ISeq.tryLast IntSeq Assert.AreEqual(9, intResult.Value) // string ISeq - let strResult = ISeq.tryLast (seq ["first"; "second"; "third"] |> ISeq.ofSeq) + let strResult = ISeq.tryLast (iseq ["first"; "second"; "third"]) Assert.AreEqual("third", strResult.Value) // Empty ISeq @@ -119,7 +122,7 @@ type ISeqModule2() = Assert.IsTrue(emptyResult.IsNone) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.tryLast nullSeq |> ignore) () @@ -127,13 +130,13 @@ type ISeqModule2() = member this.ExactlyOne() = let IntSeq = - seq { for i in 7 .. 7 do - yield i } |> ISeq.ofSeq + iseq <| seq { for i in 7 .. 7 do + yield i } if ISeq.exactlyOne IntSeq <> 7 then Assert.Fail() // string ISeq - let strSeq = seq ["second"] |> ISeq.ofSeq + let strSeq = iseq ["second"] if ISeq.exactlyOne strSeq <> "second" then Assert.Fail() // Empty ISeq @@ -142,10 +145,10 @@ type ISeqModule2() = // non-singleton ISeq let emptySeq = ISeq.empty - CheckThrowsArgumentException ( fun() -> ISeq.exactlyOne ([ 0 .. 1 ] |> ISeq.ofSeq) |> ignore ) + CheckThrowsArgumentException ( fun() -> ISeq.exactlyOne (iseq [ 0 .. 1 ]) |> ignore ) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.exactlyOne nullSeq) () @@ -155,7 +158,7 @@ type ISeqModule2() = let funcInt x = x let init_finiteInt = ISeq.init 9 funcInt - let expectedIntSeq = seq [ 0..8] |> ISeq.ofSeq + let expectedIntSeq = iseq [ 0..8] VerifySeqsEqual expectedIntSeq init_finiteInt @@ -163,16 +166,16 @@ type ISeqModule2() = // string ISeq let funcStr x = x.ToString() let init_finiteStr = ISeq.init 5 funcStr - let expectedStrSeq = seq ["0";"1";"2";"3";"4"] |> ISeq.ofSeq + let expectedStrSeq = iseq ["0";"1";"2";"3";"4"] VerifySeqsEqual expectedStrSeq init_finiteStr - //// null ISeq - //let funcNull x = null - //let init_finiteNull = ISeq.init 3 funcNull - //let expectedNullSeq = seq [ null;null;null] |> ISeq.ofSeq + // null ISeq + let funcNull x = null + let init_finiteNull = ISeq.init 3 funcNull + let expectedNullSeq = iseq [ null;null;null] - //VerifySeqsEqual expectedNullSeq init_finiteNull + VerifySeqsEqual expectedNullSeq init_finiteNull () [] @@ -180,7 +183,7 @@ type ISeqModule2() = let funcInt x = x let init_infiniteInt = ISeq.initInfinite funcInt - let resultint = Seq.find (fun x -> x =100) init_infiniteInt + let resultint = ISeq.find (fun x -> x =100) init_infiniteInt Assert.AreEqual(100,resultint) @@ -188,7 +191,7 @@ type ISeqModule2() = // string ISeq let funcStr x = x.ToString() let init_infiniteStr = ISeq.initInfinite funcStr - let resultstr = Seq.find (fun x -> x = "100") init_infiniteStr + let resultstr = ISeq.find (fun x -> x = "100") init_infiniteStr Assert.AreEqual("100",resultstr) @@ -196,40 +199,40 @@ type ISeqModule2() = [] member this.IsEmpty() = - //seq int - let seqint = seq [1;2;3] |> ISeq.ofSeq - let is_emptyInt = Seq.isEmpty seqint + //iseq int + let seqint = iseq [1;2;3] + let is_emptyInt = ISeq.isEmpty seqint Assert.IsFalse(is_emptyInt) - //seq str - let seqStr = seq["first";"second"] - let is_emptyStr = Seq.isEmpty seqStr + //iseq str + let seqStr = iseq["first";"second"] + let is_emptyStr = ISeq.isEmpty seqStr Assert.IsFalse(is_emptyInt) - //seq empty + //iseq empty let seqEmpty = ISeq.empty - let is_emptyEmpty = Seq.isEmpty seqEmpty + let is_emptyEmpty = ISeq.isEmpty seqEmpty Assert.IsTrue(is_emptyEmpty) - //seq null - let seqnull:seq<'a> = null - CheckThrowsArgumentNullException (fun () -> Seq.isEmpty seqnull |> ignore) + ////iseq null + //let seqnull:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> ISeq.isEmpty seqnull |> ignore) () [] member this.Iter() = - //seq int - let seqint = seq [ 1..3] |> ISeq.ofSeq + //iseq int + let seqint = iseq [ 1..3] let cacheint = ref 0 let funcint x = cacheint := !cacheint + x ISeq.iter funcint seqint Assert.AreEqual(6,!cacheint) - //seq str - let seqStr = seq ["first";"second"] |> ISeq.ofSeq + //iseq str + let seqStr = iseq ["first";"second"] let cachestr =ref "" let funcstr x = cachestr := !cachestr+x ISeq.iter funcstr seqStr @@ -241,8 +244,8 @@ type ISeqModule2() = let resultEpt = ref 0 ISeq.iter (fun x -> Assert.Fail()) emptyseq - // null seqay - //let nullseq:seq<'a> = null + //// null seqay + //let nullseq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.iter funcint nullseq |> ignore) () @@ -250,16 +253,16 @@ type ISeqModule2() = [] member this.Iter2() = - //seq int - let seqint = seq [ 1..3] |> ISeq.ofSeq + //iseq int + let seqint = iseq [ 1..3] let cacheint = ref 0 let funcint x y = cacheint := !cacheint + x+y ISeq.iter2 funcint seqint seqint Assert.AreEqual(12,!cacheint) - //seq str - let seqStr = seq ["first";"second"]|> ISeq.ofSeq + //iseq str + let seqStr = iseq ["first";"second"] let cachestr =ref "" let funcstr x y = cachestr := !cachestr+x+y ISeq.iter2 funcstr seqStr seqStr @@ -272,7 +275,7 @@ type ISeqModule2() = ISeq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq //// null seqay - //let nullseq:seq<'a> = null + //let nullseq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.iter2 funcint nullseq nullseq |> ignore) () @@ -280,16 +283,16 @@ type ISeqModule2() = [] member this.Iteri() = - // seq int - let seqint = seq [ 1..10] |> ISeq.ofSeq + // iseq int + let seqint = iseq [ 1..10] let cacheint = ref 0 let funcint x y = cacheint := !cacheint + x+y ISeq.iteri funcint seqint Assert.AreEqual(100,!cacheint) - // seq str - let seqStr = seq ["first";"second"]|> ISeq.ofSeq + // iseq str + let seqStr = iseq ["first";"second"] let cachestr =ref 0 let funcstr (x:int) (y:string) = cachestr := !cachestr+ x + y.Length ISeq.iteri funcstr seqStr @@ -303,41 +306,41 @@ type ISeqModule2() = Assert.AreEqual(0,!resultEpt) //// null seqay - //let nullseq:seq<'a> = null + //let nullseq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.iteri funcint nullseq |> ignore) () [] member this.Iteri2() = - //seq int - let seqint = seq [ 1..3] |> ISeq.ofSeq + //iseq int + let seqint = iseq [ 1..3] let cacheint = ref 0 let funcint x y z = cacheint := !cacheint + x + y + z ISeq.iteri2 funcint seqint seqint Assert.AreEqual(15,!cacheint) - //seq str - let seqStr = seq ["first";"second"]|> ISeq.ofSeq + //iseq str + let seqStr = iseq ["first";"second"] let cachestr = ref 0 let funcstr (x:int) (y:string) (z:string) = cachestr := !cachestr + x + y.Length + z.Length ISeq.iteri2 funcstr seqStr seqStr Assert.AreEqual(23,!cachestr) - // empty seq + // empty iseq let emptyseq = ISeq.empty let resultEpt = ref 0 ISeq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq - //// null seq - //let nullseq:seq<'a> = null + //// null iseq + //let nullseq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.iteri2 funcint nullseq nullseq |> ignore) // len1 <> len2 - let shorterSeq = seq { 1..3 } |> ISeq.ofSeq - let longerSeq = seq { 2..2..100 } |> ISeq.ofSeq + let shorterSeq = iseq <| seq { 1..3 } + let longerSeq = iseq <| seq { 2..2..100 } let testSeqLengths seq1 seq2 = let cache = ref 0 @@ -353,12 +356,12 @@ type ISeqModule2() = [] member this.Length() = - // integer seq - let resultInt = ISeq.length ({1..8}|> ISeq.ofSeq) + // integer iseq + let resultInt = ISeq.length (iseq {1..8}) if resultInt <> 8 then Assert.Fail() // string ISeq - let resultStr = ISeq.length (seq ["Lists"; "are"; "commonly" ; "list" ]|> ISeq.ofSeq) + let resultStr = ISeq.length (iseq ["Lists"; "are"; "commonly" ; "list" ]) if resultStr <> 4 then Assert.Fail() // empty ISeq @@ -366,7 +369,7 @@ type ISeqModule2() = if resultEpt <> 0 then Assert.Fail() //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.length nullSeq |> ignore) () @@ -380,15 +383,15 @@ type ISeqModule2() = | _ when x % 2 = 0 -> 10*x | _ -> x - let resultInt = ISeq.map funcInt ({ 1..10 }|> ISeq.ofSeq) - let expectedint = seq [1;20;3;40;5;60;7;80;9;100] + let resultInt = ISeq.map funcInt (iseq { 1..10 }) + let expectedint = iseq [1;20;3;40;5;60;7;80;9;100] VerifySeqsEqual expectedint resultInt // string ISeq let funcStr (x:string) = x.ToLower() - let resultStr = ISeq.map funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ] |> ISeq.ofSeq) - let expectedSeq = seq ["lists"; "are"; "commonly" ; "list"] |> ISeq.ofSeq + let resultStr = ISeq.map funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedSeq = iseq ["lists"; "are"; "commonly" ; "list"] VerifySeqsEqual expectedSeq resultStr @@ -397,7 +400,7 @@ type ISeqModule2() = VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.map funcStr nullSeq |> ignore) () @@ -406,15 +409,15 @@ type ISeqModule2() = member this.Map2() = // integer ISeq let funcInt x y = x+y - let resultInt = ISeq.map2 funcInt ({ 1..10 }|> ISeq.ofSeq) ( {2..2..20} |> ISeq.ofSeq) - let expectedint = seq [3;6;9;12;15;18;21;24;27;30]|> ISeq.ofSeq + let resultInt = ISeq.map2 funcInt (iseq { 1..10 }) (iseq {2..2..20}) + let expectedint = iseq [3;6;9;12;15;18;21;24;27;30] VerifySeqsEqual expectedint resultInt // string ISeq let funcStr (x:int) (y:string) = x+y.Length - let resultStr = ISeq.map2 funcStr (seq[3;6;9;11] |> ISeq.ofSeq) (seq ["Lists"; "Are"; "Commonly" ; "List" ] |> ISeq.ofSeq) - let expectedSeq = seq [8;9;17;15] + let resultStr = ISeq.map2 funcStr (iseq[3;6;9;11]) (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedSeq = iseq [8;9;17;15] VerifySeqsEqual expectedSeq resultStr @@ -423,40 +426,40 @@ type ISeqModule2() = VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //let nullSeq:seq<'a> = null - //let validSeq = seq [1] + //let nullSeq:iseq<'a> = null + //let validSeq = iseq [1] //CheckThrowsArgumentNullException (fun () -> ISeq.map2 funcInt nullSeq validSeq |> ignore) () [] member this.Map3() = - // Integer seq + // Integer iseq let funcInt a b c = (a + b) * c - let resultInt = ISeq.map3 funcInt ({ 1..8 }|> ISeq.ofSeq)( { 2..9 }|> ISeq.ofSeq)( { 3..10 }|> ISeq.ofSeq) - let expectedInt = seq [9; 20; 35; 54; 77; 104; 135; 170] + let resultInt = ISeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..9 }) (iseq { 3..10 }) + let expectedInt = iseq [9; 20; 35; 54; 77; 104; 135; 170] VerifySeqsEqual expectedInt resultInt - // First seq is shorter - VerifySeqsEqual (seq [9; 20]) (ISeq.map3 funcInt ({ 1..2 }|> ISeq.ofSeq)( { 2..9 }|> ISeq.ofSeq)( { 3..10 }|> ISeq.ofSeq)) - // Second seq is shorter - VerifySeqsEqual (seq [9; 20; 35]) (ISeq.map3 funcInt ({ 1..8 }|> ISeq.ofSeq)( { 2..4 }|> ISeq.ofSeq)( { 3..10 }|> ISeq.ofSeq)) - // Third seq is shorter - VerifySeqsEqual (seq [9; 20; 35; 54]) (ISeq.map3 funcInt ({ 1..8 }|> ISeq.ofSeq) ( { 2..6 }|> ISeq.ofSeq)( { 3..6 }|> ISeq.ofSeq)) + // First iseq is shorter + VerifySeqsEqual (iseq [9; 20]) (ISeq.map3 funcInt (iseq { 1..2 }) (iseq { 2..9 }) (iseq { 3..10 })) + // Second iseq is shorter + VerifySeqsEqual (iseq [9; 20; 35]) (ISeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..4 }) (iseq { 3..10 })) + // Third iseq is shorter + VerifySeqsEqual (iseq [9; 20; 35; 54]) (ISeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..6 }) (iseq { 3..6 })) - // String seq + // String iseq let funcStr a b c = a + b + c - let resultStr = ISeq.map3 funcStr (["A";"B";"C";"D"]|> ISeq.ofSeq) ( ["a";"b";"c";"d"]|> ISeq.ofSeq)( ["1";"2";"3";"4"]|> ISeq.ofSeq) - let expectedStr = seq ["Aa1";"Bb2";"Cc3";"Dd4"]|> ISeq.ofSeq + let resultStr = ISeq.map3 funcStr (iseq ["A";"B";"C";"D"]) (iseq ["a";"b";"c";"d"]) (iseq ["1";"2";"3";"4"]) + let expectedStr = iseq ["Aa1";"Bb2";"Cc3";"Dd4"] VerifySeqsEqual expectedStr resultStr - // Empty seq + // Empty iseq let resultEmpty = ISeq.map3 funcStr ISeq.empty ISeq.empty ISeq.empty VerifySeqsEqual ISeq.empty resultEmpty - //// Null seq - //let nullSeq = null : seq<_> - //let nonNullSeq = seq [1] + //// Null iseq + //let nullSeq = null : iseq<_> + //let nonNullSeq = iseq [1] //CheckThrowsArgumentNullException (fun () -> ISeq.map3 funcInt nullSeq nonNullSeq nullSeq |> ignore) () @@ -465,24 +468,24 @@ type ISeqModule2() = member this.MapFold() = // integer ISeq let funcInt acc x = if x % 2 = 0 then 10*x, acc + 1 else x, acc - let resultInt,resultIntAcc = Seq.mapFold funcInt 100 <| seq { 1..10 } - VerifySeqsEqual (seq [ 1;20;3;40;5;60;7;80;9;100 ]) resultInt + let resultInt,resultIntAcc = ISeq.mapFold funcInt 100 <| (iseq <| seq { 1..10 }) + VerifySeqsEqual (iseq [ 1;20;3;40;5;60;7;80;9;100 ]) resultInt Assert.AreEqual(105, resultIntAcc) // string ISeq let funcStr acc (x:string) = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x - let resultStr,resultStrAcc = Seq.mapFold funcStr "" <| seq [ "";"BB";"C";"" ] - VerifySeqsEqual (seq [ "empty";"bb";"c";"empty" ]) resultStr + let resultStr,resultStrAcc = ISeq.mapFold funcStr "" <| iseq [ "";"BB";"C";"" ] + VerifySeqsEqual (iseq [ "empty";"bb";"c";"empty" ]) resultStr Assert.AreEqual("BBC", resultStrAcc) // empty ISeq - let resultEpt,resultEptAcc = Seq.mapFold funcInt 100 ISeq.empty + let resultEpt,resultEptAcc = ISeq.mapFold funcInt 100 ISeq.empty VerifySeqsEqual ISeq.empty resultEpt Assert.AreEqual(100, resultEptAcc) //// null ISeq - //let nullArr = null:seq - //CheckThrowsArgumentNullException (fun () -> Seq.mapFold funcStr "" nullArr |> ignore) + //let nullArr = null:iseq + //CheckThrowsArgumentNullException (fun () -> ISeq.mapFold funcStr "" nullArr |> ignore) () @@ -490,31 +493,31 @@ type ISeqModule2() = member this.MapFoldBack() = // integer ISeq let funcInt x acc = if acc < 105 then 10*x, acc + 2 else x, acc - let resultInt,resultIntAcc = Seq.mapFoldBack funcInt (seq { 1..10 }) 100 - VerifySeqsEqual (seq [ 1;2;3;4;5;6;7;80;90;100 ]) resultInt + let resultInt,resultIntAcc = ISeq.mapFoldBack funcInt (iseq <| seq { 1..10 }) 100 + VerifySeqsEqual (iseq [ 1;2;3;4;5;6;7;80;90;100 ]) resultInt Assert.AreEqual(106, resultIntAcc) // string ISeq let funcStr (x:string) acc = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x - let resultStr,resultStrAcc = Seq.mapFoldBack funcStr (seq [ "";"BB";"C";"" ]) "" - VerifySeqsEqual (seq [ "empty";"bb";"c";"empty" ]) resultStr + let resultStr,resultStrAcc = ISeq.mapFoldBack funcStr (iseq [ "";"BB";"C";"" ]) "" + VerifySeqsEqual (iseq [ "empty";"bb";"c";"empty" ]) resultStr Assert.AreEqual("CBB", resultStrAcc) // empty ISeq - let resultEpt,resultEptAcc = Seq.mapFoldBack funcInt ISeq.empty 100 + let resultEpt,resultEptAcc = ISeq.mapFoldBack funcInt ISeq.empty 100 VerifySeqsEqual ISeq.empty resultEpt Assert.AreEqual(100, resultEptAcc) //// null ISeq - //let nullArr = null:seq - //CheckThrowsArgumentNullException (fun () -> Seq.mapFoldBack funcStr nullArr "" |> ignore) + //let nullArr = null:iseq + //CheckThrowsArgumentNullException (fun () -> ISeq.mapFoldBack funcStr nullArr "" |> ignore) () - member private this.MapWithSideEffectsTester (map : (int -> int) -> ISeq.Core.ISeq -> ISeq.Core.ISeq) expectExceptions = + member private this.MapWithSideEffectsTester (map : (int -> int) -> iseq -> iseq) expectExceptions = let i = ref 0 let f x = i := !i + 1; x*x - let e = (([1;2]|>ISeq.ofSeq) |> map f).GetEnumerator() + let e = ((iseq [1;2]) |> map f).GetEnumerator() if expectExceptions then CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) @@ -541,16 +544,16 @@ type ISeqModule2() = i := 0 - let e = (([]|> ISeq.ofSeq) |> map f).GetEnumerator() + let e = ((iseq []) |> map f).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,!i) if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,!i) - member private this.MapWithExceptionTester (map : (int -> int) -> ISeq.Core.ISeq -> ISeq.Core.ISeq) = + member private this.MapWithExceptionTester (map : (int -> int) -> iseq -> iseq) = let raiser x = if x > 0 then raise(NotSupportedException()) else x - let e = (map raiser ([0; 1]|> ISeq.ofSeq)).GetEnumerator() + let e = (map raiser (iseq [0; 1])).GetEnumerator() Assert.IsTrue(e.MoveNext()) // should not throw Assert.AreEqual(0, e.Current) CheckThrowsNotSupportedException(fun _ -> e.MoveNext() |> ignore) @@ -565,29 +568,29 @@ type ISeqModule2() = this.MapWithExceptionTester ISeq.map - //[] - //member this.SingletonCollectWithSideEffects () = - // this.MapWithSideEffectsTester (fun f-> Seq.collect (f >> Seq.singleton)) true + [] + member this.SingletonCollectWithSideEffects () = + this.MapWithSideEffectsTester (fun f-> ISeq.collect (f >> ISeq.singleton)) true - //[] - //member this.SingletonCollectWithException () = - // this.MapWithExceptionTester (fun f-> Seq.collect (f >> Seq.singleton)) + [] + member this.SingletonCollectWithException () = + this.MapWithExceptionTester (fun f-> ISeq.collect (f >> ISeq.singleton)) -//#if !FX_NO_LINQ -// [] -// member this.SystemLinqSelectWithSideEffects () = -// this.MapWithSideEffectsTester (fun f s -> System.Linq.Enumerable.Select(s, Func<_,_>(f))) false +#if !FX_NO_LINQ + [] + member this.SystemLinqSelectWithSideEffects () = + this.MapWithSideEffectsTester (fun f s -> iseq <| System.Linq.Enumerable.Select(s, Func<_,_>(f))) false -// [] -// member this.SystemLinqSelectWithException () = -// this.MapWithExceptionTester (fun f s -> System.Linq.Enumerable.Select(s, Func<_,_>(f))) -//#endif + [] + member this.SystemLinqSelectWithException () = + this.MapWithExceptionTester (fun f s -> iseq <| System.Linq.Enumerable.Select(s, Func<_,_>(f))) +#endif [] member this.MapiWithSideEffects () = let i = ref 0 let f _ x = i := !i + 1; x*x - let e = (([1;2]|> ISeq.ofSeq) |> ISeq.mapi f).GetEnumerator() + let e = ((iseq [1;2]) |> ISeq.mapi f).GetEnumerator() CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(0, !i) @@ -611,7 +614,7 @@ type ISeqModule2() = Assert.AreEqual(2, !i) i := 0 - let e = (([]|> ISeq.ofSeq) |> ISeq.mapi f).GetEnumerator() + let e = ((iseq []) |> ISeq.mapi f).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,!i) if e.MoveNext() then Assert.Fail() @@ -621,7 +624,7 @@ type ISeqModule2() = member this.Map2WithSideEffects () = let i = ref 0 let f x y = i := !i + 1; x*x - let e = (ISeq.map2 f ([1;2]|> ISeq.ofSeq) ([1;2]|> ISeq.ofSeq)).GetEnumerator() + let e = (ISeq.map2 f (iseq [1;2]) (iseq [1;2])).GetEnumerator() CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(0, !i) @@ -645,7 +648,7 @@ type ISeqModule2() = Assert.AreEqual(2, !i) i := 0 - let e = (ISeq.map2 f ([]|> ISeq.ofSeq) ([]|> ISeq.ofSeq)).GetEnumerator() + let e = (ISeq.map2 f (iseq []) (iseq [])).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,!i) if e.MoveNext() then Assert.Fail() @@ -655,7 +658,7 @@ type ISeqModule2() = member this.Mapi2WithSideEffects () = let i = ref 0 let f _ x y = i := !i + 1; x*x - let e = (ISeq.mapi2 f ([1;2]|> ISeq.ofSeq) ([1;2]|> ISeq.ofSeq)).GetEnumerator() + let e = (ISeq.mapi2 f (iseq [1;2]) (iseq [1;2])).GetEnumerator() CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) Assert.AreEqual(0, !i) @@ -679,7 +682,7 @@ type ISeqModule2() = Assert.AreEqual(2, !i) i := 0 - let e = (ISeq.mapi2 f ([]|> ISeq.ofSeq) ([]|> ISeq.ofSeq)).GetEnumerator() + let e = (ISeq.mapi2 f (iseq []) (iseq [])).GetEnumerator() if e.MoveNext() then Assert.Fail() Assert.AreEqual(0,!i) if e.MoveNext() then Assert.Fail() @@ -688,32 +691,32 @@ type ISeqModule2() = [] member this.Collect() = // integer ISeq - let funcInt x = seq [x+1] - let resultInt = Seq.collect funcInt { 1..10 } + let funcInt x = iseq [x+1] + let resultInt = ISeq.collect funcInt (iseq { 1..10 }) - let expectedint = seq {2..11} + let expectedint = iseq <| seq {2..11} VerifySeqsEqual expectedint resultInt -#if !FX_NO_CHAR_PARSE - // string ISeq - let funcStr (y:string) = y+"ist" +//#if !FX_NO_CHAR_PARSE +// // string ISeq +// let funcStr (y:string) = y+"ist" - let resultStr = Seq.collect funcStr (seq ["L"]) +// let resultStr = ISeq.collect funcStr (iseq ["L"]) - let expectedSeq = seq ['L';'i';'s';'t'] +// let expectedSeq = iseq ['L';'i';'s';'t'] - VerifySeqsEqual expectedSeq resultStr -#endif +// VerifySeqsEqual expectedSeq resultStr +//#endif // empty ISeq - let resultEpt = Seq.collect funcInt ISeq.empty + let resultEpt = ISeq.collect funcInt ISeq.empty VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> Seq.collect funcInt nullSeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> ISeq.collect funcInt nullSeq |> ignore) () @@ -722,16 +725,16 @@ type ISeqModule2() = // integer ISeq let funcInt x y = x+y - let resultInt = ISeq.mapi funcInt ({ 10..2..20 } |> ISeq.ofSeq) - let expectedint = seq [10;13;16;19;22;25] + let resultInt = ISeq.mapi funcInt (iseq { 10..2..20 } ) + let expectedint = iseq [10;13;16;19;22;25] VerifySeqsEqual expectedint resultInt // string ISeq let funcStr (x:int) (y:string) =x+y.Length - let resultStr = ISeq.mapi funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ] |> ISeq.ofSeq) - let expectedStr = seq [5;4;10;7] + let resultStr = ISeq.mapi funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedStr = iseq [5;4;10;7] VerifySeqsEqual expectedStr resultStr @@ -740,7 +743,7 @@ type ISeqModule2() = VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.mapi funcInt nullSeq |> ignore) @@ -750,15 +753,15 @@ type ISeqModule2() = member this.Mapi2() = // integer ISeq let funcInt x y z = x+y+z - let resultInt = ISeq.mapi2 funcInt ({ 1..10 }|> ISeq.ofSeq)( {2..2..20}|> ISeq.ofSeq) - let expectedint = seq [3;7;11;15;19;23;27;31;35;39] + let resultInt = ISeq.mapi2 funcInt (iseq { 1..10 }) (iseq {2..2..20}) + let expectedint = iseq [3;7;11;15;19;23;27;31;35;39] VerifySeqsEqual expectedint resultInt // string ISeq let funcStr (x:int) (y:int) (z:string) = x+y+z.Length - let resultStr = ISeq.mapi2 funcStr (seq[3;6;9;11]|> ISeq.ofSeq) (seq ["Lists"; "Are"; "Commonly" ; "List" ]|> ISeq.ofSeq) - let expectedSeq = seq [8;10;19;18] + let resultStr = ISeq.mapi2 funcStr (iseq[3;6;9;11]) (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedSeq = iseq [8;10;19;18] VerifySeqsEqual expectedSeq resultStr @@ -767,33 +770,33 @@ type ISeqModule2() = VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //let nullSeq:seq<'a> = null - //let validSeq = seq [1] + //let nullSeq:iseq<'a> = null + //let validSeq = iseq [1] //CheckThrowsArgumentNullException (fun () -> ISeq.mapi2 funcInt nullSeq validSeq |> ignore) // len1 <> len2 - let shorterSeq = seq { 1..10 }|> ISeq.ofSeq - let longerSeq = seq { 2..20 }|> ISeq.ofSeq + let shorterSeq = iseq <| seq { 1..10 } + let longerSeq = iseq <| seq { 2..20 } let testSeqLengths seq1 seq2 = let f x y z = x + y + z ISeq.mapi2 f seq1 seq2 - VerifySeqsEqual (seq [3;6;9;12;15;18;21;24;27;30]|> ISeq.ofSeq) (testSeqLengths shorterSeq longerSeq) - VerifySeqsEqual (seq [3;6;9;12;15;18;21;24;27;30]|> ISeq.ofSeq) (testSeqLengths longerSeq shorterSeq) + VerifySeqsEqual (iseq [3;6;9;12;15;18;21;24;27;30]) (testSeqLengths shorterSeq longerSeq) + VerifySeqsEqual (iseq [3;6;9;12;15;18;21;24;27;30]) (testSeqLengths longerSeq shorterSeq) [] member this.Indexed() = // integer ISeq - let resultInt = ISeq.indexed ({ 10..2..20 }|> ISeq.ofSeq) - let expectedint = seq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)]|> ISeq.ofSeq + let resultInt = ISeq.indexed (iseq { 10..2..20 }) + let expectedint = iseq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)] VerifySeqsEqual expectedint resultInt // string ISeq - let resultStr = ISeq.indexed (seq ["Lists"; "Are"; "Commonly"; "List" ]|> ISeq.ofSeq) - let expectedStr = seq [(0,"Lists");(1,"Are");(2,"Commonly");(3,"List")]|> ISeq.ofSeq + let resultStr = ISeq.indexed (iseq ["Lists"; "Are"; "Commonly"; "List" ]) + let expectedStr = iseq [(0,"Lists");(1,"Are");(2,"Commonly");(3,"List")] VerifySeqsEqual expectedStr resultStr @@ -802,7 +805,7 @@ type ISeqModule2() = VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.indexed nullSeq |> ignore) () @@ -810,20 +813,20 @@ type ISeqModule2() = [] member this.Max() = // integer ISeq - let resultInt = ISeq.max ({ 10..20 } |> ISeq.ofSeq) + let resultInt = ISeq.max (iseq { 10..20 } ) Assert.AreEqual(20,resultInt) // string ISeq - let resultStr = ISeq.max (seq ["Lists"; "Are"; "MaxString" ; "List" ]|> ISeq.ofSeq) + let resultStr = ISeq.max (iseq ["Lists"; "Are"; "MaxString" ; "List" ]) Assert.AreEqual("MaxString",resultStr) // empty ISeq - CheckThrowsArgumentException(fun () -> ISeq.max ( ISeq.empty ) |> ignore) + CheckThrowsArgumentException(fun () -> ISeq.max ( ISeq.empty : iseq) |> ignore) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.max nullSeq |> ignore) () @@ -833,19 +836,19 @@ type ISeqModule2() = // integer ISeq let funcInt x = x % 8 - let resultInt = ISeq.maxBy funcInt ({ 2..2..20 } |> ISeq.ofSeq) + let resultInt = ISeq.maxBy funcInt (iseq { 2..2..20 } ) Assert.AreEqual(6,resultInt) // string ISeq let funcStr (x:string) =x.Length - let resultStr = ISeq.maxBy funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]|> ISeq.ofSeq) + let resultStr = ISeq.maxBy funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) Assert.AreEqual("Commonly",resultStr) // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.maxBy funcInt (ISeq.empty ) |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.maxBy funcInt (ISeq.empty : iseq) |> ignore) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.maxBy funcInt nullSeq |> ignore) () @@ -855,19 +858,19 @@ type ISeqModule2() = // integer ISeq let funcInt x = x % 8 - let resultInt = ISeq.minBy funcInt ({ 2..2..20 } |> ISeq.ofSeq) + let resultInt = ISeq.minBy funcInt (iseq { 2..2..20 } ) Assert.AreEqual(8,resultInt) // string ISeq let funcStr (x:string) =x.Length - let resultStr = ISeq.minBy funcStr (seq ["Lists"; "Are"; "Commonly" ; "List" ]|> ISeq.ofSeq) + let resultStr = ISeq.minBy funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) Assert.AreEqual("Are",resultStr) // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.minBy funcInt (ISeq.empty ) |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.minBy funcInt (ISeq.empty : iseq) |> ignore) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () ->ISeq.minBy funcInt nullSeq |> ignore) () @@ -877,18 +880,18 @@ type ISeqModule2() = member this.Min() = // integer ISeq - let resultInt = ISeq.min ({ 10..20 } |> ISeq.ofSeq) + let resultInt = ISeq.min (iseq { 10..20 } ) Assert.AreEqual(10,resultInt) // string ISeq - let resultStr = ISeq.min (seq ["Lists"; "Are"; "minString" ; "List" ]|> ISeq.ofSeq) + let resultStr = ISeq.min (iseq ["Lists"; "Are"; "minString" ; "List" ]) Assert.AreEqual("Are",resultStr) // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.min (ISeq.empty ) |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.min (ISeq.empty : iseq) |> ignore) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.min nullSeq |> ignore) () @@ -896,41 +899,41 @@ type ISeqModule2() = [] member this.Item() = // integer ISeq - let resultInt = Seq.item 3 ({ 10..20 }|> ISeq.ofSeq) + let resultInt = ISeq.item 3 (iseq { 10..20 }) Assert.AreEqual(13, resultInt) // string ISeq - let resultStr = Seq.item 2 (seq ["Lists"; "Are"; "Cool" ; "List" ]|> ISeq.ofSeq) + let resultStr = ISeq.item 2 (iseq ["Lists"; "Are"; "Cool" ; "List" ]) Assert.AreEqual("Cool", resultStr) // empty ISeq - CheckThrowsArgumentException(fun () -> Seq.item 0 (ISeq.empty ) |> ignore) + CheckThrowsArgumentException(fun () -> ISeq.item 0 (ISeq.empty : iseq) |> ignore) //// null ISeq - //let nullSeq:seq<'a> = null - //CheckThrowsArgumentNullException (fun () ->Seq.item 3 nullSeq |> ignore) + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->ISeq.item 3 nullSeq |> ignore) // Negative index for i = -1 downto -10 do - CheckThrowsArgumentException (fun () -> Seq.item i { 10 .. 20 } |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.item i (iseq { 10 .. 20 }) |> ignore) // Out of range for i = 11 to 20 do - CheckThrowsArgumentException (fun () -> Seq.item i { 10 .. 20 } |> ignore) + CheckThrowsArgumentException (fun () -> ISeq.item i (iseq { 10 .. 20 }) |> ignore) [] member this.``item should fail with correct number of missing elements``() = try - Seq.item 0 (Array.zeroCreate 0) |> ignore + ISeq.item 0 (iseq (Array.zeroCreate 0)) |> ignore failwith "error expected" with - | exn when exn.Message.Contains("seq was short by 1 element") -> () + | exn when exn.Message.Contains("iseq was short by 1 element") -> () try - Seq.item 2 (Array.zeroCreate 0) |> ignore + ISeq.item 2 (iseq (Array.zeroCreate 0)) |> ignore failwith "error expected" with - | exn when exn.Message.Contains("seq was short by 3 elements") -> () + | exn when exn.Message.Contains("iseq was short by 3 elements") -> () [] member this.Of_Array() = @@ -942,7 +945,7 @@ type ISeqModule2() = // string ISeq let resultStr = ISeq.ofArray [|"Lists"; "Are"; "ofArrayString" ; "List" |] - let expectedStr = seq ["Lists"; "Are"; "ofArrayString" ; "List" ] + let expectedStr = iseq ["Lists"; "Are"; "ofArrayString" ; "List" ] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -962,7 +965,7 @@ type ISeqModule2() = // string ISeq let resultStr =ISeq.ofList ["Lists"; "Are"; "ofListString" ; "List" ] - let expectedStr = seq ["Lists"; "Are"; "ofListString" ; "List" ] + let expectedStr = iseq ["Lists"; "Are"; "ofListString" ; "List" ] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -974,19 +977,19 @@ type ISeqModule2() = [] member this.Pairwise() = // integer ISeq - let resultInt = ISeq.pairwise ({1..3}|>ISeq.ofSeq) + let resultInt = ISeq.pairwise (iseq {1..3}) - let expectedInt = seq [1,2;2,3] + let expectedInt = iseq [1,2;2,3] VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =ISeq.pairwise (["str1"; "str2";"str3" ]|>ISeq.ofSeq) - let expectedStr = seq ["str1","str2";"str2","str3"]|>ISeq.ofSeq + let resultStr =ISeq.pairwise (iseq ["str1"; "str2";"str3" ]) + let expectedStr = iseq ["str1","str2";"str2","str3"] VerifySeqsEqual expectedStr resultStr // empty ISeq - let resultEpt = ISeq.pairwise ([] |>ISeq.ofSeq) + let resultEpt = ISeq.pairwise (iseq [] ) VerifySeqsEqual resultEpt ISeq.empty () @@ -995,18 +998,18 @@ type ISeqModule2() = member this.Reduce() = // integer ISeq - let resultInt = ISeq.reduce (fun x y -> x/y) (seq [5*4*3*2; 4;3;2;1] |> ISeq.ofSeq) + let resultInt = ISeq.reduce (fun x y -> x/y) (iseq [5*4*3*2; 4;3;2;1]) Assert.AreEqual(5,resultInt) // string ISeq - let resultStr = ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) (seq ["ABCDE";"A"; "B"; "C" ; "D" ] |> ISeq.ofSeq) + let resultStr = ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) (iseq ["ABCDE";"A"; "B"; "C" ; "D" ]) Assert.AreEqual("E",resultStr) // empty ISeq CheckThrowsArgumentException (fun () -> ISeq.reduce (fun x y -> x/y) ISeq.empty |> ignore) //// null ISeq - //let nullSeq : seq<'a> = null + //let nullSeq : iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullSeq |> ignore) () @@ -1014,19 +1017,19 @@ type ISeqModule2() = member this.ReduceBack() = // int ISeq let funcInt x y = x - y - let IntSeq = seq { 1..4 } |> ISeq.ofSeq + let IntSeq = iseq <| seq { 1..4 } let reduceInt = ISeq.reduceBack funcInt IntSeq Assert.AreEqual((1-(2-(3-4))), reduceInt) // string ISeq let funcStr (x:string) (y:string) = y.Remove(0,x.Length) - let strSeq = seq [ "A"; "B"; "C"; "D" ; "ABCDE" ] |> ISeq.ofSeq + let strSeq = iseq [ "A"; "B"; "C"; "D" ; "ABCDE" ] let reduceStr = ISeq.reduceBack funcStr strSeq Assert.AreEqual("E", reduceStr) // string ISeq let funcStr2 elem acc = sprintf "%s%s" elem acc - let strSeq2 = seq [ "A" ] |> ISeq.ofSeq + let strSeq2 = iseq [ "A" ] let reduceStr2 = ISeq.reduceBack funcStr2 strSeq2 Assert.AreEqual("A", reduceStr2) @@ -1034,7 +1037,7 @@ type ISeqModule2() = CheckThrowsArgumentException (fun () -> ISeq.reduceBack funcInt ISeq.empty |> ignore) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.reduceBack funcInt nullSeq |> ignore) () @@ -1042,18 +1045,18 @@ type ISeqModule2() = [] member this.Rev() = // integer ISeq - let resultInt = ISeq.rev (seq [5;4;3;2;1] |> ISeq.ofSeq) - VerifySeqsEqual (seq[1;2;3;4;5]) resultInt + let resultInt = ISeq.rev (iseq [5;4;3;2;1]) + VerifySeqsEqual (iseq[1;2;3;4;5]) resultInt // string ISeq - let resultStr = ISeq.rev (seq ["A"; "B"; "C" ; "D" ] |> ISeq.ofSeq) - VerifySeqsEqual (seq["D";"C";"B";"A"]) resultStr + let resultStr = ISeq.rev (iseq ["A"; "B"; "C" ; "D" ]) + VerifySeqsEqual (iseq["D";"C";"B";"A"]) resultStr // empty ISeq VerifySeqsEqual ISeq.empty (ISeq.rev ISeq.empty) //// null ISeq - //let nullSeq : seq<'a> = null + //let nullSeq : iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.rev nullSeq |> ignore) () @@ -1061,24 +1064,24 @@ type ISeqModule2() = member this.Scan() = // integer ISeq let funcInt x y = x+y - let resultInt = ISeq.scan funcInt 9 ({1..10}|> ISeq.ofSeq) - let expectedInt = seq [9;10;12;15;19;24;30;37;45;54;64] |> ISeq.ofSeq + let resultInt = ISeq.scan funcInt 9 (iseq {1..10}) + let expectedInt = iseq [9;10;12;15;19;24;30;37;45;54;64] VerifySeqsEqual expectedInt resultInt // string ISeq let funcStr x y = x+y - let resultStr =ISeq.scan funcStr "x" (["str1"; "str2";"str3" ]|> ISeq.ofSeq) + let resultStr =ISeq.scan funcStr "x" (iseq ["str1"; "str2";"str3" ]) - let expectedStr = seq ["x";"xstr1"; "xstr1str2";"xstr1str2str3"]|> ISeq.ofSeq + let expectedStr = iseq ["x";"xstr1"; "xstr1str2";"xstr1str2str3"] VerifySeqsEqual expectedStr resultStr // empty ISeq let resultEpt = ISeq.scan funcInt 5 ISeq.empty - VerifySeqsEqual resultEpt (seq [ 5]) + VerifySeqsEqual resultEpt (iseq [ 5]) //// null ISeq - //let seqNull:seq<'a> = null + //let seqNull:iseq<'a> = null //CheckThrowsArgumentNullException(fun() -> ISeq.scan funcInt 5 seqNull |> ignore) () @@ -1086,36 +1089,36 @@ type ISeqModule2() = member this.ScanBack() = // integer ISeq let funcInt x y = x+y - let resultInt = ISeq.scanBack funcInt ({ 1..10 }|> ISeq.ofSeq) 9 - let expectedInt = seq [64;63;61;58;54;49;43;36;28;19;9] + let resultInt = ISeq.scanBack funcInt (iseq { 1..10 }) 9 + let expectedInt = iseq [64;63;61;58;54;49;43;36;28;19;9] VerifySeqsEqual expectedInt resultInt // string ISeq let funcStr x y = x+y - let resultStr = ISeq.scanBack funcStr (seq ["A";"B";"C";"D"]|> ISeq.ofSeq) "X" - let expectedStr = seq ["ABCDX";"BCDX";"CDX";"DX";"X"]|> ISeq.ofSeq + let resultStr = ISeq.scanBack funcStr (iseq ["A";"B";"C";"D"]) "X" + let expectedStr = iseq ["ABCDX";"BCDX";"CDX";"DX";"X"] VerifySeqsEqual expectedStr resultStr // empty ISeq let resultEpt = ISeq.scanBack funcInt ISeq.empty 5 - let expectedEpt = seq [5] + let expectedEpt = iseq [5] VerifySeqsEqual expectedEpt resultEpt //// null ISeq - //let seqNull:seq<'a> = null + //let seqNull:iseq<'a> = null //CheckThrowsArgumentNullException(fun() -> ISeq.scanBack funcInt seqNull 5 |> ignore) // exception cases let funcEx x (s:'State) = raise <| new System.FormatException() : 'State // calling scanBack with funcEx does not throw - let resultEx = ISeq.scanBack funcEx (seq {1..10} |> ISeq.ofSeq) 0 + let resultEx = ISeq.scanBack funcEx (iseq <| seq {1..10}) 0 // reading from resultEx throws CheckThrowsFormatException(fun() -> ISeq.head resultEx |> ignore) // Result consumes entire input sequence as soon as it is accesses an element let i = ref 0 let funcState x s = (i := !i + x); x+s - let resultState = ISeq.scanBack funcState (seq {1..3} |> ISeq.ofSeq) 0 + let resultState = ISeq.scanBack funcState (iseq <| seq {1..3}) 0 Assert.AreEqual(0, !i) use e = resultState.GetEnumerator() Assert.AreEqual(6, !i) @@ -1125,20 +1128,20 @@ type ISeqModule2() = [] member this.Singleton() = // integer ISeq - let resultInt = Seq.singleton 1 + let resultInt = ISeq.singleton 1 - let expectedInt = seq [1] |> ISeq.ofSeq + let expectedInt = iseq [1] VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =Seq.singleton "str1" - let expectedStr = seq ["str1"] |> ISeq.ofSeq + let resultStr =ISeq.singleton "str1" + let expectedStr = iseq ["str1"] VerifySeqsEqual expectedStr resultStr - //// null ISeq - //let resultNull = Seq.singleton null - //let expectedNull = seq [null] - //VerifySeqsEqual expectedNull resultNull + // null ISeq + let resultNull = ISeq.singleton null + let expectedNull = iseq [null] + VerifySeqsEqual expectedNull resultNull () @@ -1146,13 +1149,13 @@ type ISeqModule2() = member this.Skip() = // integer ISeq - let resultInt = ISeq.skip 2 (seq [1;2;3;4] |> ISeq.ofSeq) - let expectedInt = seq [3;4] |> ISeq.ofSeq + let resultInt = ISeq.skip 2 (iseq [1;2;3;4]) + let expectedInt = iseq [3;4] VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =ISeq.skip 2 (seq ["str1";"str2";"str3";"str4"] |> ISeq.ofSeq) - let expectedStr = seq ["str3";"str4"] |> ISeq.ofSeq + let resultStr =ISeq.skip 2 (iseq ["str1";"str2";"str3";"str4"]) + let expectedStr = iseq ["str3";"str4"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1169,14 +1172,14 @@ type ISeqModule2() = // integer ISeq let funcInt x = (x < 3) - let resultInt = ISeq.skipWhile funcInt (seq [1;2;3;4;5;6] |> ISeq.ofSeq) - let expectedInt = seq [3;4;5;6] |> ISeq.ofSeq + let resultInt = ISeq.skipWhile funcInt (iseq [1;2;3;4;5;6]) + let expectedInt = iseq [3;4;5;6] VerifySeqsEqual expectedInt resultInt // string ISeq let funcStr (x:string) = x.Contains(".") - let resultStr =ISeq.skipWhile funcStr (seq [".";"asdfasdf.asdfasdf";"";"";"";"";"";"";"";"";""] |> ISeq.ofSeq) - let expectedStr = seq ["";"";"";"";"";"";"";"";""] |> ISeq.ofSeq + let resultStr =ISeq.skipWhile funcStr (iseq [".";"asdfasdf.asdfasdf";"";"";"";"";"";"";"";"";""]) + let expectedStr = iseq ["";"";"";"";"";"";"";"";""] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1191,14 +1194,14 @@ type ISeqModule2() = member this.Sort() = // integer ISeq - let resultInt = ISeq.sort (seq [1;3;2;4;6;5;7] |> ISeq.ofSeq) - let expectedInt = {1..7} |> ISeq.ofSeq + let resultInt = ISeq.sort (iseq [1;3;2;4;6;5;7]) + let expectedInt = {1..7} VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =ISeq.sort (seq ["str1";"str3";"str2";"str4"] |> ISeq.ofSeq) - let expectedStr = seq ["str1";"str2";"str3";"str4"] |> ISeq.ofSeq + let resultStr =ISeq.sort (iseq ["str1";"str3";"str2";"str4"]) + let expectedStr = iseq ["str1";"str2";"str3";"str4"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1214,15 +1217,15 @@ type ISeqModule2() = // integer ISeq let funcInt x = Math.Abs(x-5) - let resultInt = ISeq.sortBy funcInt (seq [1;2;4;5;7] |> ISeq.ofSeq) - let expectedInt = seq [5;4;7;2;1] |> ISeq.ofSeq + let resultInt = ISeq.sortBy funcInt (iseq [1;2;4;5;7]) + let expectedInt = iseq [5;4;7;2;1] VerifySeqsEqual expectedInt resultInt // string ISeq let funcStr (x:string) = x.IndexOf("key") - let resultStr =ISeq.sortBy funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"] |> ISeq.ofSeq) + let resultStr =ISeq.sortBy funcStr (iseq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) - let expectedStr = seq ["(key)str";"s(key)tr";"st(key)r";"str(key)"] |> ISeq.ofSeq + let expectedStr = iseq ["(key)str";"s(key)tr";"st(key)r";"str(key)"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1237,35 +1240,35 @@ type ISeqModule2() = member this.SortDescending() = // integer ISeq - let resultInt = Seq.sortDescending (seq [1;3;2;Int32.MaxValue;4;6;Int32.MinValue;5;7;0]) - let expectedInt = seq{ + let resultInt = ISeq.sortDescending (iseq [1;3;2;Int32.MaxValue;4;6;Int32.MinValue;5;7;0]) + let expectedInt = iseq <| seq { yield Int32.MaxValue; - yield! seq{ 7..-1..0 } + yield! iseq{ 7..-1..0 } yield Int32.MinValue } VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr = Seq.sortDescending (seq ["str1";null;"str3";"";"Str1";"str2";"str4"]) - let expectedStr = seq ["str4";"str3";"str2";"str1";"Str1";"";null] + let resultStr = ISeq.sortDescending (iseq ["str1";null;"str3";"";"Str1";"str2";"str4"]) + let expectedStr = iseq ["str4";"str3";"str2";"str1";"Str1";"";null] VerifySeqsEqual expectedStr resultStr // empty ISeq - let resultEpt = Seq.sortDescending ISeq.empty + let resultEpt = ISeq.sortDescending ISeq.empty VerifySeqsEqual resultEpt ISeq.empty // tuple ISeq - let tupSeq = (seq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) - let resultTup = Seq.sortDescending tupSeq - let expectedTup = (seq[(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) + let tupSeq = (iseq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) + let resultTup = ISeq.sortDescending tupSeq + let expectedTup = (iseq[(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) VerifySeqsEqual expectedTup resultTup // float ISeq let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon - let floatSeq = seq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] - let resultFloat = Seq.sortDescending floatSeq - let expectedFloat = seq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] + let floatSeq = iseq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] + let resultFloat = ISeq.sortDescending floatSeq + let expectedFloat = iseq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] VerifySeqsEqual expectedFloat resultFloat //// null ISeq @@ -1277,49 +1280,49 @@ type ISeqModule2() = // integer ISeq let funcInt x = Math.Abs(x-5) - let resultInt = Seq.sortByDescending funcInt (seq [1;2;4;5;7]) - let expectedInt = seq [1;2;7;4;5] + let resultInt = ISeq.sortByDescending funcInt (iseq [1;2;4;5;7]) + let expectedInt = iseq [1;2;7;4;5] VerifySeqsEqual expectedInt resultInt // string ISeq let funcStr (x:string) = x.IndexOf("key") - let resultStr =Seq.sortByDescending funcStr (seq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) + let resultStr =ISeq.sortByDescending funcStr (iseq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) - let expectedStr = seq ["str(key)";"st(key)r";"s(key)tr";"(key)str"] + let expectedStr = iseq ["str(key)";"st(key)r";"s(key)tr";"(key)str"] VerifySeqsEqual expectedStr resultStr // empty ISeq - let resultEpt = Seq.sortByDescending funcInt ISeq.empty + let resultEpt = ISeq.sortByDescending funcInt ISeq.empty VerifySeqsEqual resultEpt ISeq.empty // tuple ISeq - let tupSeq = (seq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) - let resultTup = Seq.sortByDescending snd tupSeq - let expectedTup = (seq[(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")]) + let tupSeq = (iseq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) + let resultTup = ISeq.sortByDescending snd tupSeq + let expectedTup = (iseq[(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")]) VerifySeqsEqual expectedTup resultTup // float ISeq let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon - let floatSeq = seq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] - let resultFloat = Seq.sortByDescending id floatSeq - let expectedFloat = seq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] + let floatSeq = iseq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] + let resultFloat = ISeq.sortByDescending id floatSeq + let expectedFloat = iseq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] VerifySeqsEqual expectedFloat resultFloat //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.sortByDescending funcInt null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.sortByDescending funcInt null |> ignore) () member this.SortWith() = // integer ISeq let intComparer a b = compare (a%3) (b%3) - let resultInt = ISeq.sortWith intComparer (seq {0..10} |> ISeq.ofSeq) - let expectedInt = seq [0;3;6;9;1;4;7;10;2;5;8]|> ISeq.ofSeq + let resultInt = ISeq.sortWith intComparer (iseq <| seq {0..10}) + let expectedInt = iseq [0;3;6;9;1;4;7;10;2;5;8] VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr = ISeq.sortWith compare (seq ["str1";"str3";"str2";"str4"]|> ISeq.ofSeq) - let expectedStr = seq ["str1";"str2";"str3";"str4"]|> ISeq.ofSeq + let resultStr = ISeq.sortWith compare (iseq ["str1";"str3";"str2";"str4"]) + let expectedStr = iseq ["str1";"str2";"str3";"str4"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1335,21 +1338,21 @@ type ISeqModule2() = member this.Sum() = // integer ISeq - let resultInt = ISeq.sum (seq [1..10]|> ISeq.ofSeq) + let resultInt = ISeq.sum (iseq [1..10]) Assert.AreEqual(55,resultInt) // float32 ISeq - let floatSeq = (seq [ 1.2f;3.5f;6.7f ])|> ISeq.ofSeq + let floatSeq = (iseq [ 1.2f;3.5f;6.7f ]) let resultFloat = ISeq.sum floatSeq if resultFloat <> 11.4f then Assert.Fail() // double ISeq - let doubleSeq = (seq [ 1.0;8.0 ])|> ISeq.ofSeq + let doubleSeq = (iseq [ 1.0;8.0 ]) let resultDouble = ISeq.sum doubleSeq if resultDouble <> 9.0 then Assert.Fail() // decimal ISeq - let decimalSeq = (seq [ 0M;19M;19.03M ])|> ISeq.ofSeq + let decimalSeq = (iseq [ 0M;19M;19.03M ]) let resultDecimal = ISeq.sum decimalSeq if resultDecimal <> 38.03M then Assert.Fail() @@ -1375,21 +1378,21 @@ type ISeqModule2() = member this.SumBy() = // integer ISeq - let resultInt = ISeq.sumBy int (seq [1..10]|> ISeq.ofSeq) + let resultInt = ISeq.sumBy int (iseq [1..10]) Assert.AreEqual(55,resultInt) // float32 ISeq - let floatSeq = (seq [ 1.2f;3.5f;6.7f ])|> ISeq.ofSeq + let floatSeq = (iseq [ 1.2f;3.5f;6.7f ]) let resultFloat = ISeq.sumBy float32 floatSeq if resultFloat <> 11.4f then Assert.Fail() // double ISeq - let doubleSeq = (seq [ 1.0;8.0 ])|> ISeq.ofSeq + let doubleSeq = (iseq [ 1.0;8.0 ]) let resultDouble = ISeq.sumBy double doubleSeq if resultDouble <> 9.0 then Assert.Fail() // decimal ISeq - let decimalSeq = (seq [ 0M;19M;19.03M ]) |> ISeq.ofSeq + let decimalSeq = (iseq [ 0M;19M;19.03M ]) let resultDecimal = ISeq.sumBy decimal decimalSeq if resultDecimal <> 38.03M then Assert.Fail() @@ -1414,16 +1417,16 @@ type ISeqModule2() = member this.Take() = // integer ISeq - let resultInt = ISeq.take 3 (seq [1;2;4;5;7]|> ISeq.ofSeq) + let resultInt = ISeq.take 3 (iseq [1;2;4;5;7]) - let expectedInt = seq [1;2;4] + let expectedInt = iseq [1;2;4] VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =ISeq.take 2(seq ["str1";"str2";"str3";"str4"]|> ISeq.ofSeq) + let resultStr =ISeq.take 2(iseq ["str1";"str2";"str3";"str4"]) - let expectedStr = seq ["str1";"str2"] + let expectedStr = iseq ["str1";"str2"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1440,16 +1443,16 @@ type ISeqModule2() = member this.takeWhile() = // integer ISeq let funcInt x = (x < 6) - let resultInt = ISeq.takeWhile funcInt (seq [1;2;4;5;6;7]|> ISeq.ofSeq) + let resultInt = ISeq.takeWhile funcInt (iseq [1;2;4;5;6;7]) - let expectedInt = seq [1;2;4;5] + let expectedInt = iseq [1;2;4;5] VerifySeqsEqual expectedInt resultInt // string ISeq let funcStr (x:string) = (x.Length < 4) - let resultStr =ISeq.takeWhile funcStr (seq ["a"; "ab"; "abc"; "abcd"; "abcde"]|> ISeq.ofSeq) + let resultStr =ISeq.takeWhile funcStr (iseq ["a"; "ab"; "abc"; "abcd"; "abcde"]) - let expectedStr = seq ["a"; "ab"; "abc"] + let expectedStr = iseq ["a"; "ab"; "abc"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1463,13 +1466,13 @@ type ISeqModule2() = [] member this.ToArray() = // integer ISeq - let resultInt = ISeq.toArray(seq [1;2;4;5;7]|> ISeq.ofSeq) + let resultInt = ISeq.toArray(iseq [1;2;4;5;7]) let expectedInt = [|1;2;4;5;7|] Assert.AreEqual(expectedInt,resultInt) // string ISeq - let resultStr =ISeq.toArray (seq ["str1";"str2";"str3"]|> ISeq.ofSeq) + let resultStr =ISeq.toArray (iseq ["str1";"str2";"str3"]) let expectedStr = [|"str1";"str2";"str3"|] Assert.AreEqual(expectedStr,resultStr) @@ -1484,8 +1487,8 @@ type ISeqModule2() = [] member this.ToArrayFromICollection() = - let inputCollection = ResizeArray(seq [1;2;4;5;7]) - let resultInt = ISeq.toArray(inputCollection|> ISeq.ofSeq) + let inputCollection = ResizeArray(iseq [1;2;4;5;7]) + let resultInt = ISeq.toArray((iseq inputCollection)) let expectedInt = [|1;2;4;5;7|] Assert.AreEqual(expectedInt,resultInt) @@ -1497,45 +1500,45 @@ type ISeqModule2() = [] member this.ToArrayFromArray() = - let resultInt = ISeq.toArray([|1;2;4;5;7|]|> ISeq.ofSeq) + let resultInt = ISeq.toArray((iseq [|1;2;4;5;7|])) let expectedInt = [|1;2;4;5;7|] Assert.AreEqual(expectedInt,resultInt) [] member this.ToArrayFromList() = - let resultInt = ISeq.toArray([1;2;4;5;7]|> ISeq.ofSeq) + let resultInt = ISeq.toArray((iseq [1;2;4;5;7])) let expectedInt = [|1;2;4;5;7|] Assert.AreEqual(expectedInt,resultInt) [] member this.ToList() = // integer ISeq - let resultInt = Seq.toList (seq [1;2;4;5;7]) + let resultInt = ISeq.toList (iseq [1;2;4;5;7]) let expectedInt = [1;2;4;5;7] Assert.AreEqual(expectedInt,resultInt) // string ISeq - let resultStr =Seq.toList (seq ["str1";"str2";"str3"]) + let resultStr =ISeq.toList (iseq ["str1";"str2";"str3"]) let expectedStr = ["str1";"str2";"str3"] Assert.AreEqual(expectedStr,resultStr) // empty ISeq - let resultEpt = Seq.toList ISeq.empty + let resultEpt = ISeq.toList ISeq.empty Assert.AreEqual([],resultEpt) //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.toList null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.toList null |> ignore) () [] member this.Truncate() = // integer ISeq - let resultInt = ISeq.truncate 3 (seq [1;2;4;5;7]|> ISeq.ofSeq) + let resultInt = ISeq.truncate 3 (iseq [1;2;4;5;7]) let expectedInt = [1;2;4] VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =ISeq.truncate 2 (seq ["str1";"str2";"str3"]|> ISeq.ofSeq) + let resultStr =ISeq.truncate 2 (iseq ["str1";"str2";"str3"]) let expectedStr = ["str1";"str2"] VerifySeqsEqual expectedStr resultStr @@ -1547,27 +1550,27 @@ type ISeqModule2() = //CheckThrowsArgumentNullException(fun() -> ISeq.truncate 1 null |> ignore) // negative count - VerifySeqsEqual ISeq.empty <| ISeq.truncate -1 (seq [1;2;4;5;7]|> ISeq.ofSeq) - VerifySeqsEqual ISeq.empty <| ISeq.truncate System.Int32.MinValue (seq [1;2;4;5;7]|> ISeq.ofSeq) + VerifySeqsEqual ISeq.empty <| ISeq.truncate -1 (iseq [1;2;4;5;7]) + VerifySeqsEqual ISeq.empty <| ISeq.truncate System.Int32.MinValue (iseq [1;2;4;5;7]) () [] member this.tryFind() = // integer ISeq - let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (seq [1;2;4;5;7]|> ISeq.ofSeq) + let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (iseq [1;2;4;5;7]) Assert.AreEqual(Some(2), resultInt) // integer ISeq - None - let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (seq [1;3;5;7]|> ISeq.ofSeq) + let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (iseq [1;3;5;7]) Assert.AreEqual(None, resultInt) // string ISeq - let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (seq ["str1";"str2";"str3"]|> ISeq.ofSeq) + let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str2";"str3"]) Assert.AreEqual(Some("str2"),resultStr) // string ISeq - None - let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (seq ["str1";"str4";"str3"] |> ISeq.ofSeq) + let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str4";"str3"]) Assert.AreEqual(None,resultStr) @@ -1582,46 +1585,46 @@ type ISeqModule2() = [] member this.TryFindBack() = // integer ISeq - let resultInt = Seq.tryFindBack (fun x -> (x%2=0)) (seq [1;2;4;5;7]) + let resultInt = ISeq.tryFindBack (fun x -> (x%2=0)) (iseq [1;2;4;5;7]) Assert.AreEqual(Some 4, resultInt) // integer ISeq - None - let resultInt = Seq.tryFindBack (fun x -> (x%2=0)) (seq [1;3;5;7]) + let resultInt = ISeq.tryFindBack (fun x -> (x%2=0)) (iseq [1;3;5;7]) Assert.AreEqual(None, resultInt) // string ISeq - let resultStr = Seq.tryFindBack (fun (x:string) -> x.Contains("2")) (seq ["str1";"str2";"str2x";"str3"]) + let resultStr = ISeq.tryFindBack (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str2";"str2x";"str3"]) Assert.AreEqual(Some "str2x", resultStr) // string ISeq - None - let resultStr = Seq.tryFindBack (fun (x:string) -> x.Contains("2")) (seq ["str1";"str4";"str3"]) + let resultStr = ISeq.tryFindBack (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str4";"str3"]) Assert.AreEqual(None, resultStr) // empty ISeq - let resultEpt = Seq.tryFindBack (fun x -> (x%2=0)) ISeq.empty + let resultEpt = ISeq.tryFindBack (fun x -> (x%2=0)) ISeq.empty Assert.AreEqual(None, resultEpt) //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.tryFindBack (fun x -> (x%2=0)) null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.tryFindBack (fun x -> (x%2=0)) null |> ignore) () [] member this.TryFindIndex() = // integer ISeq - let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) ([8; 9; 10] |> ISeq.ofSeq) + let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) (iseq [8; 9; 10]) Assert.AreEqual(Some(2), resultInt) // integer ISeq - None - let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) ([9;3;11]|> ISeq.ofSeq) + let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) (iseq [9;3;11]) Assert.AreEqual(None, resultInt) // string ISeq - let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (["str1"; "str2"; "str3"]|> ISeq.ofSeq) + let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str2"; "str3"]) Assert.AreEqual(Some(1),resultStr) // string ISeq - None - let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (["str1"; "str4"; "str3"]|> ISeq.ofSeq) + let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str4"; "str3"]) Assert.AreEqual(None,resultStr) @@ -1637,27 +1640,27 @@ type ISeqModule2() = member this.TryFindIndexBack() = // integer ISeq - let resultInt = Seq.tryFindIndexBack (fun x -> (x % 5 = 0)) [5; 9; 10; 12] + let resultInt = ISeq.tryFindIndexBack (fun x -> (x % 5 = 0)) (iseq [5; 9; 10; 12]) Assert.AreEqual(Some(2), resultInt) // integer ISeq - None - let resultInt = Seq.tryFindIndexBack (fun x -> (x % 5 = 0)) [9;3;11] + let resultInt = ISeq.tryFindIndexBack (fun x -> (x % 5 = 0)) (iseq [9;3;11]) Assert.AreEqual(None, resultInt) // string ISeq - let resultStr = Seq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) ["str1"; "str2"; "str2x"; "str3"] + let resultStr = ISeq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str2"; "str2x"; "str3"]) Assert.AreEqual(Some(2), resultStr) // string ISeq - None - let resultStr = Seq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) ["str1"; "str4"; "str3"] + let resultStr = ISeq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str4"; "str3"]) Assert.AreEqual(None, resultStr) // empty ISeq - let resultEpt = Seq.tryFindIndexBack (fun x -> (x%2=0)) ISeq.empty + let resultEpt = ISeq.tryFindIndexBack (fun x -> (x%2=0)) ISeq.empty Assert.AreEqual(None, resultEpt) //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.tryFindIndexBack (fun x -> (x % 2 = 0)) null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.tryFindIndexBack (fun x -> (x % 2 = 0)) null |> ignore) () [] @@ -1666,11 +1669,11 @@ type ISeqModule2() = let resultInt = ISeq.unfold (fun x -> if x = 1 then Some(7,2) else None) 1 - VerifySeqsEqual (seq [7]) resultInt + VerifySeqsEqual (iseq [7]) resultInt // string ISeq let resultStr =ISeq.unfold (fun (x:string) -> if x.Contains("unfold") then Some("a","b") else None) "unfold" - VerifySeqsEqual (seq ["a"]) resultStr + VerifySeqsEqual (iseq ["a"]) resultStr () @@ -1680,7 +1683,6 @@ type ISeqModule2() = let testWindowed config = try config.InputSeq - |> ISeq.ofSeq |> ISeq.windowed config.WindowSize |> VerifySeqsEqual config.ExpectedSeq with @@ -1689,33 +1691,33 @@ type ISeqModule2() = | _ -> Assert.Fail() { - InputSeq = seq [1..10] + InputSeq = iseq [1..10] WindowSize = 1 - ExpectedSeq = seq { for i in 1..10 do yield [| i |] } + ExpectedSeq = iseq <| seq { for i in 1..10 do yield [| i |] } Exception = None } |> testWindowed { - InputSeq = seq [1..10] + InputSeq = iseq [1..10] WindowSize = 5 - ExpectedSeq = seq { for i in 1..6 do yield [| i; i+1; i+2; i+3; i+4 |] } + ExpectedSeq = iseq <| seq { for i in 1..6 do yield [| i; i+1; i+2; i+3; i+4 |] } Exception = None } |> testWindowed { - InputSeq = seq [1..10] + InputSeq = iseq [1..10] WindowSize = 10 - ExpectedSeq = seq { yield [| 1 .. 10 |] } + ExpectedSeq = iseq <| seq { yield [| 1 .. 10 |] } Exception = None } |> testWindowed { - InputSeq = seq [1..10] + InputSeq = iseq [1..10] WindowSize = 25 ExpectedSeq = ISeq.empty Exception = None } |> testWindowed { - InputSeq = seq ["str1";"str2";"str3";"str4"] + InputSeq = iseq ["str1";"str2";"str3";"str4"] WindowSize = 2 - ExpectedSeq = seq [ [|"str1";"str2"|];[|"str2";"str3"|];[|"str3";"str4"|]] + ExpectedSeq = iseq [ [|"str1";"str2"|];[|"str2";"str3"|];[|"str3";"str4"|]] Exception = None } |> testWindowed { @@ -1724,14 +1726,14 @@ type ISeqModule2() = ExpectedSeq = ISeq.empty Exception = None } |> testWindowed + //{ + // InputSeq = null + // WindowSize = 2 + // ExpectedSeq = ISeq.empty + // Exception = Some typeof + //} |> testWindowed { - InputSeq = null - WindowSize = 2 - ExpectedSeq = ISeq.empty - Exception = Some typeof - } |> testWindowed - { - InputSeq = seq [1..10] + InputSeq = iseq [1..10] WindowSize = 0 ExpectedSeq = ISeq.empty Exception = Some typeof @@ -1743,15 +1745,15 @@ type ISeqModule2() = member this.Zip() = // integer ISeq - let resultInt = ISeq.zip (seq [1..7] |> ISeq.ofSeq) (seq [11..17] |> ISeq.ofSeq) + let resultInt = ISeq.zip (iseq [1..7]) (iseq [11..17]) let expectedInt = - seq { for i in 1..7 do - yield i, i+10 } + iseq <| seq { for i in 1..7 do + yield i, i+10 } VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =ISeq.zip (seq ["str3";"str4"] |> ISeq.ofSeq) (seq ["str1";"str2"] |> ISeq.ofSeq) - let expectedStr = seq ["str3","str1";"str4","str2"] |> ISeq.ofSeq + let resultStr =ISeq.zip (iseq ["str3";"str4"]) (iseq ["str1";"str2"]) + let expectedStr = iseq ["str3","str1";"str4","str2"] VerifySeqsEqual expectedStr resultStr // empty ISeq @@ -1760,44 +1762,44 @@ type ISeqModule2() = //// null ISeq //CheckThrowsArgumentNullException(fun() -> ISeq.zip null null |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip null (seq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip (seq [1..7]) null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip null (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip (iseq [1..7]) null |> ignore) () [] member this.Zip3() = // integer ISeq - let resultInt = Seq.zip3 (seq [1..7]) (seq [11..17]) (seq [21..27]) + let resultInt = ISeq.zip3 (iseq [1..7]) (iseq [11..17]) (iseq [21..27]) let expectedInt = - seq { for i in 1..7 do - yield i, (i + 10), (i + 20) } + iseq <| seq { for i in 1..7 do + yield i, (i + 10), (i + 20) } VerifySeqsEqual expectedInt resultInt // string ISeq - let resultStr =Seq.zip3 (seq ["str1";"str2"]) (seq ["str11";"str12"]) (seq ["str21";"str22"]) - let expectedStr = seq ["str1","str11","str21";"str2","str12","str22" ] + let resultStr =ISeq.zip3 (iseq ["str1";"str2"]) (iseq ["str11";"str12"]) (iseq ["str21";"str22"]) + let expectedStr = iseq ["str1","str11","str21";"str2","str12","str22" ] VerifySeqsEqual expectedStr resultStr // empty ISeq - let resultEpt = Seq.zip3 ISeq.empty ISeq.empty ISeq.empty + let resultEpt = ISeq.zip3 ISeq.empty ISeq.empty ISeq.empty VerifySeqsEqual ISeq.empty resultEpt //// null ISeq - //CheckThrowsArgumentNullException(fun() -> Seq.zip3 null null null |> ignore) - //CheckThrowsArgumentNullException(fun() -> Seq.zip3 null (seq [1..7]) (seq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> Seq.zip3 (seq [1..7]) null (seq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> Seq.zip3 (seq [1..7]) (seq [1..7]) null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 null null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 null (iseq [1..7]) (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 (iseq [1..7]) null (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 (iseq [1..7]) (iseq [1..7]) null |> ignore) () [] member this.tryPick() = // integer ISeq - let resultInt = ISeq.tryPick (fun x-> if x = 1 then Some("got") else None) (seq [1..5]|> ISeq.ofSeq) + let resultInt = ISeq.tryPick (fun x-> if x = 1 then Some("got") else None) (iseq [1..5]) Assert.AreEqual(Some("got"),resultInt) // string ISeq - let resultStr = ISeq.tryPick (fun x-> if x = "Are" then Some("got") else None) (seq ["Lists"; "Are"] |> ISeq.ofSeq) + let resultStr = ISeq.tryPick (fun x-> if x = "Are" then Some("got") else None) (iseq ["Lists"; "Are"]) Assert.AreEqual(Some("got"),resultStr) // empty ISeq @@ -1805,7 +1807,7 @@ type ISeqModule2() = Assert.IsNull(resultEpt) //// null ISeq - //let nullSeq : seq<'a> = null + //let nullSeq : iseq<'a> = null //let funcNull x = Some(1) //CheckThrowsArgumentNullException(fun () -> ISeq.tryPick funcNull nullSeq |> ignore) @@ -1815,11 +1817,11 @@ type ISeqModule2() = [] member this.tryItem() = // integer ISeq - let resultInt = ISeq.tryItem 3 ({ 10..20 }|> ISeq.ofSeq) + let resultInt = ISeq.tryItem 3 (iseq { 10..20 }) Assert.AreEqual(Some(13), resultInt) // string ISeq - let resultStr = ISeq.tryItem 2 (seq ["Lists"; "Are"; "Cool"; "List" ]|> ISeq.ofSeq) + let resultStr = ISeq.tryItem 2 (iseq ["Lists"; "Are"; "Cool"; "List" ]) Assert.AreEqual(Some("Cool"), resultStr) // empty ISeq @@ -1827,13 +1829,13 @@ type ISeqModule2() = Assert.AreEqual(None, resultEmpty) //// null ISeq - //let nullSeq:seq<'a> = null + //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.tryItem 3 nullSeq |> ignore) // Negative index - let resultNegativeIndex = ISeq.tryItem -1 ({ 10..20 }|> ISeq.ofSeq) + let resultNegativeIndex = ISeq.tryItem -1 (iseq { 10..20 }) Assert.AreEqual(None, resultNegativeIndex) // Index greater than length - let resultIndexGreater = ISeq.tryItem 31 ({ 10..20 }|> ISeq.ofSeq) + let resultIndexGreater = ISeq.tryItem 31 (iseq { 10..20 }) Assert.AreEqual(None, resultIndexGreater) From deb7a70fb8dd3151b3953d43e504a1863d19ce7e Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 20 Mar 2017 19:22:39 +1100 Subject: [PATCH 011/120] Derived AppendEnumerable from ConcatEnumerable --- src/fsharp/FSharp.Core/iseq.fs | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 9d446d20806..76002a57a0a 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -478,15 +478,12 @@ namespace Microsoft.FSharp.Collections main.Dispose () active.Dispose () - and AppendEnumerable<'T> (sources:list>) = + and ConcatEnumerable<'T, 'Collection, 'Collections when 'Collection :> seq<'T> and 'Collections :> seq<'Collection>> (sources:'Collections, preEnumerate:'Collections->'Collections) = inherit EnumerableBase<'T>() interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = - Upcast.enumerator (new ConcatEnumerator<_,_> (sources |> List.rev)) - - override this.Append source = - Upcast.seq (AppendEnumerable (source::sources)) + Upcast.enumerator (new ConcatEnumerator<_,_> (preEnumerate sources)) interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = @@ -495,19 +492,11 @@ namespace Microsoft.FSharp.Collections member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.enumerable this) - and ConcatEnumerable<'T, 'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>) = - inherit EnumerableBase<'T>() - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = - Upcast.enumerator (new ConcatEnumerator<_,_> (sources)) - - interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (Enumerable<'T,'V>(this, next, 1)) + and AppendEnumerable<'T> (sources:list>) = + inherit ConcatEnumerable<'T, ISeq<'T>, list>>(sources, List.rev) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.enumerable this) + override this.Append source = + Upcast.seq (AppendEnumerable (source::sources)) let create enumerable current = Upcast.seq (Enumerable (enumerable, current, 1)) @@ -1308,7 +1297,7 @@ namespace Microsoft.FSharp.Collections [] let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - Upcast.seq (Enumerable.ConcatEnumerable sources) + Upcast.seq (Enumerable.ConcatEnumerable (sources, id)) [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = From fcc9ee324a66f54f5f990bea81aa05d7cd10e364 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 20 Mar 2017 20:07:20 +1100 Subject: [PATCH 012/120] Made CachedSeq an ISeq --- src/fsharp/FSharp.Core/iseq.fs | 125 +++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 54 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 76002a57a0a..a28c974058b 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1739,18 +1739,8 @@ namespace Microsoft.FSharp.Collections | len -> foldArraySubRight f arr 0 (len - 2) arr.[len - 1] [] - type CachedSeq<'T>(cleanup,res:seq<'T>) = - interface System.IDisposable with - member x.Dispose() = cleanup() - interface System.Collections.Generic.IEnumerable<'T> with - member x.GetEnumerator() = res.GetEnumerator() - interface System.Collections.IEnumerable with - member x.GetEnumerator() = (res :> System.Collections.IEnumerable).GetEnumerator() - member obj.Clear() = cleanup() - - [] - let cache (source:ISeq<'T>) : ISeq<'T> = - checkNonNull "source" source + type CachedSeq<'T>(source:ISeq<'T>) = + let sync = obj () // Wrap a seq to ensure that it is enumerated just once and only as far as is necessary. // // This code is required to be thread safe. @@ -1760,49 +1750,76 @@ namespace Microsoft.FSharp.Collections // The state is (prefix,enumerator) with invariants: // * the prefix followed by elts from the enumerator are the initial sequence. // * the prefix contains only as many elements as the longest enumeration so far. - let prefix = ResizeArray<_>() - let enumeratorR = ref None : IEnumerator<'T> option option ref // nested options rather than new type... - // None = Unstarted. - // Some(Some e) = Started. - // Some None = Finished. + + let prefix = ResizeArray () + + // Choice1Of3 () = Unstarted. + // Choice2Of3 e = Started. + // Choice3Of3 () = Finished. + let mutable enumeratorR = Choice1Of3 () : Choice, unit> + + // function should only be called from within the lock let oneStepTo i = - // If possible, step the enumeration to prefix length i (at most one step). - // Be speculative, since this could have already happened via another thread. - if not (i < prefix.Count) then // is a step still required? - // If not yet started, start it (create enumerator). - match !enumeratorR with - | None -> enumeratorR := Some (Some (source.GetEnumerator())) - | Some _ -> () - match (!enumeratorR).Value with - | Some enumerator -> if enumerator.MoveNext() then - prefix.Add(enumerator.Current) - else - enumerator.Dispose() // Move failed, dispose enumerator, - enumeratorR := Some None // drop it and record finished. - | None -> () - let result = - unfold (fun i -> - // i being the next position to be returned - // A lock is needed over the reads to prefix.Count since the list may be being resized - // NOTE: we could change to a reader/writer lock here - lock enumeratorR (fun () -> - if i < prefix.Count then - Some (prefix.[i],i+1) - else - oneStepTo i - if i < prefix.Count then - Some (prefix.[i],i+1) - else - None)) 0 - let cleanup() = - lock enumeratorR (fun () -> - prefix.Clear() - begin match !enumeratorR with - | Some (Some e) -> IEnumerator.dispose e - | _ -> () - end - enumeratorR := None) - (new CachedSeq<_>(cleanup, result) |> ofSeq) + // If possible, step the enumeration to prefix length i (at most one step). + // Be speculative, since this could have already happened via another thread. + if not (i < prefix.Count) then // is a step still required? + // If not yet started, start it (create enumerator). + match enumeratorR with + | Choice1Of3 _ -> enumeratorR <- Choice2Of3 (source.GetEnumerator()) + | _ -> () + + match enumeratorR with + | Choice2Of3 enumerator when enumerator.MoveNext() -> + prefix.Add enumerator.Current + | Choice2Of3 enumerator -> + enumerator.Dispose () // Move failed, dispose enumerator, + enumeratorR <- Choice3Of3 () // drop it and record finished. + | _ -> () + + let cached = + 0 |> unfold (fun i -> + // i being the next position to be returned + // A lock is needed over the reads to prefix.Count since the list may be being resized + // NOTE: we could change to a reader/writer lock here + lock sync (fun () -> + if i < prefix.Count then + Some (prefix.[i], i+1) + else + oneStepTo i + if i < prefix.Count then + Some (prefix.[i], i+1) + else + None)) + + interface System.IDisposable with + member __.Dispose() = + lock sync (fun () -> + prefix.Clear() + + match enumeratorR with + | Choice2Of3 e -> IEnumerator.dispose e + | _ -> () + + enumeratorR <- Choice1Of3 ()) + + interface System.Collections.Generic.IEnumerable<'T> with + member __.GetEnumerator() = cached.GetEnumerator() + + interface System.Collections.IEnumerable with + member __.GetEnumerator() = (cached :> System.Collections.IEnumerable).GetEnumerator() + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new Enumerable.Enumerable<'T,'U>(cached, next, 1)) + + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.enumerable cached) + + member this.Clear() = (this :> IDisposable).Dispose () + + [] + let cache (source:ISeq<'T>) : ISeq<'T> = + Upcast.seq (new CachedSeq<_> (source)) [] let collect f sources = map f sources |> concat From 90e369f40f242b528d3d568941e488720c9e1314 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 21 Mar 2017 17:57:22 +1100 Subject: [PATCH 013/120] Fix error message --- .../FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs | 4 ++-- src/fsharp/FSharp.Core/iseq.fs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs index 859a3a7f466..e6a16911496 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs @@ -927,13 +927,13 @@ type ISeqModule2() = ISeq.item 0 (iseq (Array.zeroCreate 0)) |> ignore failwith "error expected" with - | exn when exn.Message.Contains("iseq was short by 1 element") -> () + | exn when exn.Message.Contains("seq was short by 1 element") -> () try ISeq.item 2 (iseq (Array.zeroCreate 0)) |> ignore failwith "error expected" with - | exn when exn.Message.Contains("iseq was short by 3 elements") -> () + | exn when exn.Message.Contains("seq was short by 3 elements") -> () [] member this.Of_Array() = diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index a28c974058b..1e240613d05 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1777,7 +1777,7 @@ namespace Microsoft.FSharp.Collections | _ -> () let cached = - 0 |> unfold (fun i -> + unfold (fun i -> // i being the next position to be returned // A lock is needed over the reads to prefix.Count since the list may be being resized // NOTE: we could change to a reader/writer lock here @@ -1789,7 +1789,7 @@ namespace Microsoft.FSharp.Collections if i < prefix.Count then Some (prefix.[i], i+1) else - None)) + None)) 0 interface System.IDisposable with member __.Dispose() = From 627d9b44cca55b327d5d05e4a382a7a3c98209ea Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 21 Mar 2017 19:23:38 +1100 Subject: [PATCH 014/120] implemented chunkBySize --- src/fsharp/FSharp.Core/iseq.fs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 1e240613d05..9eda8c501de 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1856,21 +1856,25 @@ namespace Microsoft.FSharp.Collections checkNonNull "source" source if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" [|SR.GetString SR.inputMustBePositive; chunkSize|] - // seq { use e = source.GetEnumerator() - // let nextChunk() = - // let res = Array.zeroCreateUnchecked chunkSize - // res.[0] <- e.Current - // let i = ref 1 - // while !i < chunkSize && e.MoveNext() do - // res.[!i] <- e.Current - // i := !i + 1 - // if !i = chunkSize then - // res - // else - // res |> Array.subUnchecked 0 !i - // while e.MoveNext() do - // yield nextChunk() } |> ofSeq - raise (NotImplementedException ("TBD")) + + source.PushTransform { new TransformFactory<'T,'T[]>() with + member __.Compose outOfBand pipeIdx next = + upcast { + new TransformWithPostProcessing<'T,'U,Values<'T[],int>>(next,Values<'T[],int>(Array.zeroCreateUnchecked chunkSize, 0)) with + override this.ProcessNext (input:'T) : bool = + this.State._1.[this.State._2] <- input + this.State._2 <- this.State._2 + 1 + if this.State._2 <> chunkSize then false + else + this.State._2 <- 0 + let tmp = this.State._1 + this.State._1 <- Array.zeroCreateUnchecked chunkSize + TailCall.avoid (next.ProcessNext tmp) + override this.OnComplete _ = + if this.State._2 > 0 then + System.Array.Resize (&this.State._1, this.State._2) + next.ProcessNext this.State._1 |> ignore + override this.OnDispose () = () }} let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) |> ofSeq From 448626580d7de1bb3887f1a38d97404160bc1c0a Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 21 Mar 2017 19:24:59 +1100 Subject: [PATCH 015/120] Removed checkNonNull as ISeq can't be null --- src/fsharp/FSharp.Core/iseq.fs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 9eda8c501de..8cda0f646be 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1842,18 +1842,15 @@ namespace Microsoft.FSharp.Collections [] let isEmpty (source : ISeq<'T>) = - checkNonNull "source" source use ie = source.GetEnumerator() not (ie.MoveNext()) [] let cast (source: IEnumerable) : ISeq<'T> = - checkNonNull "source" source mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) |> ofSeq [] let chunkBySize chunkSize (source : ISeq<'T>) : ISeq<'T[]> = - checkNonNull "source" source if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" [|SR.GetString SR.inputMustBePositive; chunkSize|] @@ -1880,7 +1877,6 @@ namespace Microsoft.FSharp.Collections [] let splitInto count (source:ISeq<'T>) : ISeq<'T[]> = - checkNonNull "source" source if count <= 0 then invalidArgFmt "count" "{0}\ncount = {1}" [|SR.GetString SR.inputMustBePositive; count|] mkDelayedSeq (fun () -> @@ -1890,14 +1886,12 @@ namespace Microsoft.FSharp.Collections [] let find f source = - checkNonNull "source" source match tryFind f source with | None -> indexNotFound() | Some x -> x [] let findIndex p (source:ISeq<_>) = - checkNonNull "source" source use ie = source.GetEnumerator() let rec loop i = if ie.MoveNext() then @@ -1910,17 +1904,14 @@ namespace Microsoft.FSharp.Collections [] let findBack f source = - checkNonNull "source" source source |> toArray |> Array.findBack f [] let findIndexBack f source = - checkNonNull "source" source source |> toArray |> Array.findIndexBack f [] let pick f source = - checkNonNull "source" source match tryPick f source with | None -> indexNotFound() | Some x -> x @@ -1928,18 +1919,15 @@ namespace Microsoft.FSharp.Collections [] [] let readonly (source:seq<_>) = - checkNonNull "source" source mkSeq (fun () -> source.GetEnumerator()) |> ofSeq [] let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = - checkNonNull "source" source let arr,state = source |> toArray |> Array.mapFold f acc readonly arr, state [] let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = - checkNonNull "source" source let array = source |> toArray let arr,state = Array.mapFoldBack f array acc readonly arr, state @@ -1955,7 +1943,6 @@ namespace Microsoft.FSharp.Collections [] let item i (source : ISeq<'T>) = - checkNonNull "source" source if i < 0 then invalidArgInputMustBeNonNegative "index" i use e = source.GetEnumerator() nth i e @@ -1965,29 +1952,22 @@ namespace Microsoft.FSharp.Collections [] let inline sortDescending source = - checkNonNull "source" source let inline compareDescending a b = compare b a sortWith compareDescending source [] let inline sortByDescending keyf source = - checkNonNull "source" source let inline compareDescending a b = compare (keyf b) (keyf a) sortWith compareDescending source [] let tryFindBack f (source : ISeq<'T>) = - checkNonNull "source" source source |> toArray |> Array.tryFindBack f [] let tryFindIndexBack f (source : ISeq<'T>) = - checkNonNull "source" source source |> toArray |> Array.tryFindIndexBack f [] let zip3 source1 source2 source3 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - checkNonNull "source3" source3 map2 (fun x (y,z) -> x,y,z) source1 (zip source2 source3) From 7e403ecc2143494ec61247470990774de5c217b5 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 21 Mar 2017 19:27:52 +1100 Subject: [PATCH 016/120] type checks for cast --- src/fsharp/FSharp.Core/iseq.fs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 8cda0f646be..782ceb6ba4f 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1847,7 +1847,11 @@ namespace Microsoft.FSharp.Collections [] let cast (source: IEnumerable) : ISeq<'T> = - mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) |> ofSeq + match source with + | :? ISeq<'T> as s -> s + | :? ISeq as s -> s |> map unbox // covariant on ref types + | _ -> + mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) |> ofSeq [] let chunkBySize chunkSize (source : ISeq<'T>) : ISeq<'T[]> = From f9eab216ef928f6cd76f98f16947044e5a781572 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 22 Mar 2017 20:00:40 +1100 Subject: [PATCH 017/120] Removed type comparisons due to Choice<> --- src/fsharp/FSharp.Core/iseq.fs | 40 +++++++++++++++------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 782ceb6ba4f..64b1b6204e5 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1741,6 +1741,7 @@ namespace Microsoft.FSharp.Collections [] type CachedSeq<'T>(source:ISeq<'T>) = let sync = obj () + // Wrap a seq to ensure that it is enumerated just once and only as far as is necessary. // // This code is required to be thread safe. @@ -1753,10 +1754,8 @@ namespace Microsoft.FSharp.Collections let prefix = ResizeArray () - // Choice1Of3 () = Unstarted. - // Choice2Of3 e = Started. - // Choice3Of3 () = Finished. - let mutable enumeratorR = Choice1Of3 () : Choice, unit> + let mutable started = false + let mutable enumeratorR = None : option> // function should only be called from within the lock let oneStepTo i = @@ -1764,16 +1763,16 @@ namespace Microsoft.FSharp.Collections // Be speculative, since this could have already happened via another thread. if not (i < prefix.Count) then // is a step still required? // If not yet started, start it (create enumerator). - match enumeratorR with - | Choice1Of3 _ -> enumeratorR <- Choice2Of3 (source.GetEnumerator()) - | _ -> () + if not started then + started <- true + enumeratorR <- Some (source.GetEnumerator()) match enumeratorR with - | Choice2Of3 enumerator when enumerator.MoveNext() -> + | Some enumerator when enumerator.MoveNext() -> prefix.Add enumerator.Current - | Choice2Of3 enumerator -> - enumerator.Dispose () // Move failed, dispose enumerator, - enumeratorR <- Choice3Of3 () // drop it and record finished. + | Some enumerator -> + enumerator.Dispose () // Move failed, dispose enumerator, + enumeratorR <- None // drop it and record finished. | _ -> () let cached = @@ -1796,11 +1795,11 @@ namespace Microsoft.FSharp.Collections lock sync (fun () -> prefix.Clear() - match enumeratorR with - | Choice2Of3 e -> IEnumerator.dispose e - | _ -> () + enumeratorR + |> Option.iter IEnumerator.dispose - enumeratorR <- Choice1Of3 ()) + started <- false + enumeratorR <- None) interface System.Collections.Generic.IEnumerable<'T> with member __.GetEnumerator() = cached.GetEnumerator() @@ -1920,21 +1919,16 @@ namespace Microsoft.FSharp.Collections | None -> indexNotFound() | Some x -> x - [] - [] - let readonly (source:seq<_>) = - mkSeq (fun () -> source.GetEnumerator()) |> ofSeq - [] let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = let arr,state = source |> toArray |> Array.mapFold f acc - readonly arr, state + ofArray arr, state [] let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = let array = source |> toArray let arr,state = Array.mapFoldBack f array acc - readonly arr, state + ofArray arr, state let rec nth index (e : IEnumerator<'T>) = if not (e.MoveNext()) then @@ -1952,7 +1946,7 @@ namespace Microsoft.FSharp.Collections nth i e [] - let singleton x = mkSeq (fun () -> IEnumerator.Singleton x) |> ofSeq + let singleton x = ofArray [| x |] [] let inline sortDescending source = From 55c66cf896f2dc3fa7fba9be40741f0aad2f7ebd Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 23 Mar 2017 20:03:07 +1100 Subject: [PATCH 018/120] Restore somewhat dubious, I think, singleton The test suite has a test where it says that IEnumerator.Current shouldn't throw an exception after MoveNext has thrown an exception. I doubt if this is particularly valid behaviour. Will provide a "proper" ISeq singleton soon. --- src/fsharp/FSharp.Core/iseq.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 64b1b6204e5..3b8c6157473 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1946,7 +1946,7 @@ namespace Microsoft.FSharp.Collections nth i e [] - let singleton x = ofArray [| x |] + let singleton x = mkSeq (fun () -> IEnumerator.Singleton x) |> ofSeq [] let inline sortDescending source = From c235d1b225243f3af6b4681a0935e06655b7aeec Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 26 Mar 2017 13:24:33 +1100 Subject: [PATCH 019/120] Removed tag --- src/fsharp/FSharp.Core/iseq.fsi | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 7d3534ae768..b395fb7685d 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -14,23 +14,23 @@ namespace Microsoft.FSharp.Collections [] type NoValue = struct end - /// Values is a mutable struct. It can be embedded within the folder type - /// if two values are required for the calculation. + /// Values is a mutable struct. It can be embedded within the folder type + /// if two values are required for the calculation. [] type Value<'a> = new : a:'a -> Value<'a> val mutable _1: 'a - /// Values is a mutable struct. It can be embedded within the folder type - /// if two values are required for the calculation. + /// Values is a mutable struct. It can be embedded within the folder type + /// if two values are required for the calculation. [] type Values<'a,'b> = new : a:'a * b:'b -> Values<'a,'b> val mutable _1: 'a val mutable _2: 'b - /// Values is a mutable struct. It can be embedded within the folder type - /// if three values are required for the calculation. + /// Values is a mutable struct. It can be embedded within the folder type + /// if three values are required for the calculation. [] type Values<'a,'b,'c> = new : a:'a * b:'b * c:'c -> Values<'a,'b,'c> @@ -38,28 +38,28 @@ namespace Microsoft.FSharp.Collections val mutable _2: 'b val mutable _3: 'c - /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the - /// source of the chain. + /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the + /// source of the chain. type PipeIdx = int type IOutOfBand = abstract StopFurtherProcessing : PipeIdx -> unit - /// Activity is the root class for chains of activities. It is in a non-generic - /// form so that it can be used by subsequent activities + /// Activity is the root class for chains of activities. It is in a non-generic + /// form so that it can be used by subsequent activities [] type Activity = - /// OnComplete is used to determine if the object has been processed correctly, + /// OnComplete is used to determine if the object has been processed correctly, /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take /// operation which didn't have a source at least as large as was required). It is /// not called in the case of an exception being thrown whilst the stream is still - /// being processed. + /// being processed. abstract ChainComplete : stopTailCall:byref*PipeIdx -> unit - /// OnDispose is used to cleanup the stream. It is always called at the last operation - /// after the enumeration has completed. + /// OnDispose is used to cleanup the stream. It is always called at the last operation + /// after the enumeration has completed. abstract ChainDispose : stopTailCall:byref -> unit - /// Activity is the base class of all elements within the pipeline + /// Activity is the base class of all elements within the pipeline [] type Activity<'T,'U> = inherit Activity @@ -80,9 +80,9 @@ namespace Microsoft.FSharp.Collections abstract OnComplete : PipeIdx -> unit abstract OnDispose : unit -> unit - /// Folder is a base class to assist with fold-like operations. It's intended usage + /// Folder is a base class to assist with fold-like operations. It's intended usage /// is as a base class for an object expression that will be used from within - /// the Fold function. + /// the Fold function. [] type Folder<'T,'Result,'State> = inherit Activity<'T,'T> From 2919c627f20eeb09b6359b86099fdaf22d06d438 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 26 Mar 2017 14:48:08 +1100 Subject: [PATCH 020/120] Provided some comments around public interface --- src/fsharp/FSharp.Core/iseq.fsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index b395fb7685d..69917c10647 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -42,7 +42,9 @@ namespace Microsoft.FSharp.Collections /// source of the chain. type PipeIdx = int + /// Used within the pipline to provide out of band communications type IOutOfBand = + /// Stop the processing of any further items down the pipeline abstract StopFurtherProcessing : PipeIdx -> unit /// Activity is the root class for chains of activities. It is in a non-generic @@ -66,6 +68,9 @@ namespace Microsoft.FSharp.Collections new : unit -> Activity<'T,'U> abstract member ProcessNext : input:'T -> bool + /// An activity that transforms the input from 'T to 'U, using 'State. It's intended usage + /// is as a base class for an object expression that will be created + /// in the TransformFactory's Compose function. [] type Transform<'T,'U,'State> = inherit Activity<'T,'U> @@ -73,6 +78,11 @@ namespace Microsoft.FSharp.Collections val mutable State : 'State val private Next : Activity + /// An activity that transforms the input from 'T to 'U, using 'State + /// and performs some post processing on the pipeline, either in the case of the stream + /// ending sucessfully or when disposed. It's intended usage + /// is as a base class for an object expression that will be created + /// in the TransformFactory's Compose function. [] type TransformWithPostProcessing<'T,'U,'State> = inherit Transform<'T,'U,'State> @@ -93,6 +103,11 @@ namespace Microsoft.FSharp.Collections val mutable HaltedIdx : int member StopFurtherProcessing : PipeIdx -> unit + /// Folder is a base class to assist with fold-like operations + /// and performs some post processing on the pipeline, either in the case of the stream + /// ending sucessfully or when disposed. It's intended usage + /// is as a base class for an object expression that will be used from within + /// the Fold function. [] type FolderWithPostProcessing<'T,'Result,'State> = inherit Folder<'T,'Result,'State> @@ -100,11 +115,16 @@ namespace Microsoft.FSharp.Collections abstract OnDispose : unit -> unit abstract OnComplete : PipeIdx -> unit + /// TransformFactory provides composition of Activities. Its intended to have a specialization + /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack + /// of Actvities that will be composed. [] type TransformFactory<'T,'U> = new : unit -> TransformFactory<'T,'U> abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities + /// as well as Fold the current Activity pipeline. type ISeq<'T> = inherit System.Collections.Generic.IEnumerable<'T> abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> @@ -112,6 +132,10 @@ namespace Microsoft.FSharp.Collections open Core + /// ofResizeArrayUnchecked creates an ISeq over a ResizeArray that accesses the underlying + /// structure via Index rather than via the GetEnumerator function. This provides faster access + /// but doesn't check the version of the underlying object which means care has to be taken + /// to ensure that it is not modified which the result ISeq exists. [] val ofResizeArrayUnchecked : ResizeArray<'T> -> ISeq<'T> From 4925e6c3c85749629e1f646e173c2924dadbab60 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 27 Mar 2017 08:01:18 +1100 Subject: [PATCH 021/120] Capitalized type names (of IIterate implementations) --- src/fsharp/FSharp.Core/iseq.fs | 46 +++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 3b8c6157473..53928a7b3b4 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -192,11 +192,18 @@ namespace Microsoft.FSharp.Collections true module Fold = + // The consumers of IIterate are the execute and exeuteThin methods. IIterate is passed + // as a generic argument. The types that implement IIterate are value types. This combination + // means that the runtime will "inline" the methods. The alternatives to this were that the + // code in execute/executeThin were duplicated for each of the Fold types, or we turned the + // types back into normal functions and curried them then we would be creating garbage + // each time one of these were called. This has been an optimization to minimize the impact + // on very small collections. type IIterate<'T> = abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result,'State> -> consumer:Activity<'T,'U> -> unit [] - type enumerable<'T> (enumerable:IEnumerable<'T>) = + type IterateEnumerable<'T> (enumerable:IEnumerable<'T>) = interface IIterate<'T> with member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = use enumerator = enumerable.GetEnumerator () @@ -208,7 +215,7 @@ namespace Microsoft.FSharp.Collections iterate () [] - type Array<'T> (array:array<'T>) = + type IterateArray<'T> (array:array<'T>) = interface IIterate<'T> with member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let array = array @@ -220,7 +227,7 @@ namespace Microsoft.FSharp.Collections iterate 0 [] - type resizeArray<'T> (array:ResizeArray<'T>) = + type IterateResizeArray<'T> (array:ResizeArray<'T>) = interface IIterate<'T> with member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let array = array @@ -232,7 +239,7 @@ namespace Microsoft.FSharp.Collections iterate 0 [] - type List<'T> (alist:list<'T>) = + type IterateList<'T> (alist:list<'T>) = interface IIterate<'T> with member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let rec iterate lst = @@ -245,7 +252,7 @@ namespace Microsoft.FSharp.Collections iterate alist [] - type unfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = + type IterateUnfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = interface IIterate<'T> with member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let generator = generator @@ -259,7 +266,7 @@ namespace Microsoft.FSharp.Collections iterate state [] - type init<'T> (f:int->'T, terminatingIdx:int) = + type IterateInit<'T> (f:int->'T, terminatingIdx:int) = interface IIterate<'T> with member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let terminatingIdx = terminatingIdx @@ -292,6 +299,8 @@ namespace Microsoft.FSharp.Collections if outOfBand.HaltedIdx = 0 && finalIdx = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + // execute, and it's companion, executeThin, are hosting functions that ensure the correct sequence + // of creation, iteration and disposal for the pipeline let execute (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = let mutable stopTailCall = () let result = createFolder (pipeIdx+1) @@ -303,6 +312,9 @@ namespace Microsoft.FSharp.Collections finally consumer.ChainDispose (&stopTailCall) + // executeThin is a specialization of execute, provided as a performance optimization, that can + // be used when a sequence has been wrapped in an ISeq, but hasn't had an items added to its pipeline + // i.e. a container that has ISeq.ofSeq applied. let executeThin (createFolder:PipeIdx->Folder<'T,'Result,'State>) (executeOn:#IIterate<'T>) = let mutable stopTailCall = () let result = createFolder 1 @@ -412,7 +424,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f current pipeIdx (Fold.enumerable enumerable) + Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) and EnumerableThin<'T>(enumerable:IEnumerable<'T>) = inherit EnumerableBase<'T>() @@ -425,7 +437,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable<'T,'U>(enumerable, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.enumerable enumerable) + Fold.executeThin f (Fold.IterateEnumerable enumerable) and SeqDelayed<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() @@ -490,7 +502,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (Enumerable<'T,'V>(this, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.enumerable this) + Fold.executeThin f (Fold.IterateEnumerable this) and AppendEnumerable<'T> (sources:list>) = inherit ConcatEnumerable<'T, ISeq<'T>, list>>(sources, List.rev) @@ -519,7 +531,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (Enumerable.Enumerable<'T,'V>(this, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.enumerable this) + Fold.executeThin f (Fold.IterateEnumerable this) module Array = type Enumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = @@ -558,7 +570,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f transformFactory pipeIdx (Fold.Array array) + Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) module ResizeArray = type Enumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = @@ -597,7 +609,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f transformFactory pipeIdx (Fold.resizeArray resizeArray) + Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) module List = type Enumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = @@ -637,7 +649,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f transformFactory pipeIdx (Fold.List alist) + Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) let create alist current = Upcast.seq (Enumerable(alist, current, 1)) @@ -676,7 +688,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f transformFactory pipeIdx (Fold.unfold (generator, state)) + Fold.execute f transformFactory pipeIdx (Fold.IterateUnfold (generator, state)) module Init = // The original implementation of "init" delayed the calculation of Current, and so it was possible @@ -754,7 +766,7 @@ namespace Microsoft.FSharp.Collections member this.Fold<'Result,'State> (createResult:PipeIdx->Folder<'U,'Result,'State>) = let terminatingIdx = getTerminatingIdx count - Fold.execute createResult transformFactory pipeIdx (Fold.init (f, terminatingIdx)) + Fold.execute createResult transformFactory pipeIdx (Fold.IterateInit (f, terminatingIdx)) let upto lastOption f = match lastOption with @@ -821,7 +833,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (Enumerable<'T,'V>(count, f, next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.enumerable (Upcast.enumerable this)) + Fold.executeThin f (Fold.IterateEnumerable (Upcast.enumerable this)) [] let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = @@ -1812,7 +1824,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (new Enumerable.Enumerable<'T,'U>(cached, next, 1)) member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.enumerable cached) + Fold.executeThin f (Fold.IterateEnumerable cached) member this.Clear() = (this :> IDisposable).Dispose () From 09896e5719eb0fbc346b1a19f34b652c3ff5fac3 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 27 Mar 2017 08:32:53 +1100 Subject: [PATCH 022/120] Removed wrapping on Append to Empty --- src/fsharp/FSharp.Core/iseq.fs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 53928a7b3b4..8c11b981596 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -523,8 +523,7 @@ namespace Microsoft.FSharp.Collections interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = IEnumerator.Empty<'T>() - override this.Append source = - Upcast.seq (Enumerable.EnumerableThin<'T> source) + override this.Append source = source interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = From add013dd7ef6d5b11f15c236c4819524f4299ce3 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 27 Mar 2017 09:16:36 +1100 Subject: [PATCH 023/120] Collapsed all the wrap specific modules into one --- src/fsharp/FSharp.Core/iseq.fs | 378 ++++++++++++++++----------------- 1 file changed, 187 insertions(+), 191 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 8c11b981596..09c9edb4ea7 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -325,8 +325,8 @@ namespace Microsoft.FSharp.Collections finally result.ChainDispose (&stopTailCall) - module Enumerable = - type Empty<'T>() = + module Wrap = + type EmptyEnumerator<'T>() = let current () = failwith "library implementation error: Current should never be called" interface IEnumerator<'T> with member __.Current = current () @@ -338,7 +338,7 @@ namespace Microsoft.FSharp.Collections member __.Dispose () = () type EmptyEnumerators<'T>() = - static let element : IEnumerator<'T> = upcast (new Empty<'T> ()) + static let element : IEnumerator<'T> = upcast (new EmptyEnumerator<'T> ()) static member Element = element [] @@ -362,28 +362,7 @@ namespace Microsoft.FSharp.Collections | SeqProcessNextStates.Finished -> alreadyFinished() | _ -> failwith "library implementation error: all states should have been handled" - and [] EnumerableBase<'T> () = - let derivedClassShouldImplement () = - failwith "library implementation error: derived class should implement (should be abstract)" - - abstract member Append : (ISeq<'T>) -> ISeq<'T> - - default this.Append source = Upcast.seq (AppendEnumerable [source; this]) - - interface IEnumerable with - member this.GetEnumerator () : IEnumerator = - let genericEnumerable = Upcast.enumerable this - let genericEnumerator = genericEnumerable.GetEnumerator () - Upcast.enumeratorNonGeneric genericEnumerator - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () - - interface ISeq<'T> with - member __.PushTransform _ = derivedClassShouldImplement () - member __.Fold _ = derivedClassShouldImplement () - - and Enumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + type VanillaEnumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) let rec moveNext () = @@ -411,48 +390,7 @@ namespace Microsoft.FSharp.Collections let mutable stopTailCall = () activity.ChainDispose (&stopTailCall) - and Enumerable<'T,'U>(enumerable:IEnumerable<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new Enumerator<'T,'U>(enumerable.GetEnumerator(), createFold current result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new Enumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) - - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) - - and EnumerableThin<'T>(enumerable:IEnumerable<'T>) = - inherit EnumerableBase<'T>() - - interface IEnumerable<'T> with - member this.GetEnumerator () = enumerable.GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new Enumerable<'T,'U>(enumerable, next, 1)) - - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.IterateEnumerable enumerable) - - and SeqDelayed<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'T>() - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new SeqDelayed<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) - - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - (delayed()).Fold f - - and ConcatEnumerator<'T, 'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>) = + type ConcatEnumerator<'T, 'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>) = let mutable state = SeqProcessNextStates.NotStarted let main = sources.GetEnumerator () @@ -490,6 +428,43 @@ namespace Microsoft.FSharp.Collections main.Dispose () active.Dispose () + [] + type EnumerableBase<'T> () = + let derivedClassShouldImplement () = + failwith "library implementation error: derived class should implement (should be abstract)" + + abstract member Append : (ISeq<'T>) -> ISeq<'T> + + default this.Append source = Upcast.seq (AppendEnumerable [source; this]) + + interface IEnumerable with + member this.GetEnumerator () : IEnumerator = + let genericEnumerable = Upcast.enumerable this + let genericEnumerator = genericEnumerable.GetEnumerator () + Upcast.enumeratorNonGeneric genericEnumerator + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () + + interface ISeq<'T> with + member __.PushTransform _ = derivedClassShouldImplement () + member __.Fold _ = derivedClassShouldImplement () + + and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold current result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) + and ConcatEnumerable<'T, 'Collection, 'Collections when 'Collection :> seq<'T> and 'Collections :> seq<'Collection>> (sources:'Collections, preEnumerate:'Collections->'Collections) = inherit EnumerableBase<'T>() @@ -499,7 +474,7 @@ namespace Microsoft.FSharp.Collections interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (Enumerable<'T,'V>(this, next, 1)) + Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateEnumerable this) @@ -510,14 +485,36 @@ namespace Microsoft.FSharp.Collections override this.Append source = Upcast.seq (AppendEnumerable (source::sources)) - let create enumerable current = - Upcast.seq (Enumerable (enumerable, current, 1)) + type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = + inherit EnumerableBase<'T>() - module EmptyEnumerable = - type Enumerable<'T> () = - inherit Enumerable.EnumerableBase<'T>() + interface IEnumerable<'T> with + member this.GetEnumerator () = enumerable.GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) - static let singleton = Enumerable<'T>() :> ISeq<'T> + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.IterateEnumerable enumerable) + + type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + (delayed()).Fold f + + type EmptyEnumerable<'T> () = + inherit EnumerableBase<'T>() + + static let singleton = EmptyEnumerable<'T>() :> ISeq<'T> static member Instance = singleton interface IEnumerable<'T> with @@ -527,14 +524,13 @@ namespace Microsoft.FSharp.Collections interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (Enumerable.Enumerable<'T,'V>(this, next, 1)) + Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateEnumerable this) - module Array = - type Enumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit Enumerable.EnumeratorBase<'U>(result, activity) + type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) let mutable idx = 0 @@ -556,24 +552,23 @@ namespace Microsoft.FSharp.Collections result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type Enumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit Enumerable.EnumerableBase<'U>() + type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new Enumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) + Upcast.enumerator (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new Enumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, 1)) + Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) - module ResizeArray = - type Enumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit Enumerable.EnumeratorBase<'U>(result, activity) + type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) let mutable idx = 0 @@ -595,24 +590,23 @@ namespace Microsoft.FSharp.Collections result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type Enumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit Enumerable.EnumerableBase<'U>() + type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new Enumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) + Upcast.enumerator (new ResizeArrayEnumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new Enumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, 1)) + Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) - module List = - type Enumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit Enumerable.EnumeratorBase<'U>(result, activity) + type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) let mutable list = alist @@ -635,27 +629,23 @@ namespace Microsoft.FSharp.Collections result.SeqState <- SeqProcessNextStates.InProcess moveNext list - type Enumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit Enumerable.EnumerableBase<'U>() + type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new Enumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) + Upcast.enumerator (new ListEnumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new Enumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) - let create alist current = - Upcast.seq (Enumerable(alist, current, 1)) - - module Unfold = - type Enumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = - inherit Enumerable.EnumeratorBase<'U>(result, activity) + type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) let mutable current = state @@ -674,34 +664,22 @@ namespace Microsoft.FSharp.Collections result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type Enumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit Enumerable.EnumerableBase<'U>() + type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new Enumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) + Upcast.enumerator (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new Enumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + Upcast.seq (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateUnfold (generator, state)) - module Init = - // The original implementation of "init" delayed the calculation of Current, and so it was possible - // to do MoveNext without it's value being calculated. - // I can imagine only two scenerios where that is possibly sane, although a simple solution is readily - // at hand in both cases. The first is that of an expensive generator function, where you skip the - // first n elements. The simple solution would have just been to have a map ((+) n) as the first operation - // instead. The second case would be counting elements, but that is only of use if you're not filtering - // or mapping or doing anything else (as that would cause Current to be evaluated!) and - // so you already know what the count is!! Anyway, someone thought it was a good idea, so - // I have had to add an extra function that is used in Skip to determine if we are touching - // Current or not. - - let getTerminatingIdx (count:Nullable) = + let getInitTerminatingIdx (count:Nullable) = // we are offset by 1 to allow for values going up to System.Int32.MaxValue // System.Int32.MaxValue is an illegal value for the "infinite" sequence if count.HasValue then @@ -709,8 +687,8 @@ namespace Microsoft.FSharp.Collections else System.Int32.MaxValue - type Enumerator<'T,'U>(count:Nullable, f:int->'T, activity:Activity<'T,'U>, result:Result<'U>) = - inherit Enumerable.EnumeratorBase<'U>(result, activity) + type InitEnumerator<'T,'U>(count:Nullable, f:int->'T, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) let isSkipping = match box activity with @@ -718,7 +696,7 @@ namespace Microsoft.FSharp.Collections | _ -> fun () -> false let terminatingIdx = - getTerminatingIdx count + getInitTerminatingIdx count let mutable maybeSkipping = true let mutable idx = -1 @@ -751,74 +729,87 @@ namespace Microsoft.FSharp.Collections result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type Enumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit Enumerable.EnumerableBase<'U>() + type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new Enumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) + Upcast.enumerator (new InitEnumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new Enumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + Upcast.seq (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (createResult:PipeIdx->Folder<'U,'Result,'State>) = - let terminatingIdx = getTerminatingIdx count + let terminatingIdx = getInitTerminatingIdx count Fold.execute createResult transformFactory pipeIdx (Fold.IterateInit (f, terminatingIdx)) - let upto lastOption f = - match lastOption with - | Some b when b<0 -> failwith "library implementation error: upto can never be called with a negative value" - | _ -> - let unstarted = -1 // index value means unstarted (and no valid index) - let completed = -2 // index value means completed (and no valid index) - let unreachable = -3 // index is unreachable from 0,1,2,3,... - let finalIndex = match lastOption with - | Some b -> b // here b>=0, a valid end value. - | None -> unreachable // run "forever", well as far as Int32.MaxValue since indexing with a bounded type. - // The Current value for a valid index is "f i". - // Lazy<_> values are used as caches, to store either the result or an exception if thrown. - // These "Lazy<_>" caches are created only on the first call to current and forced immediately. - // The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. - // For example, the full enumeration of Seq.initInfinite in the tests. - // state - let index = ref unstarted - // a Lazy node to cache the result/exception - let current = ref (Unchecked.defaultof<_>) - let setIndex i = index := i; current := (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. - let getCurrent() = - if !index = unstarted then notStarted() - if !index = completed then alreadyFinished() - match box !current with - | null -> current := Lazy<_>.Create(fun () -> f !index) - | _ -> () - // forced or re-forced immediately. - (!current).Force() - { new IEnumerator<'U> with - member x.Current = getCurrent() - interface IEnumerator with - member x.Current = box (getCurrent()) - member x.MoveNext() = - if !index = completed then - false - elif !index = unstarted then - setIndex 0 - true - else ( - if !index = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) - if !index = finalIndex then + // The original implementation of "init" delayed the calculation of Current, and so it was possible + // to do MoveNext without it's value being calculated. + // I can imagine only two scenerios where that is possibly sane, although a simple solution is readily + // at hand in both cases. The first is that of an expensive generator function, where you skip the + // first n elements. The simple solution would have just been to have a map ((+) n) as the first operation + // instead. The second case would be counting elements, but that is only of use if you're not filtering + // or mapping or doing anything else (as that would cause Current to be evaluated!) and + // so you already know what the count is!! Anyway, someone thought it was a good idea, so + // I have had to add an extra function that is used in Skip to determine if we are touching + // Current or not. + // InitEnumerableDecider returns the original implementation of init when GetEnumerator is called + // If any Activites are added to the pipeline then the original implementation is ignored, as special + // handling has been added to Current isn't calculated whilst skipping enumerated items. + type InitEnumerableDecider<'T>(count:Nullable, f:int->'T, pipeIdx:PipeIdx) = + inherit EnumerableBase<'T>() + + let upto lastOption f = + match lastOption with + | Some b when b<0 -> failwith "library implementation error: upto can never be called with a negative value" + | _ -> + let unstarted = -1 // index value means unstarted (and no valid index) + let completed = -2 // index value means completed (and no valid index) + let unreachable = -3 // index is unreachable from 0,1,2,3,... + let finalIndex = match lastOption with + | Some b -> b // here b>=0, a valid end value. + | None -> unreachable // run "forever", well as far as Int32.MaxValue since indexing with a bounded type. + // The Current value for a valid index is "f i". + // Lazy<_> values are used as caches, to store either the result or an exception if thrown. + // These "Lazy<_>" caches are created only on the first call to current and forced immediately. + // The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. + // For example, the full enumeration of Seq.initInfinite in the tests. + // state + let index = ref unstarted + // a Lazy node to cache the result/exception + let current = ref (Unchecked.defaultof<_>) + let setIndex i = index := i; current := (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. + let getCurrent() = + if !index = unstarted then notStarted() + if !index = completed then alreadyFinished() + match box !current with + | null -> current := Lazy<_>.Create(fun () -> f !index) + | _ -> () + // forced or re-forced immediately. + (!current).Force() + { new IEnumerator<'U> with + member x.Current = getCurrent() + interface IEnumerator with + member x.Current = box (getCurrent()) + member x.MoveNext() = + if !index = completed then false - else - setIndex (!index + 1) + elif !index = unstarted then + setIndex 0 true - ) - member this.Reset() = noReset() - interface System.IDisposable with - member x.Dispose () = () } - - type EnumerableDecider<'T>(count:Nullable, f:int->'T, pipeIdx:PipeIdx) = - inherit Enumerable.EnumerableBase<'T>() + else ( + if !index = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + if !index = finalIndex then + false + else + setIndex (!index + 1) + true + ) + member this.Reset() = noReset() + interface System.IDisposable with + member x.Dispose () = () } interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = @@ -829,23 +820,28 @@ namespace Microsoft.FSharp.Collections interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (Enumerable<'T,'V>(count, f, next, pipeIdx+1)) + Upcast.seq (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateEnumerable (Upcast.enumerable this)) + /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray + /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. + /// i.e. usually iteration on calls the enumerator provied by GetEnumerator ensure that the + /// list hasn't been modified (throwing an exception if it has), but such a check is not + /// performed in this case. If you want this funcitonality, then use the ofSeq function instead. [] let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = - Upcast.seq (ResizeArray.Enumerable (source, IdentityFactory.Instance, 1)) + Upcast.seq (Wrap.ResizeArrayEnumerable (source, IdentityFactory.Instance, 1)) [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - Upcast.seq (Array.Enumerable (source, IdentityFactory.Instance, 1)) + Upcast.seq (Wrap.ArrayEnumerable (source, IdentityFactory.Instance, 1)) [] let ofList (source:list<'T>) : ISeq<'T> = - Upcast.seq (List.Enumerable (source, IdentityFactory.Instance, 1)) + Upcast.seq (Wrap.ListEnumerable (source, IdentityFactory.Instance, 1)) [] let ofSeq (source:seq<'T>) : ISeq<'T> = @@ -854,7 +850,7 @@ namespace Microsoft.FSharp.Collections | :? array<'T> as array -> ofArray array | :? list<'T> as list -> ofList list | null -> nullArg "source" - | _ -> Upcast.seq (Enumerable.EnumerableThin<'T> source) + | _ -> Upcast.seq (Wrap.ThinEnumerable<'T> source) [] let inline average (source:ISeq<'T>) = @@ -887,7 +883,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () }) [] - let empty<'T> = EmptyEnumerable.Enumerable<'T>.Instance + let empty<'T> = Wrap.EmptyEnumerable<'T>.Instance [] let exactlyOne (source:ISeq<'T>) : 'T = @@ -933,17 +929,17 @@ namespace Microsoft.FSharp.Collections [] let unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = - Upcast.seq (new Unfold.Enumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) + Upcast.seq (new Wrap.UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) [] let initInfinite<'T> (f:int->'T) : ISeq<'T> = - Upcast.seq (new Init.EnumerableDecider<'T>(Nullable (), f, 1)) + Upcast.seq (new Wrap.InitEnumerableDecider<'T>(Nullable (), f, 1)) [] let init<'T> (count:int) (f:int->'T) : ISeq<'T> = if count < 0 then invalidArgInputMustBeNonNegative "count" count elif count = 0 then empty else - Upcast.seq (new Init.EnumerableDecider<'T>(Nullable count, f, 1)) + Upcast.seq (new Wrap.InitEnumerableDecider<'T>(Nullable count, f, 1)) [] let inline iter f (source:ISeq<'T>) = @@ -1308,7 +1304,7 @@ namespace Microsoft.FSharp.Collections [] let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - Upcast.seq (Enumerable.ConcatEnumerable (sources, id)) + Upcast.seq (Wrap.ConcatEnumerable (sources, id)) [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = @@ -1578,12 +1574,12 @@ namespace Microsoft.FSharp.Collections [] let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = match source1 with - | :? Enumerable.EnumerableBase<'T> as s -> s.Append source2 - | _ -> Upcast.seq (new Enumerable.AppendEnumerable<_>([source2; source1])) + | :? Wrap.EnumerableBase<'T> as s -> s.Append source2 + | _ -> Upcast.seq (new Wrap.AppendEnumerable<_>([source2; source1])) [] let delay (delayed:unit->ISeq<'T>) = - Upcast.seq (Enumerable.SeqDelayed (delayed, 1)) + Upcast.seq (Wrap.DelayedEnumerable (delayed, 1)) module internal GroupBy = let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = @@ -1820,7 +1816,7 @@ namespace Microsoft.FSharp.Collections interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new Enumerable.Enumerable<'T,'U>(cached, next, 1)) + Upcast.seq (new Wrap.VanillaEnumerable<'T,'U>(cached, next, 1)) member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateEnumerable cached) From 17b0b17c5403375d0d97a74549f8e785ce02da51 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 27 Mar 2017 12:09:19 +1100 Subject: [PATCH 024/120] Add special handling for length --- src/fsharp/FSharp.Core/iseq.fs | 61 ++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 09c9edb4ea7..93d2d34abef 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -428,14 +428,23 @@ namespace Microsoft.FSharp.Collections main.Dispose () active.Dispose () + let length (source:ISeq<_>) = + source.Fold (fun _ -> + upcast { new Folder<'T,int,NoValue>(0,Unchecked.defaultof<_>) with + override this.ProcessNext v = + this.Result <- this.Result + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + [] type EnumerableBase<'T> () = let derivedClassShouldImplement () = failwith "library implementation error: derived class should implement (should be abstract)" - abstract member Append : (ISeq<'T>) -> ISeq<'T> + abstract member Append : ISeq<'T> -> ISeq<'T> + abstract member Length : unit -> int default this.Append source = Upcast.seq (AppendEnumerable [source; this]) + default this.Length () = length this interface IEnumerable with member this.GetEnumerator () : IEnumerator = @@ -485,9 +494,20 @@ namespace Microsoft.FSharp.Collections override this.Append source = Upcast.seq (AppendEnumerable (source::sources)) + /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = inherit EnumerableBase<'T>() + override __.Length () = + match enumerable with + | :? ICollection<'T> as a -> a.Count + | _ -> + use e = enumerable.GetEnumerator () + let mutable count = 0 + while e.MoveNext () do + count <- count + 1 + count + interface IEnumerable<'T> with member this.GetEnumerator () = enumerable.GetEnumerator () @@ -501,6 +521,11 @@ namespace Microsoft.FSharp.Collections type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() + override __.Length () = + match delayed() with + | :? EnumerableBase<'T> as s -> s.Length () + | s -> length s + interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () @@ -517,6 +542,8 @@ namespace Microsoft.FSharp.Collections static let singleton = EmptyEnumerable<'T>() :> ISeq<'T> static member Instance = singleton + override __.Length () = 0 + interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = IEnumerator.Empty<'T>() @@ -555,6 +582,12 @@ namespace Microsoft.FSharp.Collections type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() + override this.Length () = + if obj.ReferenceEquals (transformFactory, IdentityFactory<'U>.Instance) then + array.Length + else + length this + interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () @@ -593,6 +626,12 @@ namespace Microsoft.FSharp.Collections type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() + override this.Length () = + if obj.ReferenceEquals (transformFactory, IdentityFactory<'U>.Instance) then + resizeArray.Count + else + length this + interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () @@ -632,6 +671,12 @@ namespace Microsoft.FSharp.Collections type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() + override this.Length () = + if obj.ReferenceEquals (transformFactory, IdentityFactory<'U>.Instance) then + alist.Length + else + length this + interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () @@ -811,6 +856,12 @@ namespace Microsoft.FSharp.Collections interface System.IDisposable with member x.Dispose () = () } + override this.Length () = + if count.HasValue then + count.Value + else + raise (System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue))) + interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = // we defer back to the original implementation as, as it's quite idiomatic in it's decision @@ -1657,11 +1708,9 @@ namespace Microsoft.FSharp.Collections [] let length (source:ISeq<'T>) = - source.Fold (fun _ -> - upcast { new Folder<'T,int,NoValue>(0,Unchecked.defaultof<_>) with - override this.ProcessNext v = - this.Result <- this.Result + 1 - Unchecked.defaultof<_> (* return value unused in Fold context *) }) + match source with + | :? Wrap.EnumerableBase<'T> as s -> s.Length () + | _ -> Wrap.length source [] let toArray (source:ISeq<'T>) = From e67bc2146a8795a6bb288619c638d385aec43b4c Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 27 Mar 2017 13:10:26 +1100 Subject: [PATCH 025/120] use UnfoldEnumerable directly in cache --- src/fsharp/FSharp.Core/iseq.fs | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 93d2d34abef..cf90d6f12f8 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -144,6 +144,7 @@ namespace Microsoft.FSharp.Collections // is fixed with the compiler then these functions can be removed. let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) + let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) @@ -1831,20 +1832,21 @@ namespace Microsoft.FSharp.Collections enumeratorR <- None // drop it and record finished. | _ -> () - let cached = - unfold (fun i -> - // i being the next position to be returned - // A lock is needed over the reads to prefix.Count since the list may be being resized - // NOTE: we could change to a reader/writer lock here - lock sync (fun () -> + let unfolding i = + // i being the next position to be returned + // A lock is needed over the reads to prefix.Count since the list may be being resized + // NOTE: we could change to a reader/writer lock here + lock sync (fun () -> + if i < prefix.Count then + Some (prefix.[i], i+1) + else + oneStepTo i if i < prefix.Count then Some (prefix.[i], i+1) else - oneStepTo i - if i < prefix.Count then - Some (prefix.[i], i+1) - else - None)) 0 + None) + + let cached = Upcast.seq (new Wrap.UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1)) interface System.IDisposable with member __.Dispose() = @@ -1861,14 +1863,11 @@ namespace Microsoft.FSharp.Collections member __.GetEnumerator() = cached.GetEnumerator() interface System.Collections.IEnumerable with - member __.GetEnumerator() = (cached :> System.Collections.IEnumerable).GetEnumerator() + member __.GetEnumerator() = (Upcast.enumerableNonGeneric cached).GetEnumerator() interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new Wrap.VanillaEnumerable<'T,'U>(cached, next, 1)) - - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.IterateEnumerable cached) + member __.PushTransform next = cached.PushTransform next + member __.Fold f = cached.Fold f member this.Clear() = (this :> IDisposable).Dispose () From c315ee7d274f5905352f2833b84019d50066680c Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 27 Mar 2017 18:56:37 +1100 Subject: [PATCH 026/120] Added IReadOnlyCollection to length handling --- src/fsharp/FSharp.Core/iseq.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index cf90d6f12f8..a10e67b7705 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -502,6 +502,7 @@ namespace Microsoft.FSharp.Collections override __.Length () = match enumerable with | :? ICollection<'T> as a -> a.Count + | :? IReadOnlyCollection<'T> as a -> a.Count | _ -> use e = enumerable.GetEnumerator () let mutable count = 0 From 39a8928cf3db056278cd0dd3c39ea4e42256fada Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 28 Mar 2017 13:13:52 +1100 Subject: [PATCH 027/120] On 'take 0' set halted; check HaltedIdx up front --- src/fsharp/FSharp.Core/iseq.fs | 53 ++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index a10e67b7705..d5cfbbd3fdd 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -209,10 +209,9 @@ namespace Microsoft.FSharp.Collections member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = use enumerator = enumerable.GetEnumerator () let rec iterate () = - if enumerator.MoveNext () then + if outOfBand.HaltedIdx = 0 && enumerator.MoveNext () then consumer.ProcessNext enumerator.Current |> ignore - if outOfBand.HaltedIdx = 0 then - iterate () + iterate () iterate () [] @@ -221,10 +220,9 @@ namespace Microsoft.FSharp.Collections member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let array = array let rec iterate idx = - if idx < array.Length then + if outOfBand.HaltedIdx = 0 && idx < array.Length then consumer.ProcessNext array.[idx] |> ignore - if outOfBand.HaltedIdx = 0 then - iterate (idx+1) + iterate (idx+1) iterate 0 [] @@ -233,10 +231,9 @@ namespace Microsoft.FSharp.Collections member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let array = array let rec iterate idx = - if idx < array.Count then + if outOfBand.HaltedIdx = 0 && idx < array.Count then consumer.ProcessNext array.[idx] |> ignore - if outOfBand.HaltedIdx = 0 then - iterate (idx+1) + iterate (idx+1) iterate 0 [] @@ -245,10 +242,9 @@ namespace Microsoft.FSharp.Collections member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let rec iterate lst = match lst with - | hd :: tl -> + | hd :: tl when outOfBand.HaltedIdx = 0 -> consumer.ProcessNext hd |> ignore - if outOfBand.HaltedIdx = 0 then - iterate tl + iterate tl | _ -> () iterate alist @@ -258,12 +254,13 @@ namespace Microsoft.FSharp.Collections member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = let generator = generator let rec iterate current = - match generator current with - | Some (item, next) -> - consumer.ProcessNext item |> ignore - if outOfBand.HaltedIdx = 0 then + if outOfBand.HaltedIdx <> 0 then () + else + match generator current with + | Some (item, next) -> + consumer.ProcessNext item |> ignore iterate next - | _ -> () + | _ -> () iterate state [] @@ -697,14 +694,17 @@ namespace Microsoft.FSharp.Collections let mutable current = state let rec moveNext () = - match result.HaltedIdx, generator current with - | 0, Some (item, nextState) -> - current <- nextState - if activity.ProcessNext item then - true - else - moveNext () - | _ -> false + if result.HaltedIdx <> 0 then + false + else + match generator current with + | Some (item, nextState) -> + current <- nextState + if activity.ProcessNext item then + true + else + moveNext () + | _ -> false interface IEnumerator with member __.MoveNext () = @@ -1439,6 +1439,9 @@ namespace Microsoft.FSharp.Collections let take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new TransformFactory<'T,'T>() with member __.Compose outOfBand pipelineIdx next = + if takeCount = 0 then + outOfBand.StopFurtherProcessing pipelineIdx + upcast { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = From 2453142467bfe24b6370a29a07e0118c2d220a1d Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 28 Mar 2017 14:30:29 +1100 Subject: [PATCH 028/120] Conditional around IReadOnlyCollection --- src/fsharp/FSharp.Core/iseq.fs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index d5cfbbd3fdd..dcc9d1e1b5e 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -499,7 +499,9 @@ namespace Microsoft.FSharp.Collections override __.Length () = match enumerable with | :? ICollection<'T> as a -> a.Count +#if !FSCORE_PORTABLE_OLD | :? IReadOnlyCollection<'T> as a -> a.Count +#endif | _ -> use e = enumerable.GetEnumerator () let mutable count = 0 From 302dfbfc0e807aff9b1f18c317a07b8b3ec50742 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 29 Mar 2017 18:19:10 +1100 Subject: [PATCH 029/120] Use InitEnumerable for replicate --- src/fsharp/FSharp.Core/iseq.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index dcc9d1e1b5e..266fefd877f 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1898,7 +1898,7 @@ namespace Microsoft.FSharp.Collections [] let replicate count x = - System.Linq.Enumerable.Repeat(x,count) |> ofSeq + Upcast.seq (new Wrap.InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) [] let isEmpty (source : ISeq<'T>) = From ea813d4d1ffdd137aa875818a83a3092b892040a Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 29 Mar 2017 19:19:34 +1100 Subject: [PATCH 030/120] singleton --- src/fsharp/FSharp.Core/iseq.fs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 266fefd877f..0c00212b71f 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -248,6 +248,13 @@ namespace Microsoft.FSharp.Collections | _ -> () iterate alist + [] + type IterateSingleton<'T> (item:'T) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + if outOfBand.HaltedIdx = 0 then + consumer.ProcessNext item |> ignore + [] type IterateUnfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = interface IIterate<'T> with @@ -601,6 +608,21 @@ namespace Microsoft.FSharp.Collections member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) + type SingletonEnumerable<'T>(item:'T) = + inherit EnumerableBase<'T>() + + override __.Length () = 1 + + interface IEnumerable<'T> with + member this.GetEnumerator () = Upcast.enumerator (new Singleton<'T>(item)) + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ArrayEnumerable<'T,'U>([|item|], next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.IterateSingleton item) + type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -2007,7 +2029,7 @@ namespace Microsoft.FSharp.Collections nth i e [] - let singleton x = mkSeq (fun () -> IEnumerator.Singleton x) |> ofSeq + let singleton x = Upcast.seq (new Wrap.SingletonEnumerable<_>(x)) [] let inline sortDescending source = From d137a8870209a06b45b860c865f8e2388ecdaec3 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 29 Mar 2017 19:26:39 +1100 Subject: [PATCH 031/120] Add ArgumentOutOfRangeException for replicate --- src/fsharp/FSharp.Core/iseq.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 0c00212b71f..651d6b70a44 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1920,6 +1920,7 @@ namespace Microsoft.FSharp.Collections [] let replicate count x = + if count < 0 then raise (ArgumentOutOfRangeException "count") Upcast.seq (new Wrap.InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) [] From 6927cfd0143ba9c1adff2b63cdf103f8f9fe6c4d Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 1 Apr 2017 06:24:50 +1100 Subject: [PATCH 032/120] Added thin wrappers for array, list, ResizeArray --- src/fsharp/FSharp.Core/iseq.fs | 73 +++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 651d6b70a44..75923060860 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -590,12 +590,6 @@ namespace Microsoft.FSharp.Collections type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() - override this.Length () = - if obj.ReferenceEquals (transformFactory, IdentityFactory<'U>.Instance) then - array.Length - else - length this - interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () @@ -603,11 +597,26 @@ namespace Microsoft.FSharp.Collections interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, 1)) + Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) + type ThinArrayEnumerable<'T>(array:array<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = array.Length + + interface IEnumerable<'T> with + member this.GetEnumerator () = array.GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.IterateArray array) + type SingletonEnumerable<'T>(item:'T) = inherit EnumerableBase<'T>() @@ -649,12 +658,6 @@ namespace Microsoft.FSharp.Collections type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() - override this.Length () = - if obj.ReferenceEquals (transformFactory, IdentityFactory<'U>.Instance) then - resizeArray.Count - else - length this - interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () @@ -662,11 +665,26 @@ namespace Microsoft.FSharp.Collections interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, 1)) + Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) + type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = resizeArray.Count + + interface IEnumerable<'T> with + member this.GetEnumerator () = (Upcast.enumerable resizeArray).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.IterateResizeArray resizeArray) + type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -694,12 +712,6 @@ namespace Microsoft.FSharp.Collections type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() - override this.Length () = - if obj.ReferenceEquals (transformFactory, IdentityFactory<'U>.Instance) then - alist.Length - else - length this - interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () @@ -712,6 +724,21 @@ namespace Microsoft.FSharp.Collections member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) + type ThinListEnumerable<'T>(alist:list<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = alist.Length + + interface IEnumerable<'T> with + member this.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.IterateList alist) + type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -909,16 +936,16 @@ namespace Microsoft.FSharp.Collections /// performed in this case. If you want this funcitonality, then use the ofSeq function instead. [] let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = - Upcast.seq (Wrap.ResizeArrayEnumerable (source, IdentityFactory.Instance, 1)) + Upcast.seq (Wrap.ThinResizeArrayEnumerable<'T> source) [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - Upcast.seq (Wrap.ArrayEnumerable (source, IdentityFactory.Instance, 1)) + Upcast.seq (Wrap.ThinArrayEnumerable<'T> source) [] let ofList (source:list<'T>) : ISeq<'T> = - Upcast.seq (Wrap.ListEnumerable (source, IdentityFactory.Instance, 1)) + Upcast.seq (Wrap.ThinListEnumerable<'T> source) [] let ofSeq (source:seq<'T>) : ISeq<'T> = From 12098c817e52011434dad21901721e83e8422135 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 1 Apr 2017 10:59:48 +1100 Subject: [PATCH 033/120] call correct GetEnumerator on array --- src/fsharp/FSharp.Core/iseq.fs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 75923060860..2d2a4999cbb 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -458,9 +458,11 @@ namespace Microsoft.FSharp.Collections Upcast.enumeratorNonGeneric genericEnumerator interface IEnumerable<'T> with + // fsharp doesn't allow abstract interface methods member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () interface ISeq<'T> with + // fsharp doesn't allow abstract interface methods member __.PushTransform _ = derivedClassShouldImplement () member __.Fold _ = derivedClassShouldImplement () @@ -517,13 +519,13 @@ namespace Microsoft.FSharp.Collections count interface IEnumerable<'T> with - member this.GetEnumerator () = enumerable.GetEnumerator () + member __.GetEnumerator () = enumerable.GetEnumerator () interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateEnumerable enumerable) type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = @@ -541,7 +543,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = (delayed()).Fold f type EmptyEnumerable<'T> () = @@ -591,7 +593,7 @@ namespace Microsoft.FSharp.Collections inherit EnumerableBase<'U>() interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = + member __.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () Upcast.enumerator (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) @@ -599,7 +601,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) type ThinArrayEnumerable<'T>(array:array<'T>) = @@ -608,13 +610,13 @@ namespace Microsoft.FSharp.Collections override __.Length () = array.Length interface IEnumerable<'T> with - member this.GetEnumerator () = array.GetEnumerator () + member __.GetEnumerator () = (Upcast.enumerable array).GetEnumerator () interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateArray array) type SingletonEnumerable<'T>(item:'T) = @@ -667,7 +669,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = @@ -676,13 +678,13 @@ namespace Microsoft.FSharp.Collections override __.Length () = resizeArray.Count interface IEnumerable<'T> with - member this.GetEnumerator () = (Upcast.enumerable resizeArray).GetEnumerator () + member __.GetEnumerator () = (Upcast.enumerable resizeArray).GetEnumerator () interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateResizeArray resizeArray) type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = @@ -730,13 +732,13 @@ namespace Microsoft.FSharp.Collections override __.Length () = alist.Length interface IEnumerable<'T> with - member this.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () + member __.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateList alist) type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = From 1c68b01e7667526c5d36298d32421037bd295e9f Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 1 Apr 2017 12:56:14 +1100 Subject: [PATCH 034/120] scan use singleton --- src/fsharp/FSharp.Core/iseq.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 2d2a4999cbb..040ab0d144a 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1412,9 +1412,12 @@ namespace Microsoft.FSharp.Collections let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = Upcast.seq (Wrap.ConcatEnumerable (sources, id)) + [] + let singleton x = Upcast.seq (new Wrap.SingletonEnumerable<_>(x)) + [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = - let head = ofSeq [| initialState |] + let head = singleton initialState let tail = source.PushTransform { new TransformFactory<'T,'State>() with override __.Compose _ _ next = @@ -2058,9 +2061,6 @@ namespace Microsoft.FSharp.Collections use e = source.GetEnumerator() nth i e - [] - let singleton x = Upcast.seq (new Wrap.SingletonEnumerable<_>(x)) - [] let inline sortDescending source = let inline compareDescending a b = compare b a From 8c9a9330ad1cf6acb7c11194ce744eb34f55ae31 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 1 Apr 2017 15:02:30 +1100 Subject: [PATCH 035/120] Created Fold for Concat --- src/fsharp/FSharp.Core/iseq.fs | 208 ++++++++++++++++++++------------- 1 file changed, 125 insertions(+), 83 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 040ab0d144a..763284334b7 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -330,6 +330,29 @@ namespace Microsoft.FSharp.Collections finally result.ChainDispose (&stopTailCall) + let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>>(createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = + let mutable stopTailCall = () + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + + try + let common = + { new Folder<'T,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + override me.ProcessNext value = consumer.ProcessNext value } + + sources.Fold (fun _ -> + { new Folder<'Collection,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + override me.ProcessNext value = + value.Fold (fun _ -> common) |> ignore + me.HaltedIdx <- common.HaltedIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore + + consumer.ChainComplete (&stopTailCall, result.HaltedIdx) + result.Result + + finally + result.ChainDispose (&stopTailCall) + module Wrap = type EmptyEnumerator<'T>() = let current () = failwith "library implementation error: Current should never be called" @@ -395,43 +418,68 @@ namespace Microsoft.FSharp.Collections let mutable stopTailCall = () activity.ChainDispose (&stopTailCall) - type ConcatEnumerator<'T, 'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>) = - let mutable state = SeqProcessNextStates.NotStarted + type ConcatEnumerator<'T,'U,'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + let main = sources.GetEnumerator () let mutable active = EmptyEnumerators.Element let rec moveNext () = - if active.MoveNext () then - true - elif main.MoveNext () then - active.Dispose () - active <- main.Current.GetEnumerator () - moveNext () + if result.HaltedIdx <> 0 then false else - state <- SeqProcessNextStates.Finished - false - - interface IEnumerator<'T> with - member __.Current = - if state = SeqProcessNextStates.InProcess then active.Current + if active.MoveNext () then + if activity.ProcessNext active.Current then + true + else + moveNext () + elif main.MoveNext () then + active.Dispose () + active <- main.Current.GetEnumerator () + moveNext () else - match state with - | SeqProcessNextStates.NotStarted -> notStarted() - | SeqProcessNextStates.Finished -> alreadyFinished() - | _ -> failwith "library implementation error: all states should have been handled" + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false interface IEnumerator with - member this.Current = box ((Upcast.enumerator this)).Current member __.MoveNext () = - state <- SeqProcessNextStates.InProcess + result.SeqState <- SeqProcessNextStates.InProcess moveNext () - member __.Reset () = noReset () interface IDisposable with member __.Dispose () = - main.Dispose () - active.Dispose () + try + main.Dispose () + active.Dispose () + finally + let mutable stopTailCall = () + activity.ChainDispose (&stopTailCall) + + type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let mutable list = alist + + let rec moveNext current = + match result.HaltedIdx, current with + | 0, head::tail -> + if activity.ProcessNext head then + list <- tail + true + else + moveNext tail + | _ -> + result.SeqState <- SeqProcessNextStates.Finished + let mutable stopTailCall = () + activity.ChainComplete (&stopTailCall, result.HaltedIdx) + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext list let length (source:ISeq<_>) = source.Fold (fun _ -> @@ -481,26 +529,74 @@ namespace Microsoft.FSharp.Collections member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) - and ConcatEnumerable<'T, 'Collection, 'Collections when 'Collection :> seq<'T> and 'Collections :> seq<'Collection>> (sources:'Collections, preEnumerate:'Collections->'Collections) = + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member __.GetEnumerator () : IEnumerator<'U> = + System.Console.WriteLine "ThinConcatEnumerable.GetEnumerator" + let result = Result<'U> () + Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold current result pipeIdx, result)) + + interface ISeq<'U> with + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.executeConcat f current pipeIdx sources + + and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = inherit EnumerableBase<'T>() interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = - Upcast.enumerator (new ConcatEnumerator<_,_> (preEnumerate sources)) + System.Console.WriteLine "ThinConcatEnumerable.GetEnumerator" + let result = Result<'T> () + Upcast.enumerator (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) + Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.IterateEnumerable this) + Fold.executeConcat f IdentityFactory.Instance 1 (preEnumerate sources) and AppendEnumerable<'T> (sources:list>) = - inherit ConcatEnumerable<'T, ISeq<'T>, list>>(sources, List.rev) + inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (ThinListEnumerable>(List.rev sources))) override this.Append source = Upcast.seq (AppendEnumerable (source::sources)) + and ThinListEnumerable<'T>(alist:list<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = alist.Length + + interface IEnumerable<'T> with + member __.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) + + member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + Fold.executeThin f (Fold.IterateList alist) + + and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new ListEnumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) + /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = inherit EnumerableBase<'T>() @@ -687,60 +783,6 @@ namespace Microsoft.FSharp.Collections member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = Fold.executeThin f (Fold.IterateResizeArray resizeArray) - type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let mutable list = alist - - let rec moveNext current = - match result.HaltedIdx, current with - | 0, head::tail -> - if activity.ProcessNext head then - list <- tail - true - else - moveNext tail - | _ -> - result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext list - - type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new ListEnumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) - - type ThinListEnumerable<'T>(alist:list<'T>) = - inherit EnumerableBase<'T>() - - override __.Length () = alist.Length - - interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) - - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeThin f (Fold.IterateList alist) - type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -1410,7 +1452,7 @@ namespace Microsoft.FSharp.Collections [] let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - Upcast.seq (Wrap.ConcatEnumerable (sources, id)) + Upcast.seq (Wrap.ThinConcatEnumerable (sources, id)) [] let singleton x = Upcast.seq (new Wrap.SingletonEnumerable<_>(x)) From 08cefa80c0843ae0b53f531f63406b676fa1deb7 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 1 Apr 2017 18:00:15 +1100 Subject: [PATCH 036/120] Removed debugging WriteLines --- src/fsharp/FSharp.Core/iseq.fs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 763284334b7..2395d8c67b5 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -534,7 +534,6 @@ namespace Microsoft.FSharp.Collections interface IEnumerable<'U> with member __.GetEnumerator () : IEnumerator<'U> = - System.Console.WriteLine "ThinConcatEnumerable.GetEnumerator" let result = Result<'U> () Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold current result pipeIdx, result)) @@ -550,7 +549,6 @@ namespace Microsoft.FSharp.Collections interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = - System.Console.WriteLine "ThinConcatEnumerable.GetEnumerator" let result = Result<'T> () Upcast.enumerator (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) From 5e7715a08e71e1cbeddd1d264ff7acd45194cb5b Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 1 Apr 2017 18:29:43 +1100 Subject: [PATCH 037/120] Added executeConcatThin --- src/fsharp/FSharp.Core/iseq.fs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 2395d8c67b5..7b2ac0bece0 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -330,11 +330,10 @@ namespace Microsoft.FSharp.Collections finally result.ChainDispose (&stopTailCall) - let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>>(createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = + let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = let mutable stopTailCall = () let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx - try let common = { new Folder<'T,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with @@ -349,7 +348,26 @@ namespace Microsoft.FSharp.Collections consumer.ChainComplete (&stopTailCall, result.HaltedIdx) result.Result + finally + result.ChainDispose (&stopTailCall) + + let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result,'State>) (sources:ISeq<'Collection>) = + let mutable stopTailCall = () + let result = createFolder 1 + try + let common = + { new Folder<'T,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + override me.ProcessNext value = result.ProcessNext value } + sources.Fold (fun _ -> + { new Folder<'Collection,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + override me.ProcessNext value = + value.Fold (fun _ -> common) |> ignore + me.HaltedIdx <- common.HaltedIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore + + result.ChainComplete (&stopTailCall, result.HaltedIdx) + result.Result finally result.ChainDispose (&stopTailCall) @@ -557,7 +575,7 @@ namespace Microsoft.FSharp.Collections Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = - Fold.executeConcat f IdentityFactory.Instance 1 (preEnumerate sources) + Fold.executeConcatThin f (preEnumerate sources) and AppendEnumerable<'T> (sources:list>) = inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (ThinListEnumerable>(List.rev sources))) From cdacfb00a6c8c8a3f7a73acd90e53414ecec2fb3 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 5 Apr 2017 19:00:18 +1000 Subject: [PATCH 038/120] Cleaning API surface; removed stopTailCall --- .../SurfaceArea.net40.fs | 24 +++--- src/fsharp/FSharp.Core/iseq.fs | 75 ++++++++----------- src/fsharp/FSharp.Core/iseq.fsi | 4 +- 3 files changed, 45 insertions(+), 58 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 68f68639609..57ffbf2cdc0 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -284,16 +284,16 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Obj Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() @@ -303,8 +303,8 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResul Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) @@ -317,8 +317,8 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System. Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) @@ -340,8 +340,8 @@ Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TRe Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) @@ -351,8 +351,8 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Syst Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 7b2ac0bece0..4432ac481e0 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -48,8 +48,8 @@ namespace Microsoft.FSharp.Collections [] type Activity() = - abstract ChainComplete : stopTailCall:byref * PipeIdx -> unit - abstract ChainDispose : stopTailCall:byref -> unit + abstract ChainComplete : PipeIdx -> unit + abstract ChainDispose : unit -> unit [] type Activity<'T,'U> () = @@ -69,10 +69,10 @@ namespace Microsoft.FSharp.Collections val mutable State : 'State val Next : Activity - override this.ChainComplete (stopTailCall, terminatingIdx) = - this.Next.ChainComplete (&stopTailCall, terminatingIdx) - override this.ChainDispose stopTailCall = - this.Next.ChainDispose (&stopTailCall) + override this.ChainComplete terminatingIdx = + this.Next.ChainComplete terminatingIdx + override this.ChainDispose () = + this.Next.ChainDispose () [] type TransformWithPostProcessing<'T,'U,'State>(next:Activity, initState:'State) = @@ -81,12 +81,12 @@ namespace Microsoft.FSharp.Collections abstract OnComplete : PipeIdx -> unit abstract OnDispose : unit -> unit - override this.ChainComplete (stopTailCall, terminatingIdx) = + override this.ChainComplete terminatingIdx = this.OnComplete terminatingIdx - this.Next.ChainComplete (&stopTailCall, terminatingIdx) - override this.ChainDispose stopTailCall = + this.Next.ChainComplete terminatingIdx + override this.ChainDispose () = try this.OnDispose () - finally this.Next.ChainDispose (&stopTailCall) + finally this.Next.ChainDispose () [] type Folder<'T,'Result,'State> = @@ -107,8 +107,8 @@ namespace Microsoft.FSharp.Collections Result = initalResult } - override this.ChainComplete (_,_) = () - override this.ChainDispose _ = () + override this.ChainComplete _ = () + override this.ChainDispose () = () [] type FolderWithPostProcessing<'T,'Result,'State>(initResult,initState) = @@ -117,9 +117,9 @@ namespace Microsoft.FSharp.Collections abstract OnComplete : PipeIdx -> unit abstract OnDispose : unit -> unit - override this.ChainComplete (stopTailCall, terminatingIdx) = + override this.ChainComplete terminatingIdx = this.OnComplete terminatingIdx - override this.ChainDispose _ = + override this.ChainDispose () = this.OnDispose () [] @@ -307,31 +307,28 @@ namespace Microsoft.FSharp.Collections // execute, and it's companion, executeThin, are hosting functions that ensure the correct sequence // of creation, iteration and disposal for the pipeline let execute (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = - let mutable stopTailCall = () let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx try executeOn.Iterate result consumer - consumer.ChainComplete (&stopTailCall, result.HaltedIdx) + consumer.ChainComplete result.HaltedIdx result.Result finally - consumer.ChainDispose (&stopTailCall) + consumer.ChainDispose () // executeThin is a specialization of execute, provided as a performance optimization, that can // be used when a sequence has been wrapped in an ISeq, but hasn't had an items added to its pipeline // i.e. a container that has ISeq.ofSeq applied. let executeThin (createFolder:PipeIdx->Folder<'T,'Result,'State>) (executeOn:#IIterate<'T>) = - let mutable stopTailCall = () let result = createFolder 1 try executeOn.Iterate result result - result.ChainComplete (&stopTailCall, result.HaltedIdx) + result.ChainComplete result.HaltedIdx result.Result finally - result.ChainDispose (&stopTailCall) + result.ChainDispose () let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = - let mutable stopTailCall = () let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx try @@ -346,13 +343,12 @@ namespace Microsoft.FSharp.Collections me.HaltedIdx <- common.HaltedIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - consumer.ChainComplete (&stopTailCall, result.HaltedIdx) + consumer.ChainComplete result.HaltedIdx result.Result finally - result.ChainDispose (&stopTailCall) + result.ChainDispose () let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result,'State>) (sources:ISeq<'Collection>) = - let mutable stopTailCall = () let result = createFolder 1 try let common = @@ -366,10 +362,10 @@ namespace Microsoft.FSharp.Collections me.HaltedIdx <- common.HaltedIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - result.ChainComplete (&stopTailCall, result.HaltedIdx) + result.ChainComplete result.HaltedIdx result.Result finally - result.ChainDispose (&stopTailCall) + result.ChainDispose () module Wrap = type EmptyEnumerator<'T>() = @@ -391,8 +387,7 @@ namespace Microsoft.FSharp.Collections type EnumeratorBase<'T>(result:Result<'T>, activity:Activity) = interface IDisposable with member __.Dispose () : unit = - let mutable stopTailCall = () - activity.ChainDispose (&stopTailCall) + activity.ChainDispose () interface IEnumerator with member this.Current : obj = box ((Upcast.enumerator this)).Current @@ -419,8 +414,7 @@ namespace Microsoft.FSharp.Collections moveNext () else result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) + activity.ChainComplete result.HaltedIdx false interface IEnumerator with @@ -433,8 +427,7 @@ namespace Microsoft.FSharp.Collections try source.Dispose () finally - let mutable stopTailCall = () - activity.ChainDispose (&stopTailCall) + activity.ChainDispose () type ConcatEnumerator<'T,'U,'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -457,8 +450,7 @@ namespace Microsoft.FSharp.Collections moveNext () else result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) + activity.ChainComplete result.HaltedIdx false interface IEnumerator with @@ -472,8 +464,7 @@ namespace Microsoft.FSharp.Collections main.Dispose () active.Dispose () finally - let mutable stopTailCall = () - activity.ChainDispose (&stopTailCall) + activity.ChainDispose () type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -490,8 +481,7 @@ namespace Microsoft.FSharp.Collections moveNext tail | _ -> result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) + activity.ChainComplete result.HaltedIdx false interface IEnumerator with @@ -692,8 +682,7 @@ namespace Microsoft.FSharp.Collections moveNext () else result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) + activity.ChainComplete result.HaltedIdx false interface IEnumerator with @@ -760,8 +749,7 @@ namespace Microsoft.FSharp.Collections moveNext () else result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) + activity.ChainComplete result.HaltedIdx false interface IEnumerator with @@ -878,8 +866,7 @@ namespace Microsoft.FSharp.Collections raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) else result.SeqState <- SeqProcessNextStates.Finished - let mutable stopTailCall = () - activity.ChainComplete (&stopTailCall, result.HaltedIdx) + activity.ChainComplete result.HaltedIdx false interface IEnumerator with diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 69917c10647..a7f24719ead 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -56,10 +56,10 @@ namespace Microsoft.FSharp.Collections /// operation which didn't have a source at least as large as was required). It is /// not called in the case of an exception being thrown whilst the stream is still /// being processed. - abstract ChainComplete : stopTailCall:byref*PipeIdx -> unit + abstract ChainComplete : PipeIdx -> unit /// OnDispose is used to cleanup the stream. It is always called at the last operation /// after the enumeration has completed. - abstract ChainDispose : stopTailCall:byref -> unit + abstract ChainDispose : unit -> unit /// Activity is the base class of all elements within the pipeline [] From 6aa55b4c495ce5a0f59264567a988af577c8f7cf Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 5 Apr 2017 20:01:24 +1000 Subject: [PATCH 039/120] Cleaning API surface; remove 'State from Fold --- src/fsharp/FSharp.Core/iseq.fs | 119 +++++++++++++++++--------------- src/fsharp/FSharp.Core/iseq.fsi | 18 +++-- 2 files changed, 77 insertions(+), 60 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 4432ac481e0..8cd288a3bc0 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -89,20 +89,18 @@ namespace Microsoft.FSharp.Collections finally this.Next.ChainDispose () [] - type Folder<'T,'Result,'State> = + type Folder<'T,'Result> = inherit Activity<'T,'T> val mutable Result : 'Result - val mutable State : 'State val mutable HaltedIdx : int member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx interface IOutOfBand with member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx - new (initalResult,initState) = { + new (initalResult) = { inherit Activity<'T,'T>() - State = initState HaltedIdx = 0 Result = initalResult } @@ -110,9 +108,20 @@ namespace Microsoft.FSharp.Collections override this.ChainComplete _ = () override this.ChainDispose () = () + [] + type FolderWithState<'T,'Result,'State> = + inherit Folder<'T,'Result> + + val mutable State : 'State + + new (initalResult,initState) = { + inherit Folder<'T,'Result>(initalResult) + State = initState + } + [] type FolderWithPostProcessing<'T,'Result,'State>(initResult,initState) = - inherit Folder<'T,'Result,'State>(initResult,initState) + inherit FolderWithState<'T,'Result,'State>(initResult,initState) abstract OnComplete : PipeIdx -> unit abstract OnDispose : unit -> unit @@ -129,7 +138,7 @@ namespace Microsoft.FSharp.Collections type ISeq<'T> = inherit IEnumerable<'T> abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result,'State> : f:(PipeIdx->Folder<'T,'Result,'State>) -> 'Result + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result open Core @@ -149,7 +158,7 @@ namespace Microsoft.FSharp.Collections let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_,_>) pipeIdx = + let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_>) pipeIdx = factory.Compose (Upcast.outOfBand folder) pipeIdx folder let inline valueComparer<'T when 'T : equality> ()= @@ -184,7 +193,7 @@ namespace Microsoft.FSharp.Collections | Finished = 2 type Result<'T>() = - inherit Folder<'T,'T,NoValue>(Unchecked.defaultof<'T>,Unchecked.defaultof) + inherit Folder<'T,'T>(Unchecked.defaultof<'T>) member val SeqState = SeqProcessNextStates.NotStarted with get, set @@ -201,12 +210,12 @@ namespace Microsoft.FSharp.Collections // each time one of these were called. This has been an optimization to minimize the impact // on very small collections. type IIterate<'T> = - abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result,'State> -> consumer:Activity<'T,'U> -> unit + abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result> -> consumer:Activity<'T,'U> -> unit [] type IterateEnumerable<'T> (enumerable:IEnumerable<'T>) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = use enumerator = enumerable.GetEnumerator () let rec iterate () = if outOfBand.HaltedIdx = 0 && enumerator.MoveNext () then @@ -217,7 +226,7 @@ namespace Microsoft.FSharp.Collections [] type IterateArray<'T> (array:array<'T>) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = let array = array let rec iterate idx = if outOfBand.HaltedIdx = 0 && idx < array.Length then @@ -228,7 +237,7 @@ namespace Microsoft.FSharp.Collections [] type IterateResizeArray<'T> (array:ResizeArray<'T>) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = let array = array let rec iterate idx = if outOfBand.HaltedIdx = 0 && idx < array.Count then @@ -239,7 +248,7 @@ namespace Microsoft.FSharp.Collections [] type IterateList<'T> (alist:list<'T>) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = let rec iterate lst = match lst with | hd :: tl when outOfBand.HaltedIdx = 0 -> @@ -251,14 +260,14 @@ namespace Microsoft.FSharp.Collections [] type IterateSingleton<'T> (item:'T) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = if outOfBand.HaltedIdx = 0 then consumer.ProcessNext item |> ignore [] type IterateUnfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = let generator = generator let rec iterate current = if outOfBand.HaltedIdx <> 0 then () @@ -273,7 +282,7 @@ namespace Microsoft.FSharp.Collections [] type IterateInit<'T> (f:int->'T, terminatingIdx:int) = interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result,'State>) (consumer:Activity<'T,'U>) = + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = let terminatingIdx = terminatingIdx let f = f @@ -306,7 +315,7 @@ namespace Microsoft.FSharp.Collections // execute, and it's companion, executeThin, are hosting functions that ensure the correct sequence // of creation, iteration and disposal for the pipeline - let execute (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = + let execute (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx try @@ -319,7 +328,7 @@ namespace Microsoft.FSharp.Collections // executeThin is a specialization of execute, provided as a performance optimization, that can // be used when a sequence has been wrapped in an ISeq, but hasn't had an items added to its pipeline // i.e. a container that has ISeq.ofSeq applied. - let executeThin (createFolder:PipeIdx->Folder<'T,'Result,'State>) (executeOn:#IIterate<'T>) = + let executeThin (createFolder:PipeIdx->Folder<'T,'Result>) (executeOn:#IIterate<'T>) = let result = createFolder 1 try executeOn.Iterate result result @@ -328,16 +337,16 @@ namespace Microsoft.FSharp.Collections finally result.ChainDispose () - let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result,'State>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = + let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx try - let common = - { new Folder<'T,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with - override me.ProcessNext value = consumer.ProcessNext value } + let common = + { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = consumer.ProcessNext value } sources.Fold (fun _ -> - { new Folder<'Collection,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with override me.ProcessNext value = value.Fold (fun _ -> common) |> ignore me.HaltedIdx <- common.HaltedIdx @@ -348,15 +357,15 @@ namespace Microsoft.FSharp.Collections finally result.ChainDispose () - let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result,'State>) (sources:ISeq<'Collection>) = + let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result>) (sources:ISeq<'Collection>) = let result = createFolder 1 try let common = - { new Folder<'T,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with override me.ProcessNext value = result.ProcessNext value } sources.Fold (fun _ -> - { new Folder<'Collection,NoValue,NoValue>(Unchecked.defaultof<_>,Unchecked.defaultof<_>) with + { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with override me.ProcessNext value = value.Fold (fun _ -> common) |> ignore me.HaltedIdx <- common.HaltedIdx @@ -491,7 +500,7 @@ namespace Microsoft.FSharp.Collections let length (source:ISeq<_>) = source.Fold (fun _ -> - upcast { new Folder<'T,int,NoValue>(0,Unchecked.defaultof<_>) with + { new Folder<'T,int>(0) with override this.ProcessNext v = this.Result <- this.Result + 1 Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -534,7 +543,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = @@ -549,7 +558,7 @@ namespace Microsoft.FSharp.Collections member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine current next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = Fold.executeConcat f current pipeIdx sources and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = @@ -564,7 +573,7 @@ namespace Microsoft.FSharp.Collections member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeConcatThin f (preEnumerate sources) and AppendEnumerable<'T> (sources:list>) = @@ -585,7 +594,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateList alist) and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = @@ -600,7 +609,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list @@ -627,7 +636,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateEnumerable enumerable) type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = @@ -645,7 +654,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = (delayed()).Fold f type EmptyEnumerable<'T> () = @@ -665,7 +674,7 @@ namespace Microsoft.FSharp.Collections member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateEnumerable this) type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = @@ -702,7 +711,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) type ThinArrayEnumerable<'T>(array:array<'T>) = @@ -717,7 +726,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateArray array) type SingletonEnumerable<'T>(item:'T) = @@ -732,7 +741,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ArrayEnumerable<'T,'U>([|item|], next, 1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateSingleton item) type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = @@ -769,7 +778,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = @@ -784,7 +793,7 @@ namespace Microsoft.FSharp.Collections member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) - member __.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateResizeArray resizeArray) type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = @@ -822,7 +831,7 @@ namespace Microsoft.FSharp.Collections member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'U,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = Fold.execute f transformFactory pipeIdx (Fold.IterateUnfold (generator, state)) let getInitTerminatingIdx (count:Nullable) = @@ -886,7 +895,7 @@ namespace Microsoft.FSharp.Collections member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result,'State> (createResult:PipeIdx->Folder<'U,'Result,'State>) = + member this.Fold<'Result> (createResult:PipeIdx->Folder<'U,'Result>) = let terminatingIdx = getInitTerminatingIdx count Fold.execute createResult transformFactory pipeIdx (Fold.IterateInit (f, terminatingIdx)) @@ -973,7 +982,7 @@ namespace Microsoft.FSharp.Collections member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) - member this.Fold<'Result,'State> (f:PipeIdx->Folder<'T,'Result,'State>) = + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = Fold.executeThin f (Fold.IterateEnumerable (Upcast.enumerable this)) /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray @@ -1059,7 +1068,7 @@ namespace Microsoft.FSharp.Collections [] let inline fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:ISeq<'T>) : 'State = source.Fold (fun _ -> - upcast { new Folder<'T,'State,NoValue>(seed,Unchecked.defaultof) with + { new Folder<'T,'State>(seed) with override this.ProcessNext value = this.Result <- f this.Result value Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -1095,7 +1104,7 @@ namespace Microsoft.FSharp.Collections [] let inline iter f (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new Folder<'T,unit,NoValue> ((),Unchecked.defaultof) with + { new Folder<'T,unit> (()) with override this.ProcessNext value = f value Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -1132,7 +1141,7 @@ namespace Microsoft.FSharp.Collections [] let tryHead (source:ISeq<'T>) = source.Fold (fun pipeIdx -> - upcast { new Folder<'T, Option<'T>,NoValue> (None,Unchecked.defaultof) with + { new Folder<'T, Option<'T>> (None) with override this.ProcessNext value = this.Result <- Some value this.StopFurtherProcessing pipeIdx @@ -1147,7 +1156,7 @@ namespace Microsoft.FSharp.Collections [] let inline iteri f (source:ISeq<'T>) = source.Fold (fun _ -> - { new Folder<'T,unit,int> ((),0) with + upcast { new FolderWithState<'T,unit,int> ((),0) with override this.ProcessNext value = f this.State value this.State <- this.State + 1 @@ -1164,7 +1173,7 @@ namespace Microsoft.FSharp.Collections [] let inline exists f (source:ISeq<'T>) = source.Fold (fun pipeIdx -> - upcast { new Folder<'T, bool,NoValue> (false,Unchecked.defaultof) with + { new Folder<'T, bool> (false) with override this.ProcessNext value = if f value then this.Result <- true @@ -1190,7 +1199,7 @@ namespace Microsoft.FSharp.Collections [] let inline contains element (source:ISeq<'T>) = source.Fold (fun pipeIdx -> - upcast { new Folder<'T, bool,NoValue> (false,Unchecked.defaultof) with + { new Folder<'T, bool> (false) with override this.ProcessNext value = if element = value then this.Result <- true @@ -1200,7 +1209,7 @@ namespace Microsoft.FSharp.Collections [] let inline forall predicate (source:ISeq<'T>) = source.Fold (fun pipeIdx -> - upcast { new Folder<'T, bool,NoValue> (true,Unchecked.defaultof) with + { new Folder<'T, bool> (true) with override this.ProcessNext value = if not (predicate value) then this.Result <- false @@ -1523,7 +1532,7 @@ namespace Microsoft.FSharp.Collections [] let inline sum (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new Folder<'T,'T,NoValue> (LanguagePrimitives.GenericZero,Unchecked.defaultof) with + { new Folder<'T,'T> (LanguagePrimitives.GenericZero) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result value Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -1531,7 +1540,7 @@ namespace Microsoft.FSharp.Collections [] let inline sumBy (f:'T->'U) (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new Folder<'T,'U,NoValue> (LanguagePrimitives.GenericZero<'U>,Unchecked.defaultof) with + { new Folder<'T,'U> (LanguagePrimitives.GenericZero<'U>) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result (f value) Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -1641,7 +1650,7 @@ namespace Microsoft.FSharp.Collections [] let inline tryPick f (source:ISeq<'T>) = source.Fold (fun pipeIdx -> - upcast { new Folder<'T, Option<'U>,NoValue> (None,Unchecked.defaultof) with + { new Folder<'T, Option<'U>> (None) with override this.ProcessNext value = match f value with | (Some _) as some -> @@ -1653,7 +1662,7 @@ namespace Microsoft.FSharp.Collections [] let inline tryFind f (source:ISeq<'T>) = source.Fold (fun pipeIdx -> - upcast { new Folder<'T, Option<'T>,NoValue> (None,Unchecked.defaultof) with + { new Folder<'T, Option<'T>> (None) with override this.ProcessNext value = if f value then this.Result <- Some value @@ -1663,7 +1672,7 @@ namespace Microsoft.FSharp.Collections [] let inline tryFindIndex (predicate:'T->bool) (source:ISeq<'T>) : int option = source.Fold (fun pipeIdx -> - { new Folder<'T, Option, int>(None, 0) with + upcast { new FolderWithState<'T, Option, int>(None, 0) with // member this.index = this.State override this.ProcessNext value = if predicate value then diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index a7f24719ead..1b0957291a0 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -94,15 +94,23 @@ namespace Microsoft.FSharp.Collections /// is as a base class for an object expression that will be used from within /// the Fold function. [] - type Folder<'T,'Result,'State> = + type Folder<'T,'Result> = inherit Activity<'T,'T> - new : 'Result*'State -> Folder<'T,'Result,'State> + new : 'Result -> Folder<'T,'Result> interface IOutOfBand - val mutable State : 'State val mutable Result : 'Result val mutable HaltedIdx : int member StopFurtherProcessing : PipeIdx -> unit + /// Folder is a base class to assist with fold-like operations. It's intended usage + /// is as a base class for an object expression that will be used from within + /// the Fold function. + [] + type FolderWithState<'T,'Result,'State> = + inherit Folder<'T,'Result> + new : 'Result*'State -> FolderWithState<'T,'Result,'State> + val mutable State : 'State + /// Folder is a base class to assist with fold-like operations /// and performs some post processing on the pipeline, either in the case of the stream /// ending sucessfully or when disposed. It's intended usage @@ -110,7 +118,7 @@ namespace Microsoft.FSharp.Collections /// the Fold function. [] type FolderWithPostProcessing<'T,'Result,'State> = - inherit Folder<'T,'Result,'State> + inherit FolderWithState<'T,'Result,'State> new : 'Result*'State -> FolderWithPostProcessing<'T,'Result,'State> abstract OnDispose : unit -> unit abstract OnComplete : PipeIdx -> unit @@ -128,7 +136,7 @@ namespace Microsoft.FSharp.Collections type ISeq<'T> = inherit System.Collections.Generic.IEnumerable<'T> abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result,'State> : f:(PipeIdx->Folder<'T,'Result,'State>) -> 'Result + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result open Core From 18b78c89347c1a166d4c263e44a99ef8829c9ad5 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 6 Apr 2017 09:25:17 +1000 Subject: [PATCH 040/120] Moved minimal ISeq into seqcore.fsi --- .../ISeqModule.fs | 2 +- src/fsharp/FSharp.Core/iseq.fs | 44 +------------ src/fsharp/FSharp.Core/iseq.fsi | 56 +--------------- src/fsharp/FSharp.Core/seqcore.fs | 53 +++++++++++++++ src/fsharp/FSharp.Core/seqcore.fsi | 66 +++++++++++++++++++ 5 files changed, 122 insertions(+), 99 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs index 873fd4274e9..65531fdf073 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs @@ -19,7 +19,7 @@ Make sure each method works on: * Null ISeq (null) *) -type iseq<'a> = ISeq.Core.ISeq<'a> +type iseq<'a> = FSharp.Collections.SeqComposition.ISeq<'a> [] type ISeqModule() = diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 8cd288a3bc0..c93d4ad1d93 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -14,6 +14,7 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Control open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics + open Microsoft.FSharp.Collections.SeqComposition [] module ISeq = @@ -41,21 +42,6 @@ namespace Microsoft.FSharp.Collections val mutable _3 : 'c new (a:'a, b:'b, c:'c) = { _1 = a; _2 = b; _3 = c } - type PipeIdx = int - - type IOutOfBand = - abstract StopFurtherProcessing : PipeIdx -> unit - - [] - type Activity() = - abstract ChainComplete : PipeIdx -> unit - abstract ChainDispose : unit -> unit - - [] - type Activity<'T,'U> () = - inherit Activity() - abstract ProcessNext : input:'T -> bool - [] type Transform<'T,'U,'State> = inherit Activity<'T,'U> @@ -88,26 +74,6 @@ namespace Microsoft.FSharp.Collections try this.OnDispose () finally this.Next.ChainDispose () - [] - type Folder<'T,'Result> = - inherit Activity<'T,'T> - - val mutable Result : 'Result - - val mutable HaltedIdx : int - member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx - interface IOutOfBand with - member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx - - new (initalResult) = { - inherit Activity<'T,'T>() - HaltedIdx = 0 - Result = initalResult - } - - override this.ChainComplete _ = () - override this.ChainDispose () = () - [] type FolderWithState<'T,'Result,'State> = inherit Folder<'T,'Result> @@ -131,14 +97,6 @@ namespace Microsoft.FSharp.Collections override this.ChainDispose () = this.OnDispose () - [] - type TransformFactory<'T,'U> () = - abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> - - type ISeq<'T> = - inherit IEnumerable<'T> - abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result open Core diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 1b0957291a0..5beeaceb35b 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -7,6 +7,7 @@ namespace Microsoft.FSharp.Collections open System.Collections.Generic open Microsoft.FSharp.Core open Microsoft.FSharp.Collections + open Microsoft.FSharp.Collections.SeqComposition [] module ISeq = @@ -38,35 +39,6 @@ namespace Microsoft.FSharp.Collections val mutable _2: 'b val mutable _3: 'c - /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the - /// source of the chain. - type PipeIdx = int - - /// Used within the pipline to provide out of band communications - type IOutOfBand = - /// Stop the processing of any further items down the pipeline - abstract StopFurtherProcessing : PipeIdx -> unit - - /// Activity is the root class for chains of activities. It is in a non-generic - /// form so that it can be used by subsequent activities - [] - type Activity = - /// OnComplete is used to determine if the object has been processed correctly, - /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take - /// operation which didn't have a source at least as large as was required). It is - /// not called in the case of an exception being thrown whilst the stream is still - /// being processed. - abstract ChainComplete : PipeIdx -> unit - /// OnDispose is used to cleanup the stream. It is always called at the last operation - /// after the enumeration has completed. - abstract ChainDispose : unit -> unit - - /// Activity is the base class of all elements within the pipeline - [] - type Activity<'T,'U> = - inherit Activity - new : unit -> Activity<'T,'U> - abstract member ProcessNext : input:'T -> bool /// An activity that transforms the input from 'T to 'U, using 'State. It's intended usage /// is as a base class for an object expression that will be created @@ -90,17 +62,6 @@ namespace Microsoft.FSharp.Collections abstract OnComplete : PipeIdx -> unit abstract OnDispose : unit -> unit - /// Folder is a base class to assist with fold-like operations. It's intended usage - /// is as a base class for an object expression that will be used from within - /// the Fold function. - [] - type Folder<'T,'Result> = - inherit Activity<'T,'T> - new : 'Result -> Folder<'T,'Result> - interface IOutOfBand - val mutable Result : 'Result - val mutable HaltedIdx : int - member StopFurtherProcessing : PipeIdx -> unit /// Folder is a base class to assist with fold-like operations. It's intended usage /// is as a base class for an object expression that will be used from within @@ -123,21 +84,6 @@ namespace Microsoft.FSharp.Collections abstract OnDispose : unit -> unit abstract OnComplete : PipeIdx -> unit - /// TransformFactory provides composition of Activities. Its intended to have a specialization - /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack - /// of Actvities that will be composed. - [] - type TransformFactory<'T,'U> = - new : unit -> TransformFactory<'T,'U> - abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> - - /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities - /// as well as Fold the current Activity pipeline. - type ISeq<'T> = - inherit System.Collections.Generic.IEnumerable<'T> - abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result - open Core /// ofResizeArrayUnchecked creates an ISeq over a ResizeArray that accesses the underlying diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 71bfc1601ca..8ec7b1f13ae 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -135,6 +135,59 @@ namespace Microsoft.FSharp.Collections interface IEnumerable with member x.GetEnumerator() = (f() :> IEnumerator) } +namespace Microsoft.FSharp.Collections.SeqComposition + + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + + type PipeIdx = int + + type IOutOfBand = + abstract StopFurtherProcessing : PipeIdx -> unit + + [] + type Activity() = + abstract ChainComplete : PipeIdx -> unit + abstract ChainDispose : unit -> unit + + [] + type Activity<'T,'U> () = + inherit Activity() + abstract ProcessNext : input:'T -> bool + + [] + type Folder<'T,'Result> = + inherit Activity<'T,'T> + + val mutable Result : 'Result + + val mutable HaltedIdx : int + member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx + interface IOutOfBand with + member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx + + new (initalResult) = { + inherit Activity<'T,'T>() + HaltedIdx = 0 + Result = initalResult + } + + override this.ChainComplete _ = () + override this.ChainDispose () = () + + [] + type TransformFactory<'T,'U> () = + abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + type ISeq<'T> = + inherit IEnumerable<'T> + abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + + namespace Microsoft.FSharp.Core.CompilerServices open System diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index a1aea443aeb..6e4114fec4a 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -55,6 +55,72 @@ namespace Microsoft.FSharp.Collections f:(unit -> System.Collections.Generic.IEnumerator<'U>) -> System.Collections.Generic.IEnumerable<'U> +namespace Microsoft.FSharp.Collections.SeqComposition + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + + /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the + /// source of the chain. + type PipeIdx = int + + /// Used within the pipline to provide out of band communications + type IOutOfBand = + /// Stop the processing of any further items down the pipeline + abstract StopFurtherProcessing : PipeIdx -> unit + + /// Activity is the root class for chains of activities. It is in a non-generic + /// form so that it can be used by subsequent activities + [] + type Activity = + /// OnComplete is used to determine if the object has been processed correctly, + /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take + /// operation which didn't have a source at least as large as was required). It is + /// not called in the case of an exception being thrown whilst the stream is still + /// being processed. + abstract ChainComplete : PipeIdx -> unit + /// OnDispose is used to cleanup the stream. It is always called at the last operation + /// after the enumeration has completed. + abstract ChainDispose : unit -> unit + + /// Activity is the base class of all elements within the pipeline + [] + type Activity<'T,'U> = + inherit Activity + new : unit -> Activity<'T,'U> + abstract member ProcessNext : input:'T -> bool + + /// Folder is a base class to assist with fold-like operations. It's intended usage + /// is as a base class for an object expression that will be used from within + /// the Fold function. + [] + type Folder<'T,'Result> = + inherit Activity<'T,'T> + new : 'Result -> Folder<'T,'Result> + interface IOutOfBand + val mutable Result : 'Result + val mutable HaltedIdx : int + member StopFurtherProcessing : PipeIdx -> unit + override ChainComplete : PipeIdx -> unit + override ChainDispose : unit -> unit + + /// TransformFactory provides composition of Activities. Its intended to have a specialization + /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack + /// of Actvities that will be composed. + [] + type TransformFactory<'T,'U> = + new : unit -> TransformFactory<'T,'U> + abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities + /// as well as Fold the current Activity pipeline. + type ISeq<'T> = + inherit System.Collections.Generic.IEnumerable<'T> + abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + namespace Microsoft.FSharp.Core.CompilerServices open System From 8eb64443782f20f3e90726353eac9423fafad097 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 6 Apr 2017 12:21:52 +1000 Subject: [PATCH 041/120] Moved internal parts of ISeq into seqcore --- .../SurfaceArea.net40.fs | 216 ----- src/fsharp/FSharp.Core/iseq.fs | 865 +---------------- src/fsharp/FSharp.Core/iseq.fsi | 3 - src/fsharp/FSharp.Core/seqcore.fs | 916 +++++++++++++++++- src/fsharp/FSharp.Core/seqcore.fsi | 96 ++ 5 files changed, 1028 insertions(+), 1068 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 57ffbf2cdc0..7db771e825d 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -280,222 +280,6 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) -Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: TResult Fold[TResult,TState](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]]) -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Activity`2 Compose[V](IOutOfBand, Int32, Activity`2) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 -Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+NoValue -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] -Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 AllPairs[T1,T2](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cache[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cast[T](System.Collections.IEnumerable) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ChunkBySize[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Distinct[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Empty[T]() -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Except[T](System.Collections.Generic.IEnumerable`1[T], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Indexed[a](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], ISeq`1, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfArray[T](T[]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Replicate[T](Int32, T) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Singleton[T](T) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortDescending[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SplitInto[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip3[T1,T2,T3](ISeq`1, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Min[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], ISeq`1) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index c93d4ad1d93..ec01f198be7 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.FSharp.Collections - open System open System.Diagnostics open System.Collections @@ -15,15 +14,13 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Collections.SeqComposition + open Microsoft.FSharp.Collections.SeqComposition.Internal [] module ISeq = open IEnumerator module Core = - [] - type NoValue = struct end - [] type Value<'a> = val mutable _1 : 'a @@ -97,7 +94,6 @@ namespace Microsoft.FSharp.Collections override this.ChainDispose () = this.OnDispose () - open Core module internal TailCall = @@ -110,14 +106,7 @@ namespace Microsoft.FSharp.Collections // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality // is fixed with the compiler then these functions can be removed. let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) - let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) - let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) - let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) - let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - - let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_>) pipeIdx = - factory.Compose (Upcast.outOfBand folder) pipeIdx folder let inline valueComparer<'T when 'T : equality> ()= let c = HashIdentity.Structural<'T> @@ -125,824 +114,6 @@ namespace Microsoft.FSharp.Collections member __.GetHashCode o = c.GetHashCode o._1 member __.Equals (lhs,rhs) = c.Equals (lhs._1, rhs._1) } - type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = - inherit TransformFactory<'T,'V>() - - override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = - first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - - static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = - upcast ComposedFactory(first, second) - - and IdentityFactory<'T> private () = - inherit TransformFactory<'T,'T> () - static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) - override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next - static member Instance = singleton - - and ISkipable = - // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip - // and it can only do it at the start of a sequence - abstract CanSkip : unit -> bool - - type SeqProcessNextStates = - | InProcess = 0 - | NotStarted = 1 - | Finished = 2 - - type Result<'T>() = - inherit Folder<'T,'T>(Unchecked.defaultof<'T>) - - member val SeqState = SeqProcessNextStates.NotStarted with get, set - - override this.ProcessNext (input:'T) : bool = - this.Result <- input - true - - module Fold = - // The consumers of IIterate are the execute and exeuteThin methods. IIterate is passed - // as a generic argument. The types that implement IIterate are value types. This combination - // means that the runtime will "inline" the methods. The alternatives to this were that the - // code in execute/executeThin were duplicated for each of the Fold types, or we turned the - // types back into normal functions and curried them then we would be creating garbage - // each time one of these were called. This has been an optimization to minimize the impact - // on very small collections. - type IIterate<'T> = - abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result> -> consumer:Activity<'T,'U> -> unit - - [] - type IterateEnumerable<'T> (enumerable:IEnumerable<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - use enumerator = enumerable.GetEnumerator () - let rec iterate () = - if outOfBand.HaltedIdx = 0 && enumerator.MoveNext () then - consumer.ProcessNext enumerator.Current |> ignore - iterate () - iterate () - - [] - type IterateArray<'T> (array:array<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let array = array - let rec iterate idx = - if outOfBand.HaltedIdx = 0 && idx < array.Length then - consumer.ProcessNext array.[idx] |> ignore - iterate (idx+1) - iterate 0 - - [] - type IterateResizeArray<'T> (array:ResizeArray<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let array = array - let rec iterate idx = - if outOfBand.HaltedIdx = 0 && idx < array.Count then - consumer.ProcessNext array.[idx] |> ignore - iterate (idx+1) - iterate 0 - - [] - type IterateList<'T> (alist:list<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let rec iterate lst = - match lst with - | hd :: tl when outOfBand.HaltedIdx = 0 -> - consumer.ProcessNext hd |> ignore - iterate tl - | _ -> () - iterate alist - - [] - type IterateSingleton<'T> (item:'T) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - if outOfBand.HaltedIdx = 0 then - consumer.ProcessNext item |> ignore - - [] - type IterateUnfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let generator = generator - let rec iterate current = - if outOfBand.HaltedIdx <> 0 then () - else - match generator current with - | Some (item, next) -> - consumer.ProcessNext item |> ignore - iterate next - | _ -> () - iterate state - - [] - type IterateInit<'T> (f:int->'T, terminatingIdx:int) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let terminatingIdx = terminatingIdx - let f = f - - let firstIdx = - match box consumer with - | :? ISkipable as skipping -> - let rec skip idx = - if idx = terminatingIdx || outOfBand.HaltedIdx <> 0 then - terminatingIdx - elif skipping.CanSkip () then - skip (idx+1) - else - idx - skip -1 - | _ -> -1 - - let rec iterate idx = - if idx < terminatingIdx then - consumer.ProcessNext (f (idx+1)) |> ignore - if outOfBand.HaltedIdx = 0 then - iterate (idx+1) - else - idx - else - idx - - let finalIdx = iterate firstIdx - if outOfBand.HaltedIdx = 0 && finalIdx = System.Int32.MaxValue then - raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) - - // execute, and it's companion, executeThin, are hosting functions that ensure the correct sequence - // of creation, iteration and disposal for the pipeline - let execute (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx - try - executeOn.Iterate result consumer - consumer.ChainComplete result.HaltedIdx - result.Result - finally - consumer.ChainDispose () - - // executeThin is a specialization of execute, provided as a performance optimization, that can - // be used when a sequence has been wrapped in an ISeq, but hasn't had an items added to its pipeline - // i.e. a container that has ISeq.ofSeq applied. - let executeThin (createFolder:PipeIdx->Folder<'T,'Result>) (executeOn:#IIterate<'T>) = - let result = createFolder 1 - try - executeOn.Iterate result result - result.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () - - let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx - try - let common = - { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = consumer.ProcessNext value } - - sources.Fold (fun _ -> - { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = - value.Fold (fun _ -> common) |> ignore - me.HaltedIdx <- common.HaltedIdx - Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - - consumer.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () - - let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result>) (sources:ISeq<'Collection>) = - let result = createFolder 1 - try - let common = - { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = result.ProcessNext value } - - sources.Fold (fun _ -> - { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = - value.Fold (fun _ -> common) |> ignore - me.HaltedIdx <- common.HaltedIdx - Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - - result.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () - - module Wrap = - type EmptyEnumerator<'T>() = - let current () = failwith "library implementation error: Current should never be called" - interface IEnumerator<'T> with - member __.Current = current () - interface IEnumerator with - member __.Current = current () - member __.MoveNext () = false - member __.Reset (): unit = noReset () - interface IDisposable with - member __.Dispose () = () - - type EmptyEnumerators<'T>() = - static let element : IEnumerator<'T> = upcast (new EmptyEnumerator<'T> ()) - static member Element = element - - [] - type EnumeratorBase<'T>(result:Result<'T>, activity:Activity) = - interface IDisposable with - member __.Dispose () : unit = - activity.ChainDispose () - - interface IEnumerator with - member this.Current : obj = box ((Upcast.enumerator this)).Current - member __.MoveNext () = failwith "library implementation error: derived class should implement (should be abstract)" - member __.Reset () : unit = noReset () - - interface IEnumerator<'T> with - member __.Current = - if result.SeqState = SeqProcessNextStates.InProcess then result.Result - else - match result.SeqState with - | SeqProcessNextStates.NotStarted -> notStarted() - | SeqProcessNextStates.Finished -> alreadyFinished() - | _ -> failwith "library implementation error: all states should have been handled" - - type VanillaEnumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let rec moveNext () = - if (result.HaltedIdx = 0) && source.MoveNext () then - if activity.ProcessNext source.Current then - true - else - moveNext () - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - interface IDisposable with - member __.Dispose () = - try - source.Dispose () - finally - activity.ChainDispose () - - type ConcatEnumerator<'T,'U,'Collection when 'Collection :> seq<'T>> (sources:seq<'Collection>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let main = sources.GetEnumerator () - - let mutable active = EmptyEnumerators.Element - - let rec moveNext () = - if result.HaltedIdx <> 0 then false - else - if active.MoveNext () then - if activity.ProcessNext active.Current then - true - else - moveNext () - elif main.MoveNext () then - active.Dispose () - active <- main.Current.GetEnumerator () - moveNext () - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - interface IDisposable with - member __.Dispose () = - try - main.Dispose () - active.Dispose () - finally - activity.ChainDispose () - - type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let mutable list = alist - - let rec moveNext current = - match result.HaltedIdx, current with - | 0, head::tail -> - if activity.ProcessNext head then - list <- tail - true - else - moveNext tail - | _ -> - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext list - - let length (source:ISeq<_>) = - source.Fold (fun _ -> - { new Folder<'T,int>(0) with - override this.ProcessNext v = - this.Result <- this.Result + 1 - Unchecked.defaultof<_> (* return value unused in Fold context *) }) - - [] - type EnumerableBase<'T> () = - let derivedClassShouldImplement () = - failwith "library implementation error: derived class should implement (should be abstract)" - - abstract member Append : ISeq<'T> -> ISeq<'T> - abstract member Length : unit -> int - - default this.Append source = Upcast.seq (AppendEnumerable [source; this]) - default this.Length () = length this - - interface IEnumerable with - member this.GetEnumerator () : IEnumerator = - let genericEnumerable = Upcast.enumerable this - let genericEnumerator = genericEnumerable.GetEnumerator () - Upcast.enumeratorNonGeneric genericEnumerator - - interface IEnumerable<'T> with - // fsharp doesn't allow abstract interface methods - member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () - - interface ISeq<'T> with - // fsharp doesn't allow abstract interface methods - member __.PushTransform _ = derivedClassShouldImplement () - member __.Fold _ = derivedClassShouldImplement () - - and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold current result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) - - and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member __.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold current result pipeIdx, result)) - - interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine current next, pipeIdx+1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.executeConcat f current pipeIdx sources - - and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = - inherit EnumerableBase<'T>() - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = - let result = Result<'T> () - Upcast.enumerator (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) - - interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeConcatThin f (preEnumerate sources) - - and AppendEnumerable<'T> (sources:list>) = - inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (ThinListEnumerable>(List.rev sources))) - - override this.Append source = - Upcast.seq (AppendEnumerable (source::sources)) - - and ThinListEnumerable<'T>(alist:list<'T>) = - inherit EnumerableBase<'T>() - - override __.Length () = alist.Length - - interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateList alist) - - and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new ListEnumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) - - /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list - type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = - inherit EnumerableBase<'T>() - - override __.Length () = - match enumerable with - | :? ICollection<'T> as a -> a.Count -#if !FSCORE_PORTABLE_OLD - | :? IReadOnlyCollection<'T> as a -> a.Count -#endif - | _ -> - use e = enumerable.GetEnumerator () - let mutable count = 0 - while e.MoveNext () do - count <- count + 1 - count - - interface IEnumerable<'T> with - member __.GetEnumerator () = enumerable.GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateEnumerable enumerable) - - type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'T>() - - override __.Length () = - match delayed() with - | :? EnumerableBase<'T> as s -> s.Length () - | s -> length s - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - (delayed()).Fold f - - type EmptyEnumerable<'T> () = - inherit EnumerableBase<'T>() - - static let singleton = EmptyEnumerable<'T>() :> ISeq<'T> - static member Instance = singleton - - override __.Length () = 0 - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = IEnumerator.Empty<'T>() - - override this.Append source = source - - interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateEnumerable this) - - type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let mutable idx = 0 - - let rec moveNext () = - if (result.HaltedIdx = 0) && idx < array.Length then - idx <- idx+1 - if activity.ProcessNext array.[idx-1] then - true - else - moveNext () - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member __.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) - - type ThinArrayEnumerable<'T>(array:array<'T>) = - inherit EnumerableBase<'T>() - - override __.Length () = array.Length - - interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable array).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateArray array) - - type SingletonEnumerable<'T>(item:'T) = - inherit EnumerableBase<'T>() - - override __.Length () = 1 - - interface IEnumerable<'T> with - member this.GetEnumerator () = Upcast.enumerator (new Singleton<'T>(item)) - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ArrayEnumerable<'T,'U>([|item|], next, 1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateSingleton item) - - type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let mutable idx = 0 - - let rec moveNext () = - if (result.HaltedIdx = 0) && idx < array.Count then - idx <- idx+1 - if activity.ProcessNext array.[idx-1] then - true - else - moveNext () - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new ResizeArrayEnumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) - - type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = - inherit EnumerableBase<'T>() - - override __.Length () = resizeArray.Count - - interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable resizeArray).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) - - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateResizeArray resizeArray) - - type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let mutable current = state - - let rec moveNext () = - if result.HaltedIdx <> 0 then - false - else - match generator current with - | Some (item, nextState) -> - current <- nextState - if activity.ProcessNext item then - true - else - moveNext () - | _ -> false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateUnfold (generator, state)) - - let getInitTerminatingIdx (count:Nullable) = - // we are offset by 1 to allow for values going up to System.Int32.MaxValue - // System.Int32.MaxValue is an illegal value for the "infinite" sequence - if count.HasValue then - count.Value - 1 - else - System.Int32.MaxValue - - type InitEnumerator<'T,'U>(count:Nullable, f:int->'T, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let isSkipping = - match box activity with - | :? ISkipable as skip -> skip.CanSkip - | _ -> fun () -> false - - let terminatingIdx = - getInitTerminatingIdx count - - let mutable maybeSkipping = true - let mutable idx = -1 - - let rec moveNext () = - if result.HaltedIdx = 0 && idx < terminatingIdx then - idx <- idx + 1 - - if maybeSkipping then - // Skip can only is only checked at the start of the sequence, so once - // triggered, we stay triggered. - maybeSkipping <- isSkipping () - - if maybeSkipping then - moveNext () - elif activity.ProcessNext (f idx) then - true - else - moveNext () - elif result.HaltedIdx = 0 && idx = System.Int32.MaxValue then - raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new InitEnumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member this.Fold<'Result> (createResult:PipeIdx->Folder<'U,'Result>) = - let terminatingIdx = getInitTerminatingIdx count - Fold.execute createResult transformFactory pipeIdx (Fold.IterateInit (f, terminatingIdx)) - - // The original implementation of "init" delayed the calculation of Current, and so it was possible - // to do MoveNext without it's value being calculated. - // I can imagine only two scenerios where that is possibly sane, although a simple solution is readily - // at hand in both cases. The first is that of an expensive generator function, where you skip the - // first n elements. The simple solution would have just been to have a map ((+) n) as the first operation - // instead. The second case would be counting elements, but that is only of use if you're not filtering - // or mapping or doing anything else (as that would cause Current to be evaluated!) and - // so you already know what the count is!! Anyway, someone thought it was a good idea, so - // I have had to add an extra function that is used in Skip to determine if we are touching - // Current or not. - // InitEnumerableDecider returns the original implementation of init when GetEnumerator is called - // If any Activites are added to the pipeline then the original implementation is ignored, as special - // handling has been added to Current isn't calculated whilst skipping enumerated items. - type InitEnumerableDecider<'T>(count:Nullable, f:int->'T, pipeIdx:PipeIdx) = - inherit EnumerableBase<'T>() - - let upto lastOption f = - match lastOption with - | Some b when b<0 -> failwith "library implementation error: upto can never be called with a negative value" - | _ -> - let unstarted = -1 // index value means unstarted (and no valid index) - let completed = -2 // index value means completed (and no valid index) - let unreachable = -3 // index is unreachable from 0,1,2,3,... - let finalIndex = match lastOption with - | Some b -> b // here b>=0, a valid end value. - | None -> unreachable // run "forever", well as far as Int32.MaxValue since indexing with a bounded type. - // The Current value for a valid index is "f i". - // Lazy<_> values are used as caches, to store either the result or an exception if thrown. - // These "Lazy<_>" caches are created only on the first call to current and forced immediately. - // The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. - // For example, the full enumeration of Seq.initInfinite in the tests. - // state - let index = ref unstarted - // a Lazy node to cache the result/exception - let current = ref (Unchecked.defaultof<_>) - let setIndex i = index := i; current := (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. - let getCurrent() = - if !index = unstarted then notStarted() - if !index = completed then alreadyFinished() - match box !current with - | null -> current := Lazy<_>.Create(fun () -> f !index) - | _ -> () - // forced or re-forced immediately. - (!current).Force() - { new IEnumerator<'U> with - member x.Current = getCurrent() - interface IEnumerator with - member x.Current = box (getCurrent()) - member x.MoveNext() = - if !index = completed then - false - elif !index = unstarted then - setIndex 0 - true - else ( - if !index = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) - if !index = finalIndex then - false - else - setIndex (!index + 1) - true - ) - member this.Reset() = noReset() - interface System.IDisposable with - member x.Dispose () = () } - - override this.Length () = - if count.HasValue then - count.Value - else - raise (System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue))) - - interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = - // we defer back to the original implementation as, as it's quite idiomatic in it's decision - // to calculate Current in a lazy fashion. I doubt anyone is really using this functionality - // in the way presented, but it's possible. - upto (if count.HasValue then Some (count.Value-1) else None) f - - interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) - - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateEnumerable (Upcast.enumerable this)) - /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. /// i.e. usually iteration on calls the enumerator provied by GetEnumerator ensure that the @@ -950,16 +121,16 @@ namespace Microsoft.FSharp.Collections /// performed in this case. If you want this funcitonality, then use the ofSeq function instead. [] let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = - Upcast.seq (Wrap.ThinResizeArrayEnumerable<'T> source) + Upcast.seq (ThinResizeArrayEnumerable<'T> source) [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - Upcast.seq (Wrap.ThinArrayEnumerable<'T> source) + Upcast.seq (ThinArrayEnumerable<'T> source) [] let ofList (source:list<'T>) : ISeq<'T> = - Upcast.seq (Wrap.ThinListEnumerable<'T> source) + Upcast.seq (ThinListEnumerable<'T> source) [] let ofSeq (source:seq<'T>) : ISeq<'T> = @@ -968,7 +139,7 @@ namespace Microsoft.FSharp.Collections | :? array<'T> as array -> ofArray array | :? list<'T> as list -> ofList list | null -> nullArg "source" - | _ -> Upcast.seq (Wrap.ThinEnumerable<'T> source) + | _ -> Upcast.seq (ThinEnumerable<'T> source) [] let inline average (source:ISeq<'T>) = @@ -1001,7 +172,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () }) [] - let empty<'T> = Wrap.EmptyEnumerable<'T>.Instance + let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Internal.EmptyEnumerable<'T>.Instance [] let exactlyOne (source:ISeq<'T>) : 'T = @@ -1047,17 +218,17 @@ namespace Microsoft.FSharp.Collections [] let unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = - Upcast.seq (new Wrap.UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) + Upcast.seq (new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) [] let initInfinite<'T> (f:int->'T) : ISeq<'T> = - Upcast.seq (new Wrap.InitEnumerableDecider<'T>(Nullable (), f, 1)) + Upcast.seq (new InitEnumerableDecider<'T>(Nullable (), f, 1)) [] let init<'T> (count:int) (f:int->'T) : ISeq<'T> = if count < 0 then invalidArgInputMustBeNonNegative "count" count elif count = 0 then empty else - Upcast.seq (new Wrap.InitEnumerableDecider<'T>(Nullable count, f, 1)) + Upcast.seq (new InitEnumerableDecider<'T>(Nullable count, f, 1)) [] let inline iter f (source:ISeq<'T>) = @@ -1422,10 +593,10 @@ namespace Microsoft.FSharp.Collections [] let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - Upcast.seq (Wrap.ThinConcatEnumerable (sources, id)) + Upcast.seq (ThinConcatEnumerable (sources, id)) [] - let singleton x = Upcast.seq (new Wrap.SingletonEnumerable<_>(x)) + let singleton x = Upcast.seq (new SingletonEnumerable<_>(x)) [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = @@ -1698,12 +869,12 @@ namespace Microsoft.FSharp.Collections [] let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = match source1 with - | :? Wrap.EnumerableBase<'T> as s -> s.Append source2 - | _ -> Upcast.seq (new Wrap.AppendEnumerable<_>([source2; source1])) + | :? EnumerableBase<'T> as s -> s.Append source2 + | _ -> Upcast.seq (new AppendEnumerable<_>([source2; source1])) [] let delay (delayed:unit->ISeq<'T>) = - Upcast.seq (Wrap.DelayedEnumerable (delayed, 1)) + Upcast.seq (DelayedEnumerable (delayed, 1)) module internal GroupBy = let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = @@ -1782,8 +953,8 @@ namespace Microsoft.FSharp.Collections [] let length (source:ISeq<'T>) = match source with - | :? Wrap.EnumerableBase<'T> as s -> s.Length () - | _ -> Wrap.length source + | :? EnumerableBase<'T> as s -> s.Length () + | _ -> length source [] let toArray (source:ISeq<'T>) = @@ -1918,7 +1089,7 @@ namespace Microsoft.FSharp.Collections else None) - let cached = Upcast.seq (new Wrap.UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1)) + let cached = Upcast.seq (new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1)) interface System.IDisposable with member __.Dispose() = @@ -1965,7 +1136,7 @@ namespace Microsoft.FSharp.Collections [] let replicate count x = if count < 0 then raise (ArgumentOutOfRangeException "count") - Upcast.seq (new Wrap.InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) + Upcast.seq (new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) [] let isEmpty (source : ISeq<'T>) = diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 5beeaceb35b..076daafa4cd 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -12,9 +12,6 @@ namespace Microsoft.FSharp.Collections [] module ISeq = module Core = - [] - type NoValue = struct end - /// Values is a mutable struct. It can be embedded within the folder type /// if two values are required for the calculation. [] diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 8ec7b1f13ae..f37c96bcf02 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -136,7 +136,6 @@ namespace Microsoft.FSharp.Collections member x.GetEnumerator() = (f() :> IEnumerator) } namespace Microsoft.FSharp.Collections.SeqComposition - open System open System.Collections open System.Collections.Generic @@ -187,6 +186,857 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result +namespace Microsoft.FSharp.Collections.SeqComposition + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + open Microsoft.FSharp.Collections.IEnumerator + open Microsoft.FSharp.Collections.SeqComposition + open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators + open Microsoft.FSharp.Primitives.Basics + open Microsoft.FSharp.Control + + module Core = + [] + type NoValue = struct end + + module internal Internal = + open Core + + module internal Upcast = + // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality + // is fixed with the compiler then these functions can be removed. + let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) + let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) + let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) + let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) + let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) + let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) + + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = + inherit TransformFactory<'T,'V>() + + override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + + static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + upcast ComposedFactory(first, second) + + type IdentityFactory<'T> private () = + inherit TransformFactory<'T,'T> () + static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static member Instance = singleton + + type ISkipable = + // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip + // and it can only do it at the start of a sequence + abstract CanSkip : unit -> bool + + let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_>) pipeIdx = + factory.Compose (Upcast.outOfBand folder) pipeIdx folder + + module Fold = + // The consumers of IIterate are the execute and exeuteThin methods. IIterate is passed + // as a generic argument. The types that implement IIterate are value types. This combination + // means that the runtime will "inline" the methods. The alternatives to this were that the + // code in execute/executeThin were duplicated for each of the Fold types, or we turned the + // types back into normal functions and curried them then we would be creating garbage + // each time one of these were called. This has been an optimization to minimize the impact + // on very small collections. + type IIterate<'T> = + abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result> -> consumer:Activity<'T,'U> -> unit + + [] + type IterateEnumerable<'T> (enumerable:IEnumerable<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + use enumerator = enumerable.GetEnumerator () + let rec iterate () = + if outOfBand.HaltedIdx = 0 && enumerator.MoveNext () then + consumer.ProcessNext enumerator.Current |> ignore + iterate () + iterate () + + [] + type IterateArray<'T> (array:array<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + let array = array + let rec iterate idx = + if outOfBand.HaltedIdx = 0 && idx < array.Length then + consumer.ProcessNext array.[idx] |> ignore + iterate (idx+1) + iterate 0 + + [] + type IterateResizeArray<'T> (array:ResizeArray<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + let array = array + let rec iterate idx = + if outOfBand.HaltedIdx = 0 && idx < array.Count then + consumer.ProcessNext array.[idx] |> ignore + iterate (idx+1) + iterate 0 + + [] + type IterateList<'T> (alist:list<'T>) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + let rec iterate lst = + match lst with + | hd :: tl when outOfBand.HaltedIdx = 0 -> + consumer.ProcessNext hd |> ignore + iterate tl + | _ -> () + iterate alist + + [] + type IterateSingleton<'T> (item:'T) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + if outOfBand.HaltedIdx = 0 then + consumer.ProcessNext item |> ignore + + [] + type IterateUnfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + let generator = generator + let rec iterate current = + if outOfBand.HaltedIdx <> 0 then () + else + match generator current with + | Some (item, next) -> + consumer.ProcessNext item |> ignore + iterate next + | _ -> () + iterate state + + [] + type IterateInit<'T> (f:int->'T, terminatingIdx:int) = + interface IIterate<'T> with + member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = + let terminatingIdx = terminatingIdx + let f = f + + let firstIdx = + match box consumer with + | :? ISkipable as skipping -> + let rec skip idx = + if idx = terminatingIdx || outOfBand.HaltedIdx <> 0 then + terminatingIdx + elif skipping.CanSkip () then + skip (idx+1) + else + idx + skip -1 + | _ -> -1 + + let rec iterate idx = + if idx < terminatingIdx then + consumer.ProcessNext (f (idx+1)) |> ignore + if outOfBand.HaltedIdx = 0 then + iterate (idx+1) + else + idx + else + idx + + let finalIdx = iterate firstIdx + if outOfBand.HaltedIdx = 0 && finalIdx = System.Int32.MaxValue then + raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + + // execute, and it's companion, executeThin, are hosting functions that ensure the correct sequence + // of creation, iteration and disposal for the pipeline + let execute (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + executeOn.Iterate result consumer + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () + + // executeThin is a specialization of execute, provided as a performance optimization, that can + // be used when a sequence has been wrapped in an ISeq, but hasn't had an items added to its pipeline + // i.e. a container that has ISeq.ofSeq applied. + let executeThin (createFolder:PipeIdx->Folder<'T,'Result>) (executeOn:#IIterate<'T>) = + let result = createFolder 1 + try + executeOn.Iterate result result + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () + + let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let common = + { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = consumer.ProcessNext value } + + sources.Fold (fun _ -> + { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = + value.Fold (fun _ -> common) |> ignore + me.HaltedIdx <- common.HaltedIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () + + let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result>) (sources:ISeq<'Collection>) = + let result = createFolder 1 + try + let common = + { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = result.ProcessNext value } + + sources.Fold (fun _ -> + { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = + value.Fold (fun _ -> common) |> ignore + me.HaltedIdx <- common.HaltedIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () + + type SeqProcessNextStates = + | InProcess = 0 + | NotStarted = 1 + | Finished = 2 + + type Result<'T>() = + inherit Folder<'T,'T>(Unchecked.defaultof<'T>) + + member val SeqState = SeqProcessNextStates.NotStarted with get, set + + override this.ProcessNext (input:'T) : bool = + this.Result <- input + true + + type EmptyEnumerator<'T>() = + let current () = failwith "library implementation error: Current should never be called" + + interface IEnumerator<'T> with + member __.Current = current () + + interface IEnumerator with + member __.Current = current () + member __.MoveNext () = false + member __.Reset (): unit = noReset () + + interface IDisposable with + member __.Dispose () = () + + type EmptyEnumerators<'T>() = + static let element : IEnumerator<'T> = upcast (new EmptyEnumerator<'T> ()) + static member Element = element + + [] + type EnumeratorBase<'T>(result:Result<'T>, activity:Activity) = + interface IDisposable with + member __.Dispose () : unit = + activity.ChainDispose () + + interface IEnumerator with + member this.Current : obj = box ((Upcast.enumerator this)).Current + member __.MoveNext () = failwith "library implementation error: derived class should implement (should be abstract)" + member __.Reset () : unit = noReset () + + interface IEnumerator<'T> with + member __.Current = + if result.SeqState = SeqProcessNextStates.InProcess then result.Result + else + match result.SeqState with + | SeqProcessNextStates.NotStarted -> notStarted() + | SeqProcessNextStates.Finished -> alreadyFinished() + | _ -> failwith "library implementation error: all states should have been handled" + + type VanillaEnumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let rec moveNext () = + if (result.HaltedIdx = 0) && source.MoveNext () then + if activity.ProcessNext source.Current then + true + else + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete result.HaltedIdx + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + interface IDisposable with + member __.Dispose () = + try + source.Dispose () + finally + activity.ChainDispose () + + type ConcatEnumerator<'T,'U,'Collection when 'Collection :> IEnumerable<'T>> (sources:IEnumerable<'Collection>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let main = sources.GetEnumerator () + + let mutable active = EmptyEnumerators.Element + + let rec moveNext () = + if result.HaltedIdx <> 0 then false + else + if active.MoveNext () then + if activity.ProcessNext active.Current then + true + else + moveNext () + elif main.MoveNext () then + active.Dispose () + active <- main.Current.GetEnumerator () + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete result.HaltedIdx + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + interface IDisposable with + member __.Dispose () = + try + main.Dispose () + active.Dispose () + finally + activity.ChainDispose () + + type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let mutable list = alist + + let rec moveNext current = + match result.HaltedIdx, current with + | 0, head::tail -> + if activity.ProcessNext head then + list <- tail + true + else + moveNext tail + | _ -> + result.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete result.HaltedIdx + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext list + + let length (source:ISeq<_>) = + source.Fold (fun _ -> + { new Folder<'T,int>(0) with + override this.ProcessNext v = + this.Result <- this.Result + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) }) + + [] + type EnumerableBase<'T> () = + let derivedClassShouldImplement () = + failwith "library implementation error: derived class should implement (should be abstract)" + + abstract member Append : ISeq<'T> -> ISeq<'T> + abstract member Length : unit -> int + + default this.Append source = Upcast.seq (AppendEnumerable [source; this]) + default this.Length () = length this + + interface IEnumerable with + member this.GetEnumerator () : IEnumerator = + let genericEnumerable = Upcast.enumerable this + let genericEnumerator = genericEnumerable.GetEnumerator () + Upcast.enumeratorNonGeneric genericEnumerator + + interface IEnumerable<'T> with + // fsharp doesn't allow abstract interface methods + member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () + + interface ISeq<'T> with + // fsharp doesn't allow abstract interface methods + member __.PushTransform _ = derivedClassShouldImplement () + member __.Fold _ = derivedClassShouldImplement () + + and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold current result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) + + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member __.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold current result pipeIdx, result)) + + interface ISeq<'U> with + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + Fold.executeConcat f current pipeIdx sources + + and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = + inherit EnumerableBase<'T>() + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = + let result = Result<'T> () + Upcast.enumerator (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeConcatThin f (preEnumerate sources) + + and AppendEnumerable<'T> (sources:list>) = + inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (ThinListEnumerable>(List.rev sources))) + + override this.Append source = + Upcast.seq (AppendEnumerable (source::sources)) + + and ThinListEnumerable<'T>(alist:list<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = alist.Length + + interface IEnumerable<'T> with + member __.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateList alist) + + and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new ListEnumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) + + /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list + type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = + match enumerable with + | :? ICollection<'T> as a -> a.Count +#if !FSCORE_PORTABLE_OLD + | :? IReadOnlyCollection<'T> as a -> a.Count +#endif + | _ -> + use e = enumerable.GetEnumerator () + let mutable count = 0 + while e.MoveNext () do + count <- count + 1 + count + + interface IEnumerable<'T> with + member __.GetEnumerator () = enumerable.GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateEnumerable enumerable) + + type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'T>() + + override __.Length () = + match delayed() with + | :? EnumerableBase<'T> as s -> s.Length () + | s -> length s + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + (delayed()).Fold f + + type EmptyEnumerable<'T> private () = + inherit EnumerableBase<'T>() + + static let singleton = EmptyEnumerable<'T>() :> ISeq<'T> + static member Instance = singleton + + override __.Length () = 0 + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = IEnumerator.Empty<'T>() + + override this.Append source = source + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateEnumerable this) + + type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let mutable idx = 0 + + let rec moveNext () = + if (result.HaltedIdx = 0) && idx < array.Length then + idx <- idx+1 + if activity.ProcessNext array.[idx-1] then + true + else + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete result.HaltedIdx + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member __.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) + + type ThinArrayEnumerable<'T>(array:array<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = array.Length + + interface IEnumerable<'T> with + member __.GetEnumerator () = (Upcast.enumerable array).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateArray array) + + type SingletonEnumerable<'T>(item:'T) = + inherit EnumerableBase<'T>() + + override __.Length () = 1 + + interface IEnumerable<'T> with + member this.GetEnumerator () = Upcast.enumerator (new Singleton<'T>(item)) + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ArrayEnumerable<'T,'U>([|item|], next, 1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateSingleton item) + + type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let mutable idx = 0 + + let rec moveNext () = + if (result.HaltedIdx = 0) && idx < array.Count then + idx <- idx+1 + if activity.ProcessNext array.[idx-1] then + true + else + moveNext () + else + result.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete result.HaltedIdx + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new ResizeArrayEnumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) + + type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = + inherit EnumerableBase<'T>() + + override __.Length () = resizeArray.Count + + interface IEnumerable<'T> with + member __.GetEnumerator () = (Upcast.enumerable resizeArray).GetEnumerator () + + interface ISeq<'T> with + member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) + + member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateResizeArray resizeArray) + + type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let mutable current = state + + let rec moveNext () = + if result.HaltedIdx <> 0 then + false + else + match generator current with + | Some (item, nextState) -> + current <- nextState + if activity.ProcessNext item then + true + else + moveNext () + | _ -> false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + Fold.execute f transformFactory pipeIdx (Fold.IterateUnfold (generator, state)) + + let getInitTerminatingIdx (count:Nullable) = + // we are offset by 1 to allow for values going up to System.Int32.MaxValue + // System.Int32.MaxValue is an illegal value for the "infinite" sequence + if count.HasValue then + count.Value - 1 + else + System.Int32.MaxValue + + type InitEnumerator<'T,'U>(count:Nullable, f:int->'T, activity:Activity<'T,'U>, result:Result<'U>) = + inherit EnumeratorBase<'U>(result, activity) + + let isSkipping = + match box activity with + | :? ISkipable as skip -> skip.CanSkip + | _ -> fun () -> false + + let terminatingIdx = + getInitTerminatingIdx count + + let mutable maybeSkipping = true + let mutable idx = -1 + + let rec moveNext () = + if result.HaltedIdx = 0 && idx < terminatingIdx then + idx <- idx + 1 + + if maybeSkipping then + // Skip can only is only checked at the start of the sequence, so once + // triggered, we stay triggered. + maybeSkipping <- isSkipping () + + if maybeSkipping then + moveNext () + elif activity.ProcessNext (f idx) then + true + else + moveNext () + elif result.HaltedIdx = 0 && idx = System.Int32.MaxValue then + raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + else + result.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete result.HaltedIdx + false + + interface IEnumerator with + member __.MoveNext () = + result.SeqState <- SeqProcessNextStates.InProcess + moveNext () + + type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new InitEnumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) + + interface ISeq<'U> with + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result> (createResult:PipeIdx->Folder<'U,'Result>) = + let terminatingIdx = getInitTerminatingIdx count + Fold.execute createResult transformFactory pipeIdx (Fold.IterateInit (f, terminatingIdx)) + + // The original implementation of "init" delayed the calculation of Current, and so it was possible + // to do MoveNext without it's value being calculated. + // I can imagine only two scenerios where that is possibly sane, although a simple solution is readily + // at hand in both cases. The first is that of an expensive generator function, where you skip the + // first n elements. The simple solution would have just been to have a map ((+) n) as the first operation + // instead. The second case would be counting elements, but that is only of use if you're not filtering + // or mapping or doing anything else (as that would cause Current to be evaluated!) and + // so you already know what the count is!! Anyway, someone thought it was a good idea, so + // I have had to add an extra function that is used in Skip to determine if we are touching + // Current or not. + // InitEnumerableDecider returns the original implementation of init when GetEnumerator is called + // If any Activites are added to the pipeline then the original implementation is ignored, as special + // handling has been added to Current isn't calculated whilst skipping enumerated items. + type InitEnumerableDecider<'T>(count:Nullable, f:int->'T, pipeIdx:PipeIdx) = + inherit EnumerableBase<'T>() + + let upto lastOption f = + match lastOption with + | Some b when b<0 -> failwith "library implementation error: upto can never be called with a negative value" + | _ -> + let unstarted = -1 // index value means unstarted (and no valid index) + let completed = -2 // index value means completed (and no valid index) + let unreachable = -3 // index is unreachable from 0,1,2,3,... + let finalIndex = match lastOption with + | Some b -> b // here b>=0, a valid end value. + | None -> unreachable // run "forever", well as far as Int32.MaxValue since indexing with a bounded type. + // The Current value for a valid index is "f i". + // Lazy<_> values are used as caches, to store either the result or an exception if thrown. + // These "Lazy<_>" caches are created only on the first call to current and forced immediately. + // The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. + // For example, the full enumeration of Seq.initInfinite in the tests. + // state + let index = ref unstarted + // a Lazy node to cache the result/exception + let current = ref (Unchecked.defaultof<_>) + let setIndex i = index := i; current := (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. + let getCurrent() = + if !index = unstarted then notStarted() + if !index = completed then alreadyFinished() + match box !current with + | null -> current := Lazy<_>.Create(fun () -> f !index) + | _ -> () + // forced or re-forced immediately. + (!current).Force() + { new IEnumerator<'U> with + member x.Current = getCurrent() + interface IEnumerator with + member x.Current = box (getCurrent()) + member x.MoveNext() = + if !index = completed then + false + elif !index = unstarted then + setIndex 0 + true + else ( + if !index = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + if !index = finalIndex then + false + else + setIndex (!index + 1) + true + ) + member this.Reset() = noReset() + interface System.IDisposable with + member x.Dispose () = () } + + override this.Length () = + if count.HasValue then + count.Value + else + raise (System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue))) + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = + // we defer back to the original implementation as, as it's quite idiomatic in it's decision + // to calculate Current in a lazy fashion. I doubt anyone is really using this functionality + // in the way presented, but it's possible. + upto (if count.HasValue then Some (count.Value-1) else None) f + + interface ISeq<'T> with + member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = + Fold.executeThin f (Fold.IterateEnumerable (Upcast.enumerable this)) namespace Microsoft.FSharp.Core.CompilerServices @@ -201,6 +1051,8 @@ namespace Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Primitives.Basics open System.Collections open System.Collections.Generic + open Microsoft.FSharp.Collections.SeqComposition + open Microsoft.FSharp.Collections.SeqComposition.Internal module RuntimeHelpers = @@ -410,6 +1262,8 @@ namespace Microsoft.FSharp.Core.CompilerServices let mutable redirectTo : GeneratedSequenceBase<'T> = Unchecked.defaultof<_> let mutable redirect : bool = false + member internal x.GetCurrent () = if redirect then redirectTo.LastGenerated else x.LastGenerated + abstract GetFreshEnumerator : unit -> IEnumerator<'T> abstract GenerateNext : result:byref> -> int // 0 = Stop, 1 = Yield, 2 = Goto abstract Close: unit -> unit @@ -447,7 +1301,7 @@ namespace Microsoft.FSharp.Core.CompilerServices interface IEnumerable with member x.GetEnumerator() = (x.GetFreshEnumerator() :> IEnumerator) interface IEnumerator<'T> with - member x.Current = if redirect then redirectTo.LastGenerated else x.LastGenerated + member x.Current = x.GetCurrent () interface System.IDisposable with member x.Dispose() = if redirect then redirectTo.Close() else x.Close() interface IEnumerator with @@ -457,3 +1311,61 @@ namespace Microsoft.FSharp.Core.CompilerServices member x.MoveNext() = x.MoveNextImpl() member x.Reset() = raise <| new System.NotSupportedException() + + interface ISeq<'T> with + member this.PushTransform<'U> (next:TransformFactory<'T,'U>) : ISeq<'U> = + Upcast.seq (new GeneratedSequenceBaseEnumerable<'T,'U>(this, next, 1)) + + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + use maybeGeneratedSequenceBase = this.GetFreshEnumerator () + match maybeGeneratedSequenceBase with + | :? GeneratedSequenceBase<'T> as optimized -> + // avoids two virtual function calls + // FUTURE OPTIMIZATION: Store Current element in this class so it can be accessed non-virtual + while result.HaltedIdx = 0 && optimized.MoveNextImpl () do + result.ProcessNext (optimized.GetCurrent ()) |> ignore + | standard -> + // this path shouldn't occur, as GetFreshEnumerator should return a GeneratedSequenceBase<'T> derived class + while result.HaltedIdx = 0 && standard.MoveNext () do + result.ProcessNext standard.Current |> ignore + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () + + and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit EnumerableBase<'U>() + + interface IEnumerable<'U> with + member this.GetEnumerator () : IEnumerator<'U> = + let result = Result<'U> () + Upcast.enumerator (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), current.Compose (Upcast.outOfBand result) pipeIdx result, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = current.Compose (Upcast.outOfBand result) pipeIdx result + try + use maybeGeneratedSequenceBase = generatedSequence.GetFreshEnumerator () + match maybeGeneratedSequenceBase with + | :? GeneratedSequenceBase<'T> as optimized -> + // avoids two virtual function calls + // FUTURE OPTIMIZATION: Store Current element in this class so it can be accessed non-virtual + while result.HaltedIdx = 0 && optimized.MoveNextImpl () do + consumer.ProcessNext (optimized.GetCurrent ()) |> ignore + | standard -> + // this path shouldn't occur, as GetFreshEnumerator should return a GeneratedSequenceBase<'T> derived class + while result.HaltedIdx = 0 && standard.MoveNext () do + consumer.ProcessNext standard.Current |> ignore + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () + diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 6e4114fec4a..1f5d3db1a09 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -121,6 +121,101 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result +namespace Microsoft.FSharp.Collections.SeqComposition + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + open Microsoft.FSharp.Collections.SeqComposition + + module Core = + [] + type NoValue = struct end + + module internal Internal = + [] + type IdentityFactory<'T> = + inherit TransformFactory<'T,'T> + static member Instance : TransformFactory<'T,'T> + + type ISkipable = + // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip + // and it can only do it at the start of a sequence + abstract CanSkip : unit -> bool + + val length : ISeq<'T> -> int + + [] + type EnumerableBase<'T> = + new : unit -> EnumerableBase<'T> + abstract member Append : ISeq<'T> -> ISeq<'T> + abstract member Length : unit -> int + interface IEnumerable + interface IEnumerable<'T> + interface ISeq<'T> + + type ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> = + inherit EnumerableBase<'T> + new : 'Sources * ('Sources->ISeq<'Collection>) -> ThinConcatEnumerable<'T, 'Sources, 'Collection> + interface ISeq<'T> + + type AppendEnumerable<'T> = + inherit ThinConcatEnumerable<'T, list>, ISeq<'T>> + new : list> -> AppendEnumerable<'T> + override Append : ISeq<'T> -> ISeq<'T> + + type ThinListEnumerable<'T> = + inherit EnumerableBase<'T> + new : list<'T> -> ThinListEnumerable<'T> + interface ISeq<'T> + + type ThinResizeArrayEnumerable<'T> = + inherit EnumerableBase<'T> + new : ResizeArray<'T> -> ThinResizeArrayEnumerable<'T> + interface ISeq<'T> + + type ThinArrayEnumerable<'T> = + inherit EnumerableBase<'T> + new : array<'T> -> ThinArrayEnumerable<'T> + interface ISeq<'T> + + type ThinEnumerable<'T> = + inherit EnumerableBase<'T> + new : IEnumerable<'T> -> ThinEnumerable<'T> + interface ISeq<'T> + + type UnfoldEnumerable<'T,'U,'GeneratorState> = + inherit EnumerableBase<'U> + new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*TransformFactory<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> + interface ISeq<'U> + + type InitEnumerableDecider<'T> = + inherit EnumerableBase<'T> + new : Nullable* (int->'T) * PipeIdx -> InitEnumerableDecider<'T> + interface ISeq<'T> + + type SingletonEnumerable<'T> = + inherit EnumerableBase<'T> + new : 'T -> SingletonEnumerable<'T> + interface ISeq<'T> + + type InitEnumerable<'T,'U> = + inherit EnumerableBase<'U> + new : Nullable * (int->'T) * TransformFactory<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> + interface ISeq<'U> + + type DelayedEnumerable<'T> = + inherit EnumerableBase<'T> + new : (unit->ISeq<'T>) * PipeIdx -> DelayedEnumerable<'T> + interface ISeq<'T> + + type EmptyEnumerable<'T> = + inherit EnumerableBase<'T> + private new : unit -> EmptyEnumerable<'T> + static member Instance : ISeq<'T> + interface ISeq<'T> + namespace Microsoft.FSharp.Core.CompilerServices open System @@ -215,3 +310,4 @@ namespace Microsoft.FSharp.Core.CompilerServices interface IEnumerator<'T> interface IEnumerator interface IDisposable + interface SeqComposition.ISeq<'T> From 44417b0c2a006b008c2c8979758a191c6882430e Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 6 Apr 2017 16:30:16 +1000 Subject: [PATCH 042/120] GeneratedSequenceBase inherit EnumerableBase --- src/fsharp/FSharp.Core/iseq.fs | 4 +-- src/fsharp/FSharp.Core/seqcore.fs | 49 ++++++++++++++++-------------- src/fsharp/FSharp.Core/seqcore.fsi | 48 ++++++++++++++--------------- 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index ec01f198be7..ea3374de3f8 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -14,7 +14,7 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Collections.SeqComposition - open Microsoft.FSharp.Collections.SeqComposition.Internal + open Microsoft.FSharp.Collections.SeqComposition.Core [] module ISeq = @@ -172,7 +172,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () }) [] - let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Internal.EmptyEnumerable<'T>.Instance + let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance [] let exactlyOne (source:ISeq<'T>) : 'T = diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index f37c96bcf02..158639e1edc 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -202,9 +202,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition [] type NoValue = struct end - module internal Internal = - open Core - module internal Upcast = // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality // is fixed with the compiler then these functions can be removed. @@ -1052,7 +1049,7 @@ namespace Microsoft.FSharp.Core.CompilerServices open System.Collections open System.Collections.Generic open Microsoft.FSharp.Collections.SeqComposition - open Microsoft.FSharp.Collections.SeqComposition.Internal + open Microsoft.FSharp.Collections.SeqComposition.Core module RuntimeHelpers = @@ -1259,6 +1256,8 @@ namespace Microsoft.FSharp.Core.CompilerServices [] type GeneratedSequenceBase<'T>() = + inherit EnumerableBase<'T>() + let mutable redirectTo : GeneratedSequenceBase<'T> = Unchecked.defaultof<_> let mutable redirect : bool = false @@ -1321,21 +1320,30 @@ namespace Microsoft.FSharp.Core.CompilerServices try use maybeGeneratedSequenceBase = this.GetFreshEnumerator () match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as optimized -> - // avoids two virtual function calls - // FUTURE OPTIMIZATION: Store Current element in this class so it can be accessed non-virtual - while result.HaltedIdx = 0 && optimized.MoveNextImpl () do - result.ProcessNext (optimized.GetCurrent ()) |> ignore - | standard -> - // this path shouldn't occur, as GetFreshEnumerator should return a GeneratedSequenceBase<'T> derived class - while result.HaltedIdx = 0 && standard.MoveNext () do - result.ProcessNext standard.Current |> ignore + | :? GeneratedSequenceBase<'T> as e -> // avoids two virtual function calls + while result.HaltedIdx = 0 && e.MoveNextImpl () do + result.ProcessNext (e.GetCurrent ()) |> ignore + | e -> + while result.HaltedIdx = 0 && e.MoveNext () do + result.ProcessNext e.Current |> ignore result.ChainComplete result.HaltedIdx result.Result finally result.ChainDispose () + override this.Length () = + use maybeGeneratedSequenceBase = this.GetFreshEnumerator () + let mutable count = 0 + match maybeGeneratedSequenceBase with + | :? GeneratedSequenceBase<'T> as e -> + while e.MoveNextImpl () do + count <- count + 1 + | e -> + while e.MoveNext () do + count <- count + 1 + count + and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() @@ -1354,15 +1362,12 @@ namespace Microsoft.FSharp.Core.CompilerServices try use maybeGeneratedSequenceBase = generatedSequence.GetFreshEnumerator () match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as optimized -> - // avoids two virtual function calls - // FUTURE OPTIMIZATION: Store Current element in this class so it can be accessed non-virtual - while result.HaltedIdx = 0 && optimized.MoveNextImpl () do - consumer.ProcessNext (optimized.GetCurrent ()) |> ignore - | standard -> - // this path shouldn't occur, as GetFreshEnumerator should return a GeneratedSequenceBase<'T> derived class - while result.HaltedIdx = 0 && standard.MoveNext () do - consumer.ProcessNext standard.Current |> ignore + | :? GeneratedSequenceBase<'T> as e -> + while result.HaltedIdx = 0 && e.MoveNextImpl () do + consumer.ProcessNext (e.GetCurrent ()) |> ignore + | e -> + while result.HaltedIdx = 0 && e.MoveNext () do + consumer.ProcessNext e.Current |> ignore consumer.ChainComplete result.HaltedIdx result.Result diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 1f5d3db1a09..fd3d86bbc86 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -133,84 +133,81 @@ namespace Microsoft.FSharp.Collections.SeqComposition [] type NoValue = struct end - module internal Internal = + [] + type EnumerableBase<'T> = + new : unit -> EnumerableBase<'T> + abstract member Append : ISeq<'T> -> ISeq<'T> + abstract member Length : unit -> int + interface ISeq<'T> + [] - type IdentityFactory<'T> = + type internal IdentityFactory<'T> = inherit TransformFactory<'T,'T> static member Instance : TransformFactory<'T,'T> - type ISkipable = + type internal ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip // and it can only do it at the start of a sequence abstract CanSkip : unit -> bool - val length : ISeq<'T> -> int - - [] - type EnumerableBase<'T> = - new : unit -> EnumerableBase<'T> - abstract member Append : ISeq<'T> -> ISeq<'T> - abstract member Length : unit -> int - interface IEnumerable - interface IEnumerable<'T> - interface ISeq<'T> + val internal length : ISeq<'T> -> int - type ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> = + type internal ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> = inherit EnumerableBase<'T> new : 'Sources * ('Sources->ISeq<'Collection>) -> ThinConcatEnumerable<'T, 'Sources, 'Collection> interface ISeq<'T> - type AppendEnumerable<'T> = + type internal AppendEnumerable<'T> = inherit ThinConcatEnumerable<'T, list>, ISeq<'T>> new : list> -> AppendEnumerable<'T> override Append : ISeq<'T> -> ISeq<'T> - type ThinListEnumerable<'T> = + type internal ThinListEnumerable<'T> = inherit EnumerableBase<'T> new : list<'T> -> ThinListEnumerable<'T> interface ISeq<'T> - type ThinResizeArrayEnumerable<'T> = + type internal ThinResizeArrayEnumerable<'T> = inherit EnumerableBase<'T> new : ResizeArray<'T> -> ThinResizeArrayEnumerable<'T> interface ISeq<'T> - type ThinArrayEnumerable<'T> = + type internal ThinArrayEnumerable<'T> = inherit EnumerableBase<'T> new : array<'T> -> ThinArrayEnumerable<'T> interface ISeq<'T> - type ThinEnumerable<'T> = + type internal ThinEnumerable<'T> = inherit EnumerableBase<'T> new : IEnumerable<'T> -> ThinEnumerable<'T> interface ISeq<'T> - type UnfoldEnumerable<'T,'U,'GeneratorState> = + type internal UnfoldEnumerable<'T,'U,'GeneratorState> = inherit EnumerableBase<'U> new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*TransformFactory<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> interface ISeq<'U> - type InitEnumerableDecider<'T> = + type internal InitEnumerableDecider<'T> = inherit EnumerableBase<'T> new : Nullable* (int->'T) * PipeIdx -> InitEnumerableDecider<'T> interface ISeq<'T> - type SingletonEnumerable<'T> = + type internal SingletonEnumerable<'T> = inherit EnumerableBase<'T> new : 'T -> SingletonEnumerable<'T> interface ISeq<'T> - type InitEnumerable<'T,'U> = + type internal InitEnumerable<'T,'U> = inherit EnumerableBase<'U> new : Nullable * (int->'T) * TransformFactory<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> interface ISeq<'U> - type DelayedEnumerable<'T> = + type internal DelayedEnumerable<'T> = inherit EnumerableBase<'T> new : (unit->ISeq<'T>) * PipeIdx -> DelayedEnumerable<'T> interface ISeq<'T> - type EmptyEnumerable<'T> = + type internal EmptyEnumerable<'T> = inherit EnumerableBase<'T> private new : unit -> EmptyEnumerable<'T> static member Instance : ISeq<'T> @@ -285,6 +282,7 @@ namespace Microsoft.FSharp.Core.CompilerServices [] /// The F# compiler emits implementations of this type for compiled sequence expressions. type GeneratedSequenceBase<'T> = + inherit SeqComposition.Core.EnumerableBase<'T> /// The F# compiler emits implementations of this type for compiled sequence expressions. /// /// A new sequence generator for the expression. From 2051bdf2a032c76a2dfe67cc47aaa261953f4672 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 7 Apr 2017 12:46:27 +1000 Subject: [PATCH 043/120] Promoted ISeq to prim_types --- src/fsharp/FSharp.Core/prim-types.fs | 52 ++++++++++++++++++++- src/fsharp/FSharp.Core/prim-types.fsi | 65 +++++++++++++++++++++++++++ src/fsharp/FSharp.Core/seqcore.fs | 51 --------------------- src/fsharp/FSharp.Core/seqcore.fsi | 65 --------------------------- 4 files changed, 116 insertions(+), 117 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index bfe1a6af3dc..ff5471fe842 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3228,12 +3228,62 @@ namespace Microsoft.FSharp.Collections type seq<'T> = IEnumerable<'T> + +namespace Microsoft.FSharp.Collections.SeqComposition + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + + type PipeIdx = int + + type IOutOfBand = + abstract StopFurtherProcessing : PipeIdx -> unit + + [] + type Activity() = + abstract ChainComplete : PipeIdx -> unit + abstract ChainDispose : unit -> unit + + [] + type Activity<'T,'U> () = + inherit Activity() + abstract ProcessNext : input:'T -> bool + + [] + type Folder<'T,'Result> = + inherit Activity<'T,'T> + + val mutable Result : 'Result + + val mutable HaltedIdx : int + member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx + interface IOutOfBand with + member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx + + new (initalResult) = { + inherit Activity<'T,'T>() + HaltedIdx = 0 + Result = initalResult + } + + override this.ChainComplete _ = () + override this.ChainDispose () = () + + [] + type TransformFactory<'T,'U> () = + abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + type ISeq<'T> = + inherit IEnumerable<'T> + abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result //------------------------------------------------------------------------- // Operators //------------------------------------------------------------------------- - namespace Microsoft.FSharp.Core open System diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 9d3eabf7f70..384c11c4b7b 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1720,6 +1720,71 @@ namespace Microsoft.FSharp.Collections /// An abbreviation for the CLI type System.Collections.Generic.IEnumerable<_> type seq<'T> = IEnumerable<'T> +namespace Microsoft.FSharp.Collections.SeqComposition + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open Microsoft.FSharp.Collections + + /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the + /// source of the chain. + type PipeIdx = int + + /// Used within the pipline to provide out of band communications + type IOutOfBand = + /// Stop the processing of any further items down the pipeline + abstract StopFurtherProcessing : PipeIdx -> unit + + /// Activity is the root class for chains of activities. It is in a non-generic + /// form so that it can be used by subsequent activities + [] + type Activity = + /// OnComplete is used to determine if the object has been processed correctly, + /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take + /// operation which didn't have a source at least as large as was required). It is + /// not called in the case of an exception being thrown whilst the stream is still + /// being processed. + abstract ChainComplete : PipeIdx -> unit + /// OnDispose is used to cleanup the stream. It is always called at the last operation + /// after the enumeration has completed. + abstract ChainDispose : unit -> unit + + /// Activity is the base class of all elements within the pipeline + [] + type Activity<'T,'U> = + inherit Activity + new : unit -> Activity<'T,'U> + abstract member ProcessNext : input:'T -> bool + + /// Folder is a base class to assist with fold-like operations. It's intended usage + /// is as a base class for an object expression that will be used from within + /// the Fold function. + [] + type Folder<'T,'Result> = + inherit Activity<'T,'T> + new : 'Result -> Folder<'T,'Result> + interface IOutOfBand + val mutable Result : 'Result + val mutable HaltedIdx : int + member StopFurtherProcessing : PipeIdx -> unit + override ChainComplete : PipeIdx -> unit + override ChainDispose : unit -> unit + + /// TransformFactory provides composition of Activities. Its intended to have a specialization + /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack + /// of Actvities that will be composed. + [] + type TransformFactory<'T,'U> = + new : unit -> TransformFactory<'T,'U> + abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities + /// as well as Fold the current Activity pipeline. + type ISeq<'T> = + inherit System.Collections.Generic.IEnumerable<'T> + abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result namespace Microsoft.FSharp.Core diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 158639e1edc..658bd9d9b8d 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -135,57 +135,6 @@ namespace Microsoft.FSharp.Collections interface IEnumerable with member x.GetEnumerator() = (f() :> IEnumerator) } -namespace Microsoft.FSharp.Collections.SeqComposition - open System - open System.Collections - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - type PipeIdx = int - - type IOutOfBand = - abstract StopFurtherProcessing : PipeIdx -> unit - - [] - type Activity() = - abstract ChainComplete : PipeIdx -> unit - abstract ChainDispose : unit -> unit - - [] - type Activity<'T,'U> () = - inherit Activity() - abstract ProcessNext : input:'T -> bool - - [] - type Folder<'T,'Result> = - inherit Activity<'T,'T> - - val mutable Result : 'Result - - val mutable HaltedIdx : int - member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx - interface IOutOfBand with - member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx - - new (initalResult) = { - inherit Activity<'T,'T>() - HaltedIdx = 0 - Result = initalResult - } - - override this.ChainComplete _ = () - override this.ChainDispose () = () - - [] - type TransformFactory<'T,'U> () = - abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> - - type ISeq<'T> = - inherit IEnumerable<'T> - abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result - namespace Microsoft.FSharp.Collections.SeqComposition open System open System.Collections diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index fd3d86bbc86..936efb35d01 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -55,71 +55,6 @@ namespace Microsoft.FSharp.Collections f:(unit -> System.Collections.Generic.IEnumerator<'U>) -> System.Collections.Generic.IEnumerable<'U> -namespace Microsoft.FSharp.Collections.SeqComposition - open System - open System.Collections - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the - /// source of the chain. - type PipeIdx = int - - /// Used within the pipline to provide out of band communications - type IOutOfBand = - /// Stop the processing of any further items down the pipeline - abstract StopFurtherProcessing : PipeIdx -> unit - - /// Activity is the root class for chains of activities. It is in a non-generic - /// form so that it can be used by subsequent activities - [] - type Activity = - /// OnComplete is used to determine if the object has been processed correctly, - /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take - /// operation which didn't have a source at least as large as was required). It is - /// not called in the case of an exception being thrown whilst the stream is still - /// being processed. - abstract ChainComplete : PipeIdx -> unit - /// OnDispose is used to cleanup the stream. It is always called at the last operation - /// after the enumeration has completed. - abstract ChainDispose : unit -> unit - - /// Activity is the base class of all elements within the pipeline - [] - type Activity<'T,'U> = - inherit Activity - new : unit -> Activity<'T,'U> - abstract member ProcessNext : input:'T -> bool - - /// Folder is a base class to assist with fold-like operations. It's intended usage - /// is as a base class for an object expression that will be used from within - /// the Fold function. - [] - type Folder<'T,'Result> = - inherit Activity<'T,'T> - new : 'Result -> Folder<'T,'Result> - interface IOutOfBand - val mutable Result : 'Result - val mutable HaltedIdx : int - member StopFurtherProcessing : PipeIdx -> unit - override ChainComplete : PipeIdx -> unit - override ChainDispose : unit -> unit - - /// TransformFactory provides composition of Activities. Its intended to have a specialization - /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack - /// of Actvities that will be composed. - [] - type TransformFactory<'T,'U> = - new : unit -> TransformFactory<'T,'U> - abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> - - /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities - /// as well as Fold the current Activity pipeline. - type ISeq<'T> = - inherit System.Collections.Generic.IEnumerable<'T> - abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result namespace Microsoft.FSharp.Collections.SeqComposition open System From 34fcd2b8c7deb5af3f44aaa6ca86e448129ce082 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 8 Apr 2017 05:53:37 +1000 Subject: [PATCH 044/120] Spread ISeq into simpleIntegralRange --- src/fsharp/FSharp.Core/iseq.fs | 1 + src/fsharp/FSharp.Core/prim-types.fs | 127 ++++++++++++++++++++++++-- src/fsharp/FSharp.Core/prim-types.fsi | 10 ++ src/fsharp/FSharp.Core/seqcore.fs | 17 +--- src/fsharp/FSharp.Core/seqcore.fsi | 5 - 5 files changed, 134 insertions(+), 26 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index ea3374de3f8..8a3f88a1ea6 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -14,6 +14,7 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Collections.SeqComposition + open Microsoft.FSharp.Collections.SeqComposition.Factories open Microsoft.FSharp.Collections.SeqComposition.Core [] diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index ff5471fe842..8bf37674db6 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3280,6 +3280,22 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + module Factories = + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = + inherit TransformFactory<'T,'V>() + + override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + + static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + upcast ComposedFactory(first, second) + + type IdentityFactory<'T> private () = + inherit TransformFactory<'T,'T> () + static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static member Instance = singleton + //------------------------------------------------------------------------- // Operators //------------------------------------------------------------------------- @@ -3296,12 +3312,20 @@ namespace Microsoft.FSharp.Core open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions open Microsoft.FSharp.Core.BasicInlinedOperations open Microsoft.FSharp.Collections - - + open Microsoft.FSharp.Collections.SeqComposition [] module Operators = + // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality + // is fixed with the compiler then these functions can be removed. + module Upcast = + let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) + let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) + let inline enumerableNonGeneric<'enumerable when 'enumerable :> System.Collections.IEnumerable and 'enumerable : not struct> (t:'enumerable) : System.Collections.IEnumerable = (# "" t : System.Collections.IEnumerable #) + let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) + let inline enumeratorNonGeneric<'enumerator when 'enumerator :> System.Collections.IEnumerator and 'enumerator : not struct> (t:'enumerator) : System.Collections.IEnumerator = (# "" t : System.Collections.IEnumerator #) + let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) #if MULTI_DIMENSIONAL_EXTENSION_PROPERTIES type ``[,]``<'T> with @@ -4668,6 +4692,85 @@ namespace Microsoft.FSharp.Core | Running = 1 | Finished = 2 + type SetResultToInput<'T>() = + inherit Folder<'T,'T>(Unchecked.defaultof<'T>) + override this.ProcessNext (input:'T) : bool = + this.Result <- input + true + + type SeqSourceEnumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, folder:SetResultToInput<'U>) = + let mutable state = Mode.NotStarted + + let rec moveNext () = + if (folder.HaltedIdx = 0) && source.MoveNext () then + if activity.ProcessNext source.Current then + true + else + moveNext () + else + state <- Mode.Finished + activity.ChainComplete folder.HaltedIdx + false + + interface IEnumerator with + member this.Current : obj = box ((Upcast.enumerator this)).Current + member __.Reset () : unit = source.Reset () + member __.MoveNext () = + state <- Mode.Running + moveNext () + + interface IEnumerator<'U> with + member __.Current = + if state = Mode.Running then folder.Result + else + match state with + | Mode.NotStarted -> notStarted() + | Mode.Finished -> alreadyFinished() + | _ -> failwith "library implementation error: all states should have been handled" + + interface IDisposable with + member __.Dispose () = + try + source.Dispose () + finally + activity.ChainDispose () + + type ISeqSource<'T> = + abstract member GetEnumerator : unit -> IEnumerator<'T> + abstract member Fold<'Result,'U> : f:(PipeIdx->Folder<'U,'Result>) -> TransformFactory<'T,'U> -> PipeIdx -> 'Result + + type SeqSourceEnumerable<'T,'U>(source:ISeqSource<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + interface IEnumerable<'U> with + member __.GetEnumerator () = + let folder = SetResultToInput<'U>() + Upcast.enumerator (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (Upcast.outOfBand folder) pipeIdx folder, folder)) + + interface IEnumerable with + member __.GetEnumerator () = + let folder = SetResultToInput<'U>() + Upcast.enumeratorNonGeneric (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (Upcast.outOfBand folder) pipeIdx folder, folder)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new SeqSourceEnumerable<'T,'V>(source, Factories.ComposedFactory.Combine current next, pipeIdx+1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + source.Fold f current pipeIdx + + type SeqSourceEnumerableThin<'U>(source:ISeqSource<'U>) = + interface IEnumerable<'U> with + member __.GetEnumerator () = source.GetEnumerator () + + interface IEnumerable with + member __.GetEnumerator () = Upcast.enumeratorNonGeneric (source.GetEnumerator ()) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new SeqSourceEnumerable<'U,'V>(source, next, 1)) + + member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = + source.Fold f Factories.IdentityFactory.Instance 1 + [] type BaseRangeEnumerator<'T>() = // Generate enumerator from mutable state "z". @@ -4882,11 +4985,23 @@ namespace Microsoft.FSharp.Core false else false } - { new IEnumerable<'T> with + let source = { new ISeqSource<'T> with member __.GetEnumerator () = singleStepRangeEnumerator () - - interface IEnumerable with - member __.GetEnumerator () = (singleStepRangeEnumerator ()) :> IEnumerator } + member __.Fold<'Result,'Output> (createFolder:PipeIdx->Folder<'Output,'Result>) (transformFactory:TransformFactory<'T,'Output>) pipeIdx : 'Result = + let result = createFolder (pipeIdx+1) + let consumer = transformFactory.Compose (Upcast.outOfBand result) pipeIdx result + try + let mutable i : 'T = n + while result.HaltedIdx = 0 && i <= m do + consumer.ProcessNext i |> ignore + i <- i + LanguagePrimitives.GenericOne + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () } + + Upcast.enumerable (SeqSourceEnumerableThin<'T> source) // For RangeStepGeneric, zero and add are functions representing the static resolution of GenericZero and (+) // for the particular static type. diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 384c11c4b7b..82fec8f177b 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1786,6 +1786,16 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + module Factories = + [] + type ComposedFactory<'T,'U,'V> = + inherit TransformFactory<'T,'V> + static member Combine : TransformFactory<'T,'U> -> TransformFactory<'U,'V> -> TransformFactory<'T,'V> + + [] + type IdentityFactory<'T> = + inherit TransformFactory<'T,'T> + static member Instance : TransformFactory<'T,'T> namespace Microsoft.FSharp.Core diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 658bd9d9b8d..fef14327c93 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -143,6 +143,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition open Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.IEnumerator open Microsoft.FSharp.Collections.SeqComposition + open Microsoft.FSharp.Collections.SeqComposition.Factories open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Control @@ -161,21 +162,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = - inherit TransformFactory<'T,'V>() - - override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = - first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - - static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = - upcast ComposedFactory(first, second) - - type IdentityFactory<'T> private () = - inherit TransformFactory<'T,'T> () - static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) - override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next - static member Instance = singleton - type ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip // and it can only do it at the start of a sequence @@ -998,6 +984,7 @@ namespace Microsoft.FSharp.Core.CompilerServices open System.Collections open System.Collections.Generic open Microsoft.FSharp.Collections.SeqComposition + open Microsoft.FSharp.Collections.SeqComposition.Factories open Microsoft.FSharp.Collections.SeqComposition.Core module RuntimeHelpers = diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 936efb35d01..4593bc09587 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -75,11 +75,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member Length : unit -> int interface ISeq<'T> - [] - type internal IdentityFactory<'T> = - inherit TransformFactory<'T,'T> - static member Instance : TransformFactory<'T,'T> - type internal ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip // and it can only do it at the start of a sequence From 79c77cb78935791d0ddf426ef7ddad956a2590aa Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 8 Apr 2017 15:09:34 +1000 Subject: [PATCH 045/120] Composed/Identity in prim_types didn't work (??) --- src/fsharp/FSharp.Core/iseq.fs | 1 - src/fsharp/FSharp.Core/prim-types.fs | 35 +++++++++++++-------------- src/fsharp/FSharp.Core/prim-types.fsi | 11 --------- src/fsharp/FSharp.Core/seqcore.fs | 17 +++++++++++-- src/fsharp/FSharp.Core/seqcore.fsi | 5 ++++ 5 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 8a3f88a1ea6..ea3374de3f8 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -14,7 +14,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Collections.SeqComposition - open Microsoft.FSharp.Collections.SeqComposition.Factories open Microsoft.FSharp.Collections.SeqComposition.Core [] diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 8bf37674db6..e56e0647905 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3280,22 +3280,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result - module Factories = - type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = - inherit TransformFactory<'T,'V>() - - override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = - first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - - static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = - upcast ComposedFactory(first, second) - - type IdentityFactory<'T> private () = - inherit TransformFactory<'T,'T> () - static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) - override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next - static member Instance = singleton - //------------------------------------------------------------------------- // Operators //------------------------------------------------------------------------- @@ -4692,6 +4676,21 @@ namespace Microsoft.FSharp.Core | Running = 1 | Finished = 2 + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = + inherit TransformFactory<'T,'V>() + + override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + + static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + upcast ComposedFactory(first, second) + + type IdentityFactory<'T> private () = + inherit TransformFactory<'T,'T> () + static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static member Instance = singleton + type SetResultToInput<'T>() = inherit Folder<'T,'T>(Unchecked.defaultof<'T>) override this.ProcessNext (input:'T) : bool = @@ -4752,7 +4751,7 @@ namespace Microsoft.FSharp.Core interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new SeqSourceEnumerable<'T,'V>(source, Factories.ComposedFactory.Combine current next, pipeIdx+1)) + Upcast.seq (new SeqSourceEnumerable<'T,'V>(source, ComposedFactory.Combine current next, pipeIdx+1)) member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = source.Fold f current pipeIdx @@ -4769,7 +4768,7 @@ namespace Microsoft.FSharp.Core Upcast.seq (new SeqSourceEnumerable<'U,'V>(source, next, 1)) member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - source.Fold f Factories.IdentityFactory.Instance 1 + source.Fold f IdentityFactory.Instance 1 [] type BaseRangeEnumerator<'T>() = diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 82fec8f177b..6adc84948c9 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1786,17 +1786,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result - module Factories = - [] - type ComposedFactory<'T,'U,'V> = - inherit TransformFactory<'T,'V> - static member Combine : TransformFactory<'T,'U> -> TransformFactory<'U,'V> -> TransformFactory<'T,'V> - - [] - type IdentityFactory<'T> = - inherit TransformFactory<'T,'T> - static member Instance : TransformFactory<'T,'T> - namespace Microsoft.FSharp.Core open System diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index fef14327c93..658bd9d9b8d 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -143,7 +143,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition open Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.IEnumerator open Microsoft.FSharp.Collections.SeqComposition - open Microsoft.FSharp.Collections.SeqComposition.Factories open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Control @@ -162,6 +161,21 @@ namespace Microsoft.FSharp.Collections.SeqComposition let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = + inherit TransformFactory<'T,'V>() + + override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + + static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + upcast ComposedFactory(first, second) + + type IdentityFactory<'T> private () = + inherit TransformFactory<'T,'T> () + static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static member Instance = singleton + type ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip // and it can only do it at the start of a sequence @@ -984,7 +998,6 @@ namespace Microsoft.FSharp.Core.CompilerServices open System.Collections open System.Collections.Generic open Microsoft.FSharp.Collections.SeqComposition - open Microsoft.FSharp.Collections.SeqComposition.Factories open Microsoft.FSharp.Collections.SeqComposition.Core module RuntimeHelpers = diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 4593bc09587..936efb35d01 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -75,6 +75,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member Length : unit -> int interface ISeq<'T> + [] + type internal IdentityFactory<'T> = + inherit TransformFactory<'T,'T> + static member Instance : TransformFactory<'T,'T> + type internal ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip // and it can only do it at the start of a sequence From 143a0c2c2fc9f3648e1c3ad2bc477c095852e9b2 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 8 Apr 2017 19:42:15 +1000 Subject: [PATCH 046/120] internal List.ofISeq --- src/fsharp/FSharp.Core/iseq.fs | 2 +- src/fsharp/FSharp.Core/local.fs | 26 ++++++++++++++++++++++++++ src/fsharp/FSharp.Core/local.fsi | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index ea3374de3f8..9433342094e 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1131,7 +1131,7 @@ namespace Microsoft.FSharp.Collections [] let toList (source : ISeq<'T>) = checkNonNull "source" source - Microsoft.FSharp.Primitives.Basics.List.ofSeq source + Microsoft.FSharp.Primitives.Basics.List.ofISeq source [] let replicate count x = diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index 1fe10797cd8..074f244952c 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -86,6 +86,7 @@ open Microsoft.FSharp.Core.ICloneableExtensions module internal List = + open Microsoft.FSharp.Collections.SeqComposition let arrayZeroCreate (n:int) = (# "newarr !0" type ('T) n : 'T array #) @@ -544,10 +545,35 @@ module internal List = res <- arr.[i] :: res res + type FoldToList<'T> () = + inherit Folder<'T, list<'T>>([]) + + let mutable first = true + let mutable cons = Unchecked.defaultof<_> + + override this.ProcessNext input = + if first then + first <- false + this.Result <- freshConsNoTail input + cons <- this.Result + else + let cons2 = freshConsNoTail input + setFreshConsTail cons cons2 + cons <- cons2 + true (* result unused in fold *) + + override this.ChainComplete _ = + if not first then + setFreshConsTail cons [] + + let ofISeq (s : ISeq<'T>) = + s.Fold (fun _ -> upcast FoldToList()) + let inline ofSeq (e : IEnumerable<'T>) = match e with | :? list<'T> as l -> l | :? ('T[]) as arr -> ofArray arr + | :? ISeq<'T> as s -> ofISeq s | _ -> use ie = e.GetEnumerator() if not (ie.MoveNext()) then [] diff --git a/src/fsharp/FSharp.Core/local.fsi b/src/fsharp/FSharp.Core/local.fsi index 8ee4bbcdcfa..927a1120e05 100644 --- a/src/fsharp/FSharp.Core/local.fsi +++ b/src/fsharp/FSharp.Core/local.fsi @@ -22,6 +22,7 @@ namespace Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Core open Microsoft.FSharp.Collections +open Microsoft.FSharp.Collections.SeqComposition module internal List = val allPairs : 'T1 list -> 'T2 list -> ('T1 * 'T2) list @@ -61,6 +62,7 @@ module internal List = val take : int -> 'T list -> 'T list val takeWhile : ('T -> bool) -> 'T list -> 'T list val toArray : 'T list -> 'T[] + val ofISeq : ISeq<'T> -> 'T List val inline ofSeq : seq<'T> -> 'T List val splitAt : int -> 'T list -> ('T list * 'T list) val truncate : int -> 'T list -> 'T list From b848755bf62d6b6d5050f9e221d5221c71e3b902 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 9 Apr 2017 06:26:19 +1000 Subject: [PATCH 047/120] Removed Fold.(execute|executeThin) --- src/fsharp/FSharp.Core/seqcore.fs | 441 +++++++++++++++--------------- 1 file changed, 224 insertions(+), 217 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 658bd9d9b8d..f68ffc8bf8d 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -161,6 +161,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) + type IdentityFactory<'T> private () = + inherit TransformFactory<'T,'T> () + static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static member Instance = singleton + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = inherit TransformFactory<'T,'V>() @@ -170,12 +176,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = upcast ComposedFactory(first, second) - type IdentityFactory<'T> private () = - inherit TransformFactory<'T,'T> () - static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) - override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next - static member Instance = singleton - type ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip // and it can only do it at the start of a sequence @@ -184,181 +184,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_>) pipeIdx = factory.Compose (Upcast.outOfBand folder) pipeIdx folder - module Fold = - // The consumers of IIterate are the execute and exeuteThin methods. IIterate is passed - // as a generic argument. The types that implement IIterate are value types. This combination - // means that the runtime will "inline" the methods. The alternatives to this were that the - // code in execute/executeThin were duplicated for each of the Fold types, or we turned the - // types back into normal functions and curried them then we would be creating garbage - // each time one of these were called. This has been an optimization to minimize the impact - // on very small collections. - type IIterate<'T> = - abstract Iterate<'U,'Result,'State> : outOfBand:Folder<'U,'Result> -> consumer:Activity<'T,'U> -> unit - - [] - type IterateEnumerable<'T> (enumerable:IEnumerable<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - use enumerator = enumerable.GetEnumerator () - let rec iterate () = - if outOfBand.HaltedIdx = 0 && enumerator.MoveNext () then - consumer.ProcessNext enumerator.Current |> ignore - iterate () - iterate () - - [] - type IterateArray<'T> (array:array<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let array = array - let rec iterate idx = - if outOfBand.HaltedIdx = 0 && idx < array.Length then - consumer.ProcessNext array.[idx] |> ignore - iterate (idx+1) - iterate 0 - - [] - type IterateResizeArray<'T> (array:ResizeArray<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let array = array - let rec iterate idx = - if outOfBand.HaltedIdx = 0 && idx < array.Count then - consumer.ProcessNext array.[idx] |> ignore - iterate (idx+1) - iterate 0 - - [] - type IterateList<'T> (alist:list<'T>) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let rec iterate lst = - match lst with - | hd :: tl when outOfBand.HaltedIdx = 0 -> - consumer.ProcessNext hd |> ignore - iterate tl - | _ -> () - iterate alist - - [] - type IterateSingleton<'T> (item:'T) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - if outOfBand.HaltedIdx = 0 then - consumer.ProcessNext item |> ignore - - [] - type IterateUnfold<'S,'T> (generator:'S->option<'T*'S>, state:'S) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let generator = generator - let rec iterate current = - if outOfBand.HaltedIdx <> 0 then () - else - match generator current with - | Some (item, next) -> - consumer.ProcessNext item |> ignore - iterate next - | _ -> () - iterate state - - [] - type IterateInit<'T> (f:int->'T, terminatingIdx:int) = - interface IIterate<'T> with - member __.Iterate (outOfBand:Folder<'U,'Result>) (consumer:Activity<'T,'U>) = - let terminatingIdx = terminatingIdx - let f = f - - let firstIdx = - match box consumer with - | :? ISkipable as skipping -> - let rec skip idx = - if idx = terminatingIdx || outOfBand.HaltedIdx <> 0 then - terminatingIdx - elif skipping.CanSkip () then - skip (idx+1) - else - idx - skip -1 - | _ -> -1 - - let rec iterate idx = - if idx < terminatingIdx then - consumer.ProcessNext (f (idx+1)) |> ignore - if outOfBand.HaltedIdx = 0 then - iterate (idx+1) - else - idx - else - idx - - let finalIdx = iterate firstIdx - if outOfBand.HaltedIdx = 0 && finalIdx = System.Int32.MaxValue then - raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) - - // execute, and it's companion, executeThin, are hosting functions that ensure the correct sequence - // of creation, iteration and disposal for the pipeline - let execute (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (executeOn:#IIterate<'T>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx - try - executeOn.Iterate result consumer - consumer.ChainComplete result.HaltedIdx - result.Result - finally - consumer.ChainDispose () - - // executeThin is a specialization of execute, provided as a performance optimization, that can - // be used when a sequence has been wrapped in an ISeq, but hasn't had an items added to its pipeline - // i.e. a container that has ISeq.ofSeq applied. - let executeThin (createFolder:PipeIdx->Folder<'T,'Result>) (executeOn:#IIterate<'T>) = - let result = createFolder 1 - try - executeOn.Iterate result result - result.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () - - let executeConcat<'T,'U,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'U,'Result>) (transformFactory:TransformFactory<'T,'U>) pipeIdx (sources:ISeq<'Collection>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx - try - let common = - { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = consumer.ProcessNext value } - - sources.Fold (fun _ -> - { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = - value.Fold (fun _ -> common) |> ignore - me.HaltedIdx <- common.HaltedIdx - Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - - consumer.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () - - let executeConcatThin<'T,'Result,'State,'Collection when 'Collection :> ISeq<'T>> (createFolder:PipeIdx->Folder<'T,'Result>) (sources:ISeq<'Collection>) = - let result = createFolder 1 - try - let common = - { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = result.ProcessNext value } - - sources.Fold (fun _ -> - { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = - value.Fold (fun _ -> common) |> ignore - me.HaltedIdx <- common.HaltedIdx - Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - - result.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () - type SeqProcessNextStates = | InProcess = 0 | NotStarted = 1 @@ -530,35 +355,62 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform _ = derivedClassShouldImplement () member __.Fold _ = derivedClassShouldImplement () - and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold current result pipeIdx, result)) + Upcast.enumerator (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine current next, pipeIdx+1)) + Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + use enumerator = enumerable.GetEnumerator () + while result.HaltedIdx = 0 && enumerator.MoveNext () do + consumer.ProcessNext enumerator.Current |> ignore - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f current pipeIdx (Fold.IterateEnumerable enumerable) + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () - and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() interface IEnumerable<'U> with member __.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold current result pipeIdx, result)) + Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine current next, pipeIdx+1)) + Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let common = + { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = consumer.ProcessNext value } + + sources.Fold (fun _ -> + { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with + override me.ProcessNext value = + value.Fold (fun _ -> common) |> ignore + me.HaltedIdx <- common.HaltedIdx + Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.executeConcat f current pipeIdx sources + consumer.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = inherit EnumerableBase<'T>() @@ -572,8 +424,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeConcatThin f (preEnumerate sources) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let fat = Upcast.seq (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityFactory.Instance, 1)) + fat.Fold createFolder and AppendEnumerable<'T> (sources:list>) = inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (ThinListEnumerable>(List.rev sources))) @@ -593,8 +446,21 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateList alist) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + let rec iterate lst = + match lst with + | hd :: tl when result.HaltedIdx = 0 -> + result.ProcessNext hd |> ignore + iterate tl + | _ -> () + iterate alist + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() @@ -608,8 +474,22 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateList alist) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let rec iterate lst = + match lst with + | hd :: tl when result.HaltedIdx = 0 -> + consumer.ProcessNext hd |> ignore + iterate tl + | _ -> () + iterate alist + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = @@ -635,8 +515,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateEnumerable enumerable) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + use enumerator = enumerable.GetEnumerator () + while result.HaltedIdx = 0 && enumerator.MoveNext () do + result.ProcessNext enumerator.Current |> ignore + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() @@ -673,8 +562,13 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateEnumerable this) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -710,8 +604,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateArray array) + member __.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let array = array + let mutable idx = 0 + while result.HaltedIdx = 0 && idx < array.Length do + consumer.ProcessNext array.[idx] |> ignore + idx <- idx + 1 + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () type ThinArrayEnumerable<'T>(array:array<'T>) = inherit EnumerableBase<'T>() @@ -725,8 +631,19 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateArray array) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + let array = array + let mutable idx = 0 + while result.HaltedIdx = 0 && idx < array.Length do + result.ProcessNext array.[idx] |> ignore + idx <- idx + 1 + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () type SingletonEnumerable<'T>(item:'T) = inherit EnumerableBase<'T>() @@ -740,8 +657,16 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ArrayEnumerable<'T,'U>([|item|], next, 1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateSingleton item) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + if result.HaltedIdx = 0 then + result.ProcessNext item |> ignore + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -777,8 +702,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateResizeArray resizeArray) + member __.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let array = resizeArray + let mutable idx = 0 + while result.HaltedIdx = 0 && idx < array.Count do + consumer.ProcessNext array.[idx] |> ignore + idx <- idx + 1 + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = inherit EnumerableBase<'T>() @@ -792,8 +729,19 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateResizeArray resizeArray) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + let array = resizeArray + let mutable idx = 0 + while result.HaltedIdx = 0 && idx < array.Count do + result.ProcessNext array.[idx] |> ignore + idx <- idx + 1 + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -830,8 +778,25 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - Fold.execute f transformFactory pipeIdx (Fold.IterateUnfold (generator, state)) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let generator = generator + let rec iterate current = + if result.HaltedIdx <> 0 then () + else + match generator current with + | Some (item, next) -> + consumer.ProcessNext item |> ignore + iterate next + | _ -> () + iterate state + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () let getInitTerminatingIdx (count:Nullable) = // we are offset by 1 to allow for values going up to System.Int32.MaxValue @@ -894,9 +859,42 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = Upcast.seq (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - member this.Fold<'Result> (createResult:PipeIdx->Folder<'U,'Result>) = + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let terminatingIdx = getInitTerminatingIdx count - Fold.execute createResult transformFactory pipeIdx (Fold.IterateInit (f, terminatingIdx)) + let result = createFolder (pipeIdx+1) + let consumer = createFold transformFactory result pipeIdx + try + let firstIdx = + match box consumer with + | :? ISkipable as skipping -> + let rec skip idx = + if idx = terminatingIdx || result.HaltedIdx <> 0 then + terminatingIdx + elif skipping.CanSkip () then + skip (idx+1) + else + idx + skip -1 + | _ -> -1 + + let rec iterate idx = + if idx < terminatingIdx then + consumer.ProcessNext (f (idx+1)) |> ignore + if result.HaltedIdx = 0 then + iterate (idx+1) + else + idx + else + idx + + let finalIdx = iterate firstIdx + if result.HaltedIdx = 0 && finalIdx = System.Int32.MaxValue then + raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) + + consumer.ChainComplete result.HaltedIdx + result.Result + finally + consumer.ChainDispose () // The original implementation of "init" delayed the calculation of Current, and so it was possible // to do MoveNext without it's value being calculated. @@ -981,8 +979,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = Upcast.seq (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - Fold.executeThin f (Fold.IterateEnumerable (Upcast.enumerable this)) + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + use enumerator = (Upcast.enumerable this).GetEnumerator () + while result.HaltedIdx = 0 && enumerator.MoveNext () do + result.ProcessNext enumerator.Current |> ignore + + result.ChainComplete result.HaltedIdx + result.Result + finally + result.ChainDispose () namespace Microsoft.FSharp.Core.CompilerServices From cd0c26468064329f47163c7c9c907748b0247e7f Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 9 Apr 2017 09:15:00 +1000 Subject: [PATCH 048/120] Optimize nested concat --- src/fsharp/FSharp.Core/prim-types.fs | 6 +++++- src/fsharp/FSharp.Core/prim-types.fsi | 10 ++++++++-- src/fsharp/FSharp.Core/seqcore.fs | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index e56e0647905..410bba79965 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3247,10 +3247,14 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract ChainDispose : unit -> unit [] - type Activity<'T,'U> () = + type Activity<'T> () = inherit Activity() abstract ProcessNext : input:'T -> bool + [] + type Activity<'T,'U> () = + inherit Activity<'T>() + [] type Folder<'T,'Result> = inherit Activity<'T,'T> diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 6adc84948c9..ea4b427639f 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1752,11 +1752,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition /// Activity is the base class of all elements within the pipeline [] - type Activity<'T,'U> = + type Activity<'T> = inherit Activity - new : unit -> Activity<'T,'U> + new : unit -> Activity<'T> abstract member ProcessNext : input:'T -> bool + /// Activity is the base class of all elements within the pipeline, carrying result type + [] + type Activity<'T,'U> = + inherit Activity<'T> + new : unit -> Activity<'T,'U> + /// Folder is a base class to assist with fold-like operations. It's intended usage /// is as a base class for an object expression that will be used from within /// the Fold function. diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index f68ffc8bf8d..56dd7561d78 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -380,6 +380,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition finally consumer.ChainDispose () + and ConcatCommon<'T>(consumer:Activity<'T>) = + inherit Folder<'T,NoValue>(Unchecked.defaultof<_>) + override me.ProcessNext value = consumer.ProcessNext value + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() @@ -396,9 +400,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx try - let common = - { new Folder<'T,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = consumer.ProcessNext value } + let common : Folder<'T,NoValue> = + let concatCommon = + if not (obj.ReferenceEquals (result, consumer)) then ConcatCommon consumer + else + // (result = consumer) thus our transform is just the identity function, so check to see if + // we're nested, and can just use the deeper nested ConcatCommon object to avoid extra + // call in the chain + match box result with + | :? ConcatCommon<'T> as common -> common + | _ -> ConcatCommon consumer + upcast concatCommon sources.Fold (fun _ -> { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with From 8b51c8039e4be4f8ff41c1edaf88aea24d09f2ea Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 12 Apr 2017 18:27:31 +1000 Subject: [PATCH 049/120] Fix nested concat --- src/fsharp/FSharp.Core/seqcore.fs | 84 ++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 25 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 56dd7561d78..a5db38352ea 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -384,6 +384,47 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit Folder<'T,NoValue>(Unchecked.defaultof<_>) override me.ProcessNext value = consumer.ProcessNext value + and ConcatOutOfBand () = + let outOfBands = ResizeArray () + + interface IOutOfBand with + member this.StopFurtherProcessing pipeIdx = + for i = 0 to outOfBands.Count-1 do + outOfBands.[i].StopFurtherProcessing pipeIdx + + member this.Push outOfBand = + outOfBands.Add outOfBand + + member this.Pop n = + for i = 1 to n do + outOfBands.RemoveAt (outOfBands.Count-1) + + and IConcatGetOutOfBand = + abstract GetOutOfBand : unit -> ConcatOutOfBand + + and ConcatFold<'T,'U,'Collection,'Result when 'Collection :> ISeq<'T>>(outOfBand:ConcatOutOfBand, result:Folder<'U,'Result>, consumer:Activity<'T,'U>, common:Folder<'T,NoValue>) as this = + inherit Folder<'Collection, 'Result>(Unchecked.defaultof<_>) + + do + outOfBand.Push this + outOfBand.Push result + outOfBand.Push common + + override __.ProcessNext value = + value.Fold (fun _ -> common) |> ignore + Unchecked.defaultof<_> (* return value unused in Fold context *) + + override this.ChainComplete _ = + outOfBand.Pop 3 + consumer.ChainComplete result.HaltedIdx + this.Result <- result.Result + + override this.ChainDispose () = + consumer.ChainDispose () + + interface IConcatGetOutOfBand with + member __.GetOutOfBand () = outOfBand + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() @@ -397,32 +438,25 @@ namespace Microsoft.FSharp.Collections.SeqComposition Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx - try - let common : Folder<'T,NoValue> = - let concatCommon = - if not (obj.ReferenceEquals (result, consumer)) then ConcatCommon consumer - else - // (result = consumer) thus our transform is just the identity function, so check to see if - // we're nested, and can just use the deeper nested ConcatCommon object to avoid extra - // call in the chain - match box result with - | :? ConcatCommon<'T> as common -> common - | _ -> ConcatCommon consumer - upcast concatCommon - - sources.Fold (fun _ -> - { new Folder<'Collection,NoValue>(Unchecked.defaultof<_>) with - override me.ProcessNext value = - value.Fold (fun _ -> common) |> ignore - me.HaltedIdx <- common.HaltedIdx - Unchecked.defaultof<_> (* return value unused in Fold context *) }) |> ignore + sources.Fold (fun lowerPipeIdx -> + let thisPipeIdx = lowerPipeIdx + pipeIdx - consumer.ChainComplete result.HaltedIdx - result.Result - finally - result.ChainDispose () + let result = createFolder (thisPipeIdx+1) + + let outOfBand = + match box result with + | :? IConcatGetOutOfBand as get -> get.GetOutOfBand () + | _ -> ConcatOutOfBand () + + let consumer = + transformFactory.Compose (Upcast.outOfBand outOfBand) thisPipeIdx result + + let common = + match box consumer with + | :? ConcatCommon<'T> as common -> common + | _ -> upcast ConcatCommon consumer + + upcast ConcatFold (outOfBand, result, consumer, common)) and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = inherit EnumerableBase<'T>() From e27ee1aba9b355c91c59a0fc968dec4f7f5491ef Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 12 Apr 2017 19:45:11 +1000 Subject: [PATCH 050/120] Updated SurfaceArea files --- .../SurfaceArea.coreclr.fs | 336 +++++++++-------- .../SurfaceArea.net40.fs | 244 +++++++++++++ .../fsharpqa/Source/Misc/LongSourceFile01.fs | 337 ++++++++++-------- 3 files changed, 609 insertions(+), 308 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs index 2c5ceb43543..7bd525bfe95 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs @@ -293,20 +293,6 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() @@ -316,45 +302,32 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResul Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) -Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: TResult Fold[TResult,TState](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]]) -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Activity`2 Compose[V](IOutOfBand, Int32, Activity`2) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) @@ -363,9 +336,9 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int3 Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() @@ -389,14 +362,8 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+NoValue -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] @@ -404,111 +371,111 @@ Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqM Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 AllPairs[T1,T2](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cache[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cast[T](System.Collections.IEnumerable) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ChunkBySize[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Distinct[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Empty[T]() -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Except[T](System.Collections.Generic.IEnumerable`1[T], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Indexed[a](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], ISeq`1, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfArray[T](T[]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Replicate[T](Int32, T) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Singleton[T](T) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortDescending[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SplitInto[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip3[T1,T2,T3](ISeq`1, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T3]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cast[T](System.Collections.IEnumerable) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TCollection]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Empty[T]() +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfArray[T](T[]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Replicate[T](Int32, T) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Singleton[T](T) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Min[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], TState) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) @@ -641,6 +608,65 @@ Microsoft.FSharp.Collections.MapModule: TResult Pick[TKey,T,TResult](Microsoft.F Microsoft.FSharp.Collections.MapModule: TState FoldBack[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T], TState) Microsoft.FSharp.Collections.MapModule: TState Fold[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]]], TState, Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) Microsoft.FSharp.Collections.MapModule: Void Iterate[TKey,T](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) +Microsoft.FSharp.Collections.SeqComposition.Activity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 Length() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T] +Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue +Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Void .ctor() Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1098,6 +1124,8 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean Equal Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean get_CheckClose() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GenerateNext(System.Collections.Generic.IEnumerable`1[T] ByRef) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 7db771e825d..bb3308223e9 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -280,6 +280,189 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) +Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 +Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 +Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] +Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T3]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cast[T](System.Collections.IEnumerable) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TCollection]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Empty[T]() +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfArray[T](T[]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Replicate[T](Int32, T) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Singleton[T](T) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], TState) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) @@ -412,6 +595,65 @@ Microsoft.FSharp.Collections.MapModule: TResult Pick[TKey,T,TResult](Microsoft.F Microsoft.FSharp.Collections.MapModule: TState FoldBack[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T], TState) Microsoft.FSharp.Collections.MapModule: TState Fold[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]]], TState, Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) Microsoft.FSharp.Collections.MapModule: Void Iterate[TKey,T](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) +Microsoft.FSharp.Collections.SeqComposition.Activity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 Length() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T] +Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue +Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Void .ctor() Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -916,6 +1158,8 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean Equal Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean get_CheckClose() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GenerateNext(System.Collections.Generic.IEnumerable`1[T] ByRef) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Type GetType() diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index c144938159b..f810267527a 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -247,20 +247,6 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() @@ -270,45 +256,32 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResul Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) -Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: ISeq`1 PushTransform[TResult](TransformFactory`2) -Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]: TResult Fold[TResult,TState](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState]]) -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+NoValue: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Activity`2 Compose[V](IOutOfBand, Int32, Activity`2) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) @@ -317,9 +290,9 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int3 Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Microsoft.FSharp.Core.Unit ByRef, Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose(Microsoft.FSharp.Core.Unit ByRef) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() @@ -343,14 +316,8 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Activity`2[T,TResult] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Folder`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+IOutOfBand -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+NoValue -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformFactory`2[T,TResult] +Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] @@ -358,111 +325,111 @@ Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqM Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 AllPairs[T1,T2](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Append[T](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cache[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Cast[T](System.Collections.IEnumerable) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ChunkBySize[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Concat[TCollection,T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[T]]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Distinct[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Empty[T]() -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Except[T](System.Collections.Generic.IEnumerable`1[T], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Indexed[a](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], ISeq`1, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfArray[T](T[]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Pairwise[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Replicate[T](Int32, T) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Reverse[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Singleton[T](T) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Skip[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortDescending[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Sort[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 SplitInto[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Tail[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Take[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Truncate[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Windowed[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip3[T1,T2,T3](ISeq`1, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: ISeq`1 Zip[T1,T2](ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T3]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cast[T](System.Collections.IEnumerable) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TCollection]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Empty[T]() +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfArray[T](T[]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Replicate[T](Int32, T) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Singleton[T](T) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.ISeqModule+Core+ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: T Average[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Head[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Last[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Max[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Min[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T Sum[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], ISeq`1, ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], ISeq`1, TState) -Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], ISeq`1, ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], ISeq`1) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], ISeq`1) +Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], TState) +Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) +Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) +Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) @@ -559,6 +526,66 @@ Microsoft.FSharp.Collections.MapModule: TResult Pick[TKey,T,TResult](Microsoft.F Microsoft.FSharp.Collections.MapModule: TState FoldBack[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T], TState) Microsoft.FSharp.Collections.MapModule: TState Fold[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]]], TState, Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) Microsoft.FSharp.Collections.MapModule: Void Iterate[TKey,T](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) +Microsoft.FSharp.Collections.SeqComposition.Activity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 Length() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T] +Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue +Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) Microsoft.FSharp.Collections.SeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) @@ -1004,6 +1031,8 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean Equal Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean get_CheckClose() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GenerateNext(System.Collections.Generic.IEnumerable`1[T] ByRef) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Type GetType() From 96fa636ee53607b9def9e6d026d3001ec1d926c2 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 17 Apr 2017 16:04:53 +1000 Subject: [PATCH 051/120] Save tmp copy of Result --- src/fsharp/FSharp.Core/seqcore.fs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index a5db38352ea..f100a0bfb5e 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -376,9 +376,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition consumer.ProcessNext enumerator.Current |> ignore consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result and ConcatCommon<'T>(consumer:Activity<'T>) = inherit Folder<'T,NoValue>(Unchecked.defaultof<_>) @@ -533,9 +533,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition iterate alist consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = @@ -661,9 +661,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition idx <- idx + 1 consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result type ThinArrayEnumerable<'T>(array:array<'T>) = inherit EnumerableBase<'T>() @@ -759,9 +759,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition idx <- idx + 1 consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = inherit EnumerableBase<'T>() @@ -840,9 +840,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition iterate state consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result let getInitTerminatingIdx (count:Nullable) = // we are offset by 1 to allow for values going up to System.Int32.MaxValue @@ -938,9 +938,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result // The original implementation of "init" delayed the calculation of Current, and so it was possible // to do MoveNext without it's value being calculated. @@ -1372,7 +1372,7 @@ namespace Microsoft.FSharp.Core.CompilerServices consumer.ProcessNext e.Current |> ignore consumer.ChainComplete result.HaltedIdx - result.Result finally consumer.ChainDispose () + result.Result From 62eb1e59dc0411790fc3d026985f82b947ad93e5 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 18 Apr 2017 19:23:49 +1000 Subject: [PATCH 052/120] Removed Folder.StopFurtherProcessing --- src/fsharp/FSharp.Core/iseq.fs | 35 ++++++++++++++------------- src/fsharp/FSharp.Core/prim-types.fs | 6 ++--- src/fsharp/FSharp.Core/prim-types.fsi | 1 - 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 9433342094e..56b7636b74d 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -107,6 +107,7 @@ namespace Microsoft.FSharp.Collections // is fixed with the compiler then these functions can be removed. let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) + let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) let inline valueComparer<'T when 'T : equality> ()= let c = HashIdentity.Structural<'T> @@ -184,7 +185,7 @@ namespace Microsoft.FSharp.Collections this.Result <- value else this.State._2 <- true - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = @@ -210,7 +211,7 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then this.Result <- folder this.Result value this.State.Current else - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -246,7 +247,7 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then f value this.State.Current else - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -262,7 +263,7 @@ namespace Microsoft.FSharp.Collections this.State._1 <- this.State._1 + 1 Unchecked.defaultof<_> else - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> override this.OnComplete _ = () override this.OnDispose () = this.State._2.Dispose () }) @@ -273,7 +274,7 @@ namespace Microsoft.FSharp.Collections { new Folder<'T, Option<'T>> (None) with override this.ProcessNext value = this.Result <- Some value - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -306,7 +307,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if f value then this.Result <- true - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -317,9 +318,9 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then if predicate value this.State.Current then this.Result <- true - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx else - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -332,7 +333,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if element = value then this.Result <- true - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -342,7 +343,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if not (predicate value) then this.Result <- false - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -353,9 +354,9 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then if not (predicate value this.State.Current) then this.Result <- false - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx else - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -443,12 +444,12 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if not (this.State.MoveNext()) then this.Result <- 1 - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx else let c = f value this.State.Current if c <> 0 then this.Result <- c - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = if this.Result = 0 && this.State.MoveNext() then @@ -784,7 +785,7 @@ namespace Microsoft.FSharp.Collections match f value with | (Some _) as some -> this.Result <- some - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx | None -> () Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -795,7 +796,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if f value then this.Result <- Some value - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -806,7 +807,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if predicate value then this.Result <- Some this.State - this.StopFurtherProcessing pipeIdx + (Upcast.outOfBand this).StopFurtherProcessing pipeIdx else this.State <- this.State + 1 Unchecked.defaultof<_> (* return value unused in Fold context *) }) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 410bba79965..243900ccbb6 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3260,11 +3260,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit Activity<'T,'T> val mutable Result : 'Result - val mutable HaltedIdx : int - member this.StopFurtherProcessing pipeIdx = this.HaltedIdx <- pipeIdx + interface IOutOfBand with - member this.StopFurtherProcessing pipeIdx = this.StopFurtherProcessing pipeIdx + member this.StopFurtherProcessing pipeIdx = + this.HaltedIdx <- pipeIdx new (initalResult) = { inherit Activity<'T,'T>() diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index ea4b427639f..2836c9efe07 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1773,7 +1773,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IOutOfBand val mutable Result : 'Result val mutable HaltedIdx : int - member StopFurtherProcessing : PipeIdx -> unit override ChainComplete : PipeIdx -> unit override ChainDispose : unit -> unit From 7cb86e9966347ce8befe2b2d0309be6ec3ecb010 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 18 Apr 2017 19:26:32 +1000 Subject: [PATCH 053/120] Changed Folder style; HaltedIdx read only --- src/fsharp/FSharp.Core/prim-types.fs | 19 ++++++++----------- src/fsharp/FSharp.Core/prim-types.fsi | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 243900ccbb6..f23c5778c04 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3256,21 +3256,18 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit Activity<'T>() [] - type Folder<'T,'Result> = - inherit Activity<'T,'T> + type Folder<'T,'Result>(initalResult:'Result) = + inherit Activity<'T,'T>() - val mutable Result : 'Result - val mutable HaltedIdx : int + let mutable result = initalResult + let mutable haltedIdx = 0 + + member __.Result with get () = result and set value = result <- value + member __.HaltedIdx with get () = haltedIdx interface IOutOfBand with member this.StopFurtherProcessing pipeIdx = - this.HaltedIdx <- pipeIdx - - new (initalResult) = { - inherit Activity<'T,'T>() - HaltedIdx = 0 - Result = initalResult - } + haltedIdx <- pipeIdx override this.ChainComplete _ = () override this.ChainDispose () = () diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 2836c9efe07..6fbed60787a 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1771,8 +1771,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit Activity<'T,'T> new : 'Result -> Folder<'T,'Result> interface IOutOfBand - val mutable Result : 'Result - val mutable HaltedIdx : int + member Result : 'Result with get, set + member HaltedIdx : PipeIdx with get override ChainComplete : PipeIdx -> unit override ChainDispose : unit -> unit From bb91bd0e3eab33ca15cdb8b30ae8d59884a8e481 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 18 Apr 2017 19:35:14 +1000 Subject: [PATCH 054/120] Add listening for StopFurtherProcessing --- src/fsharp/FSharp.Core/prim-types.fs | 11 ++++++++++- src/fsharp/FSharp.Core/prim-types.fsi | 2 ++ src/fsharp/FSharp.Core/seqcore.fs | 17 +++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index f23c5778c04..4ac359dbb5b 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3240,6 +3240,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type IOutOfBand = abstract StopFurtherProcessing : PipeIdx -> unit + abstract ListenForStopFurtherProcessing : Action -> unit [] type Activity() = @@ -3259,6 +3260,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type Folder<'T,'Result>(initalResult:'Result) = inherit Activity<'T,'T>() + let mutable listeners = BasicInlinedOperations.unsafeDefault> let mutable result = initalResult let mutable haltedIdx = 0 @@ -3267,7 +3269,14 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IOutOfBand with member this.StopFurtherProcessing pipeIdx = - haltedIdx <- pipeIdx + if haltedIdx = 0 then + haltedIdx <- pipeIdx + match listeners with + | null -> () + | a -> a.Invoke pipeIdx + + member this.ListenForStopFurtherProcessing action = + listeners <- Delegate.Combine (listeners, action) :?> Action override this.ChainComplete _ = () override this.ChainDispose () = () diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 6fbed60787a..03a988cf31f 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1735,6 +1735,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition type IOutOfBand = /// Stop the processing of any further items down the pipeline abstract StopFurtherProcessing : PipeIdx -> unit + /// Add a Action delegate that gets notified if StopFurtherProcessing is called + abstract ListenForStopFurtherProcessing : Action -> unit /// Activity is the root class for chains of activities. It is in a non-generic /// form so that it can be used by subsequent activities diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index f100a0bfb5e..6dd3bbb084b 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -387,10 +387,21 @@ namespace Microsoft.FSharp.Collections.SeqComposition and ConcatOutOfBand () = let outOfBands = ResizeArray () + let mutable haltedIdx = 0 + let mutable listeners = Unchecked.defaultof> + interface IOutOfBand with member this.StopFurtherProcessing pipeIdx = - for i = 0 to outOfBands.Count-1 do - outOfBands.[i].StopFurtherProcessing pipeIdx + if haltedIdx = 0 then + haltedIdx <- pipeIdx + for i = 0 to outOfBands.Count-1 do + outOfBands.[i].StopFurtherProcessing pipeIdx + match listeners with + | null -> () + | a -> a.Invoke pipeIdx + + member this.ListenForStopFurtherProcessing action = + listeners <- Delegate.Combine (listeners, action) :?> Action member this.Push outOfBand = outOfBands.Add outOfBand @@ -408,7 +419,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition do outOfBand.Push this outOfBand.Push result + (Upcast.outOfBand result).ListenForStopFurtherProcessing (fun idx -> (Upcast.outOfBand outOfBand).StopFurtherProcessing idx) outOfBand.Push common + (Upcast.outOfBand common).ListenForStopFurtherProcessing (fun idx -> (Upcast.outOfBand outOfBand).StopFurtherProcessing idx) override __.ProcessNext value = value.Fold (fun _ -> common) |> ignore From e03bd2df28a9f898bde769f75544c82c5eb6db91 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 19 Apr 2017 19:47:04 +1000 Subject: [PATCH 055/120] Fixed concat (for good! ... hopefully) --- src/fsharp/FSharp.Core/prim-types.fs | 13 +++-- src/fsharp/FSharp.Core/seqcore.fs | 72 ++++++++++------------------ 2 files changed, 32 insertions(+), 53 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 4ac359dbb5b..2da8f42eaef 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3235,6 +3235,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition open System.Collections.Generic open Microsoft.FSharp.Core open Microsoft.FSharp.Collections + open BasicInlinedOperations type PipeIdx = int @@ -3269,11 +3270,13 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IOutOfBand with member this.StopFurtherProcessing pipeIdx = - if haltedIdx = 0 then - haltedIdx <- pipeIdx - match listeners with - | null -> () - | a -> a.Invoke pipeIdx + let currentIdx = haltedIdx + haltedIdx <- pipeIdx + if currentIdx = 0 then + if haltedIdx <> 0 then + match listeners with + | null -> () + | a -> a.Invoke pipeIdx member this.ListenForStopFurtherProcessing action = listeners <- Delegate.Combine (listeners, action) :?> Action diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 6dd3bbb084b..17029e9ca95 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -151,6 +151,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition [] type NoValue = struct end + module internal TailCall = + // used for performance reasons; these are not recursive calls, so should be safe + // ** it should be noted that potential changes to the f# compiler may render this function + // ineffictive ** + let inline avoid boolean = match boolean with true -> true | false -> false + module internal Upcast = // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality // is fixed with the compiler then these functions can be removed. @@ -382,62 +388,36 @@ namespace Microsoft.FSharp.Collections.SeqComposition and ConcatCommon<'T>(consumer:Activity<'T>) = inherit Folder<'T,NoValue>(Unchecked.defaultof<_>) - override me.ProcessNext value = consumer.ProcessNext value - - and ConcatOutOfBand () = - let outOfBands = ResizeArray () - - let mutable haltedIdx = 0 - let mutable listeners = Unchecked.defaultof> - - interface IOutOfBand with - member this.StopFurtherProcessing pipeIdx = - if haltedIdx = 0 then - haltedIdx <- pipeIdx - for i = 0 to outOfBands.Count-1 do - outOfBands.[i].StopFurtherProcessing pipeIdx - match listeners with - | null -> () - | a -> a.Invoke pipeIdx - member this.ListenForStopFurtherProcessing action = - listeners <- Delegate.Combine (listeners, action) :?> Action + member __.Consumer = consumer - member this.Push outOfBand = - outOfBands.Add outOfBand + override me.ProcessNext value = TailCall.avoid (consumer.ProcessNext value) - member this.Pop n = - for i = 1 to n do - outOfBands.RemoveAt (outOfBands.Count-1) - - and IConcatGetOutOfBand = - abstract GetOutOfBand : unit -> ConcatOutOfBand - - and ConcatFold<'T,'U,'Collection,'Result when 'Collection :> ISeq<'T>>(outOfBand:ConcatOutOfBand, result:Folder<'U,'Result>, consumer:Activity<'T,'U>, common:Folder<'T,NoValue>) as this = + and ConcatFold<'T,'U,'Collection,'Result when 'Collection :> ISeq<'T>>(result:Folder<'U,'Result>, consumer:Activity<'T,'U>, common:Folder<'T,NoValue>) as this = inherit Folder<'Collection, 'Result>(Unchecked.defaultof<_>) do - outOfBand.Push this - outOfBand.Push result - (Upcast.outOfBand result).ListenForStopFurtherProcessing (fun idx -> (Upcast.outOfBand outOfBand).StopFurtherProcessing idx) - outOfBand.Push common - (Upcast.outOfBand common).ListenForStopFurtherProcessing (fun idx -> (Upcast.outOfBand outOfBand).StopFurtherProcessing idx) + (Upcast.outOfBand this).ListenForStopFurtherProcessing (fun idx -> + (Upcast.outOfBand result).StopFurtherProcessing idx + (Upcast.outOfBand common).StopFurtherProcessing PipeIdx.MinValue) + + (Upcast.outOfBand result).ListenForStopFurtherProcessing (fun idx -> + (Upcast.outOfBand this).StopFurtherProcessing idx + (Upcast.outOfBand common).StopFurtherProcessing PipeIdx.MaxValue) override __.ProcessNext value = - value.Fold (fun _ -> common) |> ignore + value.Fold (fun _ -> + (Upcast.outOfBand common).StopFurtherProcessing 0 + common) |> ignore Unchecked.defaultof<_> (* return value unused in Fold context *) override this.ChainComplete _ = - outOfBand.Pop 3 consumer.ChainComplete result.HaltedIdx this.Result <- result.Result override this.ChainDispose () = consumer.ChainDispose () - interface IConcatGetOutOfBand with - member __.GetOutOfBand () = outOfBand - and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() @@ -456,20 +436,16 @@ namespace Microsoft.FSharp.Collections.SeqComposition let result = createFolder (thisPipeIdx+1) - let outOfBand = - match box result with - | :? IConcatGetOutOfBand as get -> get.GetOutOfBand () - | _ -> ConcatOutOfBand () + let outOfBand = Upcast.outOfBand result - let consumer = - transformFactory.Compose (Upcast.outOfBand outOfBand) thisPipeIdx result + let consumer = transformFactory.Compose outOfBand thisPipeIdx result let common = match box consumer with - | :? ConcatCommon<'T> as common -> common - | _ -> upcast ConcatCommon consumer + | :? ConcatCommon<'T> as c -> ConcatCommon c.Consumer + | _ -> ConcatCommon consumer - upcast ConcatFold (outOfBand, result, consumer, common)) + upcast ConcatFold (result, consumer, common)) and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = inherit EnumerableBase<'T>() From 75ffc531414dbcee555e9ebfe601d80fb1634368 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 20 Apr 2017 17:55:02 +1000 Subject: [PATCH 056/120] Used LanguagePrimitives.IntrinsicOperators.(&&) --- src/fsharp/FSharp.Core/prim-types.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 2da8f42eaef..c1bc280b346 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3236,6 +3236,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition open Microsoft.FSharp.Core open Microsoft.FSharp.Collections open BasicInlinedOperations + open LanguagePrimitives.IntrinsicOperators type PipeIdx = int @@ -3272,11 +3273,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.StopFurtherProcessing pipeIdx = let currentIdx = haltedIdx haltedIdx <- pipeIdx - if currentIdx = 0 then - if haltedIdx <> 0 then - match listeners with - | null -> () - | a -> a.Invoke pipeIdx + if currentIdx = 0 && haltedIdx <> 0 then + match listeners with + | null -> () + | a -> a.Invoke pipeIdx member this.ListenForStopFurtherProcessing action = listeners <- Delegate.Combine (listeners, action) :?> Action From 6de24b25225d7bcfd886ade3a2fc4b2c13690b7b Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 20 Apr 2017 17:56:57 +1000 Subject: [PATCH 057/120] Remove temp copies of Folder.Result --- src/fsharp/FSharp.Core/seqcore.fs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 17029e9ca95..44ae88854ea 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -493,9 +493,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition iterate alist result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() @@ -558,9 +558,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.ProcessNext enumerator.Current |> ignore result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() @@ -601,9 +601,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition let result = createFolder 1 try result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -676,9 +676,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition idx <- idx + 1 result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result type SingletonEnumerable<'T>(item:'T) = inherit EnumerableBase<'T>() @@ -699,9 +699,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.ProcessNext item |> ignore result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -774,9 +774,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition idx <- idx + 1 result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) @@ -1022,9 +1022,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.ProcessNext enumerator.Current |> ignore result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result namespace Microsoft.FSharp.Core.CompilerServices @@ -1319,9 +1319,9 @@ namespace Microsoft.FSharp.Core.CompilerServices result.ProcessNext e.Current |> ignore result.ChainComplete result.HaltedIdx - result.Result finally result.ChainDispose () + result.Result override this.Length () = use maybeGeneratedSequenceBase = this.GetFreshEnumerator () From f34f0cfad85f64729ea701c5de61f180fb8734df Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 20 Apr 2017 18:00:20 +1000 Subject: [PATCH 058/120] Minimize stack usage for List Folds --- src/fsharp/FSharp.Core/seqcore.fs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 44ae88854ea..bcbd2aa174f 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -484,13 +484,15 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 try - let rec iterate lst = - match lst with + let mutable lst = alist + while + ( match lst with | hd :: tl when result.HaltedIdx = 0 -> result.ProcessNext hd |> ignore - iterate tl - | _ -> () - iterate alist + lst <- tl + true + | _ -> false + ) do () result.ChainComplete result.HaltedIdx finally @@ -513,13 +515,15 @@ namespace Microsoft.FSharp.Collections.SeqComposition let result = createFolder (pipeIdx+1) let consumer = createFold transformFactory result pipeIdx try - let rec iterate lst = - match lst with + let mutable lst = alist + while + ( match lst with | hd :: tl when result.HaltedIdx = 0 -> consumer.ProcessNext hd |> ignore - iterate tl - | _ -> () - iterate alist + lst <- tl + true + | _ -> false + ) do () consumer.ChainComplete result.HaltedIdx finally From be889eb8141b6489df6a6c3b093d20f9d49a90c8 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 20 Apr 2017 18:24:32 +1000 Subject: [PATCH 059/120] Updated surface area files --- .../FSharp.Core.Unittests/SurfaceArea.coreclr.fs | 13 ++++++++++--- .../FSharp.Core.Unittests/SurfaceArea.net40.fs | 13 ++++++++++--- tests/fsharpqa/Source/Misc/LongSourceFile01.fs | 13 ++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs index 7bd525bfe95..1e96c5d8aba 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs @@ -297,28 +297,32 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResul Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult get_Result() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult get_Result() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() @@ -651,13 +655,16 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals( Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult get_Result() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) +Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index bb3308223e9..0e2137c8fc1 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -284,28 +284,32 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResul Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult get_Result() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult get_Result() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() @@ -638,13 +642,16 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals( Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult get_Result() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) +Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index f810267527a..5484feda32b 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -251,28 +251,32 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResul Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult get_Result() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult get_Result() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() @@ -569,13 +573,16 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals( Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 get_HaltedIdx() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult get_Result() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) +Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) From 86befdaaf49956eff063e891f458a1f95d824f3e Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 20 Apr 2017 18:30:39 +1000 Subject: [PATCH 060/120] Force capture of common folding closure --- src/fsharp/FSharp.Core/seqcore.fs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index bcbd2aa174f..791786f176e 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -157,6 +157,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition // ineffictive ** let inline avoid boolean = match boolean with true -> true | false -> false + module internal Closure = + // F# inlines simple functions, which can mean that it some case you keep creating closures when + // a single funciton object would have done. This forces the compiler to create the object + let inline forceCapture<'a,'b> (f:'a->'b) : 'a->'b = (# "" f : 'a->'b #) + module internal Upcast = // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality // is fixed with the compiler then these functions can be removed. @@ -405,10 +410,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition (Upcast.outOfBand this).StopFurtherProcessing idx (Upcast.outOfBand common).StopFurtherProcessing PipeIdx.MaxValue) + let getCommonFolder = Closure.forceCapture (fun (_:PipeIdx) -> + (Upcast.outOfBand common).StopFurtherProcessing 0 + common) + override __.ProcessNext value = - value.Fold (fun _ -> - (Upcast.outOfBand common).StopFurtherProcessing 0 - common) |> ignore + value.Fold getCommonFolder |> ignore Unchecked.defaultof<_> (* return value unused in Fold context *) override this.ChainComplete _ = From 9c5c1305c3cd9cd08a432778b986bbd4ba74b4be Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 21 Apr 2017 16:27:35 +1000 Subject: [PATCH 061/120] throw away input on take 0 --- src/fsharp/FSharp.Core/iseq.fs | 42 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 56b7636b74d..13e95988fbb 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -677,29 +677,31 @@ namespace Microsoft.FSharp.Collections [] let take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with - member __.Compose outOfBand pipelineIdx next = - if takeCount = 0 then - outOfBand.StopFurtherProcessing pipelineIdx + if takeCount = 0 then empty + else + source.PushTransform { new TransformFactory<'T,'T>() with + member __.Compose outOfBand pipelineIdx next = + if takeCount = 0 then + outOfBand.StopFurtherProcessing pipelineIdx - upcast { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with - // member this.count = this.State - override this.ProcessNext (input:'T) : bool = - if this.State < takeCount then - this.State <- this.State + 1 - if this.State = takeCount then + upcast { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with + // member this.count = this.State + override this.ProcessNext (input:'T) : bool = + if this.State < takeCount then + this.State <- this.State + 1 + if this.State = takeCount then + outOfBand.StopFurtherProcessing pipelineIdx + TailCall.avoid (next.ProcessNext input) + else outOfBand.StopFurtherProcessing pipelineIdx - TailCall.avoid (next.ProcessNext input) - else - outOfBand.StopFurtherProcessing pipelineIdx - false + false - override this.OnComplete terminatingIdx = - if terminatingIdx < pipelineIdx && this.State < takeCount then - let x = takeCount - this.State - invalidOpFmt "tried to take {0} {1} past the end of the seq" - [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] - override this.OnDispose () = () }} + override this.OnComplete terminatingIdx = + if terminatingIdx < pipelineIdx && this.State < takeCount then + let x = takeCount - this.State + invalidOpFmt "tried to take {0} {1} past the end of the seq" + [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] + override this.OnDispose () = () }} [] let inline takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = From 0215aed3e0dc532604ead33e13f2b8c85097e57b Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 21 Apr 2017 18:09:17 +1000 Subject: [PATCH 062/120] Added null check for except's itemsToExclude --- src/fsharp/FSharp.Core/iseq.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 13e95988fbb..bde7b7fc3d6 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -294,6 +294,7 @@ namespace Microsoft.FSharp.Collections [] let inline except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = + checkNonNull "itemsToExclude" itemsToExclude source.PushTransform { new TransformFactory<'T,'T>() with override __.Compose _ _ next = upcast { new Transform<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with From d4d6586ff77ffaa9cd54de72de0864dac44aa9b9 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 21 Apr 2017 19:22:10 +1000 Subject: [PATCH 063/120] Added check on negative input for take --- src/fsharp/FSharp.Core/iseq.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index bde7b7fc3d6..aa3d6714d63 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -678,7 +678,8 @@ namespace Microsoft.FSharp.Collections [] let take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = - if takeCount = 0 then empty + if takeCount < 0 then invalidArgInputMustBeNonNegative "count" takeCount + elif takeCount = 0 then empty else source.PushTransform { new TransformFactory<'T,'T>() with member __.Compose outOfBand pipelineIdx next = From 4dfebe158b92530aa197e3c0d37e7b6e1dfc6755 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 25 Apr 2017 06:39:22 +1000 Subject: [PATCH 064/120] Natively support ISeq on list --- src/fsharp/FSharp.Core/iseq.fs | 3 +- src/fsharp/FSharp.Core/prim-types.fs | 253 +++++++++++++++++++------- src/fsharp/FSharp.Core/prim-types.fsi | 142 +++++++-------- src/fsharp/FSharp.Core/seqcore.fs | 86 +-------- src/fsharp/FSharp.Core/seqcore.fsi | 5 - 5 files changed, 261 insertions(+), 228 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index aa3d6714d63..460adbdf3cc 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -131,14 +131,13 @@ namespace Microsoft.FSharp.Collections [] let ofList (source:list<'T>) : ISeq<'T> = - Upcast.seq (ThinListEnumerable<'T> source) + Upcast.seq source [] let ofSeq (source:seq<'T>) : ISeq<'T> = match source with | :? ISeq<'T> as seq -> seq | :? array<'T> as array -> ofArray array - | :? list<'T> as list -> ofList list | null -> nullArg "source" | _ -> Upcast.seq (ThinEnumerable<'T> source) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index c1bc280b346..59e90b6d98c 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3009,6 +3009,79 @@ namespace Microsoft.FSharp.Core //============================================================================ //============================================================================ +namespace Microsoft.FSharp.Collections.SeqComposition + open System + open System.Collections + open System.Collections.Generic + open Microsoft.FSharp.Core + open BasicInlinedOperations + open LanguagePrimitives.IntrinsicOperators + + type PipeIdx = int + + type IOutOfBand = + abstract StopFurtherProcessing : PipeIdx -> unit + abstract ListenForStopFurtherProcessing : Action -> unit + + [] + type Activity() = + abstract ChainComplete : PipeIdx -> unit + abstract ChainDispose : unit -> unit + + [] + type Activity<'T> () = + inherit Activity() + abstract ProcessNext : input:'T -> bool + + [] + type Activity<'T,'U> () = + inherit Activity<'T>() + + [] + type Folder<'T,'Result>(initalResult:'Result) = + inherit Activity<'T,'T>() + + let mutable listeners = BasicInlinedOperations.unsafeDefault> + let mutable result = initalResult + let mutable haltedIdx = 0 + + member __.Result with get () = result and set value = result <- value + member __.HaltedIdx with get () = haltedIdx + + interface IOutOfBand with + member this.StopFurtherProcessing pipeIdx = + let currentIdx = haltedIdx + haltedIdx <- pipeIdx + if currentIdx = 0 && haltedIdx <> 0 then + match listeners with + | null -> () + | a -> a.Invoke pipeIdx + + member this.ListenForStopFurtherProcessing action = + listeners <- Delegate.Combine (listeners, action) :?> Action + + override this.ChainComplete _ = () + override this.ChainDispose () = () + + [] + type TransformFactory<'T,'U> () = + abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + + type ISeq<'T> = + inherit IEnumerable<'T> + abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> + abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + + module internal Upcast = + // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality + // is fixed with the compiler then these functions can be removed. + let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) + let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) + let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) + let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) + let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) + let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) + namespace Microsoft.FSharp.Collections //------------------------------------------------------------------------- @@ -3022,6 +3095,7 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions open Microsoft.FSharp.Core.BasicInlinedOperations + open Microsoft.FSharp.Collections.SeqComposition [] [>)>] @@ -3032,6 +3106,7 @@ namespace Microsoft.FSharp.Collections type List<'T> = | ([]) : 'T list | (::) : Head: 'T * Tail: 'T list -> 'T list + interface Microsoft.FSharp.Collections.SeqComposition.ISeq<'T> interface System.Collections.Generic.IEnumerable<'T> interface System.Collections.IEnumerable @@ -3080,6 +3155,7 @@ namespace Microsoft.FSharp.Collections let notStarted() = raise (new System.InvalidOperationException(SR.GetString(SR.enumerationNotStarted))) let alreadyFinished() = raise (new System.InvalidOperationException(SR.GetString(SR.enumerationAlreadyFinished))) let outOfRange() = raise (System.IndexOutOfRangeException(SR.GetString(SR.indexOutOfBounds))) + let noReset() = raise (new System.NotSupportedException(SR.GetString(SR.resetNotSupported))) let nonempty x = match x with [] -> false | _ -> true // optimized mutation-based implementation. This code is only valid in fslib, where mutation of private @@ -3175,6 +3251,95 @@ namespace Microsoft.FSharp.Collections | [] -> outOfRange() loop n l + module ListSeqImplementation = + type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = + inherit TransformFactory<'T,'V>() + + override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + + static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + upcast ComposedFactory(first, second) + + type Result<'T>() = + inherit Folder<'T,'T>(unsafeDefault<'T>) + + member val SeqState = 1(*NotStarted*) with get, set + + override this.ProcessNext (input:'T) : bool = + this.Result <- input + true + + type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + let mutable list = alist + + let rec moveNext current = + match result.HaltedIdx, current with + | 0, head::tail -> + if activity.ProcessNext head then + list <- tail + true + else + moveNext tail + | _ -> + result.SeqState <- 2(*Finished*) + activity.ChainComplete result.HaltedIdx + false + + interface System.IDisposable with + member __.Dispose () : unit = + activity.ChainDispose () + + interface System.Collections.IEnumerator with + member this.Current : obj = box ((Upcast.enumerator this)).Current + member __.MoveNext () = + result.SeqState <- 0(*InProcess*) + moveNext list + + member __.Reset () : unit = PrivateListHelpers.noReset () + + interface IEnumerator<'U> with + member __.Current = + if result.SeqState = 0(*InProcess*) then result.Result + elif result.SeqState = 1(*NotStarted*) then PrivateListHelpers.notStarted() + else PrivateListHelpers.alreadyFinished() + + type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + interface System.Collections.IEnumerable with + member this.GetEnumerator () : System.Collections.IEnumerator = + let genericEnumerable = Upcast.enumerable this + let genericEnumerator = genericEnumerable.GetEnumerator () + Upcast.enumeratorNonGeneric genericEnumerator + + interface System.Collections.Generic.IEnumerable<'U> with + member this.GetEnumerator () : System.Collections.Generic.IEnumerator<'U> = + let result = Result<'U> () + let activity = transformFactory.Compose (Upcast.outOfBand result) pipeIdx result + Upcast.enumerator (new ListEnumerator<'T,'U>(alist, activity, result)) + + interface ISeq<'U> with + member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result = createFolder (pipeIdx+1) + let consumer = transformFactory.Compose (Upcast.outOfBand result) pipeIdx result + try + let mutable lst = alist + while + ( match lst with + | hd :: tl when result.HaltedIdx = 0 -> + ignore (consumer.ProcessNext hd) + lst <- tl + true + | _ -> false + ) do () + + consumer.ChainComplete result.HaltedIdx + finally + consumer.ChainDispose () + result.Result + type List<'T> with [] member l.Length = PrivateListHelpers.lengthAcc 0 l @@ -3215,6 +3380,28 @@ namespace Microsoft.FSharp.Collections if i > j then [] else PrivateListHelpers.sliceTake (j-i) (PrivateListHelpers.sliceSkip i l) + interface ISeq<'T> with + member this.PushTransform<'U> (next:TransformFactory<'T,'U>) = + Upcast.seq (new ListSeqImplementation.ListEnumerable<'T,'U>(this, next, 1)) + + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + let result = createFolder 1 + try + let mutable lst = this + while + ( match lst with + | hd :: tl when result.HaltedIdx = 0 -> + ignore (result.ProcessNext hd) + lst <- tl + true + | _ -> false + ) do () + + result.ChainComplete result.HaltedIdx + finally + result.ChainDispose () + result.Result + interface IEnumerable<'T> with member l.GetEnumerator() = PrivateListHelpers.mkListEnumerator l @@ -3228,71 +3415,7 @@ namespace Microsoft.FSharp.Collections type seq<'T> = IEnumerable<'T> - -namespace Microsoft.FSharp.Collections.SeqComposition - open System - open System.Collections - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - open BasicInlinedOperations - open LanguagePrimitives.IntrinsicOperators - - type PipeIdx = int - - type IOutOfBand = - abstract StopFurtherProcessing : PipeIdx -> unit - abstract ListenForStopFurtherProcessing : Action -> unit - - [] - type Activity() = - abstract ChainComplete : PipeIdx -> unit - abstract ChainDispose : unit -> unit - - [] - type Activity<'T> () = - inherit Activity() - abstract ProcessNext : input:'T -> bool - - [] - type Activity<'T,'U> () = - inherit Activity<'T>() - - [] - type Folder<'T,'Result>(initalResult:'Result) = - inherit Activity<'T,'T>() - - let mutable listeners = BasicInlinedOperations.unsafeDefault> - let mutable result = initalResult - let mutable haltedIdx = 0 - - member __.Result with get () = result and set value = result <- value - member __.HaltedIdx with get () = haltedIdx - - interface IOutOfBand with - member this.StopFurtherProcessing pipeIdx = - let currentIdx = haltedIdx - haltedIdx <- pipeIdx - if currentIdx = 0 && haltedIdx <> 0 then - match listeners with - | null -> () - | a -> a.Invoke pipeIdx - - member this.ListenForStopFurtherProcessing action = - listeners <- Delegate.Combine (listeners, action) :?> Action - - override this.ChainComplete _ = () - override this.ChainDispose () = () - - [] - type TransformFactory<'T,'U> () = - abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> - - type ISeq<'T> = - inherit IEnumerable<'T> - abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result - + //------------------------------------------------------------------------- // Operators //------------------------------------------------------------------------- diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 03a988cf31f..b81cb937269 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1650,82 +1650,11 @@ namespace Microsoft.FSharp.Core /// Represents an Error or a Failure. The code failed with a value of 'TError representing what went wrong. | Error of ErrorValue:'TError -namespace Microsoft.FSharp.Collections - - open System - open System.Collections.Generic - open Microsoft.FSharp.Core - - /// The type of immutable singly-linked lists. - /// - /// Use the constructors [] and :: (infix) to create values of this type, or - /// the notation [1;2;3]. Use the values in the List module to manipulate - /// values of this type, or pattern match against the values directly. - [] - [] - [] - type List<'T> = - | ([]) : 'T list - | (::) : Head: 'T * Tail: 'T list -> 'T list - /// Returns an empty list of a particular type - static member Empty : 'T list - - /// Gets the number of items contained in the list - member Length : int - - /// Gets a value indicating if the list contains no entries - member IsEmpty : bool - - /// Gets the first element of the list - member Head : 'T - - /// Gets the tail of the list, which is a list containing all the elements of the list, excluding the first element - member Tail : 'T list - - /// Gets the element of the list at the given position. - /// Lists are represented as linked lists so this is an O(n) operation. - /// The index. - /// The value at the given index. - member Item : index:int -> 'T with get - - /// Gets a slice of the list, the elements of the list from the given start index to the given end index. - /// The start index. - /// The end index. - /// The sub list specified by the input indices. - member GetSlice : startIndex:int option * endIndex:int option -> 'T list - - /// Returns a list with head as its first element and tail as its subsequent elements - /// A new head value for the list. - /// The existing list. - /// The list with head appended to the front of tail. - static member Cons : head:'T * tail:'T list -> 'T list - - interface System.Collections.Generic.IEnumerable<'T> - interface System.Collections.IEnumerable - -#if !FSCORE_PORTABLE_OLD - interface System.Collections.Generic.IReadOnlyCollection<'T> -#endif - - /// An abbreviation for the type of immutable singly-linked lists. - /// - /// Use the constructors [] and :: (infix) to create values of this type, or - /// the notation [1;2;3]. Use the values in the List module to manipulate - /// values of this type, or pattern match against the values directly. - and 'T list = List<'T> - - /// An abbreviation for the CLI type System.Collections.Generic.List<_> - type ResizeArray<'T> = System.Collections.Generic.List<'T> - - /// An abbreviation for the CLI type System.Collections.Generic.IEnumerable<_> - type seq<'T> = IEnumerable<'T> - namespace Microsoft.FSharp.Collections.SeqComposition open System open System.Collections open System.Collections.Generic open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections /// PipeIdx denotes the index of the element within the pipeline. 0 denotes the /// source of the chain. @@ -1793,6 +1722,77 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result +namespace Microsoft.FSharp.Collections + + open System + open System.Collections.Generic + open Microsoft.FSharp.Core + + /// The type of immutable singly-linked lists. + /// + /// Use the constructors [] and :: (infix) to create values of this type, or + /// the notation [1;2;3]. Use the values in the List module to manipulate + /// values of this type, or pattern match against the values directly. + [] + [] + [] + type List<'T> = + | ([]) : 'T list + | (::) : Head: 'T * Tail: 'T list -> 'T list + /// Returns an empty list of a particular type + static member Empty : 'T list + + /// Gets the number of items contained in the list + member Length : int + + /// Gets a value indicating if the list contains no entries + member IsEmpty : bool + + /// Gets the first element of the list + member Head : 'T + + /// Gets the tail of the list, which is a list containing all the elements of the list, excluding the first element + member Tail : 'T list + + /// Gets the element of the list at the given position. + /// Lists are represented as linked lists so this is an O(n) operation. + /// The index. + /// The value at the given index. + member Item : index:int -> 'T with get + + /// Gets a slice of the list, the elements of the list from the given start index to the given end index. + /// The start index. + /// The end index. + /// The sub list specified by the input indices. + member GetSlice : startIndex:int option * endIndex:int option -> 'T list + + /// Returns a list with head as its first element and tail as its subsequent elements + /// A new head value for the list. + /// The existing list. + /// The list with head appended to the front of tail. + static member Cons : head:'T * tail:'T list -> 'T list + + interface Microsoft.FSharp.Collections.SeqComposition.ISeq<'T> + interface System.Collections.Generic.IEnumerable<'T> + interface System.Collections.IEnumerable + +#if !FSCORE_PORTABLE_OLD + interface System.Collections.Generic.IReadOnlyCollection<'T> +#endif + + /// An abbreviation for the type of immutable singly-linked lists. + /// + /// Use the constructors [] and :: (infix) to create values of this type, or + /// the notation [1;2;3]. Use the values in the List module to manipulate + /// values of this type, or pattern match against the values directly. + and 'T list = List<'T> + + /// An abbreviation for the CLI type System.Collections.Generic.List<_> + type ResizeArray<'T> = System.Collections.Generic.List<'T> + + /// An abbreviation for the CLI type System.Collections.Generic.IEnumerable<_> + type seq<'T> = IEnumerable<'T> + namespace Microsoft.FSharp.Core open System diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 791786f176e..a4e92f5f7a9 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -310,29 +310,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition finally activity.ChainDispose () - type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let mutable list = alist - - let rec moveNext current = - match result.HaltedIdx, current with - | 0, head::tail -> - if activity.ProcessNext head then - list <- tail - true - else - moveNext tail - | _ -> - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext list - let length (source:ISeq<_>) = source.Fold (fun _ -> { new Folder<'T,int>(0) with @@ -471,72 +448,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition fat.Fold createFolder and AppendEnumerable<'T> (sources:list>) = - inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (ThinListEnumerable>(List.rev sources))) + inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (List.rev sources)) override this.Append source = Upcast.seq (AppendEnumerable (source::sources)) - and ThinListEnumerable<'T>(alist:list<'T>) = - inherit EnumerableBase<'T>() - - override __.Length () = alist.Length - - interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable alist).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ListEnumerable<'T,'U>(alist, next, 1)) - - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 - try - let mutable lst = alist - while - ( match lst with - | hd :: tl when result.HaltedIdx = 0 -> - result.ProcessNext hd |> ignore - lst <- tl - true - | _ -> false - ) do () - - result.ChainComplete result.HaltedIdx - finally - result.ChainDispose () - result.Result - - and ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() - - interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - Upcast.enumerator (new ListEnumerator<'T,'U>(alist, createFold transformFactory result pipeIdx, result)) - - interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) - - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx - try - let mutable lst = alist - while - ( match lst with - | hd :: tl when result.HaltedIdx = 0 -> - consumer.ProcessNext hd |> ignore - lst <- tl - true - | _ -> false - ) do () - - consumer.ChainComplete result.HaltedIdx - finally - consumer.ChainDispose () - result.Result - /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = inherit EnumerableBase<'T>() diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 936efb35d01..ddd598a3dc1 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -97,11 +97,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition new : list> -> AppendEnumerable<'T> override Append : ISeq<'T> -> ISeq<'T> - type internal ThinListEnumerable<'T> = - inherit EnumerableBase<'T> - new : list<'T> -> ThinListEnumerable<'T> - interface ISeq<'T> - type internal ThinResizeArrayEnumerable<'T> = inherit EnumerableBase<'T> new : ResizeArray<'T> -> ThinResizeArrayEnumerable<'T> From 820fc4d4ddcec52ad2e5339a12d4ec3c1ec32617 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 26 Apr 2017 19:24:02 +1000 Subject: [PATCH 065/120] Added list specific overloads --- src/fsharp/FSharp.Core/iseq.fs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 460adbdf3cc..2d2ed73c952 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1134,8 +1134,9 @@ namespace Microsoft.FSharp.Collections [] let toList (source : ISeq<'T>) = - checkNonNull "source" source - Microsoft.FSharp.Primitives.Basics.List.ofISeq source + match source with + | :? list<'T> as lst -> lst + | _ -> Microsoft.FSharp.Primitives.Basics.List.ofISeq source [] let replicate count x = @@ -1144,8 +1145,11 @@ namespace Microsoft.FSharp.Collections [] let isEmpty (source : ISeq<'T>) = - use ie = source.GetEnumerator() - not (ie.MoveNext()) + match source with + | :? list<'T> as lst -> lst.IsEmpty + | _ -> + use ie = source.GetEnumerator() + not (ie.MoveNext()) [] let cast (source: IEnumerable) : ISeq<'T> = From 40201d332b02de03821d97c2b15bbbc8e9595053 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 29 Apr 2017 16:30:46 +1000 Subject: [PATCH 066/120] Optimization for 0/1 element arrays --- src/fsharp/FSharp.Core/iseq.fs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 2d2ed73c952..481c19a7679 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -115,6 +115,12 @@ namespace Microsoft.FSharp.Collections member __.GetHashCode o = c.GetHashCode o._1 member __.Equals (lhs,rhs) = c.Equals (lhs._1, rhs._1) } + [] + let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance + + [] + let singleton x = Upcast.seq (new SingletonEnumerable<_>(x)) + /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. /// i.e. usually iteration on calls the enumerator provied by GetEnumerator ensure that the @@ -127,7 +133,10 @@ namespace Microsoft.FSharp.Collections [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - Upcast.seq (ThinArrayEnumerable<'T> source) + match source.Length with + | 0 -> empty + | 1 -> singleton source.[0] + | _ -> Upcast.seq (ThinArrayEnumerable<'T> source) [] let ofList (source:list<'T>) : ISeq<'T> = @@ -171,9 +180,6 @@ namespace Microsoft.FSharp.Collections this.Result <- LanguagePrimitives.DivideByInt<'U> this.Result this.State override this.OnDispose () = () }) - [] - let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance - [] let exactlyOne (source:ISeq<'T>) : 'T = source.Fold (fun pipeIdx -> @@ -596,9 +602,6 @@ namespace Microsoft.FSharp.Collections let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = Upcast.seq (ThinConcatEnumerable (sources, id)) - [] - let singleton x = Upcast.seq (new SingletonEnumerable<_>(x)) - [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = let head = singleton initialState From 2e09a43fa6f99d84e448053f2577fadfd5f9caff Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 30 Apr 2017 05:36:57 +1000 Subject: [PATCH 067/120] Map/Set use Seq.fold to utilize ISeq implementation --- src/fsharp/FSharp.Core/map.fs | 11 +---------- src/fsharp/FSharp.Core/set.fs | 8 +++++++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/fsharp/FSharp.Core/map.fs b/src/fsharp/FSharp.Core/map.fs index fd8012c1707..a7912de2f9c 100644 --- a/src/fsharp/FSharp.Core/map.fs +++ b/src/fsharp/FSharp.Core/map.fs @@ -332,12 +332,6 @@ namespace Microsoft.FSharp.Collections let toArray m = m |> toList |> Array.ofList let ofList comparer l = List.fold (fun acc (k,v) -> add comparer k v acc) empty l - let rec mkFromEnumerator comparer acc (e : IEnumerator<_>) = - if e.MoveNext() then - let (x,y) = e.Current - mkFromEnumerator comparer (add comparer x y acc) e - else acc - let ofArray comparer (arr : array<_>) = let mutable res = empty for (x,y) in arr do @@ -348,10 +342,7 @@ namespace Microsoft.FSharp.Collections match c with | :? array<'Key * 'T> as xs -> ofArray comparer xs | :? list<'Key * 'T> as xs -> ofList comparer xs - | _ -> - use ie = c.GetEnumerator() - mkFromEnumerator comparer empty ie - + | _ -> Seq.fold (fun acc (k,v) -> add comparer k v acc) empty c let copyToArray s (arr: _[]) i = let j = ref i diff --git a/src/fsharp/FSharp.Core/set.fs b/src/fsharp/FSharp.Core/set.fs index a05d8527557..142dc2d7baa 100644 --- a/src/fsharp/FSharp.Core/set.fs +++ b/src/fsharp/FSharp.Core/set.fs @@ -495,6 +495,7 @@ namespace Microsoft.FSharp.Collections let res = Array.zeroCreate n copyToArray s res 0; res +<<<<<<< HEAD @@ -506,6 +507,11 @@ namespace Microsoft.FSharp.Collections let ofSeq comparer (c: IEnumerable<_>) = use ie = c.GetEnumerator() mkFromEnumerator comparer SetEmpty ie +======= + + let ofSeq comparer (c : IEnumerable<_>) = + Seq.fold (fun acc k -> add comparer k acc) SetEmpty c +>>>>>>> Map/Set use Seq.fold to utilize ISeq implementation let ofArray comparer l = Array.fold (fun acc k -> add comparer k acc) SetEmpty l @@ -835,7 +841,7 @@ namespace Microsoft.FSharp.Collections let toSeq (set: Set<'T>) = (set:> seq<'T>) [] - let ofSeq (elements: seq<_>) = Set(elements) + let ofSeq (c : seq<_>) = new Set<_>(c) [] let difference (set1: Set<'T>) (set2: Set<'T>) = set1 - set2 From 70ee40fac4da7d7703cfe4b56c112de3ec0df602 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 1 May 2017 18:24:51 +1000 Subject: [PATCH 068/120] ISeq.length optimized for list.length --- src/fsharp/FSharp.Core/iseq.fs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 481c19a7679..c19e13f9cf9 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -133,10 +133,7 @@ namespace Microsoft.FSharp.Collections [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - match source.Length with - | 0 -> empty - | 1 -> singleton source.[0] - | _ -> Upcast.seq (ThinArrayEnumerable<'T> source) + Upcast.seq (ThinArrayEnumerable<'T> source) [] let ofList (source:list<'T>) : ISeq<'T> = @@ -961,6 +958,7 @@ namespace Microsoft.FSharp.Collections let length (source:ISeq<'T>) = match source with | :? EnumerableBase<'T> as s -> s.Length () + | :? list<'T> as l -> l.Length | _ -> length source [] From 7032a75045ec96dd008ca32dd2102b2334350251 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 3 May 2017 16:34:03 +1000 Subject: [PATCH 069/120] Removed Upcast hack due to #2972 --- src/fsharp/FSharp.Core/iseq.fs | 75 +++++++++----------- src/fsharp/FSharp.Core/prim-types.fs | 52 ++++---------- src/fsharp/FSharp.Core/seqcore.fs | 100 ++++++++++++--------------- 3 files changed, 93 insertions(+), 134 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index c19e13f9cf9..0c129b9c95a 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -102,13 +102,6 @@ namespace Microsoft.FSharp.Collections // ineffictive ** let inline avoid boolean = match boolean with true -> true | false -> false - module internal Upcast = - // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality - // is fixed with the compiler then these functions can be removed. - let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) - let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) - let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - let inline valueComparer<'T when 'T : equality> ()= let c = HashIdentity.Structural<'T> { new IEqualityComparer> with @@ -119,7 +112,7 @@ namespace Microsoft.FSharp.Collections let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance [] - let singleton x = Upcast.seq (new SingletonEnumerable<_>(x)) + let singleton<'T> (x:'T) : ISeq<'T> = upcast (new SingletonEnumerable<_>(x)) /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. @@ -128,16 +121,16 @@ namespace Microsoft.FSharp.Collections /// performed in this case. If you want this funcitonality, then use the ofSeq function instead. [] let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = - Upcast.seq (ThinResizeArrayEnumerable<'T> source) + upcast (ThinResizeArrayEnumerable<'T> source) [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - Upcast.seq (ThinArrayEnumerable<'T> source) + upcast (ThinArrayEnumerable<'T> source) [] let ofList (source:list<'T>) : ISeq<'T> = - Upcast.seq source + upcast source [] let ofSeq (source:seq<'T>) : ISeq<'T> = @@ -145,7 +138,7 @@ namespace Microsoft.FSharp.Collections | :? ISeq<'T> as seq -> seq | :? array<'T> as array -> ofArray array | null -> nullArg "source" - | _ -> Upcast.seq (ThinEnumerable<'T> source) + | _ -> upcast (ThinEnumerable<'T> source) [] let inline average (source:ISeq<'T>) = @@ -187,7 +180,7 @@ namespace Microsoft.FSharp.Collections this.Result <- value else this.State._2 <- true - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = @@ -213,7 +206,7 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then this.Result <- folder this.Result value this.State.Current else - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -221,17 +214,17 @@ namespace Microsoft.FSharp.Collections [] let unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = - Upcast.seq (new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) + upcast (new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) [] let initInfinite<'T> (f:int->'T) : ISeq<'T> = - Upcast.seq (new InitEnumerableDecider<'T>(Nullable (), f, 1)) + upcast (new InitEnumerableDecider<'T>(Nullable (), f, 1)) [] let init<'T> (count:int) (f:int->'T) : ISeq<'T> = if count < 0 then invalidArgInputMustBeNonNegative "count" count elif count = 0 then empty else - Upcast.seq (new InitEnumerableDecider<'T>(Nullable count, f, 1)) + upcast (new InitEnumerableDecider<'T>(Nullable count, f, 1)) [] let inline iter f (source:ISeq<'T>) = @@ -249,7 +242,7 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then f value this.State.Current else - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -265,7 +258,7 @@ namespace Microsoft.FSharp.Collections this.State._1 <- this.State._1 + 1 Unchecked.defaultof<_> else - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> override this.OnComplete _ = () override this.OnDispose () = this.State._2.Dispose () }) @@ -276,7 +269,7 @@ namespace Microsoft.FSharp.Collections { new Folder<'T, Option<'T>> (None) with override this.ProcessNext value = this.Result <- Some value - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -310,7 +303,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if f value then this.Result <- true - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -321,9 +314,9 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then if predicate value this.State.Current then this.Result <- true - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx else - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -336,7 +329,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if element = value then this.Result <- true - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -346,7 +339,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if not (predicate value) then this.Result <- false - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -357,9 +350,9 @@ namespace Microsoft.FSharp.Collections if this.State.MoveNext() then if not (predicate value this.State.Current) then this.Result <- false - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx else - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -447,12 +440,12 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if not (this.State.MoveNext()) then this.Result <- 1 - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx else let c = f value this.State.Current if c <> 0 then this.Result <- c - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = if this.Result = 0 && this.State.MoveNext() then @@ -597,7 +590,7 @@ namespace Microsoft.FSharp.Collections [] let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - Upcast.seq (ThinConcatEnumerable (sources, id)) + upcast (ThinConcatEnumerable (sources, id)) [] let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = @@ -788,7 +781,7 @@ namespace Microsoft.FSharp.Collections match f value with | (Some _) as some -> this.Result <- some - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx | None -> () Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -799,7 +792,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if f value then this.Result <- Some value - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] @@ -810,7 +803,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext value = if predicate value then this.Result <- Some this.State - (Upcast.outOfBand this).StopFurtherProcessing pipeIdx + (this :> IOutOfBand).StopFurtherProcessing pipeIdx else this.State <- this.State + 1 Unchecked.defaultof<_> (* return value unused in Fold context *) }) @@ -874,11 +867,11 @@ namespace Microsoft.FSharp.Collections let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = match source1 with | :? EnumerableBase<'T> as s -> s.Append source2 - | _ -> Upcast.seq (new AppendEnumerable<_>([source2; source1])) + | _ -> upcast (new AppendEnumerable<_>([source2; source1])) [] - let delay (delayed:unit->ISeq<'T>) = - Upcast.seq (DelayedEnumerable (delayed, 1)) + let delay (delayed:unit->ISeq<'T>) : ISeq<'T> = + upcast (DelayedEnumerable (delayed, 1)) module internal GroupBy = let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = @@ -1094,7 +1087,7 @@ namespace Microsoft.FSharp.Collections else None) - let cached = Upcast.seq (new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1)) + let cached : ISeq<'T> = upcast (new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1)) interface System.IDisposable with member __.Dispose() = @@ -1111,7 +1104,7 @@ namespace Microsoft.FSharp.Collections member __.GetEnumerator() = cached.GetEnumerator() interface System.Collections.IEnumerable with - member __.GetEnumerator() = (Upcast.enumerableNonGeneric cached).GetEnumerator() + member __.GetEnumerator() = (cached:>IEnumerable).GetEnumerator() interface ISeq<'T> with member __.PushTransform next = cached.PushTransform next @@ -1121,7 +1114,7 @@ namespace Microsoft.FSharp.Collections [] let cache (source:ISeq<'T>) : ISeq<'T> = - Upcast.seq (new CachedSeq<_> (source)) + upcast (new CachedSeq<_> (source)) [] let collect f sources = map f sources |> concat @@ -1140,9 +1133,9 @@ namespace Microsoft.FSharp.Collections | _ -> Microsoft.FSharp.Primitives.Basics.List.ofISeq source [] - let replicate count x = + let replicate<'T> count (x:'T) : ISeq<'T> = if count < 0 then raise (ArgumentOutOfRangeException "count") - Upcast.seq (new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) + upcast (new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) [] let isEmpty (source : ISeq<'T>) = diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 59e90b6d98c..0655a00a989 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3072,16 +3072,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result - module internal Upcast = - // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality - // is fixed with the compiler then these functions can be removed. - let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) - let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) - let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) - let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) - let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) - let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - namespace Microsoft.FSharp.Collections //------------------------------------------------------------------------- @@ -3291,7 +3281,7 @@ namespace Microsoft.FSharp.Collections activity.ChainDispose () interface System.Collections.IEnumerator with - member this.Current : obj = box ((Upcast.enumerator this)).Current + member this.Current : obj = box (this :> IEnumerator<'U>).Current member __.MoveNext () = result.SeqState <- 0(*InProcess*) moveNext list @@ -3307,23 +3297,21 @@ namespace Microsoft.FSharp.Collections type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = interface System.Collections.IEnumerable with member this.GetEnumerator () : System.Collections.IEnumerator = - let genericEnumerable = Upcast.enumerable this - let genericEnumerator = genericEnumerable.GetEnumerator () - Upcast.enumeratorNonGeneric genericEnumerator + upcast (this :> IEnumerable<'U>).GetEnumerator () interface System.Collections.Generic.IEnumerable<'U> with member this.GetEnumerator () : System.Collections.Generic.IEnumerator<'U> = let result = Result<'U> () - let activity = transformFactory.Compose (Upcast.outOfBand result) pipeIdx result - Upcast.enumerator (new ListEnumerator<'T,'U>(alist, activity, result)) + let activity = transformFactory.Compose (result :> IOutOfBand) pipeIdx result + upcast (new ListEnumerator<'T,'U>(alist, activity, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let result = createFolder (pipeIdx+1) - let consumer = transformFactory.Compose (Upcast.outOfBand result) pipeIdx result + let consumer = transformFactory.Compose (result :> IOutOfBand) pipeIdx result try let mutable lst = alist while @@ -3382,7 +3370,7 @@ namespace Microsoft.FSharp.Collections interface ISeq<'T> with member this.PushTransform<'U> (next:TransformFactory<'T,'U>) = - Upcast.seq (new ListSeqImplementation.ListEnumerable<'T,'U>(this, next, 1)) + upcast (new ListSeqImplementation.ListEnumerable<'T,'U>(this, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -3437,16 +3425,6 @@ namespace Microsoft.FSharp.Core [] module Operators = - // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality - // is fixed with the compiler then these functions can be removed. - module Upcast = - let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) - let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) - let inline enumerableNonGeneric<'enumerable when 'enumerable :> System.Collections.IEnumerable and 'enumerable : not struct> (t:'enumerable) : System.Collections.IEnumerable = (# "" t : System.Collections.IEnumerable #) - let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) - let inline enumeratorNonGeneric<'enumerator when 'enumerator :> System.Collections.IEnumerator and 'enumerator : not struct> (t:'enumerator) : System.Collections.IEnumerator = (# "" t : System.Collections.IEnumerator #) - let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - #if MULTI_DIMENSIONAL_EXTENSION_PROPERTIES type ``[,]``<'T> with [] @@ -4848,7 +4826,7 @@ namespace Microsoft.FSharp.Core false interface IEnumerator with - member this.Current : obj = box ((Upcast.enumerator this)).Current + member this.Current : obj = box (this :> IEnumerator<'U>).Current member __.Reset () : unit = source.Reset () member __.MoveNext () = state <- Mode.Running @@ -4878,16 +4856,16 @@ namespace Microsoft.FSharp.Core interface IEnumerable<'U> with member __.GetEnumerator () = let folder = SetResultToInput<'U>() - Upcast.enumerator (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (Upcast.outOfBand folder) pipeIdx folder, folder)) + upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> IOutOfBand) pipeIdx folder, folder)) interface IEnumerable with member __.GetEnumerator () = let folder = SetResultToInput<'U>() - Upcast.enumeratorNonGeneric (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (Upcast.outOfBand folder) pipeIdx folder, folder)) + upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> IOutOfBand) pipeIdx folder, folder)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new SeqSourceEnumerable<'T,'V>(source, ComposedFactory.Combine current next, pipeIdx+1)) + upcast (new SeqSourceEnumerable<'T,'V>(source, ComposedFactory.Combine current next, pipeIdx+1)) member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = source.Fold f current pipeIdx @@ -4897,11 +4875,11 @@ namespace Microsoft.FSharp.Core member __.GetEnumerator () = source.GetEnumerator () interface IEnumerable with - member __.GetEnumerator () = Upcast.enumeratorNonGeneric (source.GetEnumerator ()) + member __.GetEnumerator () = upcast (source.GetEnumerator ()) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new SeqSourceEnumerable<'U,'V>(source, next, 1)) + upcast (new SeqSourceEnumerable<'U,'V>(source, next, 1)) member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = source.Fold f IdentityFactory.Instance 1 @@ -5124,7 +5102,7 @@ namespace Microsoft.FSharp.Core member __.GetEnumerator () = singleStepRangeEnumerator () member __.Fold<'Result,'Output> (createFolder:PipeIdx->Folder<'Output,'Result>) (transformFactory:TransformFactory<'T,'Output>) pipeIdx : 'Result = let result = createFolder (pipeIdx+1) - let consumer = transformFactory.Compose (Upcast.outOfBand result) pipeIdx result + let consumer = transformFactory.Compose (result :> IOutOfBand) pipeIdx result try let mutable i : 'T = n while result.HaltedIdx = 0 && i <= m do @@ -5136,7 +5114,7 @@ namespace Microsoft.FSharp.Core finally consumer.ChainDispose () } - Upcast.enumerable (SeqSourceEnumerableThin<'T> source) + upcast (SeqSourceEnumerableThin<'T> source) // For RangeStepGeneric, zero and add are functions representing the static resolution of GenericZero and (+) // for the particular static type. diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index a4e92f5f7a9..9c89bd689f5 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -162,16 +162,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition // a single funciton object would have done. This forces the compiler to create the object let inline forceCapture<'a,'b> (f:'a->'b) : 'a->'b = (# "" f : 'a->'b #) - module internal Upcast = - // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality - // is fixed with the compiler then these functions can be removed. - let inline seq<'T,'seq when 'seq :> ISeq<'T> and 'seq : not struct> (t:'seq) : ISeq<'T> = (# "" t : ISeq<'T> #) - let inline enumerable<'T,'enumerable when 'enumerable :> IEnumerable<'T> and 'enumerable : not struct> (t:'enumerable) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) - let inline enumerableNonGeneric<'enumerable when 'enumerable :> IEnumerable and 'enumerable : not struct> (t:'enumerable) : IEnumerable = (# "" t : IEnumerable #) - let inline enumerator<'T,'enumerator when 'enumerator :> IEnumerator<'T> and 'enumerator : not struct> (t:'enumerator) : IEnumerator<'T> = (# "" t : IEnumerator<'T> #) - let inline enumeratorNonGeneric<'enumerator when 'enumerator :> IEnumerator and 'enumerator : not struct> (t:'enumerator) : IEnumerator = (# "" t : IEnumerator #) - let inline outOfBand<'outOfBand when 'outOfBand :> IOutOfBand and 'outOfBand : not struct> (t:'outOfBand) : IOutOfBand = (# "" t : IOutOfBand #) - type IdentityFactory<'T> private () = inherit TransformFactory<'T,'T> () static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) @@ -193,7 +183,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract CanSkip : unit -> bool let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_>) pipeIdx = - factory.Compose (Upcast.outOfBand folder) pipeIdx folder + factory.Compose (folder :> IOutOfBand) pipeIdx folder type SeqProcessNextStates = | InProcess = 0 @@ -234,7 +224,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition activity.ChainDispose () interface IEnumerator with - member this.Current : obj = box ((Upcast.enumerator this)).Current + member this.Current : obj = box (this :> IEnumerator<'T>).Current member __.MoveNext () = failwith "library implementation error: derived class should implement (should be abstract)" member __.Reset () : unit = noReset () @@ -325,14 +315,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member Append : ISeq<'T> -> ISeq<'T> abstract member Length : unit -> int - default this.Append source = Upcast.seq (AppendEnumerable [source; this]) + default this.Append source = upcast (AppendEnumerable [source; this]) default this.Length () = length this interface IEnumerable with member this.GetEnumerator () : IEnumerator = - let genericEnumerable = Upcast.enumerable this - let genericEnumerator = genericEnumerable.GetEnumerator () - Upcast.enumeratorNonGeneric genericEnumerator + upcast ((this:>IEnumerable<'T>).GetEnumerator ()) interface IEnumerable<'T> with // fsharp doesn't allow abstract interface methods @@ -349,11 +337,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold transformFactory result pipeIdx, result)) + upcast (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let result = createFolder (pipeIdx+1) @@ -379,16 +367,16 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit Folder<'Collection, 'Result>(Unchecked.defaultof<_>) do - (Upcast.outOfBand this).ListenForStopFurtherProcessing (fun idx -> - (Upcast.outOfBand result).StopFurtherProcessing idx - (Upcast.outOfBand common).StopFurtherProcessing PipeIdx.MinValue) + (this :> IOutOfBand).ListenForStopFurtherProcessing (fun idx -> + (result :> IOutOfBand).StopFurtherProcessing idx + (common :> IOutOfBand).StopFurtherProcessing PipeIdx.MinValue) - (Upcast.outOfBand result).ListenForStopFurtherProcessing (fun idx -> - (Upcast.outOfBand this).StopFurtherProcessing idx - (Upcast.outOfBand common).StopFurtherProcessing PipeIdx.MaxValue) + (result :> IOutOfBand).ListenForStopFurtherProcessing (fun idx -> + (this :> IOutOfBand).StopFurtherProcessing idx + (common :> IOutOfBand).StopFurtherProcessing PipeIdx.MaxValue) let getCommonFolder = Closure.forceCapture (fun (_:PipeIdx) -> - (Upcast.outOfBand common).StopFurtherProcessing 0 + (common :> IOutOfBand).StopFurtherProcessing 0 common) override __.ProcessNext value = @@ -408,11 +396,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'U> with member __.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold transformFactory result pipeIdx, result)) + upcast (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = sources.Fold (fun lowerPipeIdx -> @@ -420,7 +408,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition let result = createFolder (thisPipeIdx+1) - let outOfBand = Upcast.outOfBand result + let outOfBand = result :> IOutOfBand let consumer = transformFactory.Compose outOfBand thisPipeIdx result @@ -437,21 +425,21 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = let result = Result<'T> () - Upcast.enumerator (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) + upcast (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) + upcast (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let fat = Upcast.seq (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityFactory.Instance, 1)) + let fat : ISeq<'T> = upcast (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityFactory.Instance, 1)) fat.Fold createFolder and AppendEnumerable<'T> (sources:list>) = - inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> Upcast.seq (List.rev sources)) + inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> upcast (List.rev sources)) override this.Append source = - Upcast.seq (AppendEnumerable (source::sources)) + upcast (AppendEnumerable (source::sources)) /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = @@ -475,7 +463,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) + upcast (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -502,7 +490,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) + upcast (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = (delayed()).Fold f @@ -522,7 +510,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (VanillaEnumerable<'T,'V>(this, next, 1)) + upcast (VanillaEnumerable<'T,'V>(this, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -560,11 +548,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'U> with member __.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) + upcast (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member __.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let result = createFolder (pipeIdx+1) @@ -587,11 +575,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Length () = array.Length interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable array).GetEnumerator () + member __.GetEnumerator () = (array:>IEnumerable<'T>).GetEnumerator () interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ArrayEnumerable<'T,'U>(array, next, 1)) + upcast (new ArrayEnumerable<'T,'U>(array, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -613,11 +601,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Length () = 1 interface IEnumerable<'T> with - member this.GetEnumerator () = Upcast.enumerator (new Singleton<'T>(item)) + member this.GetEnumerator () = (new Singleton<'T>(item)) :> IEnumerator<'T> interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ArrayEnumerable<'T,'U>([|item|], next, 1)) + upcast (new ArrayEnumerable<'T,'U>([|item|], next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -658,11 +646,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new ResizeArrayEnumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) + upcast (new ResizeArrayEnumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member __.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let result = createFolder (pipeIdx+1) @@ -685,11 +673,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Length () = resizeArray.Count interface IEnumerable<'T> with - member __.GetEnumerator () = (Upcast.enumerable resizeArray).GetEnumerator () + member __.GetEnumerator () = (resizeArray :> IEnumerable<'T>).GetEnumerator () interface ISeq<'T> with member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) + upcast (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -734,11 +722,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) + upcast (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let result = createFolder (pipeIdx+1) @@ -815,11 +803,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new InitEnumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) + upcast (new InitEnumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let terminatingIdx = getInitTerminatingIdx count @@ -939,12 +927,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) + upcast (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 try - use enumerator = (Upcast.enumerable this).GetEnumerator () + use enumerator = (this:>IEnumerable<'T>).GetEnumerator () while result.HaltedIdx = 0 && enumerator.MoveNext () do result.ProcessNext enumerator.Current |> ignore @@ -1231,7 +1219,7 @@ namespace Microsoft.FSharp.Core.CompilerServices interface ISeq<'T> with member this.PushTransform<'U> (next:TransformFactory<'T,'U>) : ISeq<'U> = - Upcast.seq (new GeneratedSequenceBaseEnumerable<'T,'U>(this, next, 1)) + upcast (new GeneratedSequenceBaseEnumerable<'T,'U>(this, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 @@ -1268,15 +1256,15 @@ namespace Microsoft.FSharp.Core.CompilerServices interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - Upcast.enumerator (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), current.Compose (Upcast.outOfBand result) pipeIdx result, result)) + upcast (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), current.Compose (result :> IOutOfBand) pipeIdx result, result)) interface ISeq<'U> with member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - Upcast.seq (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, ComposedFactory.Combine current next, pipeIdx+1)) + upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, ComposedFactory.Combine current next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let result = createFolder (pipeIdx+1) - let consumer = current.Compose (Upcast.outOfBand result) pipeIdx result + let consumer = current.Compose (result :> IOutOfBand) pipeIdx result try use maybeGeneratedSequenceBase = generatedSequence.GetFreshEnumerator () match maybeGeneratedSequenceBase with From 60ee9a3e9e62762bdbd751f412af46ff0e29a661 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 5 May 2017 18:30:24 +1000 Subject: [PATCH 070/120] Consolidated common factory code --- src/fsharp/FSharp.Core/seqcore.fs | 98 ++++++++++++++++-------------- src/fsharp/FSharp.Core/seqcore.fsi | 9 ++- 2 files changed, 59 insertions(+), 48 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 9c89bd689f5..c48cd63c715 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -182,9 +182,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition // and it can only do it at the start of a sequence abstract CanSkip : unit -> bool - let createFold (factory:TransformFactory<_,_>) (folder:Folder<_,_>) pipeIdx = - factory.Compose (folder :> IOutOfBand) pipeIdx folder - type SeqProcessNextStates = | InProcess = 0 | NotStarted = 1 @@ -331,21 +328,35 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform _ = derivedClassShouldImplement () member __.Fold _ = derivedClassShouldImplement () - and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and [] SeqFactoryBase<'T,'U>(transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() + member __.CreateActivityPipeline<'Result> (folder:Folder<'U,'Result>) : Activity<'T,'U> = + transformFactory.Compose (folder :> IOutOfBand) pipeIdx folder + + member this.CreatePipeline<'Result> (createFolder:PipeIdx->Folder<'U,'Result>, [] activity:byref>) = + let folder = createFolder (pipeIdx+1) + activity <- this.CreateActivityPipeline folder + folder + + member __.Compose next = ComposedFactory.Combine transformFactory next + + member __.PipeIdx = pipeIdx + + and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), createFold transformFactory result pipeIdx, result)) + upcast (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new VanillaEnumerable<'T,'V>(enumerable, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + upcast (new VanillaEnumerable<'T,'V>(enumerable, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx + let result, consumer = this.CreatePipeline createFolder try use enumerator = enumerable.GetEnumerator () while result.HaltedIdx = 0 && enumerator.MoveNext () do @@ -391,16 +402,16 @@ namespace Microsoft.FSharp.Collections.SeqComposition consumer.ChainDispose () and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member __.GetEnumerator () : IEnumerator<'U> = + member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new ConcatEnumerator<'T,'U,'Collection>(sources, createFold transformFactory result pipeIdx, result)) + upcast (new ConcatEnumerator<'T,'U,'Collection>(sources, this.CreateActivityPipeline result, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = sources.Fold (fun lowerPipeIdx -> @@ -425,7 +436,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = let result = Result<'T> () - upcast (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, createFold IdentityFactory.Instance result 1, result)) + upcast (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, result, result)) interface ISeq<'T> with member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = @@ -543,20 +554,19 @@ namespace Microsoft.FSharp.Collections.SeqComposition moveNext () type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member __.GetEnumerator () : IEnumerator<'U> = + member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new ArrayEnumerator<'T,'U>(array, createFold transformFactory result pipeIdx, result)) + upcast (new ArrayEnumerator<'T,'U>(array, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new ArrayEnumerable<'T,'V>(array, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + upcast (new ArrayEnumerable<'T,'V>(array, this.Compose next, this.PipeIdx+1)) - member __.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result, consumer = this.CreatePipeline createFolder try let array = array let mutable idx = 0 @@ -641,20 +651,19 @@ namespace Microsoft.FSharp.Collections.SeqComposition moveNext () type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new ResizeArrayEnumerator<'T,'U>(resizeArray, createFold transformFactory result pipeIdx, result)) + upcast (new ResizeArrayEnumerator<'T,'U>(resizeArray, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, this.Compose next, this.PipeIdx+1)) - member __.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx + member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + let result, consumer = this.CreatePipeline createFolder try let array = resizeArray let mutable idx = 0 @@ -717,20 +726,19 @@ namespace Microsoft.FSharp.Collections.SeqComposition moveNext () type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, createFold transformFactory result pipeIdx, result)) + upcast (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, this.CreateActivityPipeline result, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx + let result, consumer = this.CreatePipeline createFolder try let generator = generator let rec iterate current = @@ -798,21 +806,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition moveNext () type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new InitEnumerator<'T,'U>(count, f, createFold transformFactory result pipeIdx, result)) + upcast (new InitEnumerator<'T,'U>(count, f, this.CreateActivityPipeline result, result)) interface ISeq<'U> with member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new InitEnumerable<'T,'V>(count, f, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + upcast (new InitEnumerable<'T,'V>(count, f, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = let terminatingIdx = getInitTerminatingIdx count - let result = createFolder (pipeIdx+1) - let consumer = createFold transformFactory result pipeIdx + let result, consumer = this.CreatePipeline createFolder try let firstIdx = match box consumer with @@ -1250,21 +1257,20 @@ namespace Microsoft.FSharp.Core.CompilerServices count <- count + 1 count - and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit EnumerableBase<'U>() + and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () : IEnumerator<'U> = let result = Result<'U> () - upcast (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), current.Compose (result :> IOutOfBand) pipeIdx result, result)) + upcast (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = - upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, ComposedFactory.Combine current next, pipeIdx+1)) + member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result = createFolder (pipeIdx+1) - let consumer = current.Compose (result :> IOutOfBand) pipeIdx result + let result, consumer = this.CreatePipeline createFolder try use maybeGeneratedSequenceBase = generatedSequence.GetFreshEnumerator () match maybeGeneratedSequenceBase with diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index ddd598a3dc1..2dc2be43c19 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -75,6 +75,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member Length : unit -> int interface ISeq<'T> + [] + type SeqFactoryBase<'T,'U> = + inherit EnumerableBase<'U> + new : TransformFactory<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> + [] type internal IdentityFactory<'T> = inherit TransformFactory<'T,'T> @@ -113,7 +118,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> type internal UnfoldEnumerable<'T,'U,'GeneratorState> = - inherit EnumerableBase<'U> + inherit SeqFactoryBase<'T,'U> new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*TransformFactory<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> interface ISeq<'U> @@ -128,7 +133,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> type internal InitEnumerable<'T,'U> = - inherit EnumerableBase<'U> + inherit SeqFactoryBase<'T,'U> new : Nullable * (int->'T) * TransformFactory<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> interface ISeq<'U> From 844efa2ed2c93d7b4ac6e0ee5dab97d5b142c66c Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Fri, 5 May 2017 18:42:29 +1000 Subject: [PATCH 071/120] Converted TransformFactory into interface --- src/fsharp/FSharp.Core/iseq.fs | 42 ++++++++--------- src/fsharp/FSharp.Core/iseq.fsi | 4 +- src/fsharp/FSharp.Core/prim-types.fs | 49 ++++++++++---------- src/fsharp/FSharp.Core/prim-types.fsi | 8 ++-- src/fsharp/FSharp.Core/seqcore.fs | 65 +++++++++++++-------------- src/fsharp/FSharp.Core/seqcore.fsi | 10 ++--- 6 files changed, 86 insertions(+), 92 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 0c129b9c95a..494913a22af 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -290,7 +290,7 @@ namespace Microsoft.FSharp.Collections [] let inline except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = checkNonNull "itemsToExclude" itemsToExclude - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = upcast { new Transform<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with override this.ProcessNext (input:'T) : bool = @@ -360,7 +360,7 @@ namespace Microsoft.FSharp.Collections [] let inline filter<'T> (f:'T->bool) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = @@ -369,7 +369,7 @@ namespace Microsoft.FSharp.Collections [] let inline map<'T,'U> (f:'T->'U) (source:ISeq<'T>) : ISeq<'U> = - source.PushTransform { new TransformFactory<'T,'U>() with + source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = @@ -377,7 +377,7 @@ namespace Microsoft.FSharp.Collections [] let inline mapi f (source:ISeq<_>) = - source.PushTransform { new TransformFactory<'T,'U>() with + source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = upcast { new Transform<'T,'V,int>(next, -1) with override this.ProcessNext (input:'T) : bool = @@ -386,7 +386,7 @@ namespace Microsoft.FSharp.Collections [] let inline map2<'T,'U,'V> (map:'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = - source1.PushTransform { new TransformFactory<'T,'V>() with + source1.PushTransform { new ITransformFactory<'T,'V> with override __.Compose outOfBand pipeIdx (next:Activity<'V,'W>) = upcast { new TransformWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with override this.ProcessNext input = @@ -400,7 +400,7 @@ namespace Microsoft.FSharp.Collections [] let inline mapi2<'T,'U,'V> (map:int->'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = - source1.PushTransform { new TransformFactory<'T,'V>() with + source1.PushTransform { new ITransformFactory<'T,'V> with override __.Compose<'W> outOfBand pipeIdx next = upcast { new TransformWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with override this.ProcessNext t = @@ -417,7 +417,7 @@ namespace Microsoft.FSharp.Collections [] let inline map3<'T,'U,'V,'W>(map:'T->'U->'V->'W) (source1:ISeq<'T>) (source2:ISeq<'U>) (source3:ISeq<'V>) : ISeq<'W> = - source1.PushTransform { new TransformFactory<'T,'W>() with + source1.PushTransform { new ITransformFactory<'T,'W> with override __.Compose<'X> outOfBand pipeIdx next = upcast { new TransformWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with override this.ProcessNext t = @@ -454,7 +454,7 @@ namespace Microsoft.FSharp.Collections [] let inline choose (f:'T->option<'U>) (source:ISeq<'T>) : ISeq<'U> = - source.PushTransform { new TransformFactory<'T,'U>() with + source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = @@ -464,7 +464,7 @@ namespace Microsoft.FSharp.Collections [] let inline distinct (source:ISeq<'T>) : ISeq<'T> when 'T:equality = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = upcast { new Transform<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with override this.ProcessNext (input:'T) : bool = @@ -472,7 +472,7 @@ namespace Microsoft.FSharp.Collections [] let inline distinctBy (keyf:'T->'Key) (source:ISeq<'T>) :ISeq<'T> when 'Key:equality = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = upcast { new Transform<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with override this.ProcessNext (input:'T) : bool = @@ -556,7 +556,7 @@ namespace Microsoft.FSharp.Collections [] let pairwise (source:ISeq<'T>) : ISeq<'T*'T> = - source.PushTransform { new TransformFactory<'T,'T * 'T>() with + source.PushTransform { new ITransformFactory<'T,'T*'T> with override __.Compose _ _ next = upcast { new Transform<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with // member this.isFirst = this.State._1 @@ -596,7 +596,7 @@ namespace Microsoft.FSharp.Collections let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = let head = singleton initialState let tail = - source.PushTransform { new TransformFactory<'T,'State>() with + source.PushTransform { new ITransformFactory<'T,'State> with override __.Compose _ _ next = upcast { new Transform<'T,'V,'State>(next, initialState) with override this.ProcessNext (input:'T) : bool = @@ -606,7 +606,7 @@ namespace Microsoft.FSharp.Collections [] let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = let mutable this = Unchecked.defaultof> let skipper = @@ -638,7 +638,7 @@ namespace Microsoft.FSharp.Collections [] let inline skipWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = upcast { new Transform<'T,'V,bool>(next,true) with // member this.skip = this.State @@ -673,7 +673,7 @@ namespace Microsoft.FSharp.Collections if takeCount < 0 then invalidArgInputMustBeNonNegative "count" takeCount elif takeCount = 0 then empty else - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipelineIdx next = if takeCount = 0 then outOfBand.StopFurtherProcessing pipelineIdx @@ -699,7 +699,7 @@ namespace Microsoft.FSharp.Collections [] let inline takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipeIdx next = upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext (input:'T) : bool = @@ -711,7 +711,7 @@ namespace Microsoft.FSharp.Collections [] let tail (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose _ _ next = upcast { new TransformWithPostProcessing<'T,'V,bool>(next,true) with // member this.isFirst = this.State @@ -728,7 +728,7 @@ namespace Microsoft.FSharp.Collections [] let truncate (truncateCount:int) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipeIdx next = upcast { new Transform<'T,'U,int>(next,(*count*)0) with // member this.count = this.State @@ -749,7 +749,7 @@ namespace Microsoft.FSharp.Collections [] let tryItem index (source:ISeq<'T>) = if index < 0 then None else - source.PushTransform { new TransformFactory<'T,'T>() with + source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = let mutable this = Unchecked.defaultof> let skipper = @@ -835,7 +835,7 @@ namespace Microsoft.FSharp.Collections if windowSize <= 0 then invalidArgFmt "windowSize" "{0}\nwindowSize = {1}" [|SR.GetString SR.inputMustBePositive; windowSize|] - source.PushTransform { new TransformFactory<'T,'T[]>() with + source.PushTransform { new ITransformFactory<'T,'T[]> with member __.Compose outOfBand pipeIdx next = upcast { new Transform<'T,'U,Values<'T[],int,int>>(next,Values<'T[],int,int>(Array.zeroCreateUnchecked windowSize, 0, windowSize-1)) with @@ -1158,7 +1158,7 @@ namespace Microsoft.FSharp.Collections if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" [|SR.GetString SR.inputMustBePositive; chunkSize|] - source.PushTransform { new TransformFactory<'T,'T[]>() with + source.PushTransform { new ITransformFactory<'T,'T[]> with member __.Compose outOfBand pipeIdx next = upcast { new TransformWithPostProcessing<'T,'U,Values<'T[],int>>(next,Values<'T[],int>(Array.zeroCreateUnchecked chunkSize, 0)) with diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 076daafa4cd..98160503b9e 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -39,7 +39,7 @@ namespace Microsoft.FSharp.Collections /// An activity that transforms the input from 'T to 'U, using 'State. It's intended usage /// is as a base class for an object expression that will be created - /// in the TransformFactory's Compose function. + /// in the ITransformFactory's Compose function. [] type Transform<'T,'U,'State> = inherit Activity<'T,'U> @@ -51,7 +51,7 @@ namespace Microsoft.FSharp.Collections /// and performs some post processing on the pipeline, either in the case of the stream /// ending sucessfully or when disposed. It's intended usage /// is as a base class for an object expression that will be created - /// in the TransformFactory's Compose function. + /// in the ITransformFactory's Compose function. [] type TransformWithPostProcessing<'T,'U,'State> = inherit Transform<'T,'U,'State> diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 0655a00a989..6fd00f5d65d 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -3063,13 +3063,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition override this.ChainComplete _ = () override this.ChainDispose () = () - [] - type TransformFactory<'T,'U> () = + type ITransformFactory<'T,'U> = abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> type ISeq<'T> = inherit IEnumerable<'T> - abstract member PushTransform<'U> : TransformFactory<'T,'U> -> ISeq<'U> + abstract member PushTransform<'U> : ITransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result namespace Microsoft.FSharp.Collections @@ -3242,13 +3241,12 @@ namespace Microsoft.FSharp.Collections loop n l module ListSeqImplementation = - type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = - inherit TransformFactory<'T,'V>() - - override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = - first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + type ComposedFactory<'T,'U,'V> private (first:ITransformFactory<'T,'U>, second:ITransformFactory<'U,'V>) = + interface ITransformFactory<'T,'V> with + member this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + static member Combine (first:ITransformFactory<'T,'U>) (second:ITransformFactory<'U,'V>) : ITransformFactory<'T,'V> = upcast ComposedFactory(first, second) type Result<'T>() = @@ -3294,7 +3292,7 @@ namespace Microsoft.FSharp.Collections elif result.SeqState = 1(*NotStarted*) then PrivateListHelpers.notStarted() else PrivateListHelpers.alreadyFinished() - type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = interface System.Collections.IEnumerable with member this.GetEnumerator () : System.Collections.IEnumerator = upcast (this :> IEnumerable<'U>).GetEnumerator () @@ -3306,7 +3304,7 @@ namespace Microsoft.FSharp.Collections upcast (new ListEnumerator<'T,'U>(alist, activity, result)) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member __.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -3369,7 +3367,7 @@ namespace Microsoft.FSharp.Collections PrivateListHelpers.sliceTake (j-i) (PrivateListHelpers.sliceSkip i l) interface ISeq<'T> with - member this.PushTransform<'U> (next:TransformFactory<'T,'U>) = + member this.PushTransform<'U> (next:ITransformFactory<'T,'U>) = upcast (new ListSeqImplementation.ListEnumerable<'T,'U>(this, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -4790,20 +4788,19 @@ namespace Microsoft.FSharp.Core | Running = 1 | Finished = 2 - type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = - inherit TransformFactory<'T,'V>() - - override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = - first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) + type ComposedFactory<'T,'U,'V> private (first:ITransformFactory<'T,'U>, second:ITransformFactory<'U,'V>) = + interface ITransformFactory<'T,'V> with + member this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + static member Combine (first:ITransformFactory<'T,'U>) (second:ITransformFactory<'U,'V>) : ITransformFactory<'T,'V> = upcast ComposedFactory(first, second) type IdentityFactory<'T> private () = - inherit TransformFactory<'T,'T> () - static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) - override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static let singleton : ITransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) static member Instance = singleton + interface ITransformFactory<'T,'T> with + member __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next type SetResultToInput<'T>() = inherit Folder<'T,'T>(Unchecked.defaultof<'T>) @@ -4850,9 +4847,9 @@ namespace Microsoft.FSharp.Core type ISeqSource<'T> = abstract member GetEnumerator : unit -> IEnumerator<'T> - abstract member Fold<'Result,'U> : f:(PipeIdx->Folder<'U,'Result>) -> TransformFactory<'T,'U> -> PipeIdx -> 'Result + abstract member Fold<'Result,'U> : f:(PipeIdx->Folder<'U,'Result>) -> ITransformFactory<'T,'U> -> PipeIdx -> 'Result - type SeqSourceEnumerable<'T,'U>(source:ISeqSource<'T>, current:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type SeqSourceEnumerable<'T,'U>(source:ISeqSource<'T>, current:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = interface IEnumerable<'U> with member __.GetEnumerator () = let folder = SetResultToInput<'U>() @@ -4864,7 +4861,7 @@ namespace Microsoft.FSharp.Core upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> IOutOfBand) pipeIdx folder, folder)) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member __.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new SeqSourceEnumerable<'T,'V>(source, ComposedFactory.Combine current next, pipeIdx+1)) member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = @@ -4878,7 +4875,7 @@ namespace Microsoft.FSharp.Core member __.GetEnumerator () = upcast (source.GetEnumerator ()) interface ISeq<'U> with - member __.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member __.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new SeqSourceEnumerable<'U,'V>(source, next, 1)) member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = @@ -5100,7 +5097,7 @@ namespace Microsoft.FSharp.Core let source = { new ISeqSource<'T> with member __.GetEnumerator () = singleStepRangeEnumerator () - member __.Fold<'Result,'Output> (createFolder:PipeIdx->Folder<'Output,'Result>) (transformFactory:TransformFactory<'T,'Output>) pipeIdx : 'Result = + member __.Fold<'Result,'Output> (createFolder:PipeIdx->Folder<'Output,'Result>) (transformFactory:ITransformFactory<'T,'Output>) pipeIdx : 'Result = let result = createFolder (pipeIdx+1) let consumer = transformFactory.Compose (result :> IOutOfBand) pipeIdx result try diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index b81cb937269..9eb54ae660d 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1707,19 +1707,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition override ChainComplete : PipeIdx -> unit override ChainDispose : unit -> unit - /// TransformFactory provides composition of Activities. Its intended to have a specialization + /// ITransformFactory provides composition of Activities. Its intended to have a specialization /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack /// of Actvities that will be composed. - [] - type TransformFactory<'T,'U> = - new : unit -> TransformFactory<'T,'U> + type ITransformFactory<'T,'U> = abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities /// as well as Fold the current Activity pipeline. type ISeq<'T> = inherit System.Collections.Generic.IEnumerable<'T> - abstract member PushTransform : TransformFactory<'T,'U> -> ISeq<'U> + abstract member PushTransform : ITransformFactory<'T,'U> -> ISeq<'U> abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result namespace Microsoft.FSharp.Collections diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index c48cd63c715..67c3774ff21 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -163,18 +163,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition let inline forceCapture<'a,'b> (f:'a->'b) : 'a->'b = (# "" f : 'a->'b #) type IdentityFactory<'T> private () = - inherit TransformFactory<'T,'T> () - static let singleton : TransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) - override __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + static let singleton : ITransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) static member Instance = singleton + interface ITransformFactory<'T,'T> with + member __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next - type ComposedFactory<'T,'U,'V> private (first:TransformFactory<'T,'U>, second:TransformFactory<'U,'V>) = - inherit TransformFactory<'T,'V>() + type ComposedFactory<'T,'U,'V> private (first:ITransformFactory<'T,'U>, second:ITransformFactory<'U,'V>) = + interface ITransformFactory<'T,'V> with + member this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - override this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = - first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - - static member Combine (first:TransformFactory<'T,'U>) (second:TransformFactory<'U,'V>) : TransformFactory<'T,'V> = + static member Combine (first:ITransformFactory<'T,'U>) (second:ITransformFactory<'U,'V>) : ITransformFactory<'T,'V> = upcast ComposedFactory(first, second) type ISkipable = @@ -328,7 +327,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PushTransform _ = derivedClassShouldImplement () member __.Fold _ = derivedClassShouldImplement () - and [] SeqFactoryBase<'T,'U>(transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and [] SeqFactoryBase<'T,'U>(transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() member __.CreateActivityPipeline<'Result> (folder:Folder<'U,'Result>) : Activity<'T,'U> = @@ -343,7 +342,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.PipeIdx = pipeIdx - and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -352,7 +351,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new VanillaEnumerable<'T,'V>(enumerable, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -401,7 +400,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition override this.ChainDispose () = consumer.ChainDispose () - and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -410,7 +409,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new ConcatEnumerator<'T,'U,'Collection>(sources, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -439,7 +438,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, result, result)) interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -473,7 +472,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.GetEnumerator () = enumerable.GetEnumerator () interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -500,7 +499,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = @@ -520,7 +519,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition override this.Append source = source interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (VanillaEnumerable<'T,'V>(this, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -553,7 +552,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -562,7 +561,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new ArrayEnumerator<'T,'U>(array, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new ArrayEnumerable<'T,'V>(array, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -588,7 +587,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.GetEnumerator () = (array:>IEnumerable<'T>).GetEnumerator () interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (new ArrayEnumerable<'T,'U>(array, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -614,7 +613,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member this.GetEnumerator () = (new Singleton<'T>(item)) :> IEnumerator<'T> interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (new ArrayEnumerable<'T,'U>([|item|], next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -650,7 +649,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -659,7 +658,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new ResizeArrayEnumerator<'T,'U>(resizeArray, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -685,7 +684,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.GetEnumerator () = (resizeArray :> IEnumerable<'T>).GetEnumerator () interface ISeq<'T> with - member __.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -725,7 +724,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -734,7 +733,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -805,7 +804,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.SeqState <- SeqProcessNextStates.InProcess moveNext () - type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -814,7 +813,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast (new InitEnumerator<'T,'U>(count, f, this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new InitEnumerable<'T,'V>(count, f, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = @@ -933,7 +932,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition upto (if count.HasValue then Some (count.Value-1) else None) f interface ISeq<'T> with - member this.PushTransform (next:TransformFactory<'T,'U>) : ISeq<'U> = + member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -1225,7 +1224,7 @@ namespace Microsoft.FSharp.Core.CompilerServices member x.Reset() = raise <| new System.NotSupportedException() interface ISeq<'T> with - member this.PushTransform<'U> (next:TransformFactory<'T,'U>) : ISeq<'U> = + member this.PushTransform<'U> (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (new GeneratedSequenceBaseEnumerable<'T,'U>(this, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = @@ -1257,7 +1256,7 @@ namespace Microsoft.FSharp.Core.CompilerServices count <- count + 1 count - and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transformFactory:TransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with @@ -1266,7 +1265,7 @@ namespace Microsoft.FSharp.Core.CompilerServices upcast (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), this.CreateActivityPipeline result, result)) interface ISeq<'U> with - member this.PushTransform (next:TransformFactory<'U,'V>) : ISeq<'V> = + member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, this.Compose next, this.PipeIdx+1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 2dc2be43c19..a8ec2d2b26c 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -78,12 +78,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition [] type SeqFactoryBase<'T,'U> = inherit EnumerableBase<'U> - new : TransformFactory<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> + new : ITransformFactory<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> [] type internal IdentityFactory<'T> = - inherit TransformFactory<'T,'T> - static member Instance : TransformFactory<'T,'T> + interface ITransformFactory<'T,'T> + static member Instance : ITransformFactory<'T,'T> type internal ISkipable = // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip @@ -119,7 +119,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal UnfoldEnumerable<'T,'U,'GeneratorState> = inherit SeqFactoryBase<'T,'U> - new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*TransformFactory<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> + new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*ITransformFactory<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> interface ISeq<'U> type internal InitEnumerableDecider<'T> = @@ -134,7 +134,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal InitEnumerable<'T,'U> = inherit SeqFactoryBase<'T,'U> - new : Nullable * (int->'T) * TransformFactory<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> + new : Nullable * (int->'T) * ITransformFactory<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> interface ISeq<'U> type internal DelayedEnumerable<'T> = From 2bde79a31712de37b2a15aee0656e65b6a740483 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 6 May 2017 13:45:23 +1000 Subject: [PATCH 072/120] Moved list/array before seq in compilation order --- src/fsharp/FSharp.Core/FSharp.Core.fsproj | 24 ++++++++--------- src/fsharp/FSharp.Core/array.fs | 27 +++++++++---------- src/fsharp/FSharp.Core/collections.fs | 9 +++++++ src/fsharp/FSharp.Core/collections.fsi | 6 ++++- .../FSharp.Core/fslib-extra-pervasives.fs | 2 +- src/fsharp/FSharp.Core/list.fs | 9 +++---- src/fsharp/FSharp.Core/local.fs | 21 +++++++++++++++ src/fsharp/FSharp.Core/local.fsi | 18 ++----------- src/fsharp/FSharp.Core/seq.fs | 4 +-- src/fsharp/FSharp.Core/seqcore.fs | 10 ------- src/fsharp/FSharp.Core/seqcore.fsi | 6 ----- 11 files changed, 69 insertions(+), 67 deletions(-) diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 207cf5b3861..38d9b421cfa 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -98,6 +98,18 @@ Collections/collections.fs + + Collections/list.fsi + + + Collections/list.fs + + + Collections/array.fsi + + + Collections/array.fs + Collections/seqcore.fsi @@ -122,18 +134,6 @@ Collections/string.fs - - Collections/list.fsi - - - Collections/list.fs - - - Collections/array.fsi - - - Collections/array.fs - Collections/array3.fsi diff --git a/src/fsharp/FSharp.Core/array.fs b/src/fsharp/FSharp.Core/array.fs index dfcc0a9def2..a7ff099c5e4 100644 --- a/src/fsharp/FSharp.Core/array.fs +++ b/src/fsharp/FSharp.Core/array.fs @@ -8,7 +8,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core open Microsoft.FSharp.Collections open Microsoft.FSharp.Core.Operators - open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators #if FX_RESHAPED_REFLECTION open System.Reflection @@ -100,12 +99,22 @@ namespace Microsoft.FSharp.Collections j <- j + len res + [] + let toSeq array = + checkNonNull "array" array + Microsoft.FSharp.Primitives.Basics.Array.toSeq array + + [] + let ofSeq source = + checkNonNull "source" source + Microsoft.FSharp.Primitives.Basics.Array.ofSeq source + [] let concat (arrays: seq<'T[]>) = checkNonNull "arrays" arrays match arrays with | :? ('T[][]) as ts -> ts |> concatArrays // avoid a clone, since we only read the array - | _ -> arrays |> Seq.toArray |> concatArrays + | _ -> arrays |> ofSeq |> concatArrays [] let replicate count initial = @@ -185,7 +194,7 @@ namespace Microsoft.FSharp.Collections let countByValueType (projection:'T->'Key) (array:'T[]) = countByImpl HashIdentity.Structural<'Key> projection id array // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let countByRefType (projection:'T->'Key) (array:'T[]) = countByImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun t -> RuntimeHelpers.StructBox (projection t)) (fun sb -> sb.Value) array + let countByRefType (projection:'T->'Key) (array:'T[]) = countByImpl StructBox<'Key>.Comparer (fun t -> StructBox (projection t)) (fun sb -> sb.Value) array [] let countBy (projection:'T->'Key) (array:'T[]) = @@ -435,7 +444,7 @@ namespace Microsoft.FSharp.Collections let groupByValueType (keyf:'T->'Key) (array:'T[]) = groupByImpl HashIdentity.Structural<'Key> keyf id array // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let groupByRefType (keyf:'T->'Key) (array:'T[]) = groupByImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun t -> RuntimeHelpers.StructBox (keyf t)) (fun sb -> sb.Value) array + let groupByRefType (keyf:'T->'Key) (array:'T[]) = groupByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value) array [] let groupBy (projection:'T->'Key) (array:'T[]) = @@ -1054,16 +1063,6 @@ namespace Microsoft.FSharp.Collections let inline compareDescending a b = compare b a sortWith compareDescending array - [] - let toSeq array = - checkNonNull "array" array - Seq.ofArray array - - [] - let ofSeq source = - checkNonNull "source" source - Seq.toArray source - [] let findIndex predicate (array : _[]) = checkNonNull "array" array diff --git a/src/fsharp/FSharp.Core/collections.fs b/src/fsharp/FSharp.Core/collections.fs index bd200a7bd75..a04577f4a4a 100644 --- a/src/fsharp/FSharp.Core/collections.fs +++ b/src/fsharp/FSharp.Core/collections.fs @@ -48,3 +48,12 @@ namespace Microsoft.FSharp.Collections { new IComparer<'T> with member __.Compare(x,y) = comparer.Invoke(x,y) } + [] + type internal StructBox<'T when 'T:equality>(value:'T) = + member x.Value = value + static member Comparer = + let gcomparer = HashIdentity.Structural<'T> + { new IEqualityComparer> with + member __.GetHashCode(v) = gcomparer.GetHashCode(v.Value) + member __.Equals(v1,v2) = gcomparer.Equals(v1.Value,v2.Value) } + diff --git a/src/fsharp/FSharp.Core/collections.fsi b/src/fsharp/FSharp.Core/collections.fsi index ad7f4363d1b..a581c80c3fd 100644 --- a/src/fsharp/FSharp.Core/collections.fsi +++ b/src/fsharp/FSharp.Core/collections.fsi @@ -49,4 +49,8 @@ namespace Microsoft.FSharp.Collections // inline justification: allows inlining of hash functions val inline FromFunctions<'T> : hasher:('T -> int) -> equality:('T -> 'T -> bool) -> IEqualityComparer<'T> - + [] + type internal StructBox<'T when 'T : equality> = + new : value:'T -> StructBox<'T> + member Value : 'T + static member Comparer : IEqualityComparer> diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs index 25aab8048aa..da93edb96f6 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs @@ -98,7 +98,7 @@ module ExtraTopLevelOperators = let dictValueType (l:seq<'Key*'T>) = dictImpl HashIdentity.Structural<'Key> id id l // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let dictRefType (l:seq<'Key*'T>) = dictImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun k -> RuntimeHelpers.StructBox k) (fun sb -> sb.Value) l + let dictRefType (l:seq<'Key*'T>) = dictImpl StructBox<'Key>.Comparer (fun k -> StructBox k) (fun sb -> sb.Value) l [] let dict (keyValuePairs:seq<'Key*'T>) = diff --git a/src/fsharp/FSharp.Core/list.fs b/src/fsharp/FSharp.Core/list.fs index 6b31ea2b0f8..dc6fba05383 100644 --- a/src/fsharp/FSharp.Core/list.fs +++ b/src/fsharp/FSharp.Core/list.fs @@ -7,7 +7,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.LanguagePrimitives open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open Microsoft.FSharp.Collections - open Microsoft.FSharp.Core.CompilerServices open System.Collections.Generic #if FX_RESHAPED_REFLECTION open System.Reflection @@ -59,7 +58,7 @@ namespace Microsoft.FSharp.Collections let countByValueType (projection:'T->'Key) (list:'T list) = countByImpl HashIdentity.Structural<'Key> projection id list // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let countByRefType (projection:'T->'Key) (list:'T list) = countByImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun t -> RuntimeHelpers.StructBox (projection t)) (fun sb -> sb.Value) list + let countByRefType (projection:'T->'Key) (list:'T list) = countByImpl StructBox<'Key>.Comparer (fun t -> StructBox (projection t)) (fun sb -> sb.Value) list [] let countBy (projection:'T->'Key) (list:'T list) = @@ -432,7 +431,7 @@ namespace Microsoft.FSharp.Collections let groupByValueType (keyf:'T->'Key) (list:'T list) = groupByImpl HashIdentity.Structural<'Key> keyf id list // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let groupByRefType (keyf:'T->'Key) (list:'T list) = groupByImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun t -> RuntimeHelpers.StructBox (keyf t)) (fun sb -> sb.Value) list + let groupByRefType (keyf:'T->'Key) (list:'T list) = groupByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value) list [] let groupBy (projection:'T->'Key) (list:'T list) = @@ -522,10 +521,10 @@ namespace Microsoft.FSharp.Collections sortWith compareDescending list [] - let ofSeq source = Seq.toList source + let ofSeq<'T> (source:seq<'T>) : list<'T> = Microsoft.FSharp.Primitives.Basics.List.ofSeq source [] - let toSeq list = Seq.ofList list + let toSeq<'T> (list:list<'T>) : seq<'T> = (list :> seq<'T>) [] let findIndex predicate list = diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index 074f244952c..b3121dead6c 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -1145,3 +1145,24 @@ module internal Array = res.[i] <- subUnchecked !startIndex minChunkSize array startIndex := !startIndex + minChunkSize res + + let ofSeq (source : seq<'T>) = + match source with + | :? ('T[]) as res -> (res.Clone() :?> 'T[]) + | :? ('T list) as res -> List.toArray res + | :? ICollection<'T> as res -> + // Directly create an array and copy ourselves. + // This avoids an extra copy if using ResizeArray in fallback below. + let arr = zeroCreateUnchecked res.Count + res.CopyTo(arr, 0) + arr + | _ -> + let res = ResizeArray source + res.ToArray() + + let toSeq (source : array<'T>) : seq<'T> = + { new IEnumerable<'T> with + member this.GetEnumerator(): Collections.IEnumerator = + (source:>System.Collections.IEnumerable).GetEnumerator () + member this.GetEnumerator(): IEnumerator<'T> = + (source:>IEnumerable<'T>).GetEnumerator () } \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/local.fsi b/src/fsharp/FSharp.Core/local.fsi index 927a1120e05..21a92eadfae 100644 --- a/src/fsharp/FSharp.Core/local.fsi +++ b/src/fsharp/FSharp.Core/local.fsi @@ -70,35 +70,21 @@ module internal List = module internal Array = // The input parameter should be checked by callers if necessary val inline zeroCreateUnchecked : int -> 'T[] - val inline init : int -> (int -> 'T) -> 'T[] - val splitInto : int -> 'T[] -> 'T[][] - val findBack: predicate:('T -> bool) -> array:'T[] -> 'T - val tryFindBack: predicate:('T -> bool) -> array:'T[] -> 'T option - val findIndexBack: predicate:('T -> bool) -> array:'T[] -> int - val tryFindIndexBack: predicate:('T -> bool) -> array:'T[] -> int option - val mapFold : ('State -> 'T -> 'U * 'State) -> 'State -> 'T[] -> 'U[] * 'State - val mapFoldBack : ('T -> 'State -> 'U * 'State) -> 'T[] -> 'State -> 'U[] * 'State - val permute : indexMap:(int -> int) -> 'T[] -> 'T[] - val scanSubRight: f:('T -> 'State -> 'State) -> array:'T[] -> start:int -> fin:int -> initState:'State -> 'State[] - val inline subUnchecked : int -> int -> 'T[] -> 'T[] - val unstableSortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison - val unstableSortInPlace: array:'T[] -> unit when 'T : comparison - val stableSortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison - val stableSortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit - val stableSortInPlace: array:'T[] -> unit when 'T : comparison + val ofSeq : seq<'T> -> array<'T> + val toSeq : array<'T> -> seq<'T> \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 3d82bff7901..25c77f131d3 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -1067,7 +1067,7 @@ namespace Microsoft.FSharp.Collections let groupByValueType (keyf:'T->'Key) (seq:seq<'T>) = seq |> groupByImpl HashIdentity.Structural<'Key> keyf id // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let groupByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> groupByImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun t -> RuntimeHelpers.StructBox (keyf t)) (fun sb -> sb.Value) + let groupByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> groupByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value) [] let groupBy (projection:'T->'Key) (source:seq<'T>) = @@ -1150,7 +1150,7 @@ namespace Microsoft.FSharp.Collections let countByValueType (keyf:'T->'Key) (seq:seq<'T>) = seq |> countByImpl HashIdentity.Structural<'Key> keyf id // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let countByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> countByImpl RuntimeHelpers.StructBox<'Key>.Comparer (fun t -> RuntimeHelpers.StructBox (keyf t)) (fun sb -> sb.Value) + let countByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> countByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value) [] let countBy (projection:'T->'Key) (source:seq<'T>) = diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 67c3774ff21..f69852ab10b 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -964,16 +964,6 @@ namespace Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Collections.SeqComposition.Core module RuntimeHelpers = - - [] - type internal StructBox<'T when 'T:equality>(value:'T) = - member x.Value = value - static member Comparer = - let gcomparer = HashIdentity.Structural<'T> - { new IEqualityComparer> with - member __.GetHashCode(v) = gcomparer.GetHashCode(v.Value) - member __.Equals(v1,v2) = gcomparer.Equals(v1.Value,v2.Value) } - let Generate openf compute closef = mkSeq (fun () -> IEnumerator.generateWhileSome openf compute closef) diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index a8ec2d2b26c..8578d4e2193 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -160,12 +160,6 @@ namespace Microsoft.FSharp.Core.CompilerServices /// A group of functions used as part of the compiled representation of F# sequence expressions. module RuntimeHelpers = - [] - type internal StructBox<'T when 'T : equality> = - new : value:'T -> StructBox<'T> - member Value : 'T - static member Comparer : IEqualityComparer> - val internal mkConcatSeq : sources:(seq<#seq<'T>>) -> seq<'T> /// The F# compiler emits calls to this function to From 6f69c78dc5b1fc5860356e1548f46616a6221a42 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 6 May 2017 19:28:50 +1000 Subject: [PATCH 073/120] Removed duplicate code in Thin implementations --- src/fsharp/FSharp.Core/seqcore.fs | 67 ++---------------------------- src/fsharp/FSharp.Core/seqcore.fsi | 24 ++++++++--- 2 files changed, 21 insertions(+), 70 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index f69852ab10b..f1076ef271b 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -453,7 +453,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = - inherit EnumerableBase<'T>() + inherit VanillaEnumerable<'T,'T>(enumerable, IdentityFactory.Instance, 0) override __.Length () = match enumerable with @@ -468,25 +468,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition count <- count + 1 count - interface IEnumerable<'T> with - member __.GetEnumerator () = enumerable.GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = - upcast (new VanillaEnumerable<'T,'U>(enumerable, next, 1)) - - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 - try - use enumerator = enumerable.GetEnumerator () - while result.HaltedIdx = 0 && enumerator.MoveNext () do - result.ProcessNext enumerator.Current |> ignore - - result.ChainComplete result.HaltedIdx - finally - result.ChainDispose () - result.Result - type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() @@ -579,31 +560,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.Result type ThinArrayEnumerable<'T>(array:array<'T>) = - inherit EnumerableBase<'T>() + inherit ArrayEnumerable<'T,'T>(array, IdentityFactory.Instance, 0) override __.Length () = array.Length - interface IEnumerable<'T> with - member __.GetEnumerator () = (array:>IEnumerable<'T>).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = - upcast (new ArrayEnumerable<'T,'U>(array, next, 1)) - - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 - try - let array = array - let mutable idx = 0 - while result.HaltedIdx = 0 && idx < array.Length do - result.ProcessNext array.[idx] |> ignore - idx <- idx + 1 - - result.ChainComplete result.HaltedIdx - finally - result.ChainDispose () - result.Result - type SingletonEnumerable<'T>(item:'T) = inherit EnumerableBase<'T>() @@ -676,31 +636,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.Result type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = - inherit EnumerableBase<'T>() + inherit ResizeArrayEnumerable<'T,'T>(resizeArray, IdentityFactory.Instance, 0) override __.Length () = resizeArray.Count - interface IEnumerable<'T> with - member __.GetEnumerator () = (resizeArray :> IEnumerable<'T>).GetEnumerator () - - interface ISeq<'T> with - member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = - upcast (new ResizeArrayEnumerable<'T,'U>(resizeArray, next, 1)) - - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 - try - let array = resizeArray - let mutable idx = 0 - while result.HaltedIdx = 0 && idx < array.Count do - result.ProcessNext array.[idx] |> ignore - idx <- idx + 1 - - result.ChainComplete result.HaltedIdx - finally - result.ChainDispose () - result.Result - type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = inherit EnumeratorBase<'U>(result, activity) diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 8578d4e2193..5b1b51f2efd 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -102,20 +102,32 @@ namespace Microsoft.FSharp.Collections.SeqComposition new : list> -> AppendEnumerable<'T> override Append : ISeq<'T> -> ISeq<'T> + type internal ResizeArrayEnumerable<'T,'U> = + inherit SeqFactoryBase<'T,'U> + new : ResizeArray<'T> * ITransformFactory<'T,'U> * PipeIdx -> ResizeArrayEnumerable<'T,'U> + interface ISeq<'U> + type internal ThinResizeArrayEnumerable<'T> = - inherit EnumerableBase<'T> + inherit ResizeArrayEnumerable<'T,'T> new : ResizeArray<'T> -> ThinResizeArrayEnumerable<'T> - interface ISeq<'T> + + type internal ArrayEnumerable<'T,'U> = + inherit SeqFactoryBase<'T,'U> + new : array<'T> * ITransformFactory<'T,'U> * PipeIdx -> ArrayEnumerable<'T,'U> + interface ISeq<'U> type internal ThinArrayEnumerable<'T> = - inherit EnumerableBase<'T> + inherit ArrayEnumerable<'T, 'T> new : array<'T> -> ThinArrayEnumerable<'T> - interface ISeq<'T> + + type internal VanillaEnumerable<'T,'U> = + inherit SeqFactoryBase<'T,'U> + new : IEnumerable<'T> * ITransformFactory<'T,'U> * PipeIdx -> VanillaEnumerable<'T,'U> + interface ISeq<'U> type internal ThinEnumerable<'T> = - inherit EnumerableBase<'T> + inherit VanillaEnumerable<'T,'T> new : IEnumerable<'T> -> ThinEnumerable<'T> - interface ISeq<'T> type internal UnfoldEnumerable<'T,'U,'GeneratorState> = inherit SeqFactoryBase<'T,'U> From 9fd968369863354ca333edae2ce1fcca3d26c278 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 7 May 2017 10:46:35 +1000 Subject: [PATCH 074/120] Added EnumerableBase.GetRaw --- src/fsharp/FSharp.Core/seqcore.fs | 8 ++++++++ src/fsharp/FSharp.Core/seqcore.fsi | 1 + 2 files changed, 9 insertions(+) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index f1076ef271b..2e25b86bf9b 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -310,9 +310,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member Append : ISeq<'T> -> ISeq<'T> abstract member Length : unit -> int + abstract member GetRaw : unit -> seq<'T> default this.Append source = upcast (AppendEnumerable [source; this]) default this.Length () = length this + default this.GetRaw () = upcast this interface IEnumerable with member this.GetEnumerator () : IEnumerator = @@ -476,6 +478,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition | :? EnumerableBase<'T> as s -> s.Length () | s -> length s + override __.GetRaw () = + match delayed() with + | :? EnumerableBase<'T> as s -> s.GetRaw () + | s -> upcast s + interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () @@ -563,6 +570,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit ArrayEnumerable<'T,'T>(array, IdentityFactory.Instance, 0) override __.Length () = array.Length + override __.GetRaw () = upcast array type SingletonEnumerable<'T>(item:'T) = inherit EnumerableBase<'T>() diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 5b1b51f2efd..39fc0ae17a8 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -73,6 +73,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition new : unit -> EnumerableBase<'T> abstract member Append : ISeq<'T> -> ISeq<'T> abstract member Length : unit -> int + abstract member GetRaw : unit -> seq<'T> interface ISeq<'T> [] From 6d07c5a837c87f75b9777184d11d02a0ef7c9ba5 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 7 May 2017 10:56:25 +1000 Subject: [PATCH 075/120] made EnumerableBase internal --- src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs | 8 -------- src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs | 8 -------- src/fsharp/FSharp.Core/seqcore.fsi | 4 ++-- tests/fsharpqa/Source/Misc/LongSourceFile01.fs | 8 -------- 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs index 1e96c5d8aba..14ad16889fb 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs @@ -634,20 +634,12 @@ Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type G Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 Length() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Void .ctor() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.Type GetType() Microsoft.FSharp.Collections.SeqComposition.Core: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T] Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 0e2137c8fc1..41ae5f3e071 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -621,20 +621,12 @@ Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type G Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 Length() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Void .ctor() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.Type GetType() Microsoft.FSharp.Collections.SeqComposition.Core: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T] Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 39fc0ae17a8..4892804aba5 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -69,7 +69,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type NoValue = struct end [] - type EnumerableBase<'T> = + type internal EnumerableBase<'T> = new : unit -> EnumerableBase<'T> abstract member Append : ISeq<'T> -> ISeq<'T> abstract member Length : unit -> int @@ -77,7 +77,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> [] - type SeqFactoryBase<'T,'U> = + type internal SeqFactoryBase<'T,'U> = inherit EnumerableBase<'U> new : ITransformFactory<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index 5484feda32b..e805735744b 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -552,20 +552,12 @@ Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type G Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Int32 Length() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T]: Void .ctor() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.Type GetType() Microsoft.FSharp.Collections.SeqComposition.Core: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+EnumerableBase`1[T] Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() From 37eafebc920d80a99a88f31e1be3908870133451 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sun, 7 May 2017 11:54:48 +1000 Subject: [PATCH 076/120] Fix surface area --- .../FSharp.Core.Unittests/SurfaceArea.coreclr.fs | 10 +++------- src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs | 10 +++------- tests/fsharpqa/Source/Misc/LongSourceFile01.fs | 10 +++------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs index 14ad16889fb..12f258e8e9e 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs @@ -658,14 +658,9 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispo Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1126,6 +1121,7 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHash Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerable`1[T] GetRaw() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Type GetType() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: T LastGenerated diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 41ae5f3e071..8af75a20fff 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -645,14 +645,9 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispo Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1160,6 +1155,7 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHash Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerable`1[T] GetRaw() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Type GetType() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: T LastGenerated diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index e805735744b..d35f290ee73 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -576,14 +576,9 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispo Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]) Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.TransformFactory`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1033,6 +1028,7 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHash Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerable`1[T] GetRaw() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Type GetType() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: T LastGenerated From 0166801d661010e63c320a2ac332eea4184a6fcd Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 8 May 2017 19:37:26 +1000 Subject: [PATCH 077/120] Moved ISeq.length into Basics --- src/fsharp/FSharp.Core/iseq.fs | 2 +- src/fsharp/FSharp.Core/local.fs | 12 +++++++++++- src/fsharp/FSharp.Core/local.fsi | 5 ++++- src/fsharp/FSharp.Core/seqcore.fs | 11 ++--------- src/fsharp/FSharp.Core/seqcore.fsi | 2 -- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 494913a22af..9eba4490817 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -952,7 +952,7 @@ namespace Microsoft.FSharp.Collections match source with | :? EnumerableBase<'T> as s -> s.Length () | :? list<'T> as l -> l.Length - | _ -> length source + | _ -> Microsoft.FSharp.Primitives.Basics.ISeq.length source [] let toArray (source:ISeq<'T>) = diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index b3121dead6c..d5da8da6e7e 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -1165,4 +1165,14 @@ module internal Array = member this.GetEnumerator(): Collections.IEnumerator = (source:>System.Collections.IEnumerable).GetEnumerator () member this.GetEnumerator(): IEnumerator<'T> = - (source:>IEnumerable<'T>).GetEnumerator () } \ No newline at end of file + (source:>IEnumerable<'T>).GetEnumerator () } + +module internal ISeq = + open Microsoft.FSharp.Collections.SeqComposition + + let length (source:ISeq<_>) = + source.Fold (fun _ -> + { new Folder<'T,int>(0) with + override this.ProcessNext v = + this.Result <- this.Result + 1 + Unchecked.defaultof<_> (* return value unused in Fold context *) }) diff --git a/src/fsharp/FSharp.Core/local.fsi b/src/fsharp/FSharp.Core/local.fsi index 21a92eadfae..dcf94f12ad3 100644 --- a/src/fsharp/FSharp.Core/local.fsi +++ b/src/fsharp/FSharp.Core/local.fsi @@ -87,4 +87,7 @@ module internal Array = val stableSortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit val stableSortInPlace: array:'T[] -> unit when 'T : comparison val ofSeq : seq<'T> -> array<'T> - val toSeq : array<'T> -> seq<'T> \ No newline at end of file + val toSeq : array<'T> -> seq<'T> + +module internal ISeq = + val length : ISeq<'T> -> int \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 2e25b86bf9b..41b5e5f57d3 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -296,13 +296,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition finally activity.ChainDispose () - let length (source:ISeq<_>) = - source.Fold (fun _ -> - { new Folder<'T,int>(0) with - override this.ProcessNext v = - this.Result <- this.Result + 1 - Unchecked.defaultof<_> (* return value unused in Fold context *) }) - [] type EnumerableBase<'T> () = let derivedClassShouldImplement () = @@ -313,7 +306,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member GetRaw : unit -> seq<'T> default this.Append source = upcast (AppendEnumerable [source; this]) - default this.Length () = length this + default this.Length () = Microsoft.FSharp.Primitives.Basics.ISeq.length this default this.GetRaw () = upcast this interface IEnumerable with @@ -476,7 +469,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Length () = match delayed() with | :? EnumerableBase<'T> as s -> s.Length () - | s -> length s + | s -> Microsoft.FSharp.Primitives.Basics.ISeq.length s override __.GetRaw () = match delayed() with diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 4892804aba5..8d1c9b37d68 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -91,8 +91,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition // and it can only do it at the start of a sequence abstract CanSkip : unit -> bool - val internal length : ISeq<'T> -> int - type internal ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> = inherit EnumerableBase<'T> new : 'Sources * ('Sources->ISeq<'Collection>) -> ThinConcatEnumerable<'T, 'Sources, 'Collection> From 0cf6fa02b3fd496590106727d0c94c1d8096bc1f Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 8 May 2017 19:46:27 +1000 Subject: [PATCH 078/120] Added ISeq support in Array.ofSeq --- src/fsharp/FSharp.Core/local.fs | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index d5da8da6e7e..efcec761677 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -949,6 +949,75 @@ module internal List = module internal Array = open System + open System.Collections.Generic + open Microsoft.FSharp.Collections.SeqComposition + +#if FX_NO_ARRAY_KEY_SORT + // Mimic behavior of BCL QSort routine, used under the hood by various array sorting APIs + let qsort<'Key,'Value>(keys : 'Key[], values : 'Value[], start : int, last : int, comparer : IComparer<'Key>) = + let valuesExist = + match values with + | null -> false + | _ -> true + + let swap (p1, p2) = + let tk = keys.[p1] + keys.[p1] <- keys.[p2] + keys.[p2] <- tk + if valuesExist then + let tv = values.[p1] + values.[p1] <- values.[p2] + values.[p2] <- tv + + let partition (left, right, pivot) = + let value = keys.[pivot] + swap (pivot, right) + let mutable store = left + + for i in left..(right - 1) do + if comparer.Compare(keys.[i],value) < 0 then + swap(i, store) + store <- store + 1 + + swap (store, right) + store + + let rec qs (left, right) = + if left < right then + let pivot = left + (right-left)/2 + let newpivot = partition(left,right,pivot) + qs(left,newpivot - 1) + qs(newpivot+1,right) + + qs(start, last) + + type System.Array with + static member Sort<'Key,'Value>(keys : 'Key[], values : 'Value[], comparer : IComparer<'Key>) = + let valuesExist = + match values with + | null -> false + | _ -> true + match keys,values with + | null,_ -> raise (ArgumentNullException()) + | _,_ when valuesExist && (keys.Length <> values.Length) -> raise (ArgumentException()) + | _,_ -> qsort(keys, values, 0, keys.Length-1, comparer) + + static member Sort<'Key,'Value when 'Key : comparison>(keys : 'Key[], values : 'Value[]) = + let valuesExist = + match values with + | null -> false + | _ -> true + match keys,values with + | null,_ -> raise (ArgumentNullException()) + | _,_ when valuesExist && (keys.Length <> values.Length) -> raise (ArgumentException()) + | _,_ -> qsort(keys,values,0,keys.Length-1,LanguagePrimitives.FastGenericComparer<'Key>) + + static member Sort<'Key,'Value>(keys : 'Key[], values : 'Value[], start : int, length : int, comparer : IComparer<'Key>) = + match keys with + | null -> raise (ArgumentNullException()) + | _ -> qsort(keys,values,start,start+length-1,comparer) +#else +#endif let inline fastComparerForArraySort<'t when 't : comparison> () = LanguagePrimitives.FastGenericComparerCanBeNull<'t> @@ -1146,6 +1215,21 @@ module internal Array = startIndex := !startIndex + minChunkSize res + type FoldToArray<'T> () = + inherit Folder<'T, array<'T>>(Unchecked.defaultof<_>) + + let mutable tmp = ResizeArray () + + override this.ProcessNext input = + tmp.Add input + true (* result unused in fold *) + + override this.ChainComplete _ = + this.Result <- tmp.ToArray () + + let ofISeq (s : ISeq<'T>) = + s.Fold (fun _ -> upcast FoldToArray()) + let ofSeq (source : seq<'T>) = match source with | :? ('T[]) as res -> (res.Clone() :?> 'T[]) @@ -1156,6 +1240,7 @@ module internal Array = let arr = zeroCreateUnchecked res.Count res.CopyTo(arr, 0) arr + | :? ISeq<'T> as s -> ofISeq s | _ -> let res = ResizeArray source res.ToArray() From 14fb0cbc55e80211f5cf7eaef71a8f8deca64278 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 8 May 2017 19:46:46 +1000 Subject: [PATCH 079/120] Added IReadOnlyCollection to Array.ofSeq --- src/fsharp/FSharp.Core/local.fs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index efcec761677..65c572fb6e0 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -1241,6 +1241,15 @@ module internal Array = res.CopyTo(arr, 0) arr | :? ISeq<'T> as s -> ofISeq s +#if !FSCORE_PORTABLE_OLD + | :? IReadOnlyCollection<'T> as col -> + let res = zeroCreateUnchecked col.Count : 'T[] + let mutable idx = 0 + for x in source do + res.[idx] <- x + idx <- idx + 1 + res +#endif | _ -> let res = ResizeArray source res.ToArray() From 8301832f697ac5b6dde17eee3d17bb0ddb375c61 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 13 May 2017 17:51:46 +1000 Subject: [PATCH 080/120] Merged EnumeratorBase and Result --- src/fsharp/FSharp.Core/seqcore.fs | 380 +++++++++++++++++------------- 1 file changed, 217 insertions(+), 163 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 41b5e5f57d3..896b4d01e37 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -186,15 +186,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition | NotStarted = 1 | Finished = 2 - type Result<'T>() = - inherit Folder<'T,'T>(Unchecked.defaultof<'T>) - - member val SeqState = SeqProcessNextStates.NotStarted with get, set - - override this.ProcessNext (input:'T) : bool = - this.Result <- input - true - type EmptyEnumerator<'T>() = let current () = failwith "library implementation error: Current should never be called" @@ -213,89 +204,6 @@ namespace Microsoft.FSharp.Collections.SeqComposition static let element : IEnumerator<'T> = upcast (new EmptyEnumerator<'T> ()) static member Element = element - [] - type EnumeratorBase<'T>(result:Result<'T>, activity:Activity) = - interface IDisposable with - member __.Dispose () : unit = - activity.ChainDispose () - - interface IEnumerator with - member this.Current : obj = box (this :> IEnumerator<'T>).Current - member __.MoveNext () = failwith "library implementation error: derived class should implement (should be abstract)" - member __.Reset () : unit = noReset () - - interface IEnumerator<'T> with - member __.Current = - if result.SeqState = SeqProcessNextStates.InProcess then result.Result - else - match result.SeqState with - | SeqProcessNextStates.NotStarted -> notStarted() - | SeqProcessNextStates.Finished -> alreadyFinished() - | _ -> failwith "library implementation error: all states should have been handled" - - type VanillaEnumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let rec moveNext () = - if (result.HaltedIdx = 0) && source.MoveNext () then - if activity.ProcessNext source.Current then - true - else - moveNext () - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - interface IDisposable with - member __.Dispose () = - try - source.Dispose () - finally - activity.ChainDispose () - - type ConcatEnumerator<'T,'U,'Collection when 'Collection :> IEnumerable<'T>> (sources:IEnumerable<'Collection>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let main = sources.GetEnumerator () - - let mutable active = EmptyEnumerators.Element - - let rec moveNext () = - if result.HaltedIdx <> 0 then false - else - if active.MoveNext () then - if activity.ProcessNext active.Current then - true - else - moveNext () - elif main.MoveNext () then - active.Dispose () - active <- main.Current.GetEnumerator () - moveNext () - else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx - false - - interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () - - interface IDisposable with - member __.Dispose () = - try - main.Dispose () - active.Dispose () - finally - activity.ChainDispose () - [] type EnumerableBase<'T> () = let derivedClassShouldImplement () = @@ -336,14 +244,78 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.Compose next = ComposedFactory.Combine transformFactory next member __.PipeIdx = pipeIdx + + and [] EnumeratorBase<'T>() = + inherit Folder<'T,'T>(Unchecked.defaultof<'T>) + + member val SeqState = SeqProcessNextStates.NotStarted with get, set + abstract Activity : Activity + + override this.ProcessNext (input:'T) : bool = + this.Result <- input + true + + interface IDisposable with + member this.Dispose () : unit = + this.Activity.ChainDispose () + + interface IEnumerator with + member this.Current : obj = box (this :> IEnumerator<'T>).Current + member __.MoveNext () = failwith "library implementation error: derived class should implement (should be abstract)" + member __.Reset () : unit = noReset () + + interface IEnumerator<'T> with + member this.Current = + if this.SeqState = SeqProcessNextStates.InProcess then this.Result + else + match this.SeqState with + | SeqProcessNextStates.NotStarted -> notStarted() + | SeqProcessNextStates.Finished -> alreadyFinished() + | _ -> failwith "library implementation error: all states should have been handled" + + and VanillaEnumerator<'T,'U> private (source:IEnumerator<'T>) = + inherit EnumeratorBase<'U>() + + let mutable activity = Unchecked.defaultof> + + member __.FinaliseConstruct(activity':Activity<'T,'U>) = + activity <- activity' + + override this.Activity = upcast activity + + member private this.MoveNext () = + if this.HaltedIdx = 0 && source.MoveNext () then + if activity.ProcessNext source.Current then + true + else + this.MoveNext () + else + this.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete this.HaltedIdx + false + + interface IEnumerator with + member this.MoveNext () = + this.SeqState <- SeqProcessNextStates.InProcess + this.MoveNext () + + interface IDisposable with + member __.Dispose () = + try + source.Dispose () + finally + activity.ChainDispose () + + static member Construct (source:IEnumerator<'T>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + let enumerator = new VanillaEnumerator<'T,'U>(source) + enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) + upcast enumerator and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new VanillaEnumerator<'T,'U>(enumerable.GetEnumerator(), this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Construct (enumerable.GetEnumerator()) this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = @@ -395,13 +367,58 @@ namespace Microsoft.FSharp.Collections.SeqComposition override this.ChainDispose () = consumer.ChainDispose () + and ConcatEnumerator<'T,'U,'Collection when 'Collection :> IEnumerable<'T>> private (sources:IEnumerable<'Collection>) = + inherit EnumeratorBase<'U>() + + let main = sources.GetEnumerator () + let mutable active = EmptyEnumerators.Element + let mutable activity = Unchecked.defaultof> + + override this.Activity = upcast activity + + member __.FinaliseConstruct(activity':Activity<'T,'U>) = + activity <- activity' + + member private this.MoveNext () = + if this.HaltedIdx <> 0 then false + else + if active.MoveNext () then + if activity.ProcessNext active.Current then + true + else + this.MoveNext () + elif main.MoveNext () then + active.Dispose () + active <- main.Current.GetEnumerator () + this.MoveNext () + else + this.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete this.HaltedIdx + false + + interface IEnumerator with + member this.MoveNext () = + this.SeqState <- SeqProcessNextStates.InProcess + this.MoveNext () + + interface IDisposable with + member __.Dispose () = + try + main.Dispose () + active.Dispose () + finally + activity.ChainDispose () + + static member Construct (sources:IEnumerable<'Collection>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + let enumerator = new ConcatEnumerator<'T,'U,'Collection>(sources) + enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) + upcast enumerator + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new ConcatEnumerator<'T,'U,'Collection>(sources, this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = ConcatEnumerator<'T,'U,'Collection>.Construct sources this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = @@ -427,18 +444,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = inherit EnumerableBase<'T>() + member private __.Fatten : ISeq<'T> = upcast (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityFactory.Instance, 1)) + interface IEnumerable<'T> with - member this.GetEnumerator () : IEnumerator<'T> = - let result = Result<'T> () - upcast (new ConcatEnumerator<'T,'T,'Collection> (preEnumerate sources, result, result)) + member this.GetEnumerator () = this.Fatten.GetEnumerator () interface ISeq<'T> with member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = upcast (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let fat : ISeq<'T> = upcast (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityFactory.Instance, 1)) - fat.Fold createFolder + this.Fatten.Fold createFolder and AppendEnumerable<'T> (sources:list>) = inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> upcast (List.rev sources)) @@ -511,35 +527,44 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.ChainDispose () result.Result - type ArrayEnumerator<'T,'U>(array:array<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) + type ArrayEnumerator<'T,'U> private (array:array<'T>) = + inherit EnumeratorBase<'U>() let mutable idx = 0 + let mutable activity = Unchecked.defaultof> + + member __.FinaliseConstruct(activity':Activity<'T,'U>) = + activity <- activity' + + override this.Activity = upcast activity - let rec moveNext () = - if (result.HaltedIdx = 0) && idx < array.Length then + member private this.MoveNext () = + if this.HaltedIdx = 0 && idx < array.Length then idx <- idx+1 if activity.ProcessNext array.[idx-1] then true else - moveNext () + this.MoveNext () else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx + this.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete this.HaltedIdx false interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () + member this.MoveNext () = + this.SeqState <- SeqProcessNextStates.InProcess + this.MoveNext () + + static member Construct (array:array<'T>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + let enumerator = new ArrayEnumerator<'T,'U>(array) + enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) + upcast enumerator type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new ArrayEnumerator<'T,'U>(array, this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = ArrayEnumerator<'T,'U>.Construct array this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = @@ -588,35 +613,44 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.ChainDispose () result.Result - type ResizeArrayEnumerator<'T,'U>(array:ResizeArray<'T>, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) + type ResizeArrayEnumerator<'T,'U> private (array:ResizeArray<'T>) = + inherit EnumeratorBase<'U>() let mutable idx = 0 + let mutable activity = Unchecked.defaultof> + + member __.FinaliseConstruct(activity':Activity<'T,'U>) = + activity <- activity' - let rec moveNext () = - if (result.HaltedIdx = 0) && idx < array.Count then + override this.Activity = upcast activity + + member private this.MoveNext () = + if this.HaltedIdx = 0 && idx < array.Count then idx <- idx+1 if activity.ProcessNext array.[idx-1] then true else - moveNext () + this.MoveNext () else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx + this.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete this.HaltedIdx false interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () + member this.MoveNext () = + this.SeqState <- SeqProcessNextStates.InProcess + this.MoveNext () + + static member Construct (array:ResizeArray<'T>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + let enumerator = new ResizeArrayEnumerator<'T,'U>(array) + enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) + upcast enumerator type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new ResizeArrayEnumerator<'T,'U>(resizeArray, this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = ResizeArrayEnumerator<'T,'U>.Construct resizeArray this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = @@ -641,13 +675,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Length () = resizeArray.Count - type UnfoldEnumerator<'T,'U,'State>(generator:'State->option<'T*'State>, state:'State, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) + type UnfoldEnumerator<'T,'U,'State> private (generator:'State->option<'T*'State>, state:'State) = + inherit EnumeratorBase<'U>() let mutable current = state - let rec moveNext () = - if result.HaltedIdx <> 0 then + let mutable activity = Unchecked.defaultof> + + member __.FinaliseConstruct(activity':Activity<'T,'U>) = + activity <- activity' + + override this.Activity = upcast activity + + member private this.MoveNext () = + if this.HaltedIdx <> 0 then false else match generator current with @@ -656,21 +697,24 @@ namespace Microsoft.FSharp.Collections.SeqComposition if activity.ProcessNext item then true else - moveNext () + this.MoveNext () | _ -> false interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () + member this.MoveNext () = + this.SeqState <- SeqProcessNextStates.InProcess + this.MoveNext () + + static member Construct (generator:'State->option<'T*'State>) (state:'State) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + let enumerator = new UnfoldEnumerator<'T,'U,'State>(generator, state) + enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) + upcast enumerator type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new UnfoldEnumerator<'T,'U,'GeneratorState>(generator, state, this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = UnfoldEnumerator<'T,'U,'GeneratorState>.Construct generator state this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = @@ -703,13 +747,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition else System.Int32.MaxValue - type InitEnumerator<'T,'U>(count:Nullable, f:int->'T, activity:Activity<'T,'U>, result:Result<'U>) = - inherit EnumeratorBase<'U>(result, activity) - - let isSkipping = - match box activity with - | :? ISkipable as skip -> skip.CanSkip - | _ -> fun () -> false + type InitEnumerator<'T,'U>(count:Nullable, f:int->'T) = + inherit EnumeratorBase<'U>() let terminatingIdx = getInitTerminatingIdx count @@ -717,8 +756,22 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable maybeSkipping = true let mutable idx = -1 - let rec moveNext () = - if result.HaltedIdx = 0 && idx < terminatingIdx then + let mutable activity = Unchecked.defaultof> + let mutable isSkipping = Unchecked.defaultofbool> + + member __.FinaliseConstruct(activity':Activity<'T,'U>) = + activity <- activity' + + isSkipping <- + match box activity with + | :? ISkipable as skip -> skip.CanSkip + | _ -> fun () -> false + + + override this.Activity = upcast activity + + member private this.MoveNext () = + if this.HaltedIdx = 0 && idx < terminatingIdx then idx <- idx + 1 if maybeSkipping then @@ -727,30 +780,33 @@ namespace Microsoft.FSharp.Collections.SeqComposition maybeSkipping <- isSkipping () if maybeSkipping then - moveNext () + this.MoveNext () elif activity.ProcessNext (f idx) then true else - moveNext () - elif result.HaltedIdx = 0 && idx = System.Int32.MaxValue then + this.MoveNext () + elif this.HaltedIdx = 0 && idx = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) else - result.SeqState <- SeqProcessNextStates.Finished - activity.ChainComplete result.HaltedIdx + this.SeqState <- SeqProcessNextStates.Finished + activity.ChainComplete this.HaltedIdx false interface IEnumerator with - member __.MoveNext () = - result.SeqState <- SeqProcessNextStates.InProcess - moveNext () + member this.MoveNext () = + this.SeqState <- SeqProcessNextStates.InProcess + this.MoveNext () + + static member Construct (count:Nullable) (f:int->'T) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + let enumerator = new InitEnumerator<'T,'U>(count, f) + enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) + upcast enumerator type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new InitEnumerator<'T,'U>(count, f, this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = InitEnumerator<'T,'U>.Construct count f this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = @@ -1190,9 +1246,7 @@ namespace Microsoft.FSharp.Core.CompilerServices inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () : IEnumerator<'U> = - let result = Result<'U> () - upcast (new VanillaEnumerator<'T,'U>(generatedSequence.GetFreshEnumerator(), this.CreateActivityPipeline result, result)) + member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Construct (generatedSequence.GetFreshEnumerator()) this interface ISeq<'U> with member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = From 8486a2708bc3be3993db6e28018756eabbc91787 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 13 May 2017 17:55:23 +1000 Subject: [PATCH 081/120] Use list for small ISeqs --- src/fsharp/FSharp.Core/iseq.fs | 2 +- src/fsharp/FSharp.Core/seqcore.fs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 9eba4490817..1ae5fbf7feb 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -602,7 +602,7 @@ namespace Microsoft.FSharp.Collections override this.ProcessNext (input:'T) : bool = this.State <- folder this.State input TailCall.avoid (next.ProcessNext this.State) } } - concat (ofSeq [| head ; tail |]) + concat (ofList [ head ; tail ]) [] let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 896b4d01e37..9a7f8661ef2 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -600,7 +600,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface ISeq<'T> with member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = - upcast (new ArrayEnumerable<'T,'U>([|item|], next, 1)) + ([item] :> ISeq<'T>).PushTransform next member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = let result = createFolder 1 From 4d5374b97cb88ca2d11df7325fc5e7ba47216445 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 15 May 2017 19:08:55 +1000 Subject: [PATCH 082/120] Thin direct calls to IEnumerable.GetEnumerator --- src/fsharp/FSharp.Core/seqcore.fs | 6 ++++++ src/fsharp/FSharp.Core/seqcore.fsi | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 9a7f8661ef2..a1b772161dc 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -479,6 +479,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition count <- count + 1 count + interface IEnumerable<'T> with + member __.GetEnumerator () = enumerable.GetEnumerator () + type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() @@ -590,6 +593,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Length () = array.Length override __.GetRaw () = upcast array + interface IEnumerable<'T> with + member __.GetEnumerator () = (array:>IEnumerable<'T>).GetEnumerator () + type SingletonEnumerable<'T>(item:'T) = inherit EnumerableBase<'T>() diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 8d1c9b37d68..e562572f4cd 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -118,6 +118,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal ThinArrayEnumerable<'T> = inherit ArrayEnumerable<'T, 'T> new : array<'T> -> ThinArrayEnumerable<'T> + interface IEnumerable<'T> type internal VanillaEnumerable<'T,'U> = inherit SeqFactoryBase<'T,'U> @@ -127,6 +128,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal ThinEnumerable<'T> = inherit VanillaEnumerable<'T,'T> new : IEnumerable<'T> -> ThinEnumerable<'T> + interface IEnumerable<'T> type internal UnfoldEnumerable<'T,'U,'GeneratorState> = inherit SeqFactoryBase<'T,'U> From 56525a5253b8b891384d864c2d8bcbca1d609b12 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 18 May 2017 19:12:01 +1000 Subject: [PATCH 083/120] Provided an optimized GetEnumerator for scan --- src/fsharp/FSharp.Core/iseq.fs | 96 ++++++++++++++++++++++++++---- src/fsharp/FSharp.Core/iseq.fsi | 2 +- src/fsharp/FSharp.Core/seqcore.fsi | 3 + 3 files changed, 90 insertions(+), 11 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 1ae5fbf7feb..92dc11b2775 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -108,6 +108,20 @@ namespace Microsoft.FSharp.Collections member __.GetHashCode o = c.GetHashCode o._1 member __.Equals (lhs,rhs) = c.Equals (lhs._1, rhs._1) } + [] + type PreferGetEnumerator<'T>() = + inherit EnumerableBase<'T>() + + abstract GetEnumerator: unit -> IEnumerator<'T> + abstract GetSeq : unit -> ISeq<'T> + + interface IEnumerable<'T> with + member this.GetEnumerator () : IEnumerator<'T> = this.GetEnumerator () + + interface ISeq<'T> with + member this.PushTransform<'U> (next:ITransformFactory<'T,'U>) : ISeq<'U> = (this.GetSeq()).PushTransform next + member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) : 'Result = (this.GetSeq()).Fold f + [] let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance @@ -592,17 +606,79 @@ namespace Microsoft.FSharp.Collections let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = upcast (ThinConcatEnumerable (sources, id)) + (* + Represents the following seq comprehension, but they don't work at this level + + seq { + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder + let mutable state = initialState + yield state + for item in enumerable do + state <- f.Invoke (state, item) + yield state } + *) + type ScanEnumerator<'T,'State>(folder:'State->'T->'State, initialState:'State, enumerable:seq<'T>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder + + let mutable state = 0 (*Pre-start*) + let mutable enumerator = Unchecked.defaultof> + let mutable current = initialState + + interface IEnumerator<'State> with + member this.Current: 'State = + match state with + | 0(*PreStart*) -> notStarted() + | 1(*GetEnumerator*) -> current + | 2(*MoveNext*) -> current + | _(*Finished*) -> alreadyFinished() + + interface IEnumerator with + member this.Current : obj = + box (this:>IEnumerator<'State>).Current + + member this.MoveNext () : bool = + match state with + | 0(*PreStart*) -> + state <- 1(*GetEnumerator*) + true + | 1(*GetEnumerator*) -> + enumerator <- enumerable.GetEnumerator () + state <- 2(*MoveNext*) + (this:>IEnumerator).MoveNext () + | 2(*MoveNext*) -> + if enumerator.MoveNext () then + current <- f.Invoke (current, enumerator.Current) + true + else + current <- Unchecked.defaultof<_> + state <- 3(*Finished*) + false + | _(*Finished*) -> alreadyFinished() + + member this.Reset () : unit = noReset () + + interface IDisposable with + member this.Dispose(): unit = + if isNotNull enumerator then + enumerator.Dispose () + [] - let inline scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) :ISeq<'State> = - let head = singleton initialState - let tail = - source.PushTransform { new ITransformFactory<'T,'State> with - override __.Compose _ _ next = - upcast { new Transform<'T,'V,'State>(next, initialState) with - override this.ProcessNext (input:'T) : bool = - this.State <- folder this.State input - TailCall.avoid (next.ProcessNext this.State) } } - concat (ofList [ head ; tail ]) + let scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) : ISeq<'State> = + upcast { new PreferGetEnumerator<'State>() with + member this.GetEnumerator () = + upcast new ScanEnumerator<'T,'State>(folder, initialState, source) + + member this.GetSeq () = + let head = singleton initialState + let tail = + source.PushTransform { new ITransformFactory<'T,'State> with + override __.Compose _ _ next = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder + upcast { new Transform<'T,'V,'State>(next, initialState) with + override this.ProcessNext (input:'T) : bool = + this.State <- f.Invoke (this.State, input) + TailCall.avoid (next.ProcessNext this.State) } } + concat (ofList [ head ; tail ]) } [] let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 98160503b9e..0c78d1e567e 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -217,7 +217,7 @@ namespace Microsoft.FSharp.Collections val inline reduce : f:('T->'T->'T) -> source:ISeq<'T> -> 'T [] - val inline scan : folder:('State->'T->'State) -> initialState:'State -> source:ISeq<'T> -> ISeq<'State> + val scan : folder:('State->'T->'State) -> initialState:'State -> source:ISeq<'T> -> ISeq<'State> [] val skip : skipCount:int -> source:ISeq<'T> -> ISeq<'T> diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index e562572f4cd..3e3ffcef68c 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -74,6 +74,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition abstract member Append : ISeq<'T> -> ISeq<'T> abstract member Length : unit -> int abstract member GetRaw : unit -> seq<'T> + default Append : ISeq<'T> -> ISeq<'T> + default Length : unit -> int + default GetRaw : unit -> seq<'T> interface ISeq<'T> [] From cebfaabb55a616fc5df55b15a226d76be929d5e3 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 18 Mar 2017 15:24:25 +1100 Subject: [PATCH 084/120] Stubbed in remaining functions Took implementations from seq.fs --- src/fsharp/FSharp.Core/iseq.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 92dc11b2775..eef8522082b 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1342,4 +1342,4 @@ namespace Microsoft.FSharp.Collections [] let zip3 source1 source2 source3 = - map2 (fun x (y,z) -> x,y,z) source1 (zip source2 source3) + map2 (fun x (y,z) -> x,y,z) source1 (zip source2 source3) \ No newline at end of file From ee3db4e00ad7c1616b7b95b566f872094739a52b Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 18:35:26 +1000 Subject: [PATCH 085/120] Most Seq implementation to ISeq --- src/fsharp/FSharp.Core/seq.fs | 903 +++++++--------------------------- 1 file changed, 180 insertions(+), 723 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 25c77f131d3..11acbaa5611 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -13,6 +13,11 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Control open Microsoft.FSharp.Collections + module Upcast = + // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality + // is fixed with the compiler then these functions can be removed. + let inline enumerable (t:#IEnumerable<'T>) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) + module Internal = module IEnumerator = open Microsoft.FSharp.Collections.IEnumerator @@ -442,21 +447,9 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics - [] - type CachedSeq<'T>(cleanup,res:seq<'T>) = - interface System.IDisposable with - member x.Dispose() = cleanup() - interface System.Collections.Generic.IEnumerable<'T> with - member x.GetEnumerator() = res.GetEnumerator() - interface System.Collections.IEnumerable with - member x.GetEnumerator() = (res :> System.Collections.IEnumerable).GetEnumerator() - member obj.Clear() = cleanup() - - [] [] module Seq = - #if FX_NO_ICLONEABLE open Microsoft.FSharp.Core.ICloneableExtensions #else @@ -465,6 +458,13 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.Internal open Microsoft.FSharp.Collections.IEnumerator + // these helpers are just to consolidate the null checking + let inline toISeq (source:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source" source; ISeq.ofSeq source + let inline toISeq1 (source1:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source1" source1; ISeq.ofSeq source1 + let inline toISeq2 (source2:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source2" source2; ISeq.ofSeq source2 + let inline toISeq3 (source3:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source3" source3; ISeq.ofSeq source3 + let inline toISeqs (sources:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "sources" sources; ISeq.ofSeq sources + let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) let mkUnfoldSeq f x = mkSeq (fun () -> IEnumerator.unfold f x) let inline indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) @@ -473,25 +473,23 @@ namespace Microsoft.FSharp.Collections let delay generator = mkDelayedSeq generator [] - let unfold generator state = mkUnfoldSeq generator state + let unfold f x = + ISeq.unfold f x |> Upcast.enumerable [] let empty<'T> = (EmptyEnumerable :> seq<'T>) [] - let initInfinite initializer = mkSeq (fun () -> IEnumerator.upto None initializer) + let initInfinite f = + ISeq.initInfinite f |> Upcast.enumerable [] - let init count initializer = - if count < 0 then invalidArgInputMustBeNonNegative "count" count - mkSeq (fun () -> IEnumerator.upto (Some (count-1)) initializer) + let init count f = + ISeq.init count f |> Upcast.enumerable [] - let iter action (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - while e.MoveNext() do - action e.Current + let iter f (source : seq<'T>) = + ISeq.iter f (toISeq source) [] let item index (source : seq<'T>) = @@ -501,191 +499,107 @@ namespace Microsoft.FSharp.Collections IEnumerator.nth index e [] - let tryItem index (source : seq<'T>) = - checkNonNull "source" source - if index < 0 then None else - use e = source.GetEnumerator() - IEnumerator.tryItem index e + let tryItem i (source : seq<'T>) = + ISeq.tryItem i (toISeq source) [] let nth index (source : seq<'T>) = item index source [] - let iteri action (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(action) - let mutable i = 0 - while e.MoveNext() do - f.Invoke(i, e.Current) - i <- i + 1 + let iteri f (source : seq<'T>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.iteri (fun idx a -> f.Invoke (idx,a)) (toISeq source) [] - let exists predicate (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable state = false - while (not state && e.MoveNext()) do - state <- predicate e.Current - state + let exists f (source : seq<'T>) = + ISeq.exists f (toISeq source) [] - let inline contains value (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable state = false - while (not state && e.MoveNext()) do - state <- value = e.Current - state + let inline contains element (source : seq<'T>) = + ISeq.contains element (toISeq source) [] - let forall predicate (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable state = true - while (state && e.MoveNext()) do - state <- predicate e.Current - state + let forall f (source : seq<'T>) = + ISeq.forall f (toISeq source) [] - let iter2 action (source1 : seq<_>) (source2 : seq<_>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - use e1 = source1.GetEnumerator() - use e2 = source2.GetEnumerator() - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(action) - while (e1.MoveNext() && e2.MoveNext()) do - f.Invoke(e1.Current, e2.Current) + let iter2 f (source1 : seq<_>) (source2 : seq<_>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.iter2 (fun a b -> f.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] - let iteri2 action (source1 : seq<_>) (source2 : seq<_>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - use e1 = source1.GetEnumerator() - use e2 = source2.GetEnumerator() - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt(action) - let mutable i = 0 - while (e1.MoveNext() && e2.MoveNext()) do - f.Invoke(i, e1.Current, e2.Current) - i <- i + 1 - - // Build an IEnumerable by wrapping/transforming iterators as they get generated. - let revamp f (ie : seq<_>) = mkSeq (fun () -> f (ie.GetEnumerator())) - let revamp2 f (ie1 : seq<_>) (source2 : seq<_>) = - mkSeq (fun () -> f (ie1.GetEnumerator()) (source2.GetEnumerator())) - let revamp3 f (ie1 : seq<_>) (source2 : seq<_>) (source3 : seq<_>) = - mkSeq (fun () -> f (ie1.GetEnumerator()) (source2.GetEnumerator()) (source3.GetEnumerator())) + let iteri2 f (source1 : seq<_>) (source2 : seq<_>) = + let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f + ISeq.iteri2 (fun idx a b -> f.Invoke(idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] - let filter predicate source = - checkNonNull "source" source - revamp (IEnumerator.filter predicate) source + let filter f source = + ISeq.filter f (toISeq source) |> Upcast.enumerable [] let where predicate source = filter predicate source [] - let map mapping source = - checkNonNull "source" source - revamp (IEnumerator.map mapping) source + let map f source = + ISeq.map f (toISeq source) |> Upcast.enumerable [] - let mapi mapping source = - checkNonNull "source" source - revamp (IEnumerator.mapi mapping) source + let mapi f source = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.mapi (fun idx a ->f.Invoke(idx,a)) (toISeq source) |> Upcast.enumerable [] - let mapi2 mapping source1 source2 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - revamp2 (IEnumerator.mapi2 mapping) source1 source2 + let mapi2 f source1 source2 = + let f = OptimizedClosures.FSharpFunc.Adapt f + ISeq.mapi2 (fun idx a b -> f.Invoke (idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable [] - let map2 mapping source1 source2 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - revamp2 (IEnumerator.map2 mapping) source1 source2 + let map2 f source1 source2 = + ISeq.map2 f (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable [] - let map3 mapping source1 source2 source3 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - checkNonNull "source3" source3 - revamp3 (IEnumerator.map3 mapping) source1 source2 source3 + let map3 f source1 source2 source3 = + ISeq.map3 f (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) |> Upcast.enumerable [] - let choose chooser source = - checkNonNull "source" source - revamp (IEnumerator.choose chooser) source + let choose f source = + ISeq.choose f (toISeq source) |> Upcast.enumerable [] let indexed source = - checkNonNull "source" source - mapi (fun i x -> i,x) source + ISeq.indexed (toISeq source) |> Upcast.enumerable [] let zip source1 source2 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - map2 (fun x y -> x,y) source1 source2 + ISeq.zip (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable [] let zip3 source1 source2 source3 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - checkNonNull "source3" source3 - map2 (fun x (y,z) -> x,y,z) source1 (zip source2 source3) + ISeq.zip3 (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) |> Upcast.enumerable [] let cast (source: IEnumerable) = - checkNonNull "source" source - mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) + source |> ISeq.cast |> Upcast.enumerable [] - let tryPick chooser (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable res = None - while (Option.isNone res && e.MoveNext()) do - res <- chooser e.Current - res + let tryPick f (source : seq<'T>) = + ISeq.tryPick f (toISeq source) [] - let pick chooser source = - checkNonNull "source" source - match tryPick chooser source with - | None -> indexNotFound() - | Some x -> x + let pick f source = + ISeq.pick f (toISeq source) [] - let tryFind predicate (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable res = None - while (Option.isNone res && e.MoveNext()) do - let c = e.Current - if predicate c then res <- Some(c) - res + let tryFind f (source : seq<'T>) = + ISeq.tryFind f (toISeq source) [] - let find predicate source = - checkNonNull "source" source - match tryFind predicate source with - | None -> indexNotFound() - | Some x -> x + let find f source = + ISeq.find f (toISeq source) [] let take count (source : seq<'T>) = - checkNonNull "source" source - if count < 0 then invalidArgInputMustBeNonNegative "count" count - (* Note: don't create or dispose any IEnumerable if n = 0 *) - if count = 0 then empty else - seq { use e = source.GetEnumerator() - for x in 0 .. count - 1 do - if not (e.MoveNext()) then - invalidOpFmt "tried to take {0} {1} past the end of the seq" - [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] - yield e.Current } + ISeq.take count (toISeq source) |> Upcast.enumerable [] let isEmpty (source : seq<'T>) = @@ -698,335 +612,133 @@ namespace Microsoft.FSharp.Collections use ie = source.GetEnumerator() not (ie.MoveNext()) - [] let concat sources = - checkNonNull "sources" sources - RuntimeHelpers.mkConcatSeq sources + sources |> toISeqs |> ISeq.map toISeq |> ISeq.concat |> Upcast.enumerable [] let length (source : seq<'T>) = - checkNonNull "source" source - match source with - | :? ('T[]) as a -> a.Length - | :? ('T list) as a -> a.Length - | :? ICollection<'T> as a -> a.Count - | _ -> - use e = source.GetEnumerator() - let mutable state = 0 - while e.MoveNext() do - state <- state + 1 - state + ISeq.length (toISeq source) [] - let fold<'T,'State> folder (state:'State) (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(folder) - let mutable state = state - while e.MoveNext() do - state <- f.Invoke(state, e.Current) - state + let fold<'T,'State> f (x:'State) (source : seq<'T>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.fold (fun acc item -> f.Invoke (acc, item)) x (toISeq source) [] - let fold2<'T1,'T2,'State> folder (state:'State) (source1: seq<'T1>) (source2: seq<'T2>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - - use e1 = source1.GetEnumerator() - use e2 = source2.GetEnumerator() - - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt(folder) - - let mutable state = state - while e1.MoveNext() && e2.MoveNext() do - state <- f.Invoke(state, e1.Current, e2.Current) - - state + let fold2<'T1,'T2,'State> f (state:'State) (source1: seq<'T1>) (source2: seq<'T2>) = + let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f + ISeq.fold2 (fun acc item1 item2 -> f.Invoke (acc, item1, item2)) state (source1 |> toISeq1) (source2 |> toISeq2) [] - let reduce reduction (source : seq<'T>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(reduction) - let mutable state = e.Current - while e.MoveNext() do - state <- f.Invoke(state, e.Current) - state + let reduce f (source : seq<'T>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.reduce (fun acc item -> f.Invoke (acc, item)) (toISeq source) let fromGenerator f = mkSeq(fun () -> Generator.EnumerateFromGenerator (f())) let toGenerator (ie : seq<_>) = Generator.GenerateFromEnumerator (ie.GetEnumerator()) [] - let replicate count initial = - System.Linq.Enumerable.Repeat(initial,count) + let replicate count x = + ISeq.replicate count x |> Upcast.enumerable [] let append (source1: seq<'T>) (source2: seq<'T>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - fromGenerator(fun () -> Generator.bindG (toGenerator source1) (fun () -> toGenerator source2)) - + ISeq.append (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable [] let collect mapping source = map mapping source |> concat [] - let compareWith (comparer:'T -> 'T -> int) (source1 : seq<'T>) (source2: seq<'T>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - use e1 = source1.GetEnumerator() - use e2 = source2.GetEnumerator() - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(comparer) - let rec go () = - let e1ok = e1.MoveNext() - let e2ok = e2.MoveNext() - let c = if e1ok = e2ok then 0 else if e1ok then 1 else -1 - if c <> 0 then c else - if not e1ok || not e2ok then 0 - else - let c = f.Invoke(e1.Current, e2.Current) - if c <> 0 then c else - go () - go() + let compareWith (f:'T -> 'T -> int) (source1 : seq<'T>) (source2: seq<'T>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.compareWith (fun a b -> f.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] let ofList (source : 'T list) = - (source :> seq<'T>) + ISeq.ofList source |> Upcast.enumerable [] let toList (source : seq<'T>) = - checkNonNull "source" source - Microsoft.FSharp.Primitives.Basics.List.ofSeq source + ISeq.toList (toISeq source) // Create a new object to ensure underlying array may not be mutated by a backdoor cast [] let ofArray (source : 'T array) = - checkNonNull "source" source - mkSeq (fun () -> IEnumerator.ofArray source) + ISeq.ofArray source |> Upcast.enumerable [] let toArray (source : seq<'T>) = - checkNonNull "source" source - match source with - | :? ('T[]) as res -> (res.Clone() :?> 'T[]) - | :? ('T list) as res -> List.toArray res - | :? ICollection<'T> as res -> - // Directly create an array and copy ourselves. - // This avoids an extra copy if using ResizeArray in fallback below. - let arr = Array.zeroCreateUnchecked res.Count - res.CopyTo(arr, 0) - arr - | _ -> - let res = ResizeArray<_>(source) - res.ToArray() - - let foldArraySubRight (f:OptimizedClosures.FSharpFunc<'T,_,_>) (arr: 'T[]) start fin acc = - let mutable state = acc - for i = fin downto start do - state <- f.Invoke(arr.[i], state) - state + ISeq.toArray (toISeq source) [] - let foldBack<'T,'State> folder (source : seq<'T>) (state:'State) = - checkNonNull "source" source - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(folder) - let arr = toArray source - let len = arr.Length - foldArraySubRight f arr 0 (len - 1) state + let foldBack<'T,'State> f (source : seq<'T>) (x:'State) = + ISeq.foldBack f (toISeq source) x [] - let foldBack2<'T1,'T2,'State> folder (source1 : seq<'T1>) (source2 : seq<'T2>) (state:'State) = - let zipped = zip source1 source2 - foldBack ((<||) folder) zipped state + let foldBack2<'T1,'T2,'State> f (source1 : seq<'T1>) (source2 : seq<'T2>) (x:'State) = + ISeq.foldBack2 f (toISeq1 source1) (toISeq2 source2) x [] - let reduceBack reduction (source : seq<'T>) = - checkNonNull "source" source - let arr = toArray source - match arr.Length with - | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - | len -> - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(reduction) - foldArraySubRight f arr 0 (len - 2) arr.[len - 1] + let reduceBack f (source : seq<'T>) = + ISeq.reduceBack f (toISeq source) [] - let singleton value = mkSeq (fun () -> IEnumerator.Singleton value) - + let singleton x = + ISeq.singleton x |> Upcast.enumerable [] - let truncate count (source: seq<'T>) = - checkNonNull "source" source - seq { let i = ref 0 - use ie = source.GetEnumerator() - while !i < count && ie.MoveNext() do - i := !i + 1 - yield ie.Current } + let truncate n (source: seq<'T>) = + ISeq.truncate n (toISeq source) |> Upcast.enumerable [] let pairwise (source: seq<'T>) = - checkNonNull "source" source - seq { use ie = source.GetEnumerator() - if ie.MoveNext() then - let iref = ref ie.Current - while ie.MoveNext() do - let j = ie.Current - yield (!iref, j) - iref := j } + ISeq.pairwise (toISeq source) |> Upcast.enumerable [] - let scan<'T,'State> folder (state:'State) (source : seq<'T>) = - checkNonNull "source" source - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(folder) - seq { let zref = ref state - yield !zref - use ie = source.GetEnumerator() - while ie.MoveNext() do - zref := f.Invoke(!zref, ie.Current) - yield !zref } + let scan<'T,'State> f (z:'State) (source : seq<'T>) = + ISeq.scan f z (toISeq source) |> Upcast.enumerable [] - let tryFindBack predicate (source : seq<'T>) = - checkNonNull "source" source - source |> toArray |> Array.tryFindBack predicate + let tryFindBack f (source : seq<'T>) = + ISeq.tryFindBack f (toISeq source) [] - let findBack predicate source = - checkNonNull "source" source - source |> toArray |> Array.findBack predicate + let findBack f source = + ISeq.findBack f (toISeq source) [] - let scanBack<'T,'State> folder (source : seq<'T>) (state:'State) = - checkNonNull "source" source - mkDelayedSeq(fun () -> - let arr = source |> toArray - let res = Array.scanSubRight folder arr 0 (arr.Length - 1) state - res :> seq<_>) + let scanBack<'T,'State> f (source : seq<'T>) (acc:'State) = + ISeq.scanBack f (toISeq source) acc |> Upcast.enumerable [] - let findIndex predicate (source:seq<_>) = - checkNonNull "source" source - use ie = source.GetEnumerator() - let rec loop i = - if ie.MoveNext() then - if predicate ie.Current then - i - else loop (i+1) - else - indexNotFound() - loop 0 + let findIndex p (source:seq<_>) = + ISeq.findIndex p (toISeq source) [] - let tryFindIndex predicate (source:seq<_>) = - checkNonNull "source" source - use ie = source.GetEnumerator() - let rec loop i = - if ie.MoveNext() then - if predicate ie.Current then - Some i - else loop (i+1) - else - None - loop 0 + let tryFindIndex p (source:seq<_>) = + ISeq.tryFindIndex p (toISeq source) [] - let tryFindIndexBack predicate (source : seq<'T>) = - checkNonNull "source" source - source |> toArray |> Array.tryFindIndexBack predicate + let tryFindIndexBack f (source : seq<'T>) = + ISeq.tryFindIndexBack f (toISeq source) [] - let findIndexBack predicate source = - checkNonNull "source" source - source |> toArray |> Array.findIndexBack predicate + let findIndexBack f source = + ISeq.findIndexBack f (toISeq source) // windowed : int -> seq<'T> -> seq<'T[]> [] let windowed windowSize (source: seq<_>) = - checkNonNull "source" source - if windowSize <= 0 then invalidArgFmt "windowSize" "{0}\nwindowSize = {1}" - [|SR.GetString SR.inputMustBePositive; windowSize|] - seq { - let arr = Array.zeroCreateUnchecked windowSize - let r = ref (windowSize - 1) - let i = ref 0 - use e = source.GetEnumerator() - while e.MoveNext() do - arr.[!i] <- e.Current - i := (!i + 1) % windowSize - if !r = 0 then - if windowSize < 32 then - yield Array.init windowSize (fun j -> arr.[(!i+j) % windowSize]) - else - let result = Array.zeroCreateUnchecked windowSize - Array.Copy(arr, !i, result, 0, windowSize - !i) - Array.Copy(arr, 0, result, windowSize - !i, !i) - yield result - else r := (!r - 1) - } + ISeq.windowed windowSize (toISeq source) |> Upcast.enumerable [] let cache (source : seq<'T>) = - checkNonNull "source" source - // Wrap a seq to ensure that it is enumerated just once and only as far as is necessary. - // - // This code is required to be thread safe. - // The necessary calls should be called at most once (include .MoveNext() = false). - // The enumerator should be disposed (and dropped) when no longer required. - //------ - // The state is (prefix,enumerator) with invariants: - // * the prefix followed by elts from the enumerator are the initial sequence. - // * the prefix contains only as many elements as the longest enumeration so far. - let prefix = ResizeArray<_>() - let enumeratorR = ref None : IEnumerator<'T> option option ref // nested options rather than new type... - // None = Unstarted. - // Some(Some e) = Started. - // Some None = Finished. - let oneStepTo i = - // If possible, step the enumeration to prefix length i (at most one step). - // Be speculative, since this could have already happened via another thread. - if not (i < prefix.Count) then // is a step still required? - // If not yet started, start it (create enumerator). - match !enumeratorR with - | None -> enumeratorR := Some (Some (source.GetEnumerator())) - | Some _ -> () - match (!enumeratorR).Value with - | Some enumerator -> if enumerator.MoveNext() then - prefix.Add(enumerator.Current) - else - enumerator.Dispose() // Move failed, dispose enumerator, - enumeratorR := Some None // drop it and record finished. - | None -> () - let result = - unfold (fun i -> - // i being the next position to be returned - // A lock is needed over the reads to prefix.Count since the list may be being resized - // NOTE: we could change to a reader/writer lock here - lock enumeratorR (fun () -> - if i < prefix.Count then - Some (prefix.[i],i+1) - else - oneStepTo i - if i < prefix.Count then - Some (prefix.[i],i+1) - else - None)) 0 - let cleanup() = - lock enumeratorR (fun () -> - prefix.Clear() - begin match !enumeratorR with - | Some (Some e) -> IEnumerator.dispose e - | _ -> () - end - enumeratorR := None) - (new CachedSeq<_>(cleanup, result) :> seq<_>) + ISeq.cache (toISeq source) |> Upcast.enumerable [] let allPairs source1 source2 = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - let cached = cache source2 - source1 |> collect (fun x -> cached |> map (fun y -> x,y)) + ISeq.allPairs (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable [] [] @@ -1034,207 +746,82 @@ namespace Microsoft.FSharp.Collections checkNonNull "source" source mkSeq (fun () -> source.GetEnumerator()) - let inline groupByImpl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (seq:seq<'T>) = - checkNonNull "seq" seq - - let dict = Dictionary<_,ResizeArray<_>> comparer - - // Previously this was 1, but I think this is rather stingy, considering that we are already paying - // for at least a key, the ResizeArray reference, which includes an array reference, an Entry in the - // Dictionary, plus any empty space in the Dictionary of unfilled hash buckets. - let minimumBucketSize = 4 - - // Build the groupings - seq |> iter (fun v -> - let safeKey = keyf v - let mutable prev = Unchecked.defaultof<_> - match dict.TryGetValue (safeKey, &prev) with - | true -> prev.Add v - | false -> - let prev = ResizeArray () - dict.[safeKey] <- prev - prev.Add v) - - // Trim the size of each result group, don't trim very small buckets, as excessive work, and garbage for - // minimal gain - dict |> iter (fun group -> if group.Value.Count > minimumBucketSize then group.Value.TrimExcess()) - - // Return the sequence-of-sequences. Don't reveal the - // internal collections: just reveal them as sequences - dict |> map (fun group -> (getKey group.Key, readonly group.Value)) - - // We avoid wrapping a StructBox, because under 64 JIT we get some "hard" tailcalls which affect performance - let groupByValueType (keyf:'T->'Key) (seq:seq<'T>) = seq |> groupByImpl HashIdentity.Structural<'Key> keyf id - - // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let groupByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> groupByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value) - [] - let groupBy (projection:'T->'Key) (source:seq<'T>) = + let groupBy (keyf:'T->'Key) (seq:seq<'T>) = + let grouped = #if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType + if (typeof<'Key>).GetTypeInfo().IsValueType #else - if typeof<'Key>.IsValueType + if typeof<'Key>.IsValueType #endif - then mkDelayedSeq (fun () -> groupByValueType projection source) - else mkDelayedSeq (fun () -> groupByRefType projection source) + then seq |> toISeq |> ISeq.GroupBy.byVal keyf + else seq |> toISeq |> ISeq.GroupBy.byRef keyf + + grouped + |> ISeq.map (fun (key,value) -> key, Upcast.enumerable value) + |> Upcast.enumerable [] let distinct source = - checkNonNull "source" source - seq { let hashSet = HashSet<'T>(HashIdentity.Structural<'T>) - for v in source do - if hashSet.Add(v) then - yield v } + ISeq.distinct (toISeq source) |> Upcast.enumerable [] - let distinctBy projection source = - checkNonNull "source" source - seq { let hashSet = HashSet<_>(HashIdentity.Structural<_>) - for v in source do - if hashSet.Add(projection v) then - yield v } + let distinctBy keyf source = + ISeq.distinctBy keyf (toISeq source) |> Upcast.enumerable [] - let sortBy projection source = - checkNonNull "source" source - mkDelayedSeq (fun () -> - let array = source |> toArray - Array.stableSortInPlaceBy projection array - array :> seq<_>) + let sortBy keyf source = + ISeq.sortBy keyf (toISeq source) |> Upcast.enumerable [] let sort source = - checkNonNull "source" source - mkDelayedSeq (fun () -> - let array = source |> toArray - Array.stableSortInPlace array - array :> seq<_>) + ISeq.sort (toISeq source) |> Upcast.enumerable [] - let sortWith comparer source = - checkNonNull "source" source - mkDelayedSeq (fun () -> - let array = source |> toArray - Array.stableSortInPlaceWith comparer array - array :> seq<_>) + let sortWith f source = + ISeq.sortWith f (toISeq source) |> Upcast.enumerable [] - let inline sortByDescending projection source = - checkNonNull "source" source - let inline compareDescending a b = compare (projection b) (projection a) - sortWith compareDescending source + let inline sortByDescending keyf source = + ISeq.sortByDescending keyf (toISeq source) |> Upcast.enumerable [] let inline sortDescending source = - checkNonNull "source" source - let inline compareDescending a b = compare b a - sortWith compareDescending source - - let inline countByImpl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:seq<'T>) = - checkNonNull "source" source - - let dict = Dictionary comparer - - // Build the groupings - source |> iter (fun v -> - let safeKey = keyf v - let mutable prev = Unchecked.defaultof<_> - if dict.TryGetValue(safeKey, &prev) - then dict.[safeKey] <- prev + 1 - else dict.[safeKey] <- 1) - - dict |> map (fun group -> (getKey group.Key, group.Value)) - - // We avoid wrapping a StructBox, because under 64 JIT we get some "hard" tailcalls which affect performance - let countByValueType (keyf:'T->'Key) (seq:seq<'T>) = seq |> countByImpl HashIdentity.Structural<'Key> keyf id - - // Wrap a StructBox around all keys in case the key type is itself a type using null as a representation - let countByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> countByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value) + ISeq.sortDescending (toISeq source) |> Upcast.enumerable [] - let countBy (projection:'T->'Key) (source:seq<'T>) = - checkNonNull "source" source - + let countBy (keyf:'T->'Key) (source:seq<'T>) = #if FX_RESHAPED_REFLECTION if (typeof<'Key>).GetTypeInfo().IsValueType #else if typeof<'Key>.IsValueType #endif - then mkDelayedSeq (fun () -> countByValueType projection source) - else mkDelayedSeq (fun () -> countByRefType projection source) + then ISeq.CountBy.byVal keyf (toISeq source) |> Upcast.enumerable + else ISeq.CountBy.byRef keyf (toISeq source) |> Upcast.enumerable [] let inline sum (source: seq< ^a>) : ^a = - use e = source.GetEnumerator() - let mutable acc = LanguagePrimitives.GenericZero< ^a> - while e.MoveNext() do - acc <- Checked.(+) acc e.Current - acc + ISeq.sum (toISeq source) [] - let inline sumBy (projection : 'T -> ^U) (source: seq<'T>) : ^U = - use e = source.GetEnumerator() - let mutable acc = LanguagePrimitives.GenericZero< ^U> - while e.MoveNext() do - acc <- Checked.(+) acc (projection e.Current) - acc + let inline sumBy (f : 'T -> ^U) (source: seq<'T>) : ^U = + ISeq.sumBy f (toISeq source) [] let inline average (source: seq< ^a>) : ^a = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable acc = LanguagePrimitives.GenericZero< ^a> - let mutable count = 0 - while e.MoveNext() do - acc <- Checked.(+) acc e.Current - count <- count + 1 - if count = 0 then - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - LanguagePrimitives.DivideByInt< ^a> acc count + ISeq.average (toISeq source) [] - let inline averageBy (projection : 'T -> ^U) (source: seq< 'T >) : ^U = - checkNonNull "source" source - use e = source.GetEnumerator() - let mutable acc = LanguagePrimitives.GenericZero< ^U> - let mutable count = 0 - while e.MoveNext() do - acc <- Checked.(+) acc (projection e.Current) - count <- count + 1 - if count = 0 then - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - LanguagePrimitives.DivideByInt< ^U> acc count + let inline averageBy (f : 'T -> ^U) (source: seq< 'T >) : ^U = + ISeq.averageBy f (toISeq source) [] let inline min (source: seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - let mutable acc = e.Current - while e.MoveNext() do - let curr = e.Current - if curr < acc then - acc <- curr - acc + ISeq.min (toISeq source) [] - let inline minBy (projection : 'T -> 'U) (source: seq<'T>) : 'T = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - let first = e.Current - let mutable acc = projection first - let mutable accv = first - while e.MoveNext() do - let currv = e.Current - let curr = projection currv - if curr < acc then - acc <- curr - accv <- currv - accv + let inline minBy (f : 'T -> 'U) (source: seq<'T>) : 'T = + ISeq.minBy f (toISeq source) (* [] @@ -1255,33 +842,11 @@ namespace Microsoft.FSharp.Collections *) [] let inline max (source: seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - let mutable acc = e.Current - while e.MoveNext() do - let curr = e.Current - if curr > acc then - acc <- curr - acc + ISeq.max (toISeq source) [] - let inline maxBy (projection : 'T -> 'U) (source: seq<'T>) : 'T = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - let first = e.Current - let mutable acc = projection first - let mutable accv = first - while e.MoveNext() do - let currv = e.Current - let curr = projection currv - if curr > acc then - acc <- curr - accv <- currv - accv + let inline maxBy (f : 'T -> 'U) (source: seq<'T>) : 'T = + ISeq.maxBy f (toISeq source) (* @@ -1302,183 +867,75 @@ namespace Microsoft.FSharp.Collections *) [] - let takeWhile predicate (source: seq<_>) = - checkNonNull "source" source - seq { use e = source.GetEnumerator() - let latest = ref Unchecked.defaultof<_> - while e.MoveNext() && (latest := e.Current; predicate !latest) do - yield !latest } + let takeWhile p (source: seq<_>) = + ISeq.takeWhile p (toISeq source) |> Upcast.enumerable [] let skip count (source: seq<_>) = - checkNonNull "source" source - seq { use e = source.GetEnumerator() - for x in 1 .. count do - if not (e.MoveNext()) then - invalidOpFmt "tried to skip {0} {1} past the end of the seq" - [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] - while e.MoveNext() do - yield e.Current } + ISeq.skip count (toISeq source) |> Upcast.enumerable [] - let skipWhile predicate (source: seq<_>) = - checkNonNull "source" source - seq { use e = source.GetEnumerator() - let latest = ref (Unchecked.defaultof<_>) - let ok = ref false - while e.MoveNext() do - if (latest := e.Current; (!ok || not (predicate !latest))) then - ok := true - yield !latest } + let skipWhile p (source: seq<_>) = + ISeq.skipWhile p (toISeq source) |> Upcast.enumerable [] - let forall2 predicate (source1: seq<_>) (source2: seq<_>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - use e1 = source1.GetEnumerator() - use e2 = source2.GetEnumerator() - let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(predicate) - let mutable ok = true - while (ok && e1.MoveNext() && e2.MoveNext()) do - ok <- p.Invoke(e1.Current, e2.Current) - ok + let forall2 p (source1: seq<_>) (source2: seq<_>) = + let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt p + ISeq.forall2 (fun a b -> p.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] - let exists2 predicate (source1: seq<_>) (source2: seq<_>) = - checkNonNull "source1" source1 - checkNonNull "source2" source2 - use e1 = source1.GetEnumerator() - use e2 = source2.GetEnumerator() - let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(predicate) - let mutable ok = false - while (not ok && e1.MoveNext() && e2.MoveNext()) do - ok <- p.Invoke(e1.Current, e2.Current) - ok + let exists2 p (source1: seq<_>) (source2: seq<_>) = + let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt p + ISeq.exists2 (fun a b -> p.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] let head (source : seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if (e.MoveNext()) then e.Current - else invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + ISeq.head (toISeq source) [] let tryHead (source : seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if (e.MoveNext()) then Some e.Current - else None + ISeq.tryHead (toISeq source) [] let tail (source: seq<'T>) = - checkNonNull "source" source - seq { use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" (SR.GetString(SR.notEnoughElements)) - while e.MoveNext() do - yield e.Current } + ISeq.tail (toISeq source) |> Upcast.enumerable [] let last (source : seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if e.MoveNext() then - let mutable res = e.Current - while (e.MoveNext()) do res <- e.Current - res - else - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + ISeq.last (toISeq source) [] let tryLast (source : seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if e.MoveNext() then - let mutable res = e.Current - while (e.MoveNext()) do res <- e.Current - Some res - else - None + ISeq.tryLast (toISeq source) [] let exactlyOne (source : seq<_>) = - checkNonNull "source" source - use e = source.GetEnumerator() - if e.MoveNext() then - let v = e.Current - if e.MoveNext() then - invalidArg "source" (SR.GetString(SR.inputSequenceTooLong)) - else - v - else - invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString + ISeq.exactlyOne (toISeq source) [] let rev source = - checkNonNull "source" source - mkDelayedSeq (fun () -> - let array = source |> toArray - Array.Reverse array - array :> seq<_>) + ISeq.rev (toISeq source) |> Upcast.enumerable [] - let permute indexMap (source : seq<_>) = - checkNonNull "source" source - mkDelayedSeq (fun () -> - source |> toArray |> Array.permute indexMap :> seq<_>) + let permute f (source : seq<_>) = + ISeq.permute f (toISeq source) |> Upcast.enumerable [] - let mapFold<'T,'State,'Result> (mapping: 'State -> 'T -> 'Result * 'State) state source = - checkNonNull "source" source - let arr,state = source |> toArray |> Array.mapFold mapping state - readonly arr, state + let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = + ISeq.mapFold f acc (toISeq source) |> fun (iseq, state) -> Upcast.enumerable iseq, state [] - let mapFoldBack<'T,'State,'Result> (mapping: 'T -> 'State -> 'Result * 'State) source state = - checkNonNull "source" source - let array = source |> toArray - let arr,state = Array.mapFoldBack mapping array state - readonly arr, state + let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = + ISeq.mapFoldBack f (toISeq source) acc |> fun (iseq, state) -> Upcast.enumerable iseq, state [] let except (itemsToExclude: seq<'T>) (source: seq<'T>) = - checkNonNull "itemsToExclude" itemsToExclude - checkNonNull "source" source - - seq { - use e = source.GetEnumerator() - if e.MoveNext() then - let cached = HashSet(itemsToExclude, HashIdentity.Structural) - let next = e.Current - if (cached.Add next) then yield next - while e.MoveNext() do - let next = e.Current - if (cached.Add next) then yield next } + ISeq.except itemsToExclude (toISeq source) |> Upcast.enumerable [] let chunkBySize chunkSize (source : seq<_>) = - checkNonNull "source" source - if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" - [|SR.GetString SR.inputMustBePositive; chunkSize|] - seq { use e = source.GetEnumerator() - let nextChunk() = - let res = Array.zeroCreateUnchecked chunkSize - res.[0] <- e.Current - let i = ref 1 - while !i < chunkSize && e.MoveNext() do - res.[!i] <- e.Current - i := !i + 1 - if !i = chunkSize then - res - else - res |> Array.subUnchecked 0 !i - while e.MoveNext() do - yield nextChunk() } + ISeq.chunkBySize chunkSize (toISeq source) |> Upcast.enumerable [] let splitInto count source = - checkNonNull "source" source - if count <= 0 then invalidArgFmt "count" "{0}\ncount = {1}" - [|SR.GetString SR.inputMustBePositive; count|] - mkDelayedSeq (fun () -> - source |> toArray |> Array.splitInto count :> seq<_>) + ISeq.splitInto count (toISeq source) |> Upcast.enumerable From 003e83de60bbc28159da35e3f64aa26ec31cc818 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 18:35:48 +1000 Subject: [PATCH 086/120] fix tailcalls.NoNeedToTailcall.output.test.bsl --- .../analyses/tailcalls.NoNeedToTailcall.output.test.bsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl b/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl index 5f4e677efc6..8df7fccda60 100644 --- a/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl +++ b/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl @@ -39,9 +39,9 @@ value simpleLibraryCall7 at line 61 does not make a critical tailcall value simpleLibraryCall8 at line 62 does not make a critical tailcall value simpleLibraryCall9 at line 63 does not make a critical tailcall value simpleLibraryCall10 at line 65 does not make a critical tailcall -value simpleLibraryCall11 at line 66 does not make a critical tailcall -value simpleLibraryCall12 at line 67 does not make a critical tailcall -value simpleLibraryCall13 at line 68 does not make a critical tailcall +value simpleLibraryCall11 at line 66 may make a critical tailcall +value simpleLibraryCall12 at line 67 may make a critical tailcall +value simpleLibraryCall13 at line 68 may make a critical tailcall value simpleLibraryUse14 at line 69 does not make a critical tailcall value simpleLibraryUse15 at line 70 does not make a critical tailcall value simpleLibraryUse16 at line 71 does not make a critical tailcall From 6911fe9ea64137436b7f028c7319eec6dfa5de85 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 18:36:13 +1000 Subject: [PATCH 087/120] Fixed for new namespace --- src/fsharp/FSharp.Core/seq.fs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 11acbaa5611..023418c4bf5 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -446,6 +446,7 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Control open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics + open Microsoft.FSharp.Collections.SeqComposition [] [] @@ -459,11 +460,11 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.IEnumerator // these helpers are just to consolidate the null checking - let inline toISeq (source:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source" source; ISeq.ofSeq source - let inline toISeq1 (source1:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source1" source1; ISeq.ofSeq source1 - let inline toISeq2 (source2:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source2" source2; ISeq.ofSeq source2 - let inline toISeq3 (source3:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "source3" source3; ISeq.ofSeq source3 - let inline toISeqs (sources:seq<'T>) : ISeq.Core.ISeq<'T> = checkNonNull "sources" sources; ISeq.ofSeq sources + let inline toISeq (source:seq<'T>) : ISeq<'T> = checkNonNull "source" source; ISeq.ofSeq source + let inline toISeq1 (source1:seq<'T>) : ISeq<'T> = checkNonNull "source1" source1; ISeq.ofSeq source1 + let inline toISeq2 (source2:seq<'T>) : ISeq<'T> = checkNonNull "source2" source2; ISeq.ofSeq source2 + let inline toISeq3 (source3:seq<'T>) : ISeq<'T> = checkNonNull "source3" source3; ISeq.ofSeq source3 + let inline toISeqs (sources:seq<'T>) : ISeq<'T> = checkNonNull "sources" sources; ISeq.ofSeq sources let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) let mkUnfoldSeq f x = mkSeq (fun () -> IEnumerator.unfold f x) From aaf8ffb755f534eb6d0b7d568bdd6d6e27f5a39a Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 19:02:10 +1000 Subject: [PATCH 088/120] restored error-on-delay functionality groupBy --- src/fsharp/FSharp.Core/seq.fs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 023418c4bf5..21420e88a61 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -749,18 +749,19 @@ namespace Microsoft.FSharp.Collections [] let groupBy (keyf:'T->'Key) (seq:seq<'T>) = - let grouped = + delay (fun () -> + let grouped = #if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType + if (typeof<'Key>).GetTypeInfo().IsValueType #else - if typeof<'Key>.IsValueType + if typeof<'Key>.IsValueType #endif - then seq |> toISeq |> ISeq.GroupBy.byVal keyf - else seq |> toISeq |> ISeq.GroupBy.byRef keyf + then seq |> toISeq |> ISeq.GroupBy.byVal keyf + else seq |> toISeq |> ISeq.GroupBy.byRef keyf - grouped - |> ISeq.map (fun (key,value) -> key, Upcast.enumerable value) - |> Upcast.enumerable + grouped + |> ISeq.map (fun (key,value) -> key, Upcast.enumerable value) + |> Upcast.enumerable) [] let distinct source = From 451b5d540f0897f5f8004f973e2ff3de0c4e0ec7 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 19:02:35 +1000 Subject: [PATCH 089/120] Modified test; previous equality check was dubious --- .../Conformance/Expressions/SyntacticSugar/Slices04.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/SyntacticSugar/Slices04.fs b/tests/fsharpqa/Source/Conformance/Expressions/SyntacticSugar/Slices04.fs index 061912d8962..1aed204e3d8 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/SyntacticSugar/Slices04.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/SyntacticSugar/Slices04.fs @@ -148,18 +148,18 @@ if f.LastLB2 <> None then exit 1 if f.LastUB2 <> None then exit 1 let _ = f.[['a'; 'b'], *] -if f.LastI1 <> Seq.ofList ['a'; 'b'] then exit 1 +if Seq.toList f.LastI1 <> ['a'; 'b'] then exit 1 if f.LastLB2 <> None then exit 1 if f.LastUB2 <> None then exit 1 f.[['t'; 'g'], *] <- [['f']] -if f.LastI1 <> Seq.ofList ['t'; 'g'] then exit 1 +if Seq.toList f.LastI1 <> ['t'; 'g'] then exit 1 if f.LastLB2 <> None then exit 1 if f.LastUB2 <> None then exit 1 if f.LastV2D <> [['f']] then exit 1 let _ = f.[*, ['c'; 'd']] -if f.LastI2 <> Seq.ofList ['c'; 'd'] then exit 1 +if Seq.toList f.LastI2 <> ['c'; 'd'] then exit 1 if f.LastLB1 <> None then exit 1 if f.LastUB1 <> None then exit 1 From 0d588363936c7ff5ec9c5576b1cf90816635ee1b Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 19:02:49 +1000 Subject: [PATCH 090/120] Deleted unused code from seq.fs --- src/fsharp/FSharp.Core/seq.fs | 450 +--------------------------------- 1 file changed, 1 insertion(+), 449 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 21420e88a61..a52c51ba02b 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -22,11 +22,6 @@ namespace Microsoft.FSharp.Collections module IEnumerator = open Microsoft.FSharp.Collections.IEnumerator - let rec tryItem index (e : IEnumerator<'T>) = - if not (e.MoveNext()) then None - elif index = 0 then Some(e.Current) - else tryItem (index-1) e - let rec nth index (e : IEnumerator<'T>) = if not (e.MoveNext()) then let shortBy = index + 1 @@ -36,404 +31,7 @@ namespace Microsoft.FSharp.Collections if index = 0 then e.Current else nth (index-1) e - [] - type MapEnumeratorState = - | NotStarted - | InProcess - | Finished - - [] - type MapEnumerator<'T> () = - let mutable state = NotStarted - [] - val mutable private curr : 'T - - member this.GetCurrent () = - match state with - | NotStarted -> notStarted() - | Finished -> alreadyFinished() - | InProcess -> () - this.curr - - abstract DoMoveNext : byref<'T> -> bool - abstract Dispose : unit -> unit - - interface IEnumerator<'T> with - member this.Current = this.GetCurrent() - - interface IEnumerator with - member this.Current = box(this.GetCurrent()) - member this.MoveNext () = - state <- InProcess - if this.DoMoveNext(&this.curr) then - true - else - state <- Finished - false - member this.Reset() = noReset() - interface System.IDisposable with - member this.Dispose() = this.Dispose() - - let map f (e : IEnumerator<_>) : IEnumerator<_>= - upcast - { new MapEnumerator<_>() with - member this.DoMoveNext (curr : byref<_>) = - if e.MoveNext() then - curr <- (f e.Current) - true - else - false - member this.Dispose() = e.Dispose() - } - - let mapi f (e : IEnumerator<_>) : IEnumerator<_> = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f) - let i = ref (-1) - upcast - { new MapEnumerator<_>() with - member this.DoMoveNext curr = - i := !i + 1 - if e.MoveNext() then - curr <- f.Invoke(!i, e.Current) - true - else - false - member this.Dispose() = e.Dispose() - } - - let map2 f (e1 : IEnumerator<_>) (e2 : IEnumerator<_>) : IEnumerator<_>= - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f) - upcast - { new MapEnumerator<_>() with - member this.DoMoveNext curr = - let n1 = e1.MoveNext() - let n2 = e2.MoveNext() - if n1 && n2 then - curr <- f.Invoke(e1.Current, e2.Current) - true - else - false - member this.Dispose() = - try - e1.Dispose() - finally - e2.Dispose() - } - - let mapi2 f (e1 : IEnumerator<_>) (e2 : IEnumerator<_>) : IEnumerator<_> = - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt(f) - let i = ref (-1) - upcast - { new MapEnumerator<_>() with - member this.DoMoveNext curr = - i := !i + 1 - if (e1.MoveNext() && e2.MoveNext()) then - curr <- f.Invoke(!i, e1.Current, e2.Current) - true - else - false - member this.Dispose() = - try - e1.Dispose() - finally - e2.Dispose() - } - - let map3 f (e1 : IEnumerator<_>) (e2 : IEnumerator<_>) (e3 : IEnumerator<_>) : IEnumerator<_> = - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt(f) - upcast - { new MapEnumerator<_>() with - member this.DoMoveNext curr = - let n1 = e1.MoveNext() - let n2 = e2.MoveNext() - let n3 = e3.MoveNext() - - if n1 && n2 && n3 then - curr <- f.Invoke(e1.Current, e2.Current, e3.Current) - true - else - false - member this.Dispose() = - try - e1.Dispose() - finally - try - e2.Dispose() - finally - e3.Dispose() - } - - let choose f (e : IEnumerator<'T>) = - let started = ref false - let curr = ref None - let get() = check !started; (match !curr with None -> alreadyFinished() | Some x -> x) - { new IEnumerator<'U> with - member x.Current = get() - interface IEnumerator with - member x.Current = box (get()) - member x.MoveNext() = - if not !started then started := true - curr := None - while ((!curr).IsNone && e.MoveNext()) do - curr := f e.Current - Option.isSome !curr - member x.Reset() = noReset() - interface System.IDisposable with - member x.Dispose() = e.Dispose() } - - let filter f (e : IEnumerator<'T>) = - let started = ref false - let this = - { new IEnumerator<'T> with - member x.Current = check !started; e.Current - interface IEnumerator with - member x.Current = check !started; box e.Current - member x.MoveNext() = - let rec next() = - if not !started then started := true - e.MoveNext() && (f e.Current || next()) - next() - member x.Reset() = noReset() - interface System.IDisposable with - member x.Dispose() = e.Dispose() } - this - - let unfold f x : IEnumerator<_> = - let state = ref x - upcast - { new MapEnumerator<_>() with - member this.DoMoveNext curr = - match f !state with - | None -> false - | Some(r,s) -> - curr <- r - state := s - true - member this.Dispose() = () - } - - let upto lastOption f = - match lastOption with - | Some b when b<0 -> Empty() // a request for -ve length returns empty sequence - | _ -> - let unstarted = -1 // index value means unstarted (and no valid index) - let completed = -2 // index value means completed (and no valid index) - let unreachable = -3 // index is unreachable from 0,1,2,3,... - let finalIndex = match lastOption with - | Some b -> b // here b>=0, a valid end value. - | None -> unreachable // run "forever", well as far as Int32.MaxValue since indexing with a bounded type. - // The Current value for a valid index is "f i". - // Lazy<_> values are used as caches, to store either the result or an exception if thrown. - // These "Lazy<_>" caches are created only on the first call to current and forced immediately. - // The lazy creation of the cache nodes means enumerations that skip many Current values are not delayed by GC. - // For example, the full enumeration of Seq.initInfinite in the tests. - // state - let index = ref unstarted - // a Lazy node to cache the result/exception - let current = ref (Unchecked.defaultof<_>) - let setIndex i = index := i; current := (Unchecked.defaultof<_>) // cache node unprimed, initialised on demand. - let getCurrent() = - if !index = unstarted then notStarted() - if !index = completed then alreadyFinished() - match box !current with - | null -> current := Lazy<_>.Create(fun () -> f !index) - | _ -> () - // forced or re-forced immediately. - (!current).Force() - { new IEnumerator<'U> with - member x.Current = getCurrent() - interface IEnumerator with - member x.Current = box (getCurrent()) - member x.MoveNext() = - if !index = completed then - false - elif !index = unstarted then - setIndex 0 - true - else ( - if !index = System.Int32.MaxValue then raise <| System.InvalidOperationException (SR.GetString(SR.enumerationPastIntMaxValue)) - if !index = finalIndex then - false - else - setIndex (!index + 1) - true - ) - member self.Reset() = noReset() - interface System.IDisposable with - member x.Dispose() = () } - - [] - type ArrayEnumerator<'T>(arr: 'T array) = - let mutable curr = -1 - let mutable len = arr.Length - member x.Get() = - if curr >= 0 then - if curr >= len then alreadyFinished() - else arr.[curr] - else - notStarted() - interface IEnumerator<'T> with - member x.Current = x.Get() - interface System.Collections.IEnumerator with - member x.MoveNext() = - if curr >= len then false - else - curr <- curr + 1 - (curr < len) - member x.Current = box(x.Get()) - member x.Reset() = noReset() - interface System.IDisposable with - member x.Dispose() = () - - let ofArray arr = (new ArrayEnumerator<'T>(arr) :> IEnumerator<'T>) - - // Use generators for some implementations of IEnumerables. - // - module Generator = - - open System.Collections - open System.Collections.Generic - - [] - type Step<'T> = - | Stop - | Yield of 'T - | Goto of Generator<'T> - - and Generator<'T> = - abstract Apply: (unit -> Step<'T>) - abstract Disposer: (unit -> unit) option - - let disposeG (g:Generator<'T>) = - match g.Disposer with - | None -> () - | Some f -> f() - - let appG (g:Generator<_>) = - //System.Console.WriteLine("{0}.appG", box g) - let res = g.Apply() - match res with - | Goto(next) -> - Goto(next) - | Yield _ -> - res - | Stop -> - //System.Console.WriteLine("appG: Stop") - disposeG g - res - - // Binding. - // - // We use a type definition to apply a local dynamic optimization. - // We automatically right-associate binding, i.e. push the continuations to the right. - // That is, bindG (bindG G1 cont1) cont2 --> bindG G1 (cont1 o cont2) - // This makes constructs such as the following linear rather than quadratic: - // - // let rec rwalk n = { if n > 0 then - // yield! rwalk (n-1) - // yield n } - - type GenerateThen<'T>(g:Generator<'T>, cont : unit -> Generator<'T>) = - member self.Generator = g - member self.Cont = cont - interface Generator<'T> with - member x.Apply = (fun () -> - match appG g with - | Stop -> - // OK, move onto the generator given by the continuation - Goto(cont()) - - | Yield _ as res -> - res - - | Goto next -> - Goto(GenerateThen<_>.Bind(next,cont))) - member x.Disposer = - g.Disposer - - - static member Bind (g:Generator<'T>, cont) = - match g with - | :? GenerateThen<'T> as g -> GenerateThen<_>.Bind(g.Generator,(fun () -> GenerateThen<_>.Bind (g.Cont(), cont))) - | g -> (new GenerateThen<'T>(g, cont) :> Generator<'T>) - - - let bindG g cont = GenerateThen<_>.Bind(g,cont) - - - // Internal type. Drive an underlying generator. Crucially when the generator returns - // a new generator we simply update our current generator and continue. Thus the enumerator - // effectively acts as a reference cell holding the current generator. This means that - // infinite or large generation chains (e.g. caused by long sequences of append's, including - // possible delay loops) can be referenced via a single enumerator. - // - // A classic case where this arises in this sort of sequence expression: - // let rec data s = { yield s; - // yield! data (s + random()) } - // - // This translates to - // let rec data s = Seq.delay (fun () -> Seq.append (Seq.singleton s) (Seq.delay (fun () -> data (s+random())))) - // - // When you unwind through all the Seq, IEnumerator and Generator objects created, - // you get (data s).GetEnumerator being an "GenerateFromEnumerator(EnumeratorWrappingLazyGenerator(...))" for the append. - // After one element is yielded, we move on to the generator for the inner delay, which in turn - // comes back to be a "GenerateFromEnumerator(EnumeratorWrappingLazyGenerator(...))". - // - // Defined as a type so we can optimize Enumerator/Generator chains in enumerateFromLazyGenerator - // and GenerateFromEnumerator. - - [] - type EnumeratorWrappingLazyGenerator<'T>(g:Generator<'T>) = - let mutable g = g - let mutable curr = None - let mutable finished = false - member e.Generator = g - interface IEnumerator<'T> with - member x.Current= match curr with Some(v) -> v | None -> raise <| System.InvalidOperationException (SR.GetString(SR.moveNextNotCalledOrFinished)) - interface System.Collections.IEnumerator with - member x.Current = box (x :> IEnumerator<_>).Current - member x.MoveNext() = - not finished && - (match appG g with - | Stop -> - curr <- None - finished <- true - false - | Yield(v) -> - curr <- Some(v) - true - | Goto(next) -> - (g <- next) - (x :> IEnumerator).MoveNext()) - member x.Reset() = IEnumerator.noReset() - interface System.IDisposable with - member x.Dispose() = - if not finished then disposeG g - - // Internal type, used to optimize Enumerator/Generator chains - type LazyGeneratorWrappingEnumerator<'T>(e:IEnumerator<'T>) = - member g.Enumerator = e - interface Generator<'T> with - member g.Apply = (fun () -> - if e.MoveNext() then - Yield(e.Current) - else - Stop) - member g.Disposer= Some(e.Dispose) - - let EnumerateFromGenerator(g:Generator<'T>) = - match g with - | :? LazyGeneratorWrappingEnumerator<'T> as g -> g.Enumerator - | _ -> (new EnumeratorWrappingLazyGenerator<'T>(g) :> IEnumerator<'T>) - - let GenerateFromEnumerator (e:IEnumerator<'T>) = - match e with - | :? EnumeratorWrappingLazyGenerator<'T> as e -> e.Generator - | _ -> (new LazyGeneratorWrappingEnumerator<'T>(e) :> Generator<'T>) - - namespace Microsoft.FSharp.Collections - open System open System.Diagnostics open System.Collections @@ -451,11 +49,6 @@ namespace Microsoft.FSharp.Collections [] [] module Seq = -#if FX_NO_ICLONEABLE - open Microsoft.FSharp.Core.ICloneableExtensions -#else -#endif - open Microsoft.FSharp.Collections.Internal open Microsoft.FSharp.Collections.IEnumerator @@ -467,8 +60,6 @@ namespace Microsoft.FSharp.Collections let inline toISeqs (sources:seq<'T>) : ISeq<'T> = checkNonNull "sources" sources; ISeq.ofSeq sources let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) - let mkUnfoldSeq f x = mkSeq (fun () -> IEnumerator.unfold f x) - let inline indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) [] let delay generator = mkDelayedSeq generator @@ -636,9 +227,6 @@ namespace Microsoft.FSharp.Collections let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f ISeq.reduce (fun acc item -> f.Invoke (acc, item)) (toISeq source) - let fromGenerator f = mkSeq(fun () -> Generator.EnumerateFromGenerator (f())) - let toGenerator (ie : seq<_>) = Generator.GenerateFromEnumerator (ie.GetEnumerator()) - [] let replicate count x = ISeq.replicate count x |> Upcast.enumerable @@ -663,7 +251,6 @@ namespace Microsoft.FSharp.Collections let toList (source : seq<'T>) = ISeq.toList (toISeq source) - // Create a new object to ensure underlying array may not be mutated by a backdoor cast [] let ofArray (source : 'T array) = ISeq.ofArray source |> Upcast.enumerable @@ -825,23 +412,6 @@ namespace Microsoft.FSharp.Collections let inline minBy (f : 'T -> 'U) (source: seq<'T>) : 'T = ISeq.minBy f (toISeq source) -(* - [] - let inline minValBy (f : 'T -> 'U) (source: seq<'T>) : 'U = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" InputSequenceEmptyString - let first = e.Current - let mutable acc = f first - while e.MoveNext() do - let currv = e.Current - let curr = f currv - if curr < acc then - acc <- curr - acc - -*) [] let inline max (source: seq<_>) = ISeq.max (toISeq source) @@ -850,24 +420,6 @@ namespace Microsoft.FSharp.Collections let inline maxBy (f : 'T -> 'U) (source: seq<'T>) : 'T = ISeq.maxBy f (toISeq source) - -(* - [] - let inline maxValBy (f : 'T -> 'U) (source: seq<'T>) : 'U = - checkNonNull "source" source - use e = source.GetEnumerator() - if not (e.MoveNext()) then - invalidArg "source" InputSequenceEmptyString - let first = e.Current - let mutable acc = f first - while e.MoveNext() do - let currv = e.Current - let curr = f currv - if curr > acc then - acc <- curr - acc - -*) [] let takeWhile p (source: seq<_>) = ISeq.takeWhile p (toISeq source) |> Upcast.enumerable @@ -940,4 +492,4 @@ namespace Microsoft.FSharp.Collections [] let splitInto count source = - ISeq.splitInto count (toISeq source) |> Upcast.enumerable + ISeq.splitInto count (toISeq source) |> Upcast.enumerable \ No newline at end of file From 5f5d8b24ddfdff1ade537749c2a4824f023be00d Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 19:03:06 +1000 Subject: [PATCH 091/120] Removed Upcast hack due to #2972 --- src/fsharp/FSharp.Core/seq.fs | 105 ++++++++++++++++------------------ 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index a52c51ba02b..6fc3751a0d4 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -13,11 +13,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Control open Microsoft.FSharp.Collections - module Upcast = - // The f# compiler outputs unnecessary unbox.any calls in upcasts. If this functionality - // is fixed with the compiler then these functions can be removed. - let inline enumerable (t:#IEnumerable<'T>) : IEnumerable<'T> = (# "" t : IEnumerable<'T> #) - module Internal = module IEnumerator = open Microsoft.FSharp.Collections.IEnumerator @@ -66,18 +61,18 @@ namespace Microsoft.FSharp.Collections [] let unfold f x = - ISeq.unfold f x |> Upcast.enumerable + ISeq.unfold f x :> seq<_> [] let empty<'T> = (EmptyEnumerable :> seq<'T>) [] let initInfinite f = - ISeq.initInfinite f |> Upcast.enumerable + ISeq.initInfinite f :> seq<_> [] let init count f = - ISeq.init count f |> Upcast.enumerable + ISeq.init count f :> seq<_> [] let iter f (source : seq<'T>) = @@ -126,52 +121,52 @@ namespace Microsoft.FSharp.Collections [] let filter f source = - ISeq.filter f (toISeq source) |> Upcast.enumerable + ISeq.filter f (toISeq source) :> seq<_> [] let where predicate source = filter predicate source [] let map f source = - ISeq.map f (toISeq source) |> Upcast.enumerable + ISeq.map f (toISeq source) :> seq<_> [] let mapi f source = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f - ISeq.mapi (fun idx a ->f.Invoke(idx,a)) (toISeq source) |> Upcast.enumerable + ISeq.mapi (fun idx a ->f.Invoke(idx,a)) (toISeq source) :> seq<_> [] let mapi2 f source1 source2 = let f = OptimizedClosures.FSharpFunc.Adapt f - ISeq.mapi2 (fun idx a b -> f.Invoke (idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable + ISeq.mapi2 (fun idx a b -> f.Invoke (idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] let map2 f source1 source2 = - ISeq.map2 f (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable + ISeq.map2 f (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] let map3 f source1 source2 source3 = - ISeq.map3 f (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) |> Upcast.enumerable + ISeq.map3 f (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> [] let choose f source = - ISeq.choose f (toISeq source) |> Upcast.enumerable + ISeq.choose f (toISeq source) :> seq<_> [] let indexed source = - ISeq.indexed (toISeq source) |> Upcast.enumerable + ISeq.indexed (toISeq source) :> seq<_> [] let zip source1 source2 = - ISeq.zip (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable + ISeq.zip (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] let zip3 source1 source2 source3 = - ISeq.zip3 (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) |> Upcast.enumerable + ISeq.zip3 (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> [] let cast (source: IEnumerable) = - source |> ISeq.cast |> Upcast.enumerable + source |> ISeq.cast :> seq<_> [] let tryPick f (source : seq<'T>) = @@ -191,7 +186,7 @@ namespace Microsoft.FSharp.Collections [] let take count (source : seq<'T>) = - ISeq.take count (toISeq source) |> Upcast.enumerable + ISeq.take count (toISeq source) :> seq<_> [] let isEmpty (source : seq<'T>) = @@ -206,7 +201,7 @@ namespace Microsoft.FSharp.Collections [] let concat sources = - sources |> toISeqs |> ISeq.map toISeq |> ISeq.concat |> Upcast.enumerable + sources |> toISeqs |> ISeq.map toISeq |> ISeq.concat :> seq<_> [] let length (source : seq<'T>) = @@ -229,11 +224,11 @@ namespace Microsoft.FSharp.Collections [] let replicate count x = - ISeq.replicate count x |> Upcast.enumerable + ISeq.replicate count x :> seq<_> [] let append (source1: seq<'T>) (source2: seq<'T>) = - ISeq.append (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable + ISeq.append (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] let collect mapping source = map mapping source |> concat @@ -245,7 +240,7 @@ namespace Microsoft.FSharp.Collections [] let ofList (source : 'T list) = - ISeq.ofList source |> Upcast.enumerable + ISeq.ofList source :> seq<_> [] let toList (source : seq<'T>) = @@ -253,7 +248,7 @@ namespace Microsoft.FSharp.Collections [] let ofArray (source : 'T array) = - ISeq.ofArray source |> Upcast.enumerable + ISeq.ofArray source :> seq<_> [] let toArray (source : seq<'T>) = @@ -273,19 +268,19 @@ namespace Microsoft.FSharp.Collections [] let singleton x = - ISeq.singleton x |> Upcast.enumerable + ISeq.singleton x :> seq<_> [] let truncate n (source: seq<'T>) = - ISeq.truncate n (toISeq source) |> Upcast.enumerable + ISeq.truncate n (toISeq source) :> seq<_> [] let pairwise (source: seq<'T>) = - ISeq.pairwise (toISeq source) |> Upcast.enumerable + ISeq.pairwise (toISeq source) :> seq<_> [] let scan<'T,'State> f (z:'State) (source : seq<'T>) = - ISeq.scan f z (toISeq source) |> Upcast.enumerable + ISeq.scan f z (toISeq source) :> seq<_> [] let tryFindBack f (source : seq<'T>) = @@ -297,7 +292,7 @@ namespace Microsoft.FSharp.Collections [] let scanBack<'T,'State> f (source : seq<'T>) (acc:'State) = - ISeq.scanBack f (toISeq source) acc |> Upcast.enumerable + ISeq.scanBack f (toISeq source) acc :> seq<_> [] let findIndex p (source:seq<_>) = @@ -318,15 +313,15 @@ namespace Microsoft.FSharp.Collections // windowed : int -> seq<'T> -> seq<'T[]> [] let windowed windowSize (source: seq<_>) = - ISeq.windowed windowSize (toISeq source) |> Upcast.enumerable + ISeq.windowed windowSize (toISeq source) :> seq<_> [] let cache (source : seq<'T>) = - ISeq.cache (toISeq source) |> Upcast.enumerable + ISeq.cache (toISeq source) :> seq<_> [] let allPairs source1 source2 = - ISeq.allPairs (source1 |> toISeq1) (source2 |> toISeq2) |> Upcast.enumerable + ISeq.allPairs (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] [] @@ -347,36 +342,36 @@ namespace Microsoft.FSharp.Collections else seq |> toISeq |> ISeq.GroupBy.byRef keyf grouped - |> ISeq.map (fun (key,value) -> key, Upcast.enumerable value) - |> Upcast.enumerable) + |> ISeq.map (fun (key,value) -> key, value :> seq<_>) + :> seq<_>) [] let distinct source = - ISeq.distinct (toISeq source) |> Upcast.enumerable + ISeq.distinct (toISeq source) :> seq<_> [] let distinctBy keyf source = - ISeq.distinctBy keyf (toISeq source) |> Upcast.enumerable + ISeq.distinctBy keyf (toISeq source) :> seq<_> [] let sortBy keyf source = - ISeq.sortBy keyf (toISeq source) |> Upcast.enumerable + ISeq.sortBy keyf (toISeq source) :> seq<_> [] let sort source = - ISeq.sort (toISeq source) |> Upcast.enumerable + ISeq.sort (toISeq source) :> seq<_> [] let sortWith f source = - ISeq.sortWith f (toISeq source) |> Upcast.enumerable + ISeq.sortWith f (toISeq source) :> seq<_> [] let inline sortByDescending keyf source = - ISeq.sortByDescending keyf (toISeq source) |> Upcast.enumerable + ISeq.sortByDescending keyf (toISeq source) :> seq<_> [] let inline sortDescending source = - ISeq.sortDescending (toISeq source) |> Upcast.enumerable + ISeq.sortDescending (toISeq source) :> seq<_> [] let countBy (keyf:'T->'Key) (source:seq<'T>) = @@ -385,8 +380,8 @@ namespace Microsoft.FSharp.Collections #else if typeof<'Key>.IsValueType #endif - then ISeq.CountBy.byVal keyf (toISeq source) |> Upcast.enumerable - else ISeq.CountBy.byRef keyf (toISeq source) |> Upcast.enumerable + then ISeq.CountBy.byVal keyf (toISeq source) :> seq<_> + else ISeq.CountBy.byRef keyf (toISeq source) :> seq<_> [] let inline sum (source: seq< ^a>) : ^a = @@ -422,15 +417,15 @@ namespace Microsoft.FSharp.Collections [] let takeWhile p (source: seq<_>) = - ISeq.takeWhile p (toISeq source) |> Upcast.enumerable + ISeq.takeWhile p (toISeq source) :> seq<_> [] let skip count (source: seq<_>) = - ISeq.skip count (toISeq source) |> Upcast.enumerable + ISeq.skip count (toISeq source) :> seq<_> [] let skipWhile p (source: seq<_>) = - ISeq.skipWhile p (toISeq source) |> Upcast.enumerable + ISeq.skipWhile p (toISeq source) :> seq<_> [] let forall2 p (source1: seq<_>) (source2: seq<_>) = @@ -452,7 +447,7 @@ namespace Microsoft.FSharp.Collections [] let tail (source: seq<'T>) = - ISeq.tail (toISeq source) |> Upcast.enumerable + ISeq.tail (toISeq source) :> seq<_> [] let last (source : seq<_>) = @@ -468,28 +463,28 @@ namespace Microsoft.FSharp.Collections [] let rev source = - ISeq.rev (toISeq source) |> Upcast.enumerable + ISeq.rev (toISeq source) :> seq<_> [] let permute f (source : seq<_>) = - ISeq.permute f (toISeq source) |> Upcast.enumerable + ISeq.permute f (toISeq source) :> seq<_> [] let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = - ISeq.mapFold f acc (toISeq source) |> fun (iseq, state) -> Upcast.enumerable iseq, state + ISeq.mapFold f acc (toISeq source) |> fun (iseq, state) -> iseq :> seq<_>, state [] let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = - ISeq.mapFoldBack f (toISeq source) acc |> fun (iseq, state) -> Upcast.enumerable iseq, state + ISeq.mapFoldBack f (toISeq source) acc |> fun (iseq, state) -> iseq :> seq<_>, state [] let except (itemsToExclude: seq<'T>) (source: seq<'T>) = - ISeq.except itemsToExclude (toISeq source) |> Upcast.enumerable + ISeq.except itemsToExclude (toISeq source) :> seq<_> [] let chunkBySize chunkSize (source : seq<_>) = - ISeq.chunkBySize chunkSize (toISeq source) |> Upcast.enumerable + ISeq.chunkBySize chunkSize (toISeq source) :> seq<_> [] let splitInto count source = - ISeq.splitInto count (toISeq source) |> Upcast.enumerable \ No newline at end of file + ISeq.splitInto count (toISeq source) :> seq<_> \ No newline at end of file From f9876e06578785357cfc98ae74666279881845d8 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 9 May 2017 19:03:35 +1000 Subject: [PATCH 092/120] Seq defer to List/Array where it can --- src/fsharp/FSharp.Core/seq.fs | 113 ++++++++++++++++++++++++++++------ 1 file changed, 94 insertions(+), 19 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 6fc3751a0d4..84d7e25ffa2 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -54,6 +54,14 @@ namespace Microsoft.FSharp.Collections let inline toISeq3 (source3:seq<'T>) : ISeq<'T> = checkNonNull "source3" source3; ISeq.ofSeq source3 let inline toISeqs (sources:seq<'T>) : ISeq<'T> = checkNonNull "sources" sources; ISeq.ofSeq sources + let getRaw (source:ISeq<_>) = + match source with + | :? Core.EnumerableBase<'T> as s -> s.GetRaw () + | _ -> upcast source + + let rawOrOriginal (raw:seq<_>) (original:ISeq<_>) = + if obj.ReferenceEquals (raw, original) then original else toISeq raw + let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) [] @@ -76,7 +84,11 @@ namespace Microsoft.FSharp.Collections [] let iter f (source : seq<'T>) = - ISeq.iter f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.iter f arr + | :? list<'T> as lst -> List.iter f lst + | raw -> ISeq.iter f (rawOrOriginal raw original) [] let item index (source : seq<'T>) = @@ -87,19 +99,32 @@ namespace Microsoft.FSharp.Collections [] let tryItem i (source : seq<'T>) = - ISeq.tryItem i (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.tryItem i arr + | :? list<'T> as lst -> List.tryItem i lst + | raw -> ISeq.tryItem i (rawOrOriginal raw original) [] let nth index (source : seq<'T>) = item index source [] let iteri f (source : seq<'T>) = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f - ISeq.iteri (fun idx a -> f.Invoke (idx,a)) (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.iteri f arr + | :? list<'T> as lst -> List.iteri f lst + | raw -> + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.iteri (fun idx a -> f.Invoke (idx,a)) (rawOrOriginal raw original) [] let exists f (source : seq<'T>) = - ISeq.exists f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.exists f arr + | :? list<'T> as lst -> List.exists f lst + | raw -> ISeq.exists f (rawOrOriginal raw original) [] let inline contains element (source : seq<'T>) = @@ -107,7 +132,11 @@ namespace Microsoft.FSharp.Collections [] let forall f (source : seq<'T>) = - ISeq.forall f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.forall f arr + | :? list<'T> as lst -> List.forall f lst + | raw -> ISeq.forall f (rawOrOriginal raw original) [] let iter2 f (source1 : seq<_>) (source2 : seq<_>) = @@ -170,19 +199,35 @@ namespace Microsoft.FSharp.Collections [] let tryPick f (source : seq<'T>) = - ISeq.tryPick f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.tryPick f arr + | :? list<'T> as lst -> List.tryPick f lst + | raw -> ISeq.tryPick f (rawOrOriginal raw original) [] let pick f source = - ISeq.pick f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.pick f arr + | :? list<'T> as lst -> List.pick f lst + | raw -> ISeq.pick f (rawOrOriginal raw original) [] let tryFind f (source : seq<'T>) = - ISeq.tryFind f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.tryFind f arr + | :? list<'T> as lst -> List.tryFind f lst + | raw -> ISeq.tryFind f (rawOrOriginal raw original) [] let find f source = - ISeq.find f (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.find f arr + | :? list<'T> as lst -> List.find f lst + | raw -> ISeq.find f (rawOrOriginal raw original) [] let take count (source : seq<'T>) = @@ -209,8 +254,13 @@ namespace Microsoft.FSharp.Collections [] let fold<'T,'State> f (x:'State) (source : seq<'T>) = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f - ISeq.fold (fun acc item -> f.Invoke (acc, item)) x (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.fold f x arr + | :? list<'T> as lst -> List.fold f x lst + | raw -> + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.fold (fun acc item -> f.Invoke (acc, item)) x (rawOrOriginal raw original) [] let fold2<'T1,'T2,'State> f (state:'State) (source1: seq<'T1>) (source2: seq<'T2>) = @@ -219,8 +269,13 @@ namespace Microsoft.FSharp.Collections [] let reduce f (source : seq<'T>) = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f - ISeq.reduce (fun acc item -> f.Invoke (acc, item)) (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.reduce f arr + | :? list<'T> as lst -> List.reduce f lst + | raw -> + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + ISeq.reduce (fun acc item -> f.Invoke (acc, item)) (rawOrOriginal raw original) [] let replicate count x = @@ -439,11 +494,19 @@ namespace Microsoft.FSharp.Collections [] let head (source : seq<_>) = - ISeq.head (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.head arr + | :? list<'T> as lst -> List.head lst + | raw -> ISeq.head (rawOrOriginal raw original) [] let tryHead (source : seq<_>) = - ISeq.tryHead (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.tryHead arr + | :? list<'T> as lst -> List.tryHead lst + | raw -> ISeq.tryHead (rawOrOriginal raw original) [] let tail (source: seq<'T>) = @@ -451,15 +514,27 @@ namespace Microsoft.FSharp.Collections [] let last (source : seq<_>) = - ISeq.last (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.last arr + | :? list<'T> as lst -> List.last lst + | raw -> ISeq.last (rawOrOriginal raw original) [] let tryLast (source : seq<_>) = - ISeq.tryLast (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.tryLast arr + | :? list<'T> as lst -> List.tryLast lst + | raw -> ISeq.tryLast (rawOrOriginal raw original) [] let exactlyOne (source : seq<_>) = - ISeq.exactlyOne (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.exactlyOne arr + | :? list<'T> as lst -> List.exactlyOne lst + | raw -> ISeq.exactlyOne (rawOrOriginal raw original) [] let rev source = From af27a282a60fb87b6f4d3ddf5590e39c6ef483c2 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Mon, 15 May 2017 19:11:23 +1000 Subject: [PATCH 093/120] Fix misdirected ISeq.length --- src/fsharp/FSharp.Core/seq.fs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 84d7e25ffa2..c97b6ff3b5f 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -38,7 +38,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Control open Microsoft.FSharp.Collections - open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Collections.SeqComposition [] From f8b7dbf63215cb0ee55dd31d333bd291dfc8371c Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 17 Aug 2017 16:33:16 +1000 Subject: [PATCH 094/120] Updated Linq101Aggregates01 --- .../Linq101Aggregates01.il.bsl | 4052 +++++++++-------- 1 file changed, 2180 insertions(+), 1872 deletions(-) diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl index 8c8c4d065d8..75db60c1178 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl @@ -38,20 +38,20 @@ } .mresource public FSharpSignatureData.Linq101Aggregates01 { - // Offset: 0x00000000 Length: 0x0000060C + // Offset: 0x00000000 Length: 0x00000610 } .mresource public FSharpOptimizationData.Linq101Aggregates01 { - // Offset: 0x00000610 Length: 0x00000211 + // Offset: 0x00000618 Length: 0x00000211 } .module Linq101Aggregates01.exe -// MVID: {59B19240-D281-4783-A745-03834092B159} +// MVID: {599414C4-D281-4783-A745-0383C4149459} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x010C0000 +// Image base: 0x01520000 // =============== CLASS MEMBERS DECLARATION =================== @@ -116,7 +116,7 @@ // Code size 191 (0xbf) .maxstack 6 .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 100001,100001 : 0,0 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\QueryExpressionStepping\\Linq101Aggregates01.fs' + .line 100001,100001 : 0,0 'C:\\src\\manofstick\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\QueryExpressionStepping\\Linq101Aggregates01.fs' IL_0000: ldarg.0 IL_0001: ldfld int32 Linq101Aggregates01/uniqueFactors@12::pc IL_0006: ldc.i4.1 @@ -133,18 +133,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 12,12 : 9,33 '' @@ -233,10 +237,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -258,22 +264,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -337,52 +348,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/uniqueFactors@12::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/uniqueFactors@12::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method uniqueFactors@12::get_CheckClose .method public strict virtual instance int32 @@ -390,11 +396,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/uniqueFactors@12::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/uniqueFactors@12::current + IL_0007: ret } // end of method uniqueFactors@12::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -402,19 +409,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldc.i4.0 + IL_0000: nop IL_0001: ldc.i4.0 - IL_0002: ldnull - IL_0003: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldnull IL_0004: ldc.i4.0 - IL_0005: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, + IL_0005: ldc.i4.0 + IL_0006: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000a: ret + IL_000b: ret } // end of method uniqueFactors@12::GetFreshEnumerator } // end of class uniqueFactors@12 @@ -491,18 +499,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 21,21 : 9,28 '' @@ -591,10 +603,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -616,22 +630,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -695,52 +714,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/numSum@21::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/numSum@21::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method numSum@21::get_CheckClose .method public strict virtual instance int32 @@ -748,11 +762,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/numSum@21::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/numSum@21::current + IL_0007: ret } // end of method numSum@21::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -760,19 +775,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldc.i4.0 + IL_0000: nop IL_0001: ldc.i4.0 - IL_0002: ldnull - IL_0003: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldnull IL_0004: ldc.i4.0 - IL_0005: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, + IL_0005: ldc.i4.0 + IL_0006: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000a: ret + IL_000b: ret } // end of method numSum@21::GetFreshEnumerator } // end of class numSum@21 @@ -795,15 +811,101 @@ .method public strict virtual instance int32 Invoke(int32 n) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 22,22 : 15,16 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'numSum@22-1'::Invoke } // end of class 'numSum@22-1' + .class auto autochar serializable sealed nested assembly beforefieldinit specialname 'numSum@22-3' + extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + // Code size 18 (0x12) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::f + IL_0007: nop + IL_0008: ldarg.0 + IL_0009: ldc.i4.0 + IL_000a: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_000f: ldarg.0 + IL_0010: pop + IL_0011: ret + } // end of method 'numSum@22-3'::.ctor + + .method public hidebysig virtual instance bool + ProcessNext(int32 input) cil managed + { + // Code size 29 (0x1d) + .maxstack 8 + .line 22,22 : 9,16 '' + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::f + IL_000d: ldarg.1 + IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0013: add.ovf + IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) + IL_0019: nop + IL_001a: nop + IL_001b: ldc.i4.0 + IL_001c: ret + } // end of method 'numSum@22-3'::ProcessNext + + } // end of class 'numSum@22-3' + + .class auto ansi serializable sealed nested assembly beforefieldinit 'numSum@22-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::f + IL_000d: ret + } // end of method 'numSum@22-2'::.ctor + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + Invoke(int32 _arg1) cil managed + { + // Code size 13 (0xd) + .maxstack 8 + .line 22,22 : 9,16 '' + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::f + IL_0007: newobj instance void Linq101Aggregates01/'numSum@22-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000c: ret + } // end of method 'numSum@22-2'::Invoke + + } // end of class 'numSum@22-2' + .class auto autochar serializable sealed nested assembly beforefieldinit specialname totalChars@30 extends class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1 { @@ -876,18 +978,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 30,30 : 9,26 '' @@ -976,10 +1082,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -1001,22 +1109,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -1080,52 +1193,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/totalChars@30::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/totalChars@30::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method totalChars@30::get_CheckClose .method public strict virtual instance string @@ -1133,11 +1241,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld string Linq101Aggregates01/totalChars@30::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld string Linq101Aggregates01/totalChars@30::current + IL_0007: ret } // end of method totalChars@30::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -1145,19 +1254,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldnull + IL_0000: nop IL_0001: ldnull IL_0002: ldnull - IL_0003: ldc.i4.0 - IL_0004: ldnull - IL_0005: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, + IL_0003: ldnull + IL_0004: ldc.i4.0 + IL_0005: ldnull + IL_0006: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_000a: ret + IL_000b: ret } // end of method totalChars@30::GetFreshEnumerator } // end of class totalChars@30 @@ -1180,16 +1290,102 @@ .method public strict virtual instance int32 Invoke(string w) cil managed { - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 .line 31,31 : 16,24 '' - IL_0000: ldarg.1 - IL_0001: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0007: ret } // end of method 'totalChars@31-1'::Invoke } // end of class 'totalChars@31-1' + .class auto autochar serializable sealed nested assembly beforefieldinit specialname 'totalChars@31-3' + extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + // Code size 18 (0x12) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::f + IL_0007: nop + IL_0008: ldarg.0 + IL_0009: ldc.i4.0 + IL_000a: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_000f: ldarg.0 + IL_0010: pop + IL_0011: ret + } // end of method 'totalChars@31-3'::.ctor + + .method public hidebysig virtual instance bool + ProcessNext(string input) cil managed + { + // Code size 29 (0x1d) + .maxstack 8 + .line 31,31 : 9,25 '' + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::f + IL_000d: ldarg.1 + IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0013: add.ovf + IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) + IL_0019: nop + IL_001a: nop + IL_001b: ldc.i4.0 + IL_001c: ret + } // end of method 'totalChars@31-3'::ProcessNext + + } // end of class 'totalChars@31-3' + + .class auto ansi serializable sealed nested assembly beforefieldinit 'totalChars@31-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::f + IL_000d: ret + } // end of method 'totalChars@31-2'::.ctor + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + Invoke(int32 _arg1) cil managed + { + // Code size 13 (0xd) + .maxstack 8 + .line 31,31 : 9,25 '' + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::f + IL_0007: newobj instance void Linq101Aggregates01/'totalChars@31-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000c: ret + } // end of method 'totalChars@31-2'::Invoke + + } // end of class 'totalChars@31-2' + .class auto ansi serializable sealed nested assembly beforefieldinit categories@39 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -1212,19 +1408,20 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 39,39 : 9,29 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 40,40 : 9,32 '' - IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories@39::builder@ - IL_0008: ldloc.0 - IL_0009: tail. - IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0010: ret + IL_0003: ldarg.0 + IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories@39::builder@ + IL_0009: ldloc.0 + IL_000a: tail. + IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0011: ret } // end of method categories@39::Invoke } // end of class categories@39 @@ -1247,11 +1444,12 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 40,40 : 20,21 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'categories@40-1'::Invoke } // end of class 'categories@40-1' @@ -1274,13 +1472,14 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 40,40 : 22,32 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0009: ret } // end of method 'categories@40-2'::Invoke } // end of class 'categories@40-2' @@ -1362,18 +1561,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 42,42 : 13,26 '' @@ -1463,10 +1666,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -1488,22 +1693,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -1567,52 +1777,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/sum@42::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/sum@42::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method sum@42::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -1620,11 +1825,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/sum@42::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/sum@42::current + IL_0007: ret } // end of method sum@42::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -1632,22 +1838,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/sum@42::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/sum@42::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method sum@42::GetFreshEnumerator } // end of class sum@42 @@ -1670,17 +1877,103 @@ .method public strict virtual instance int32 Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 43,43 : 19,33 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance int32 [Utils]Utils/Product::get_UnitsInStock() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance int32 [Utils]Utils/Product::get_UnitsInStock() + IL_0009: ret } // end of method 'sum@43-1'::Invoke } // end of class 'sum@43-1' + .class auto autochar serializable sealed nested assembly beforefieldinit specialname 'sum@43-3' + extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + // Code size 18 (0x12) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::f + IL_0007: nop + IL_0008: ldarg.0 + IL_0009: ldc.i4.0 + IL_000a: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_000f: ldarg.0 + IL_0010: pop + IL_0011: ret + } // end of method 'sum@43-3'::.ctor + + .method public hidebysig virtual instance bool + ProcessNext(class [Utils]Utils/Product input) cil managed + { + // Code size 29 (0x1d) + .maxstack 8 + .line 43,43 : 13,33 '' + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::f + IL_000d: ldarg.1 + IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0013: add.ovf + IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) + IL_0019: nop + IL_001a: nop + IL_001b: ldc.i4.0 + IL_001c: ret + } // end of method 'sum@43-3'::ProcessNext + + } // end of class 'sum@43-3' + + .class auto ansi serializable sealed nested assembly beforefieldinit 'sum@43-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::f + IL_000d: ret + } // end of method 'sum@43-2'::.ctor + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + Invoke(int32 _arg1) cil managed + { + // Code size 13 (0xd) + .maxstack 8 + .line 43,43 : 13,33 '' + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::f + IL_0007: newobj instance void Linq101Aggregates01/'sum@43-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000c: ret + } // end of method 'sum@43-2'::Invoke + + } // end of class 'sum@43-2' + .class auto ansi serializable sealed nested assembly beforefieldinit 'categories@40-3' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,int32>,object>> { @@ -1703,7 +1996,7 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,int32>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 147 (0x93) + // Code size 109 (0x6d) .maxstack 10 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] int32 sum, @@ -1711,101 +2004,64 @@ [3] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_3, [4] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_4, [5] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_5, - [6] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_6, - [7] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_7, - [8] int32 V_8, - [9] int32 V_9, - [10] class [mscorlib]System.IDisposable V_10) + [6] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_6) .line 40,40 : 38,39 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 - IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0007: stloc.2 - IL_0008: ldloc.2 - IL_0009: stloc.3 - IL_000a: ldloc.0 - IL_000b: ldnull + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 + IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0008: stloc.2 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: ldloc.0 IL_000c: ldnull IL_000d: ldnull - IL_000e: ldc.i4.0 - IL_000f: ldnull - IL_0010: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000e: ldnull + IL_000f: ldc.i4.0 + IL_0010: ldnull + IL_0011: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001a: stloc.s V_4 - IL_001c: newobj instance void Linq101Aggregates01/'sum@43-1'::.ctor() - IL_0021: stloc.s V_5 - IL_0023: ldloc.s V_4 - IL_0025: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_002a: stloc.s V_6 - IL_002c: ldloc.s V_6 - IL_002e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0033: stloc.s V_7 - .try - { - IL_0035: ldc.i4.0 - IL_0036: stloc.s V_9 - IL_0038: ldloc.s V_7 - IL_003a: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_003f: brfalse.s IL_0057 - - .line 43,43 : 13,33 '' - IL_0041: ldloc.s V_9 - IL_0043: ldloc.s V_5 - IL_0045: ldloc.s V_7 - IL_0047: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_004c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0051: add.ovf - IL_0052: stloc.s V_9 - .line 100001,100001 : 0,0 '' - IL_0054: nop - IL_0055: br.s IL_0038 - - IL_0057: ldloc.s V_9 - IL_0059: stloc.s V_8 - IL_005b: leave.s IL_007b + IL_0016: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001b: stloc.s V_4 + IL_001d: newobj instance void Linq101Aggregates01/'sum@43-1'::.ctor() + IL_0022: stloc.s V_5 + IL_0024: ldloc.s V_4 + IL_0026: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_002b: stloc.s V_6 + IL_002d: ldloc.s V_6 + IL_002f: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_0034: brfalse.s IL_0038 - } // end .try - finally - { - IL_005d: ldloc.s V_7 - IL_005f: isinst [mscorlib]System.IDisposable - IL_0064: stloc.s V_10 - IL_0066: ldloc.s V_10 - IL_0068: brfalse.s IL_006c - - IL_006a: br.s IL_006e + IL_0036: br.s IL_0043 - IL_006c: br.s IL_0078 + .line 100001,100001 : 0,0 '' + IL_0038: ldstr "source" + IL_003d: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_0042: throw - .line 100001,100001 : 0,0 '' - IL_006e: ldloc.s V_10 - IL_0070: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0075: ldnull - IL_0076: pop - IL_0077: endfinally - .line 100001,100001 : 0,0 '' - IL_0078: ldnull - IL_0079: pop - IL_007a: endfinally - .line 100001,100001 : 0,0 '' - } // end handler - IL_007b: ldloc.s V_8 - IL_007d: stloc.1 + .line 100001,100001 : 0,0 '' + .line 100001,100001 : 0,0 '' + IL_0043: nop + IL_0044: ldloc.s V_6 + IL_0046: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_004b: ldloc.s V_5 + IL_004d: newobj instance void Linq101Aggregates01/'sum@43-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0052: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0057: stloc.1 .line 45,45 : 9,28 '' - IL_007e: ldarg.0 - IL_007f: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories@40-3'::builder@ - IL_0084: ldloc.0 - IL_0085: ldloc.1 - IL_0086: newobj instance void class [mscorlib]System.Tuple`2,int32>::.ctor(!0, + IL_0058: ldarg.0 + IL_0059: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories@40-3'::builder@ + IL_005e: ldloc.0 + IL_005f: ldloc.1 + IL_0060: newobj instance void class [mscorlib]System.Tuple`2,int32>::.ctor(!0, !1) - IL_008b: tail. - IL_008d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,int32>,object>(!!0) - IL_0092: ret + IL_0065: tail. + IL_0067: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,int32>,object>(!!0) + IL_006c: ret } // end of method 'categories@40-3'::Invoke } // end of class 'categories@40-3' @@ -1828,24 +2084,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,int32> tupledArg) cil managed { - // Code size 27 (0x1b) + // Code size 28 (0x1c) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] int32 sum) - .line 100001,100001 : 0,0 '' + .line 45,45 : 17,27 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,int32>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,int32>::get_Item2() IL_000d: stloc.1 - .line 45,45 : 17,27 '' - IL_000e: ldloc.0 - IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0014: ldloc.1 - IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_000e: nop + IL_000f: ldloc.0 + IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0015: ldloc.1 + IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001a: ret + IL_001b: ret } // end of method 'categories@45-4'::Invoke } // end of class 'categories@45-4' @@ -1922,18 +2178,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 49,49 : 22,41 '' @@ -2022,10 +2282,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -2047,22 +2309,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -2126,52 +2393,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/minNum@49::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/minNum@49::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method minNum@49::get_CheckClose .method public strict virtual instance int32 @@ -2179,11 +2441,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/minNum@49::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/minNum@49::current + IL_0007: ret } // end of method minNum@49::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -2191,19 +2454,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldc.i4.0 + IL_0000: nop IL_0001: ldc.i4.0 - IL_0002: ldnull - IL_0003: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldnull IL_0004: ldc.i4.0 - IL_0005: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, + IL_0005: ldc.i4.0 + IL_0006: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000a: ret + IL_000b: ret } // end of method minNum@49::GetFreshEnumerator } // end of class minNum@49 @@ -2226,11 +2490,12 @@ .method public strict virtual instance int32 Invoke(int32 n) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 49,49 : 48,49 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'minNum@49-1'::Invoke } // end of class 'minNum@49-1' @@ -2307,18 +2572,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 52,52 : 28,45 '' @@ -2407,10 +2676,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -2432,22 +2703,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -2511,52 +2787,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/shortestWord@52::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/shortestWord@52::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method shortestWord@52::get_CheckClose .method public strict virtual instance string @@ -2564,11 +2835,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld string Linq101Aggregates01/shortestWord@52::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld string Linq101Aggregates01/shortestWord@52::current + IL_0007: ret } // end of method shortestWord@52::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -2576,19 +2848,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldnull + IL_0000: nop IL_0001: ldnull IL_0002: ldnull - IL_0003: ldc.i4.0 - IL_0004: ldnull - IL_0005: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, + IL_0003: ldnull + IL_0004: ldc.i4.0 + IL_0005: ldnull + IL_0006: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_000a: ret + IL_000b: ret } // end of method shortestWord@52::GetFreshEnumerator } // end of class shortestWord@52 @@ -2611,12 +2884,13 @@ .method public strict virtual instance int32 Invoke(string w) cil managed { - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 .line 52,52 : 52,60 '' - IL_0000: ldarg.1 - IL_0001: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0007: ret } // end of method 'shortestWord@52-1'::Invoke } // end of class 'shortestWord@52-1' @@ -2643,19 +2917,20 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 57,57 : 9,29 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 58,58 : 9,32 '' - IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories2@57::builder@ - IL_0008: ldloc.0 - IL_0009: tail. - IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0010: ret + IL_0003: ldarg.0 + IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories2@57::builder@ + IL_0009: ldloc.0 + IL_000a: tail. + IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0011: ret } // end of method categories2@57::Invoke } // end of class categories2@57 @@ -2678,11 +2953,12 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 58,58 : 20,21 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'categories2@58-1'::Invoke } // end of class 'categories2@58-1' @@ -2705,13 +2981,14 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 58,58 : 22,32 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0009: ret } // end of method 'categories2@58-2'::Invoke } // end of class 'categories2@58-2' @@ -2793,18 +3070,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 59,59 : 27,40 '' @@ -2894,10 +3175,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -2919,22 +3202,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -2998,52 +3286,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/min@59::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/min@59::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method min@59::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -3051,11 +3334,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/min@59::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/min@59::current + IL_0007: ret } // end of method min@59::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -3063,22 +3347,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/min@59::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/min@59::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method min@59::GetFreshEnumerator } // end of class min@59 @@ -3101,13 +3386,14 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 59,59 : 47,58 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0009: ret } // end of method 'min@59-1'::Invoke } // end of class 'min@59-1' @@ -3134,44 +3420,45 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 57 (0x39) + // Code size 58 (0x3a) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min, [2] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) .line 58,58 : 38,39 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 - IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0007: stloc.2 - IL_0008: ldloc.2 - IL_0009: ldloc.0 - IL_000a: ldnull + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 + IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0008: stloc.2 + IL_0009: ldloc.2 + IL_000a: ldloc.0 IL_000b: ldnull IL_000c: ldnull - IL_000d: ldc.i4.0 - IL_000e: ldnull - IL_000f: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000d: ldnull + IL_000e: ldc.i4.0 + IL_000f: ldnull + IL_0010: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0019: newobj instance void Linq101Aggregates01/'min@59-1'::.ctor() - IL_001e: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001a: newobj instance void Linq101Aggregates01/'min@59-1'::.ctor() + IL_001f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0023: stloc.1 + IL_0024: stloc.1 .line 60,60 : 9,28 '' - IL_0024: ldarg.0 - IL_0025: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories2@58-3'::builder@ - IL_002a: ldloc.0 - IL_002b: ldloc.1 - IL_002c: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, + IL_0025: ldarg.0 + IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories2@58-3'::builder@ + IL_002b: ldloc.0 + IL_002c: ldloc.1 + IL_002d: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, !1) - IL_0031: tail. - IL_0033: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) - IL_0038: ret + IL_0032: tail. + IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) + IL_0039: ret } // end of method 'categories2@58-3'::Invoke } // end of class 'categories2@58-3' @@ -3194,24 +3481,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal> tupledArg) cil managed { - // Code size 27 (0x1b) + // Code size 28 (0x1c) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min) - .line 100001,100001 : 0,0 '' + .line 60,60 : 17,27 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item2() IL_000d: stloc.1 - .line 60,60 : 17,27 '' - IL_000e: ldloc.0 - IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0014: ldloc.1 - IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_000e: nop + IL_000f: ldloc.0 + IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0015: ldloc.1 + IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001a: ret + IL_001b: ret } // end of method 'categories2@60-4'::Invoke } // end of class 'categories2@60-4' @@ -3238,19 +3525,20 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 66,66 : 9,29 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 67,67 : 9,32 '' - IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories3@66::builder@ - IL_0008: ldloc.0 - IL_0009: tail. - IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0010: ret + IL_0003: ldarg.0 + IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories3@66::builder@ + IL_0009: ldloc.0 + IL_000a: tail. + IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0011: ret } // end of method categories3@66::Invoke } // end of class categories3@66 @@ -3273,11 +3561,12 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 67,67 : 20,21 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'categories3@67-1'::Invoke } // end of class 'categories3@67-1' @@ -3300,13 +3589,14 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 67,67 : 22,32 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0009: ret } // end of method 'categories3@67-2'::Invoke } // end of class 'categories3@67-2' @@ -3326,15 +3616,16 @@ } // end of method 'min@68-2'::.ctor .method assembly hidebysig instance valuetype [mscorlib]System.Decimal - Invoke(class [Utils]Utils/Product p) cil managed + Invoke(class [Utils]Utils/Product arg) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 68,68 : 46,57 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0009: ret } // end of method 'min@68-2'::Invoke } // end of class 'min@68-2' @@ -3416,18 +3707,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 69,69 : 40,53 '' @@ -3517,10 +3812,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -3542,22 +3839,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -3621,52 +3923,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/cheapestProducts@69::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/cheapestProducts@69::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method cheapestProducts@69::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -3674,11 +3971,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/cheapestProducts@69::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/cheapestProducts@69::current + IL_0007: ret } // end of method cheapestProducts@69::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -3686,22 +3984,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/cheapestProducts@69::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/cheapestProducts@69::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method cheapestProducts@69::GetFreshEnumerator } // end of class cheapestProducts@69 @@ -3728,16 +4027,17 @@ .method public strict virtual instance bool Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 18 (0x12) + // Code size 19 (0x13) .maxstack 8 .line 69,69 : 61,78 '' - IL_0000: ldarg.1 - IL_0001: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0006: ldarg.0 - IL_0007: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'cheapestProducts@69-1'::min - IL_000c: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0007: ldarg.0 + IL_0008: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'cheapestProducts@69-1'::min + IL_000d: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_0011: ret + IL_0012: ret } // end of method 'cheapestProducts@69-1'::Invoke } // end of class 'cheapestProducts@69-1' @@ -3764,59 +4064,60 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 87 (0x57) + // Code size 88 (0x58) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min, [2] class [mscorlib]System.Collections.Generic.IEnumerable`1 cheapestProducts, [3] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) .line 67,67 : 38,39 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 68,68 : 9,58 '' - IL_0002: ldloc.0 - IL_0003: newobj instance void Linq101Aggregates01/'min@68-2'::.ctor() - IL_0008: ldftn instance valuetype [mscorlib]System.Decimal Linq101Aggregates01/'min@68-2'::Invoke(class [Utils]Utils/Product) - IL_000e: newobj instance void class [mscorlib]System.Func`2::.ctor(object, + IL_0003: ldloc.0 + IL_0004: newobj instance void Linq101Aggregates01/'min@68-2'::.ctor() + IL_0009: ldftn instance valuetype [mscorlib]System.Decimal Linq101Aggregates01/'min@68-2'::Invoke(class [Utils]Utils/Product) + IL_000f: newobj instance void class [mscorlib]System.Func`2::.ctor(object, native int) - IL_0013: call valuetype [mscorlib]System.Decimal [System.Core]System.Linq.Enumerable::Min(class [mscorlib]System.Collections.Generic.IEnumerable`1, + IL_0014: call valuetype [mscorlib]System.Decimal [System.Core]System.Linq.Enumerable::Min(class [mscorlib]System.Collections.Generic.IEnumerable`1, class [mscorlib]System.Func`2) - IL_0018: stloc.1 + IL_0019: stloc.1 .line 70,70 : 9,41 '' - IL_0019: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_001e: stloc.3 - IL_001f: ldloc.3 - IL_0020: ldloc.0 - IL_0021: ldnull + IL_001a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_001f: stloc.3 + IL_0020: ldloc.3 + IL_0021: ldloc.0 IL_0022: ldnull IL_0023: ldnull - IL_0024: ldc.i4.0 - IL_0025: ldnull - IL_0026: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0024: ldnull + IL_0025: ldc.i4.0 + IL_0026: ldnull + IL_0027: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_002b: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0030: ldloc.1 - IL_0031: newobj instance void Linq101Aggregates01/'cheapestProducts@69-1'::.ctor(valuetype [mscorlib]System.Decimal) - IL_0036: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_002c: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0031: ldloc.1 + IL_0032: newobj instance void Linq101Aggregates01/'cheapestProducts@69-1'::.ctor(valuetype [mscorlib]System.Decimal) + IL_0037: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_003b: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_0040: stloc.2 + IL_003c: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_0041: stloc.2 .line 70,70 : 9,41 '' - IL_0041: ldarg.0 - IL_0042: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories3@67-3'::builder@ - IL_0047: ldloc.0 - IL_0048: ldloc.1 - IL_0049: ldloc.2 - IL_004a: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, + IL_0042: ldarg.0 + IL_0043: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories3@67-3'::builder@ + IL_0048: ldloc.0 + IL_0049: ldloc.1 + IL_004a: ldloc.2 + IL_004b: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, !1, !2) - IL_004f: tail. - IL_0051: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) - IL_0056: ret + IL_0050: tail. + IL_0052: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) + IL_0057: ret } // end of method 'categories3@67-3'::Invoke } // end of class 'categories3@67-3' @@ -3839,12 +4140,12 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2> Invoke(class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed { - // Code size 34 (0x22) + // Code size 35 (0x23) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min, [2] class [mscorlib]System.Collections.Generic.IEnumerable`1 cheapestProducts) - .line 100001,100001 : 0,0 '' + .line 70,70 : 17,40 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item1() IL_0006: stloc.0 @@ -3854,13 +4155,13 @@ IL_000e: ldarg.1 IL_000f: call instance !2 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item3() IL_0014: stloc.2 - .line 70,70 : 17,40 '' - IL_0015: ldloc.0 - IL_0016: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_001b: ldloc.2 - IL_001c: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, + IL_0015: nop + IL_0016: ldloc.0 + IL_0017: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_001c: ldloc.2 + IL_001d: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, !1) - IL_0021: ret + IL_0022: ret } // end of method 'categories3@70-4'::Invoke } // end of class 'categories3@70-4' @@ -3937,18 +4238,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 74,74 : 22,41 '' @@ -4037,10 +4342,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -4062,22 +4369,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -4141,52 +4453,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/maxNum@74::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/maxNum@74::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method maxNum@74::get_CheckClose .method public strict virtual instance int32 @@ -4194,11 +4501,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/maxNum@74::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/maxNum@74::current + IL_0007: ret } // end of method maxNum@74::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -4206,19 +4514,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldc.i4.0 + IL_0000: nop IL_0001: ldc.i4.0 - IL_0002: ldnull - IL_0003: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldnull IL_0004: ldc.i4.0 - IL_0005: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, + IL_0005: ldc.i4.0 + IL_0006: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000a: ret + IL_000b: ret } // end of method maxNum@74::GetFreshEnumerator } // end of class maxNum@74 @@ -4241,11 +4550,12 @@ .method public strict virtual instance int32 Invoke(int32 n) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 74,74 : 48,49 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'maxNum@74-1'::Invoke } // end of class 'maxNum@74-1' @@ -4322,18 +4632,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 77,77 : 29,46 '' @@ -4422,10 +4736,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -4447,22 +4763,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -4526,52 +4847,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/longestLength@77::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/longestLength@77::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method longestLength@77::get_CheckClose .method public strict virtual instance string @@ -4579,11 +4895,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld string Linq101Aggregates01/longestLength@77::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld string Linq101Aggregates01/longestLength@77::current + IL_0007: ret } // end of method longestLength@77::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -4591,19 +4908,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 11 (0xb) + // Code size 12 (0xc) .maxstack 9 - IL_0000: ldnull + IL_0000: nop IL_0001: ldnull IL_0002: ldnull - IL_0003: ldc.i4.0 - IL_0004: ldnull - IL_0005: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, + IL_0003: ldnull + IL_0004: ldc.i4.0 + IL_0005: ldnull + IL_0006: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_000a: ret + IL_000b: ret } // end of method longestLength@77::GetFreshEnumerator } // end of class longestLength@77 @@ -4626,12 +4944,13 @@ .method public strict virtual instance int32 Invoke(string w) cil managed { - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 .line 77,77 : 53,61 '' - IL_0000: ldarg.1 - IL_0001: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0007: ret } // end of method 'longestLength@77-1'::Invoke } // end of class 'longestLength@77-1' @@ -4658,19 +4977,20 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 82,82 : 9,29 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 83,83 : 9,32 '' - IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories4@82::builder@ - IL_0008: ldloc.0 - IL_0009: tail. - IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0010: ret + IL_0003: ldarg.0 + IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories4@82::builder@ + IL_0009: ldloc.0 + IL_000a: tail. + IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0011: ret } // end of method categories4@82::Invoke } // end of class categories4@82 @@ -4693,11 +5013,12 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 83,83 : 20,21 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'categories4@83-1'::Invoke } // end of class 'categories4@83-1' @@ -4720,13 +5041,14 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 83,83 : 22,32 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0009: ret } // end of method 'categories4@83-2'::Invoke } // end of class 'categories4@83-2' @@ -4808,18 +5130,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 84,84 : 42,55 '' @@ -4909,10 +5235,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -4934,22 +5262,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -5013,52 +5346,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/mostExpensivePrice@84::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/mostExpensivePrice@84::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method mostExpensivePrice@84::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -5066,11 +5394,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensivePrice@84::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensivePrice@84::current + IL_0007: ret } // end of method mostExpensivePrice@84::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -5078,22 +5407,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensivePrice@84::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensivePrice@84::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method mostExpensivePrice@84::GetFreshEnumerator } // end of class mostExpensivePrice@84 @@ -5116,13 +5446,14 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 84,84 : 62,73 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0009: ret } // end of method 'mostExpensivePrice@84-1'::Invoke } // end of class 'mostExpensivePrice@84-1' @@ -5149,44 +5480,45 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 57 (0x39) + // Code size 58 (0x3a) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal mostExpensivePrice, [2] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) - .line 83,83 : 38,39 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 - IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0007: stloc.2 - IL_0008: ldloc.2 - IL_0009: ldloc.0 - IL_000a: ldnull + .line 83,83 : 38,39 '' + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 + IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0008: stloc.2 + IL_0009: ldloc.2 + IL_000a: ldloc.0 IL_000b: ldnull IL_000c: ldnull - IL_000d: ldc.i4.0 - IL_000e: ldnull - IL_000f: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000d: ldnull + IL_000e: ldc.i4.0 + IL_000f: ldnull + IL_0010: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0019: newobj instance void Linq101Aggregates01/'mostExpensivePrice@84-1'::.ctor() - IL_001e: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001a: newobj instance void Linq101Aggregates01/'mostExpensivePrice@84-1'::.ctor() + IL_001f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0023: stloc.1 + IL_0024: stloc.1 .line 85,85 : 9,43 '' - IL_0024: ldarg.0 - IL_0025: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories4@83-3'::builder@ - IL_002a: ldloc.0 - IL_002b: ldloc.1 - IL_002c: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, + IL_0025: ldarg.0 + IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories4@83-3'::builder@ + IL_002b: ldloc.0 + IL_002c: ldloc.1 + IL_002d: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, !1) - IL_0031: tail. - IL_0033: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) - IL_0038: ret + IL_0032: tail. + IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) + IL_0039: ret } // end of method 'categories4@83-3'::Invoke } // end of class 'categories4@83-3' @@ -5209,24 +5541,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal> tupledArg) cil managed { - // Code size 27 (0x1b) + // Code size 28 (0x1c) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal mostExpensivePrice) - .line 100001,100001 : 0,0 '' + .line 85,85 : 17,42 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item2() IL_000d: stloc.1 - .line 85,85 : 17,42 '' - IL_000e: ldloc.0 - IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0014: ldloc.1 - IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_000e: nop + IL_000f: ldloc.0 + IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0015: ldloc.1 + IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001a: ret + IL_001b: ret } // end of method 'categories4@85-4'::Invoke } // end of class 'categories4@85-4' @@ -5253,19 +5585,20 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 91,91 : 9,29 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 92,92 : 9,32 '' - IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories5@91::builder@ - IL_0008: ldloc.0 - IL_0009: tail. - IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0010: ret + IL_0003: ldarg.0 + IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories5@91::builder@ + IL_0009: ldloc.0 + IL_000a: tail. + IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0011: ret } // end of method categories5@91::Invoke } // end of class categories5@91 @@ -5288,11 +5621,12 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 92,92 : 20,21 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'categories5@92-1'::Invoke } // end of class 'categories5@92-1' @@ -5315,13 +5649,14 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 92,92 : 22,32 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0009: ret } // end of method 'categories5@92-2'::Invoke } // end of class 'categories5@92-2' @@ -5403,18 +5738,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 93,93 : 32,45 '' @@ -5504,10 +5843,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -5529,22 +5870,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -5608,52 +5954,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/maxPrice@93::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/maxPrice@93::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method maxPrice@93::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -5661,11 +6002,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/maxPrice@93::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/maxPrice@93::current + IL_0007: ret } // end of method maxPrice@93::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -5673,22 +6015,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/maxPrice@93::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/maxPrice@93::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method maxPrice@93::GetFreshEnumerator } // end of class maxPrice@93 @@ -5711,13 +6054,14 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 93,93 : 52,63 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0009: ret } // end of method 'maxPrice@93-1'::Invoke } // end of class 'maxPrice@93-1' @@ -5799,18 +6143,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 94,94 : 45,58 '' @@ -5900,10 +6248,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -5925,22 +6275,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -6004,52 +6359,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/mostExpensiveProducts@94::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/mostExpensiveProducts@94::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method mostExpensiveProducts@94::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -6057,11 +6407,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensiveProducts@94::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensiveProducts@94::current + IL_0007: ret } // end of method mostExpensiveProducts@94::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -6069,22 +6420,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensiveProducts@94::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensiveProducts@94::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method mostExpensiveProducts@94::GetFreshEnumerator } // end of class mostExpensiveProducts@94 @@ -6111,16 +6463,17 @@ .method public strict virtual instance bool Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 18 (0x12) + // Code size 19 (0x13) .maxstack 8 .line 94,94 : 66,88 '' - IL_0000: ldarg.1 - IL_0001: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0006: ldarg.0 - IL_0007: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'mostExpensiveProducts@94-1'::maxPrice - IL_000c: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0007: ldarg.0 + IL_0008: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'mostExpensiveProducts@94-1'::maxPrice + IL_000d: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_0011: ret + IL_0012: ret } // end of method 'mostExpensiveProducts@94-1'::Invoke } // end of class 'mostExpensiveProducts@94-1' @@ -6147,7 +6500,7 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 100 (0x64) + // Code size 101 (0x65) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal maxPrice, @@ -6155,63 +6508,64 @@ [3] class [mscorlib]System.Collections.Generic.IEnumerable`1 mostExpensiveProducts, [4] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_4) .line 92,92 : 38,39 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 - IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0007: stloc.2 - IL_0008: ldloc.2 - IL_0009: ldloc.0 - IL_000a: ldnull + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 + IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0008: stloc.2 + IL_0009: ldloc.2 + IL_000a: ldloc.0 IL_000b: ldnull IL_000c: ldnull - IL_000d: ldc.i4.0 - IL_000e: ldnull - IL_000f: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000d: ldnull + IL_000e: ldc.i4.0 + IL_000f: ldnull + IL_0010: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0019: newobj instance void Linq101Aggregates01/'maxPrice@93-1'::.ctor() - IL_001e: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001a: newobj instance void Linq101Aggregates01/'maxPrice@93-1'::.ctor() + IL_001f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0023: stloc.1 + IL_0024: stloc.1 .line 95,95 : 9,46 '' - IL_0024: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0029: stloc.s V_4 - IL_002b: ldloc.s V_4 - IL_002d: ldloc.0 - IL_002e: ldnull + IL_0025: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_002a: stloc.s V_4 + IL_002c: ldloc.s V_4 + IL_002e: ldloc.0 IL_002f: ldnull IL_0030: ldnull - IL_0031: ldc.i4.0 - IL_0032: ldnull - IL_0033: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0031: ldnull + IL_0032: ldc.i4.0 + IL_0033: ldnull + IL_0034: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0038: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_003d: ldloc.1 - IL_003e: newobj instance void Linq101Aggregates01/'mostExpensiveProducts@94-1'::.ctor(valuetype [mscorlib]System.Decimal) - IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0039: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_003e: ldloc.1 + IL_003f: newobj instance void Linq101Aggregates01/'mostExpensiveProducts@94-1'::.ctor(valuetype [mscorlib]System.Decimal) + IL_0044: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0048: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_004d: stloc.3 + IL_0049: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_004e: stloc.3 .line 95,95 : 9,46 '' - IL_004e: ldarg.0 - IL_004f: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories5@92-3'::builder@ - IL_0054: ldloc.0 - IL_0055: ldloc.1 - IL_0056: ldloc.3 - IL_0057: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, + IL_004f: ldarg.0 + IL_0050: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories5@92-3'::builder@ + IL_0055: ldloc.0 + IL_0056: ldloc.1 + IL_0057: ldloc.3 + IL_0058: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, !1, !2) - IL_005c: tail. - IL_005e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) - IL_0063: ret + IL_005d: tail. + IL_005f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) + IL_0064: ret } // end of method 'categories5@92-3'::Invoke } // end of class 'categories5@92-3' @@ -6234,12 +6588,12 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2> Invoke(class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed { - // Code size 34 (0x22) + // Code size 35 (0x23) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal maxPrice, [2] class [mscorlib]System.Collections.Generic.IEnumerable`1 mostExpensiveProducts) - .line 100001,100001 : 0,0 '' + .line 95,95 : 17,45 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item1() IL_0006: stloc.0 @@ -6249,13 +6603,13 @@ IL_000e: ldarg.1 IL_000f: call instance !2 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item3() IL_0014: stloc.2 - .line 95,95 : 17,45 '' - IL_0015: ldloc.0 - IL_0016: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_001b: ldloc.2 - IL_001c: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, + IL_0015: nop + IL_0016: ldloc.0 + IL_0017: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_001c: ldloc.2 + IL_001d: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, !1) - IL_0021: ret + IL_0022: ret } // end of method 'categories5@95-4'::Invoke } // end of class 'categories5@95-4' @@ -6332,18 +6686,22 @@ IL_001f: br.s IL_002a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br IL_00a8 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br.s IL_0087 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002a: nop IL_002b: br IL_00c9 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0030: nop .line 100,100 : 26,46 '' @@ -6432,10 +6790,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0091 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -6457,22 +6817,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -6536,52 +6901,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/averageNum@100::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/averageNum@100::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method averageNum@100::get_CheckClose .method public strict virtual instance float64 @@ -6589,11 +6949,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld float64 Linq101Aggregates01/averageNum@100::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld float64 Linq101Aggregates01/averageNum@100::current + IL_0007: ret } // end of method averageNum@100::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -6601,19 +6962,20 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 35 (0x23) + // Code size 36 (0x24) .maxstack 9 - IL_0000: ldc.r8 0.0 - IL_0009: ldc.r8 0.0 - IL_0012: ldnull - IL_0013: ldc.i4.0 - IL_0014: ldc.r8 0.0 - IL_001d: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, + IL_0000: nop + IL_0001: ldc.r8 0.0 + IL_000a: ldc.r8 0.0 + IL_0013: ldnull + IL_0014: ldc.i4.0 + IL_0015: ldc.r8 0.0 + IL_001e: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, float64, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, float64) - IL_0022: ret + IL_0023: ret } // end of method averageNum@100::GetFreshEnumerator } // end of class averageNum@100 @@ -6636,11 +6998,12 @@ .method public strict virtual instance float64 Invoke(float64 n) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 100,100 : 57,58 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'averageNum@100-1'::Invoke } // end of class 'averageNum@100-1' @@ -6667,28 +7030,29 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(string _arg1) cil managed { - // Code size 31 (0x1f) + // Code size 32 (0x20) .maxstack 7 .locals init ([0] string w, [1] float64 wl) .line 105,105 : 9,26 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 106,106 : 9,35 '' - IL_0002: ldloc.0 - IL_0003: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0008: conv.r8 - IL_0009: stloc.1 + IL_0003: ldloc.0 + IL_0004: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0009: conv.r8 + IL_000a: stloc.1 .line 107,107 : 9,21 '' - IL_000a: ldarg.0 - IL_000b: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/averageLength@105::builder@ - IL_0010: ldloc.0 - IL_0011: ldloc.1 - IL_0012: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_000b: ldarg.0 + IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/averageLength@105::builder@ + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_0017: tail. - IL_0019: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,object>(!!0) - IL_001e: ret + IL_0018: tail. + IL_001a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,object>(!!0) + IL_001f: ret } // end of method averageLength@105::Invoke } // end of class averageLength@105 @@ -6711,20 +7075,20 @@ .method public strict virtual instance float64 Invoke(class [mscorlib]System.Tuple`2 tupledArg) cil managed { - // Code size 16 (0x10) + // Code size 17 (0x11) .maxstack 5 .locals init ([0] string w, [1] float64 wl) - .line 100001,100001 : 0,0 '' + .line 107,107 : 19,21 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2::get_Item2() IL_000d: stloc.1 - .line 107,107 : 19,21 '' - IL_000e: ldloc.1 - IL_000f: ret + IL_000e: nop + IL_000f: ldloc.1 + IL_0010: ret } // end of method 'averageLength@107-1'::Invoke } // end of class 'averageLength@107-1' @@ -6751,19 +7115,20 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 113,113 : 9,29 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 .line 114,114 : 9,32 '' - IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories6@113::builder@ - IL_0008: ldloc.0 - IL_0009: tail. - IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0010: ret + IL_0003: ldarg.0 + IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories6@113::builder@ + IL_0009: ldloc.0 + IL_000a: tail. + IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0011: ret } // end of method categories6@113::Invoke } // end of class categories6@113 @@ -6786,11 +7151,12 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 2 (0x2) + // Code size 3 (0x3) .maxstack 8 .line 114,114 : 20,21 '' - IL_0000: ldarg.1 - IL_0001: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ret } // end of method 'categories6@114-1'::Invoke } // end of class 'categories6@114-1' @@ -6813,13 +7179,14 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 114,114 : 22,32 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0009: ret } // end of method 'categories6@114-2'::Invoke } // end of class 'categories6@114-2' @@ -6901,18 +7268,22 @@ IL_001f: br.s IL_0027 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 115,115 : 36,49 '' @@ -7002,10 +7373,12 @@ IL_0015) IL_0013: br.s IL_001b + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -7027,22 +7400,27 @@ IL_003f: br.s IL_004a + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 + .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -7106,52 +7484,47 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 56 (0x38) + // Code size 57 (0x39) .maxstack 8 - .line 100001,100001 : 0,0 '' - IL_0000: ldarg.0 - IL_0001: ldfld int32 Linq101Aggregates01/averagePrice@115::pc - IL_0006: switch ( - IL_001d, - IL_001f, - IL_0021, - IL_0023) - IL_001b: br.s IL_0031 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 Linq101Aggregates01/averagePrice@115::pc + IL_0007: switch ( + IL_001e, + IL_0020, + IL_0022, + IL_0024) + IL_001c: br.s IL_0032 - IL_001d: br.s IL_0025 + IL_001e: br.s IL_0026 - IL_001f: br.s IL_0028 + IL_0020: br.s IL_0029 - IL_0021: br.s IL_002b + IL_0022: br.s IL_002c - IL_0023: br.s IL_002e + IL_0024: br.s IL_002f - .line 100001,100001 : 0,0 '' - IL_0025: nop - IL_0026: br.s IL_0036 + IL_0026: nop + IL_0027: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0028: nop - IL_0029: br.s IL_0034 + IL_0029: nop + IL_002a: br.s IL_0035 - .line 100001,100001 : 0,0 '' - IL_002b: nop - IL_002c: br.s IL_0032 + IL_002c: nop + IL_002d: br.s IL_0033 - .line 100001,100001 : 0,0 '' - IL_002e: nop - IL_002f: br.s IL_0036 + IL_002f: nop + IL_0030: br.s IL_0037 - .line 100001,100001 : 0,0 '' - IL_0031: nop - IL_0032: ldc.i4.1 - IL_0033: ret + IL_0032: nop + IL_0033: ldc.i4.1 + IL_0034: ret - IL_0034: ldc.i4.1 - IL_0035: ret + IL_0035: ldc.i4.1 + IL_0036: ret - IL_0036: ldc.i4.0 - IL_0037: ret + IL_0037: ldc.i4.0 + IL_0038: ret } // end of method averagePrice@115::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -7159,11 +7532,12 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) + // Code size 8 (0x8) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/averagePrice@115::current - IL_0006: ret + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/averagePrice@115::current + IL_0007: ret } // end of method averagePrice@115::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -7171,22 +7545,23 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 17 (0x11) + // Code size 18 (0x12) .maxstack 10 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/averagePrice@115::g - IL_0006: ldnull + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/averagePrice@115::g IL_0007: ldnull IL_0008: ldnull - IL_0009: ldc.i4.0 - IL_000a: ldnull - IL_000b: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldnull + IL_000a: ldc.i4.0 + IL_000b: ldnull + IL_000c: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0010: ret + IL_0011: ret } // end of method averagePrice@115::GetFreshEnumerator } // end of class averagePrice@115 @@ -7209,13 +7584,14 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 9 (0x9) + // Code size 10 (0xa) .maxstack 8 .line 115,115 : 60,71 '' - IL_0000: ldarg.1 - IL_0001: tail. - IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0008: ret + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: tail. + IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0009: ret } // end of method 'averagePrice@115-1'::Invoke } // end of class 'averagePrice@115-1' @@ -7242,7 +7618,7 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 232 (0xe8) + // Code size 233 (0xe9) .maxstack 10 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal averagePrice, @@ -7259,146 +7635,149 @@ [12] int32 V_12, [13] class [mscorlib]System.IDisposable V_13) .line 114,114 : 38,39 '' - IL_0000: ldarg.1 - IL_0001: stloc.0 - IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0007: stloc.2 - IL_0008: ldloc.2 - IL_0009: stloc.3 - IL_000a: ldloc.0 - IL_000b: ldnull + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 + IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0008: stloc.2 + IL_0009: ldloc.2 + IL_000a: stloc.3 + IL_000b: ldloc.0 IL_000c: ldnull IL_000d: ldnull - IL_000e: ldc.i4.0 - IL_000f: ldnull - IL_0010: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000e: ldnull + IL_000f: ldc.i4.0 + IL_0010: ldnull + IL_0011: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001a: stloc.s V_4 - IL_001c: newobj instance void Linq101Aggregates01/'averagePrice@115-1'::.ctor() - IL_0021: stloc.s V_5 - IL_0023: ldloc.s V_4 - IL_0025: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_002a: stloc.s V_6 - IL_002c: ldloc.s V_6 - IL_002e: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_0033: brfalse.s IL_0037 + IL_0016: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001b: stloc.s V_4 + IL_001d: newobj instance void Linq101Aggregates01/'averagePrice@115-1'::.ctor() + IL_0022: stloc.s V_5 + IL_0024: ldloc.s V_4 + IL_0026: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_002b: stloc.s V_6 + IL_002d: ldloc.s V_6 + IL_002f: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_0034: brfalse.s IL_0038 - IL_0035: br.s IL_0042 + IL_0036: br.s IL_0043 .line 100001,100001 : 0,0 '' - IL_0037: ldstr "source" - IL_003c: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_0041: throw + IL_0038: ldstr "source" + IL_003d: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_0042: throw .line 100001,100001 : 0,0 '' - IL_0042: nop - IL_0043: ldloc.s V_6 - IL_0045: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_004a: stloc.s V_7 + .line 100001,100001 : 0,0 '' + IL_0043: nop + IL_0044: ldloc.s V_6 + IL_0046: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_004b: stloc.s V_7 .try { - IL_004c: ldc.i4.0 IL_004d: ldc.i4.0 IL_004e: ldc.i4.0 IL_004f: ldc.i4.0 IL_0050: ldc.i4.0 - IL_0051: newobj instance void [mscorlib]System.Decimal::.ctor(int32, + IL_0051: ldc.i4.0 + IL_0052: newobj instance void [mscorlib]System.Decimal::.ctor(int32, int32, int32, bool, uint8) - IL_0056: stloc.s V_9 - IL_0058: ldc.i4.0 - IL_0059: stloc.s V_10 - IL_005b: ldloc.s V_7 - IL_005d: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0062: brfalse.s IL_0084 - - IL_0064: ldloc.s V_9 - IL_0066: ldloc.s V_5 - IL_0068: ldloc.s V_7 - IL_006a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_006f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0074: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::op_Addition(valuetype [mscorlib]System.Decimal, + IL_0057: stloc.s V_9 + IL_0059: ldc.i4.0 + IL_005a: stloc.s V_10 + IL_005c: ldloc.s V_7 + IL_005e: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0063: brfalse.s IL_0085 + + IL_0065: ldloc.s V_9 + IL_0067: ldloc.s V_5 + IL_0069: ldloc.s V_7 + IL_006b: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0070: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0075: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::op_Addition(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_0079: stloc.s V_9 + IL_007a: stloc.s V_9 .line 115,115 : 50,71 '' - IL_007b: ldloc.s V_10 - IL_007d: ldc.i4.1 - IL_007e: add - IL_007f: stloc.s V_10 + IL_007c: ldloc.s V_10 + IL_007e: ldc.i4.1 + IL_007f: add + IL_0080: stloc.s V_10 .line 100001,100001 : 0,0 '' - IL_0081: nop - IL_0082: br.s IL_005b + IL_0082: nop + IL_0083: br.s IL_005c - IL_0084: ldloc.s V_10 - IL_0086: brtrue.s IL_008a + IL_0085: ldloc.s V_10 + IL_0087: brtrue.s IL_008b - IL_0088: br.s IL_008c + IL_0089: br.s IL_008d - IL_008a: br.s IL_0097 + IL_008b: br.s IL_0098 .line 100001,100001 : 0,0 '' - IL_008c: ldstr "source" - IL_0091: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_0096: throw + IL_008d: ldstr "source" + IL_0092: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_0097: throw .line 100001,100001 : 0,0 '' - IL_0097: nop - IL_0098: ldloc.s V_9 - IL_009a: stloc.s V_11 - IL_009c: ldloc.s V_10 - IL_009e: stloc.s V_12 - IL_00a0: ldloc.s V_11 - IL_00a2: ldloc.s V_12 - IL_00a4: call valuetype [mscorlib]System.Decimal [mscorlib]System.Convert::ToDecimal(int32) - IL_00a9: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::Divide(valuetype [mscorlib]System.Decimal, + .line 100001,100001 : 0,0 '' + IL_0098: nop + IL_0099: ldloc.s V_9 + IL_009b: stloc.s V_11 + IL_009d: ldloc.s V_10 + IL_009f: stloc.s V_12 + IL_00a1: ldloc.s V_11 + IL_00a3: ldloc.s V_12 + IL_00a5: call valuetype [mscorlib]System.Decimal [mscorlib]System.Convert::ToDecimal(int32) + IL_00aa: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::Divide(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_00ae: stloc.s V_8 - IL_00b0: leave.s IL_00d0 + IL_00af: stloc.s V_8 + IL_00b1: leave.s IL_00d1 } // end .try finally { - IL_00b2: ldloc.s V_7 - IL_00b4: isinst [mscorlib]System.IDisposable - IL_00b9: stloc.s V_13 - IL_00bb: ldloc.s V_13 - IL_00bd: brfalse.s IL_00c1 + IL_00b3: ldloc.s V_7 + IL_00b5: isinst [mscorlib]System.IDisposable + IL_00ba: stloc.s V_13 + IL_00bc: ldloc.s V_13 + IL_00be: brfalse.s IL_00c2 - IL_00bf: br.s IL_00c3 + IL_00c0: br.s IL_00c4 - IL_00c1: br.s IL_00cd + IL_00c2: br.s IL_00ce .line 100001,100001 : 0,0 '' - IL_00c3: ldloc.s V_13 - IL_00c5: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_00ca: ldnull - IL_00cb: pop - IL_00cc: endfinally + IL_00c4: ldloc.s V_13 + IL_00c6: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_00cb: ldnull + IL_00cc: pop + IL_00cd: endfinally .line 100001,100001 : 0,0 '' - IL_00cd: ldnull - IL_00ce: pop - IL_00cf: endfinally + IL_00ce: ldnull + IL_00cf: pop + IL_00d0: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_00d0: ldloc.s V_8 - IL_00d2: stloc.1 + IL_00d1: ldloc.s V_8 + IL_00d3: stloc.1 .line 116,116 : 9,37 '' - IL_00d3: ldarg.0 - IL_00d4: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories6@114-3'::builder@ - IL_00d9: ldloc.0 - IL_00da: ldloc.1 - IL_00db: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, + IL_00d4: ldarg.0 + IL_00d5: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories6@114-3'::builder@ + IL_00da: ldloc.0 + IL_00db: ldloc.1 + IL_00dc: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, !1) - IL_00e0: tail. - IL_00e2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) - IL_00e7: ret + IL_00e1: tail. + IL_00e3: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) + IL_00e8: ret } // end of method 'categories6@114-3'::Invoke } // end of class 'categories6@114-3' @@ -7421,24 +7800,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal> tupledArg) cil managed { - // Code size 27 (0x1b) + // Code size 28 (0x1c) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal averagePrice) - .line 100001,100001 : 0,0 '' + .line 116,116 : 17,36 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item2() IL_000d: stloc.1 - .line 116,116 : 17,36 '' - IL_000e: ldloc.0 - IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0014: ldloc.1 - IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_000e: nop + IL_000f: ldloc.0 + IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0015: ldloc.1 + IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001a: ret + IL_001b: ret } // end of method 'categories6@116-4'::Invoke } // end of class 'categories6@116-4' @@ -7786,7 +8165,7 @@ .method public static void main@() cil managed { .entrypoint - // Code size 1813 (0x715) + // Code size 1736 (0x6c8) .maxstack 13 .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 factorsOf300, [1] int32 uniqueFactors, @@ -7814,835 +8193,764 @@ [23] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_23, [24] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_24, [25] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_25, - [26] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_26, - [27] int32 V_27, - [28] int32 V_28, - [29] class [mscorlib]System.IDisposable V_29, - [30] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_30, + [26] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_26, + [27] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_27, + [28] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_28, + [29] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_29, + [30] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_30, [31] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_31, - [32] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_32, - [33] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_33, - [34] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_34, - [35] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_35, - [36] int32 V_36, - [37] int32 V_37, - [38] class [mscorlib]System.IDisposable V_38, + [32] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_32, + [33] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_33, + [34] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_34, + [35] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_35, + [36] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_36, + [37] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_37, + [38] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_38, [39] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_39, [40] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_40, [41] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_41, - [42] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_42, - [43] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_43, - [44] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_44, - [45] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_45, - [46] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_46, - [47] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_47, - [48] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_48, - [49] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_49, - [50] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_50, - [51] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_51, - [52] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_52, - [53] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_53, - [54] float64 V_54, - [55] float64 V_55, - [56] int32 V_56, - [57] float64 V_57, - [58] int32 V_58, - [59] class [mscorlib]System.IDisposable V_59, - [60] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_60, - [61] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_61, - [62] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable> V_62, - [63] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64> V_63, - [64] class [mscorlib]System.Collections.Generic.IEnumerable`1> V_64, - [65] class [mscorlib]System.Collections.Generic.IEnumerator`1> V_65, - [66] float64 V_66, - [67] float64 V_67, - [68] int32 V_68, - [69] float64 V_69, - [70] int32 V_70, - [71] class [mscorlib]System.IDisposable V_71, - [72] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_72) + [42] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_42, + [43] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_43, + [44] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_44, + [45] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_45, + [46] float64 V_46, + [47] float64 V_47, + [48] int32 V_48, + [49] float64 V_49, + [50] int32 V_50, + [51] class [mscorlib]System.IDisposable V_51, + [52] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_52, + [53] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_53, + [54] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable> V_54, + [55] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64> V_55, + [56] class [mscorlib]System.Collections.Generic.IEnumerable`1> V_56, + [57] class [mscorlib]System.Collections.Generic.IEnumerator`1> V_57, + [58] float64 V_58, + [59] float64 V_59, + [60] int32 V_60, + [61] float64 V_61, + [62] int32 V_62, + [63] class [mscorlib]System.IDisposable V_63, + [64] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_64) .line 8,8 : 1,31 '' - IL_0000: ldc.i4.2 + IL_0000: nop IL_0001: ldc.i4.2 - IL_0002: ldc.i4.3 - IL_0003: ldc.i4.5 + IL_0002: ldc.i4.2 + IL_0003: ldc.i4.3 IL_0004: ldc.i4.5 - IL_0005: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_000a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0005: ldc.i4.5 + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0010: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0014: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0015: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0019: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_001a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_001e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_001f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0023: dup - IL_0024: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::factorsOf300@8 - IL_0029: stloc.0 + IL_0024: dup + IL_0025: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::factorsOf300@8 + IL_002a: stloc.0 .line 10,14 : 1,20 '' - IL_002a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_002f: stloc.s builder@ - IL_0031: ldloc.s builder@ - IL_0033: ldc.i4.0 + IL_002b: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0030: stloc.s builder@ + IL_0032: ldloc.s builder@ IL_0034: ldc.i4.0 - IL_0035: ldnull - IL_0036: ldc.i4.0 + IL_0035: ldc.i4.0 + IL_0036: ldnull IL_0037: ldc.i4.0 - IL_0038: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, + IL_0038: ldc.i4.0 + IL_0039: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_003d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0042: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Distinct(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2) - IL_0047: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_004c: call int32 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Length(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0051: dup - IL_0052: stsfld int32 ''.$Linq101Aggregates01::uniqueFactors@10 - IL_0057: stloc.1 + IL_003e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Distinct(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2) + IL_0048: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_004d: call int32 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Length(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0052: dup + IL_0053: stsfld int32 ''.$Linq101Aggregates01::uniqueFactors@10 + IL_0058: stloc.1 .line 17,17 : 1,47 '' - IL_0058: ldc.i4.5 - IL_0059: ldc.i4.4 - IL_005a: ldc.i4.1 - IL_005b: ldc.i4.3 - IL_005c: ldc.i4.s 9 - IL_005e: ldc.i4.8 - IL_005f: ldc.i4.6 - IL_0060: ldc.i4.7 - IL_0061: ldc.i4.2 - IL_0062: ldc.i4.0 - IL_0063: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0068: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0059: ldc.i4.5 + IL_005a: ldc.i4.4 + IL_005b: ldc.i4.1 + IL_005c: ldc.i4.3 + IL_005d: ldc.i4.s 9 + IL_005f: ldc.i4.8 + IL_0060: ldc.i4.6 + IL_0061: ldc.i4.7 + IL_0062: ldc.i4.2 + IL_0063: ldc.i4.0 + IL_0064: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0069: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_006d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_006e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0072: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0077: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0078: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_007c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_007d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0081: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0082: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0086: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0087: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_008b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_008c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0090: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0091: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0095: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0096: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_009a: dup - IL_009b: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers@17 - IL_00a0: stloc.2 - IL_00a1: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_00a6: stloc.s V_21 - IL_00a8: ldloc.s V_21 - IL_00aa: stloc.s V_22 - IL_00ac: ldc.i4.0 + IL_009b: dup + IL_009c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers@17 + IL_00a1: stloc.2 + IL_00a2: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_00a7: stloc.s V_21 + IL_00a9: ldloc.s V_21 + IL_00ab: stloc.s V_22 IL_00ad: ldc.i4.0 - IL_00ae: ldnull - IL_00af: ldc.i4.0 + IL_00ae: ldc.i4.0 + IL_00af: ldnull IL_00b0: ldc.i4.0 - IL_00b1: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, + IL_00b1: ldc.i4.0 + IL_00b2: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_00b6: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_00bb: stloc.s V_23 - IL_00bd: newobj instance void Linq101Aggregates01/'numSum@22-1'::.ctor() - IL_00c2: stloc.s V_24 - IL_00c4: ldloc.s V_23 - IL_00c6: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_00cb: stloc.s V_25 - IL_00cd: ldloc.s V_25 - IL_00cf: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_00d4: stloc.s V_26 - .try - { - IL_00d6: ldc.i4.0 - IL_00d7: stloc.s V_28 - IL_00d9: ldloc.s V_26 - IL_00db: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_00e0: brfalse.s IL_00f8 - - .line 22,22 : 9,16 '' - IL_00e2: ldloc.s V_28 - IL_00e4: ldloc.s V_24 - IL_00e6: ldloc.s V_26 - IL_00e8: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_00ed: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_00f2: add.ovf - IL_00f3: stloc.s V_28 - .line 100001,100001 : 0,0 '' - IL_00f5: nop - IL_00f6: br.s IL_00d9 - - IL_00f8: ldloc.s V_28 - IL_00fa: stloc.s V_27 - IL_00fc: leave.s IL_011c - - } // end .try - finally - { - IL_00fe: ldloc.s V_26 - IL_0100: isinst [mscorlib]System.IDisposable - IL_0105: stloc.s V_29 - IL_0107: ldloc.s V_29 - IL_0109: brfalse.s IL_010d + IL_00b7: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_00bc: stloc.s V_23 + IL_00be: newobj instance void Linq101Aggregates01/'numSum@22-1'::.ctor() + IL_00c3: stloc.s V_24 + IL_00c5: ldloc.s V_23 + IL_00c7: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_00cc: stloc.s V_25 + IL_00ce: ldloc.s V_25 + IL_00d0: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_00d5: brfalse.s IL_00d9 + + IL_00d7: br.s IL_00e4 - IL_010b: br.s IL_010f - - IL_010d: br.s IL_0119 + .line 100001,100001 : 0,0 '' + IL_00d9: ldstr "source" + IL_00de: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_00e3: throw - .line 100001,100001 : 0,0 '' - IL_010f: ldloc.s V_29 - IL_0111: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0116: ldnull - IL_0117: pop - IL_0118: endfinally - .line 100001,100001 : 0,0 '' - IL_0119: ldnull - IL_011a: pop - IL_011b: endfinally - .line 100001,100001 : 0,0 '' - } // end handler - IL_011c: ldloc.s V_27 - IL_011e: dup - IL_011f: stsfld int32 ''.$Linq101Aggregates01::numSum@19 - IL_0124: stloc.3 + .line 100001,100001 : 0,0 '' + .line 100001,100001 : 0,0 '' + IL_00e4: nop + IL_00e5: ldloc.s V_25 + IL_00e7: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_00ec: ldloc.s V_24 + IL_00ee: newobj instance void Linq101Aggregates01/'numSum@22-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_00f3: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_00f8: dup + IL_00f9: stsfld int32 ''.$Linq101Aggregates01::numSum@19 + IL_00fe: stloc.3 .line 26,26 : 1,45 '' - IL_0125: ldstr "cherry" - IL_012a: ldstr "apple" - IL_012f: ldstr "blueberry" - IL_0134: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0139: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_00ff: ldstr "cherry" + IL_0104: ldstr "apple" + IL_0109: ldstr "blueberry" + IL_010e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0113: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_013e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0118: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0143: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_011d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0148: dup - IL_0149: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::words@26 - IL_014e: stloc.s words - IL_0150: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0155: stloc.s V_30 - IL_0157: ldloc.s V_30 - IL_0159: stloc.s V_31 - IL_015b: ldnull - IL_015c: ldnull - IL_015d: ldnull - IL_015e: ldc.i4.0 - IL_015f: ldnull - IL_0160: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, + IL_0122: dup + IL_0123: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::words@26 + IL_0128: stloc.s words + IL_012a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_012f: stloc.s V_26 + IL_0131: ldloc.s V_26 + IL_0133: stloc.s V_27 + IL_0135: ldnull + IL_0136: ldnull + IL_0137: ldnull + IL_0138: ldc.i4.0 + IL_0139: ldnull + IL_013a: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_0165: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_016a: stloc.s V_32 - IL_016c: newobj instance void Linq101Aggregates01/'totalChars@31-1'::.ctor() - IL_0171: stloc.s V_33 - IL_0173: ldloc.s V_32 - IL_0175: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_017a: stloc.s V_34 - IL_017c: ldloc.s V_34 - IL_017e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0183: stloc.s V_35 - .try - { - IL_0185: ldc.i4.0 - IL_0186: stloc.s V_37 - IL_0188: ldloc.s V_35 - IL_018a: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_018f: brfalse.s IL_01a7 - - .line 31,31 : 9,25 '' - IL_0191: ldloc.s V_37 - IL_0193: ldloc.s V_33 - IL_0195: ldloc.s V_35 - IL_0197: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_019c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_01a1: add.ovf - IL_01a2: stloc.s V_37 - .line 100001,100001 : 0,0 '' - IL_01a4: nop - IL_01a5: br.s IL_0188 - - IL_01a7: ldloc.s V_37 - IL_01a9: stloc.s V_36 - IL_01ab: leave.s IL_01cb + IL_013f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0144: stloc.s V_28 + IL_0146: newobj instance void Linq101Aggregates01/'totalChars@31-1'::.ctor() + IL_014b: stloc.s V_29 + IL_014d: ldloc.s V_28 + IL_014f: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_0154: stloc.s V_30 + IL_0156: ldloc.s V_30 + IL_0158: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_015d: brfalse.s IL_0161 + + IL_015f: br.s IL_016c - } // end .try - finally - { - IL_01ad: ldloc.s V_35 - IL_01af: isinst [mscorlib]System.IDisposable - IL_01b4: stloc.s V_38 - IL_01b6: ldloc.s V_38 - IL_01b8: brfalse.s IL_01bc - - IL_01ba: br.s IL_01be - - IL_01bc: br.s IL_01c8 + .line 100001,100001 : 0,0 '' + IL_0161: ldstr "source" + IL_0166: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_016b: throw - .line 100001,100001 : 0,0 '' - IL_01be: ldloc.s V_38 - IL_01c0: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_01c5: ldnull - IL_01c6: pop - IL_01c7: endfinally - .line 100001,100001 : 0,0 '' - IL_01c8: ldnull - IL_01c9: pop - IL_01ca: endfinally - .line 100001,100001 : 0,0 '' - } // end handler - IL_01cb: ldloc.s V_36 - IL_01cd: dup - IL_01ce: stsfld int32 ''.$Linq101Aggregates01::totalChars@28 - IL_01d3: stloc.s totalChars + .line 100001,100001 : 0,0 '' + .line 100001,100001 : 0,0 '' + IL_016c: nop + IL_016d: ldloc.s V_30 + IL_016f: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0174: ldloc.s V_29 + IL_0176: newobj instance void Linq101Aggregates01/'totalChars@31-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_017b: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0180: dup + IL_0181: stsfld int32 ''.$Linq101Aggregates01::totalChars@28 + IL_0186: stloc.s totalChars .line 35,35 : 1,32 '' - IL_01d5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [Utils]Utils::getProductList() - IL_01da: dup - IL_01db: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::products@35 - IL_01e0: stloc.s products + IL_0188: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [Utils]Utils::getProductList() + IL_018d: dup + IL_018e: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::products@35 + IL_0193: stloc.s products .line 37,46 : 1,21 '' - IL_01e2: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_01e7: stloc.s V_39 - IL_01e9: ldloc.s V_39 - IL_01eb: ldloc.s V_39 - IL_01ed: ldloc.s V_39 - IL_01ef: ldloc.s V_39 - IL_01f1: ldloc.s V_39 - IL_01f3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_01f8: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_01fd: ldloc.s V_39 - IL_01ff: newobj instance void Linq101Aggregates01/categories@39::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0204: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0195: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_019a: stloc.s V_31 + IL_019c: ldloc.s V_31 + IL_019e: ldloc.s V_31 + IL_01a0: ldloc.s V_31 + IL_01a2: ldloc.s V_31 + IL_01a4: ldloc.s V_31 + IL_01a6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_01ab: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_01b0: ldloc.s V_31 + IL_01b2: newobj instance void Linq101Aggregates01/categories@39::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_01b7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0209: newobj instance void Linq101Aggregates01/'categories@40-1'::.ctor() - IL_020e: newobj instance void Linq101Aggregates01/'categories@40-2'::.ctor() - IL_0213: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_01bc: newobj instance void Linq101Aggregates01/'categories@40-1'::.ctor() + IL_01c1: newobj instance void Linq101Aggregates01/'categories@40-2'::.ctor() + IL_01c6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0218: ldloc.s V_39 - IL_021a: newobj instance void Linq101Aggregates01/'categories@40-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_021f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,int32>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_01cb: ldloc.s V_31 + IL_01cd: newobj instance void Linq101Aggregates01/'categories@40-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_01d2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,int32>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0224: newobj instance void Linq101Aggregates01/'categories@45-4'::.ctor() - IL_0229: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,int32>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_01d7: newobj instance void Linq101Aggregates01/'categories@45-4'::.ctor() + IL_01dc: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,int32>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_022e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0233: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0238: dup - IL_0239: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories@37 - IL_023e: stloc.s categories - IL_0240: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0245: stloc.s V_40 - IL_0247: ldloc.s V_40 - IL_0249: ldc.i4.0 - IL_024a: ldc.i4.0 - IL_024b: ldnull - IL_024c: ldc.i4.0 - IL_024d: ldc.i4.0 - IL_024e: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, + IL_01e1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_01e6: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_01eb: dup + IL_01ec: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories@37 + IL_01f1: stloc.s categories + IL_01f3: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_01f8: stloc.s V_32 + IL_01fa: ldloc.s V_32 + IL_01fc: ldc.i4.0 + IL_01fd: ldc.i4.0 + IL_01fe: ldnull + IL_01ff: ldc.i4.0 + IL_0200: ldc.i4.0 + IL_0201: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_0253: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0258: newobj instance void Linq101Aggregates01/'minNum@49-1'::.ctor() - IL_025d: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0206: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_020b: newobj instance void Linq101Aggregates01/'minNum@49-1'::.ctor() + IL_0210: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0262: dup - IL_0263: stsfld int32 ''.$Linq101Aggregates01::minNum@49 - IL_0268: stloc.s minNum - IL_026a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_026f: stloc.s V_41 - IL_0271: ldloc.s V_41 - IL_0273: ldnull - IL_0274: ldnull - IL_0275: ldnull - IL_0276: ldc.i4.0 - IL_0277: ldnull - IL_0278: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, + IL_0215: dup + IL_0216: stsfld int32 ''.$Linq101Aggregates01::minNum@49 + IL_021b: stloc.s minNum + IL_021d: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0222: stloc.s V_33 + IL_0224: ldloc.s V_33 + IL_0226: ldnull + IL_0227: ldnull + IL_0228: ldnull + IL_0229: ldc.i4.0 + IL_022a: ldnull + IL_022b: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_027d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0282: newobj instance void Linq101Aggregates01/'shortestWord@52-1'::.ctor() - IL_0287: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0230: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0235: newobj instance void Linq101Aggregates01/'shortestWord@52-1'::.ctor() + IL_023a: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_028c: dup - IL_028d: stsfld int32 ''.$Linq101Aggregates01::shortestWord@52 - IL_0292: stloc.s shortestWord + IL_023f: dup + IL_0240: stsfld int32 ''.$Linq101Aggregates01::shortestWord@52 + IL_0245: stloc.s shortestWord .line 55,61 : 1,21 '' - IL_0294: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0299: stloc.s V_42 - IL_029b: ldloc.s V_42 - IL_029d: ldloc.s V_42 - IL_029f: ldloc.s V_42 - IL_02a1: ldloc.s V_42 - IL_02a3: ldloc.s V_42 - IL_02a5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_02aa: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_02af: ldloc.s V_42 - IL_02b1: newobj instance void Linq101Aggregates01/categories2@57::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_02b6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0247: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_024c: stloc.s V_34 + IL_024e: ldloc.s V_34 + IL_0250: ldloc.s V_34 + IL_0252: ldloc.s V_34 + IL_0254: ldloc.s V_34 + IL_0256: ldloc.s V_34 + IL_0258: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_025d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0262: ldloc.s V_34 + IL_0264: newobj instance void Linq101Aggregates01/categories2@57::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0269: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_02bb: newobj instance void Linq101Aggregates01/'categories2@58-1'::.ctor() - IL_02c0: newobj instance void Linq101Aggregates01/'categories2@58-2'::.ctor() - IL_02c5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_026e: newobj instance void Linq101Aggregates01/'categories2@58-1'::.ctor() + IL_0273: newobj instance void Linq101Aggregates01/'categories2@58-2'::.ctor() + IL_0278: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_02ca: ldloc.s V_42 - IL_02cc: newobj instance void Linq101Aggregates01/'categories2@58-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_02d1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_027d: ldloc.s V_34 + IL_027f: newobj instance void Linq101Aggregates01/'categories2@58-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0284: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_02d6: newobj instance void Linq101Aggregates01/'categories2@60-4'::.ctor() - IL_02db: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0289: newobj instance void Linq101Aggregates01/'categories2@60-4'::.ctor() + IL_028e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_02e0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_02e5: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_02ea: dup - IL_02eb: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories2@55 - IL_02f0: stloc.s categories2 + IL_0293: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_0298: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_029d: dup + IL_029e: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories2@55 + IL_02a3: stloc.s categories2 .line 64,71 : 1,21 '' - IL_02f2: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_02f7: stloc.s V_43 - IL_02f9: ldloc.s V_43 - IL_02fb: ldloc.s V_43 - IL_02fd: ldloc.s V_43 - IL_02ff: ldloc.s V_43 - IL_0301: ldloc.s V_43 - IL_0303: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_0308: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_030d: ldloc.s V_43 - IL_030f: newobj instance void Linq101Aggregates01/categories3@66::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0314: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02a5: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_02aa: stloc.s V_35 + IL_02ac: ldloc.s V_35 + IL_02ae: ldloc.s V_35 + IL_02b0: ldloc.s V_35 + IL_02b2: ldloc.s V_35 + IL_02b4: ldloc.s V_35 + IL_02b6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_02bb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_02c0: ldloc.s V_35 + IL_02c2: newobj instance void Linq101Aggregates01/categories3@66::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_02c7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0319: newobj instance void Linq101Aggregates01/'categories3@67-1'::.ctor() - IL_031e: newobj instance void Linq101Aggregates01/'categories3@67-2'::.ctor() - IL_0323: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02cc: newobj instance void Linq101Aggregates01/'categories3@67-1'::.ctor() + IL_02d1: newobj instance void Linq101Aggregates01/'categories3@67-2'::.ctor() + IL_02d6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0328: ldloc.s V_43 - IL_032a: newobj instance void Linq101Aggregates01/'categories3@67-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_032f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02db: ldloc.s V_35 + IL_02dd: newobj instance void Linq101Aggregates01/'categories3@67-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_02e2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0334: newobj instance void Linq101Aggregates01/'categories3@70-4'::.ctor() - IL_0339: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02e7: newobj instance void Linq101Aggregates01/'categories3@70-4'::.ctor() + IL_02ec: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_033e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0343: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0348: dup - IL_0349: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories3@64 - IL_034e: stloc.s categories3 - IL_0350: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0355: stloc.s V_44 - IL_0357: ldloc.s V_44 - IL_0359: ldc.i4.0 - IL_035a: ldc.i4.0 - IL_035b: ldnull - IL_035c: ldc.i4.0 - IL_035d: ldc.i4.0 - IL_035e: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, + IL_02f1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_02f6: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_02fb: dup + IL_02fc: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories3@64 + IL_0301: stloc.s categories3 + IL_0303: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0308: stloc.s V_36 + IL_030a: ldloc.s V_36 + IL_030c: ldc.i4.0 + IL_030d: ldc.i4.0 + IL_030e: ldnull + IL_030f: ldc.i4.0 + IL_0310: ldc.i4.0 + IL_0311: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_0363: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0368: newobj instance void Linq101Aggregates01/'maxNum@74-1'::.ctor() - IL_036d: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0316: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_031b: newobj instance void Linq101Aggregates01/'maxNum@74-1'::.ctor() + IL_0320: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0372: dup - IL_0373: stsfld int32 ''.$Linq101Aggregates01::maxNum@74 - IL_0378: stloc.s maxNum - IL_037a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_037f: stloc.s V_45 - IL_0381: ldloc.s V_45 - IL_0383: ldnull - IL_0384: ldnull - IL_0385: ldnull - IL_0386: ldc.i4.0 - IL_0387: ldnull - IL_0388: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, + IL_0325: dup + IL_0326: stsfld int32 ''.$Linq101Aggregates01::maxNum@74 + IL_032b: stloc.s maxNum + IL_032d: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0332: stloc.s V_37 + IL_0334: ldloc.s V_37 + IL_0336: ldnull + IL_0337: ldnull + IL_0338: ldnull + IL_0339: ldc.i4.0 + IL_033a: ldnull + IL_033b: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_038d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0392: newobj instance void Linq101Aggregates01/'longestLength@77-1'::.ctor() - IL_0397: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0340: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0345: newobj instance void Linq101Aggregates01/'longestLength@77-1'::.ctor() + IL_034a: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_039c: dup - IL_039d: stsfld int32 ''.$Linq101Aggregates01::longestLength@77 - IL_03a2: stloc.s longestLength + IL_034f: dup + IL_0350: stsfld int32 ''.$Linq101Aggregates01::longestLength@77 + IL_0355: stloc.s longestLength .line 80,86 : 1,21 '' - IL_03a4: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_03a9: stloc.s V_46 - IL_03ab: ldloc.s V_46 - IL_03ad: ldloc.s V_46 - IL_03af: ldloc.s V_46 - IL_03b1: ldloc.s V_46 - IL_03b3: ldloc.s V_46 - IL_03b5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_03ba: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_03bf: ldloc.s V_46 - IL_03c1: newobj instance void Linq101Aggregates01/categories4@82::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_03c6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0357: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_035c: stloc.s V_38 + IL_035e: ldloc.s V_38 + IL_0360: ldloc.s V_38 + IL_0362: ldloc.s V_38 + IL_0364: ldloc.s V_38 + IL_0366: ldloc.s V_38 + IL_0368: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_036d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0372: ldloc.s V_38 + IL_0374: newobj instance void Linq101Aggregates01/categories4@82::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0379: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_03cb: newobj instance void Linq101Aggregates01/'categories4@83-1'::.ctor() - IL_03d0: newobj instance void Linq101Aggregates01/'categories4@83-2'::.ctor() - IL_03d5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_037e: newobj instance void Linq101Aggregates01/'categories4@83-1'::.ctor() + IL_0383: newobj instance void Linq101Aggregates01/'categories4@83-2'::.ctor() + IL_0388: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_03da: ldloc.s V_46 - IL_03dc: newobj instance void Linq101Aggregates01/'categories4@83-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_03e1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_038d: ldloc.s V_38 + IL_038f: newobj instance void Linq101Aggregates01/'categories4@83-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0394: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_03e6: newobj instance void Linq101Aggregates01/'categories4@85-4'::.ctor() - IL_03eb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0399: newobj instance void Linq101Aggregates01/'categories4@85-4'::.ctor() + IL_039e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_03f0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_03f5: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_03fa: dup - IL_03fb: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories4@80 - IL_0400: stloc.s categories4 + IL_03a3: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_03a8: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_03ad: dup + IL_03ae: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories4@80 + IL_03b3: stloc.s categories4 .line 89,96 : 1,21 '' - IL_0402: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0407: stloc.s V_47 - IL_0409: ldloc.s V_47 - IL_040b: ldloc.s V_47 - IL_040d: ldloc.s V_47 - IL_040f: ldloc.s V_47 - IL_0411: ldloc.s V_47 - IL_0413: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_0418: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_041d: ldloc.s V_47 - IL_041f: newobj instance void Linq101Aggregates01/categories5@91::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0424: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03b5: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_03ba: stloc.s V_39 + IL_03bc: ldloc.s V_39 + IL_03be: ldloc.s V_39 + IL_03c0: ldloc.s V_39 + IL_03c2: ldloc.s V_39 + IL_03c4: ldloc.s V_39 + IL_03c6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_03cb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_03d0: ldloc.s V_39 + IL_03d2: newobj instance void Linq101Aggregates01/categories5@91::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_03d7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0429: newobj instance void Linq101Aggregates01/'categories5@92-1'::.ctor() - IL_042e: newobj instance void Linq101Aggregates01/'categories5@92-2'::.ctor() - IL_0433: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03dc: newobj instance void Linq101Aggregates01/'categories5@92-1'::.ctor() + IL_03e1: newobj instance void Linq101Aggregates01/'categories5@92-2'::.ctor() + IL_03e6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0438: ldloc.s V_47 - IL_043a: newobj instance void Linq101Aggregates01/'categories5@92-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_043f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03eb: ldloc.s V_39 + IL_03ed: newobj instance void Linq101Aggregates01/'categories5@92-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_03f2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0444: newobj instance void Linq101Aggregates01/'categories5@95-4'::.ctor() - IL_0449: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03f7: newobj instance void Linq101Aggregates01/'categories5@95-4'::.ctor() + IL_03fc: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_044e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0453: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0458: dup - IL_0459: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories5@89 - IL_045e: stloc.s categories5 + IL_0401: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_0406: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_040b: dup + IL_040c: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories5@89 + IL_0411: stloc.s categories5 .line 99,99 : 1,66 '' - IL_0460: ldc.r8 5. - IL_0469: ldc.r8 4. - IL_0472: ldc.r8 1. - IL_047b: ldc.r8 3. - IL_0484: ldc.r8 9. - IL_048d: ldc.r8 8. - IL_0496: ldc.r8 6. - IL_049f: ldc.r8 7. - IL_04a8: ldc.r8 2. - IL_04b1: ldc.r8 0.0 - IL_04ba: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_04bf: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0413: ldc.r8 5. + IL_041c: ldc.r8 4. + IL_0425: ldc.r8 1. + IL_042e: ldc.r8 3. + IL_0437: ldc.r8 9. + IL_0440: ldc.r8 8. + IL_0449: ldc.r8 6. + IL_0452: ldc.r8 7. + IL_045b: ldc.r8 2. + IL_0464: ldc.r8 0.0 + IL_046d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0472: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04c4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0477: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04c9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_047c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04ce: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0481: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04d3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0486: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04d8: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_048b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04dd: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0490: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04e2: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0495: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04e7: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_049a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04ec: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_049f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04f1: dup - IL_04f2: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers2@99 - IL_04f7: stloc.s numbers2 - IL_04f9: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_04fe: stloc.s V_48 - IL_0500: ldloc.s V_48 - IL_0502: stloc.s V_49 - IL_0504: ldc.r8 0.0 - IL_050d: ldc.r8 0.0 - IL_0516: ldnull - IL_0517: ldc.i4.0 - IL_0518: ldc.r8 0.0 - IL_0521: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, + IL_04a4: dup + IL_04a5: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers2@99 + IL_04aa: stloc.s numbers2 + IL_04ac: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_04b1: stloc.s V_40 + IL_04b3: ldloc.s V_40 + IL_04b5: stloc.s V_41 + IL_04b7: ldc.r8 0.0 + IL_04c0: ldc.r8 0.0 + IL_04c9: ldnull + IL_04ca: ldc.i4.0 + IL_04cb: ldc.r8 0.0 + IL_04d4: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, float64, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, float64) - IL_0526: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_052b: stloc.s V_50 - IL_052d: newobj instance void Linq101Aggregates01/'averageNum@100-1'::.ctor() - IL_0532: stloc.s V_51 - IL_0534: ldloc.s V_50 - IL_0536: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_053b: stloc.s V_52 - IL_053d: ldloc.s V_52 - IL_053f: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_0544: brfalse.s IL_0548 - - IL_0546: br.s IL_0553 + IL_04d9: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_04de: stloc.s V_42 + IL_04e0: newobj instance void Linq101Aggregates01/'averageNum@100-1'::.ctor() + IL_04e5: stloc.s V_43 + IL_04e7: ldloc.s V_42 + IL_04e9: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_04ee: stloc.s V_44 + IL_04f0: ldloc.s V_44 + IL_04f2: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_04f7: brfalse.s IL_04fb + + IL_04f9: br.s IL_0506 .line 100001,100001 : 0,0 '' - IL_0548: ldstr "source" - IL_054d: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_0552: throw + IL_04fb: ldstr "source" + IL_0500: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_0505: throw .line 100001,100001 : 0,0 '' - IL_0553: nop - IL_0554: ldloc.s V_52 - IL_0556: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_055b: stloc.s V_53 + .line 100001,100001 : 0,0 '' + IL_0506: nop + IL_0507: ldloc.s V_44 + IL_0509: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_050e: stloc.s V_45 .try { - IL_055d: ldc.r8 0.0 - IL_0566: stloc.s V_55 - IL_0568: ldc.i4.0 - IL_0569: stloc.s V_56 - IL_056b: ldloc.s V_53 - IL_056d: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0572: brfalse.s IL_0590 - - IL_0574: ldloc.s V_55 - IL_0576: ldloc.s V_51 - IL_0578: ldloc.s V_53 - IL_057a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_057f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0584: add - IL_0585: stloc.s V_55 + IL_0510: ldc.r8 0.0 + IL_0519: stloc.s V_47 + IL_051b: ldc.i4.0 + IL_051c: stloc.s V_48 + IL_051e: ldloc.s V_45 + IL_0520: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0525: brfalse.s IL_0543 + + IL_0527: ldloc.s V_47 + IL_0529: ldloc.s V_43 + IL_052b: ldloc.s V_45 + IL_052d: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0532: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0537: add + IL_0538: stloc.s V_47 .line 100,100 : 47,58 '' - IL_0587: ldloc.s V_56 - IL_0589: ldc.i4.1 - IL_058a: add - IL_058b: stloc.s V_56 + IL_053a: ldloc.s V_48 + IL_053c: ldc.i4.1 + IL_053d: add + IL_053e: stloc.s V_48 .line 100001,100001 : 0,0 '' - IL_058d: nop - IL_058e: br.s IL_056b + IL_0540: nop + IL_0541: br.s IL_051e - IL_0590: ldloc.s V_56 - IL_0592: brtrue.s IL_0596 + IL_0543: ldloc.s V_48 + IL_0545: brtrue.s IL_0549 - IL_0594: br.s IL_0598 + IL_0547: br.s IL_054b - IL_0596: br.s IL_05a3 + IL_0549: br.s IL_0556 .line 100001,100001 : 0,0 '' - IL_0598: ldstr "source" - IL_059d: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_05a2: throw + IL_054b: ldstr "source" + IL_0550: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_0555: throw .line 100001,100001 : 0,0 '' - IL_05a3: nop - IL_05a4: ldloc.s V_55 - IL_05a6: stloc.s V_57 - IL_05a8: ldloc.s V_56 - IL_05aa: stloc.s V_58 - IL_05ac: ldloc.s V_57 - IL_05ae: ldloc.s V_58 - IL_05b0: conv.r8 - IL_05b1: div - IL_05b2: stloc.s V_54 - IL_05b4: leave.s IL_05d4 + .line 100001,100001 : 0,0 '' + IL_0556: nop + IL_0557: ldloc.s V_47 + IL_0559: stloc.s V_49 + IL_055b: ldloc.s V_48 + IL_055d: stloc.s V_50 + IL_055f: ldloc.s V_49 + IL_0561: ldloc.s V_50 + IL_0563: conv.r8 + IL_0564: div + IL_0565: stloc.s V_46 + IL_0567: leave.s IL_0587 } // end .try finally { - IL_05b6: ldloc.s V_53 - IL_05b8: isinst [mscorlib]System.IDisposable - IL_05bd: stloc.s V_59 - IL_05bf: ldloc.s V_59 - IL_05c1: brfalse.s IL_05c5 + IL_0569: ldloc.s V_45 + IL_056b: isinst [mscorlib]System.IDisposable + IL_0570: stloc.s V_51 + IL_0572: ldloc.s V_51 + IL_0574: brfalse.s IL_0578 - IL_05c3: br.s IL_05c7 + IL_0576: br.s IL_057a - IL_05c5: br.s IL_05d1 + IL_0578: br.s IL_0584 .line 100001,100001 : 0,0 '' - IL_05c7: ldloc.s V_59 - IL_05c9: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_05ce: ldnull - IL_05cf: pop - IL_05d0: endfinally + IL_057a: ldloc.s V_51 + IL_057c: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0581: ldnull + IL_0582: pop + IL_0583: endfinally .line 100001,100001 : 0,0 '' - IL_05d1: ldnull - IL_05d2: pop - IL_05d3: endfinally + IL_0584: ldnull + IL_0585: pop + IL_0586: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_05d4: ldloc.s V_54 - IL_05d6: dup - IL_05d7: stsfld float64 ''.$Linq101Aggregates01::averageNum@100 - IL_05dc: stloc.s averageNum - IL_05de: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_05e3: stloc.s V_60 - IL_05e5: ldloc.s V_60 - IL_05e7: stloc.s V_61 - IL_05e9: ldloc.s V_60 - IL_05eb: ldloc.s V_60 - IL_05ed: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_words() - IL_05f2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_05f7: ldloc.s V_60 - IL_05f9: newobj instance void Linq101Aggregates01/averageLength@105::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_05fe: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0587: ldloc.s V_46 + IL_0589: dup + IL_058a: stsfld float64 ''.$Linq101Aggregates01::averageNum@100 + IL_058f: stloc.s averageNum + IL_0591: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0596: stloc.s V_52 + IL_0598: ldloc.s V_52 + IL_059a: stloc.s V_53 + IL_059c: ldloc.s V_52 + IL_059e: ldloc.s V_52 + IL_05a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_words() + IL_05a5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_05aa: ldloc.s V_52 + IL_05ac: newobj instance void Linq101Aggregates01/averageLength@105::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_05b1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0603: stloc.s V_62 - IL_0605: newobj instance void Linq101Aggregates01/'averageLength@107-1'::.ctor() - IL_060a: stloc.s V_63 - IL_060c: ldloc.s V_62 - IL_060e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0613: stloc.s V_64 - IL_0615: ldloc.s V_64 - IL_0617: box class [mscorlib]System.Collections.Generic.IEnumerable`1> - IL_061c: brfalse.s IL_0620 - - IL_061e: br.s IL_062b + IL_05b6: stloc.s V_54 + IL_05b8: newobj instance void Linq101Aggregates01/'averageLength@107-1'::.ctor() + IL_05bd: stloc.s V_55 + IL_05bf: ldloc.s V_54 + IL_05c1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_05c6: stloc.s V_56 + IL_05c8: ldloc.s V_56 + IL_05ca: box class [mscorlib]System.Collections.Generic.IEnumerable`1> + IL_05cf: brfalse.s IL_05d3 + + IL_05d1: br.s IL_05de .line 100001,100001 : 0,0 '' - IL_0620: ldstr "source" - IL_0625: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_062a: throw + IL_05d3: ldstr "source" + IL_05d8: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_05dd: throw .line 100001,100001 : 0,0 '' - IL_062b: nop - IL_062c: ldloc.s V_64 - IL_062e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1>::GetEnumerator() - IL_0633: stloc.s V_65 + .line 100001,100001 : 0,0 '' + IL_05de: nop + IL_05df: ldloc.s V_56 + IL_05e1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1>::GetEnumerator() + IL_05e6: stloc.s V_57 .try { - IL_0635: ldc.r8 0.0 - IL_063e: stloc.s V_67 - IL_0640: ldc.i4.0 - IL_0641: stloc.s V_68 - IL_0643: ldloc.s V_65 - IL_0645: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_064a: brfalse.s IL_0668 - - IL_064c: ldloc.s V_67 - IL_064e: ldloc.s V_63 - IL_0650: ldloc.s V_65 - IL_0652: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1>::get_Current() - IL_0657: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64>::Invoke(!0) - IL_065c: add - IL_065d: stloc.s V_67 + IL_05e8: ldc.r8 0.0 + IL_05f1: stloc.s V_59 + IL_05f3: ldc.i4.0 + IL_05f4: stloc.s V_60 + IL_05f6: ldloc.s V_57 + IL_05f8: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_05fd: brfalse.s IL_061b + + IL_05ff: ldloc.s V_59 + IL_0601: ldloc.s V_55 + IL_0603: ldloc.s V_57 + IL_0605: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1>::get_Current() + IL_060a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64>::Invoke(!0) + IL_060f: add + IL_0610: stloc.s V_59 .line 107,107 : 9,21 '' - IL_065f: ldloc.s V_68 - IL_0661: ldc.i4.1 - IL_0662: add - IL_0663: stloc.s V_68 + IL_0612: ldloc.s V_60 + IL_0614: ldc.i4.1 + IL_0615: add + IL_0616: stloc.s V_60 .line 100001,100001 : 0,0 '' - IL_0665: nop - IL_0666: br.s IL_0643 + IL_0618: nop + IL_0619: br.s IL_05f6 - IL_0668: ldloc.s V_68 - IL_066a: brtrue.s IL_066e + IL_061b: ldloc.s V_60 + IL_061d: brtrue.s IL_0621 - IL_066c: br.s IL_0670 + IL_061f: br.s IL_0623 - IL_066e: br.s IL_067b + IL_0621: br.s IL_062e .line 100001,100001 : 0,0 '' - IL_0670: ldstr "source" - IL_0675: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_067a: throw + IL_0623: ldstr "source" + IL_0628: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_062d: throw .line 100001,100001 : 0,0 '' - IL_067b: nop - IL_067c: ldloc.s V_67 - IL_067e: stloc.s V_69 - IL_0680: ldloc.s V_68 - IL_0682: stloc.s V_70 - IL_0684: ldloc.s V_69 - IL_0686: ldloc.s V_70 - IL_0688: conv.r8 - IL_0689: div - IL_068a: stloc.s V_66 - IL_068c: leave.s IL_06ac + .line 100001,100001 : 0,0 '' + IL_062e: nop + IL_062f: ldloc.s V_59 + IL_0631: stloc.s V_61 + IL_0633: ldloc.s V_60 + IL_0635: stloc.s V_62 + IL_0637: ldloc.s V_61 + IL_0639: ldloc.s V_62 + IL_063b: conv.r8 + IL_063c: div + IL_063d: stloc.s V_58 + IL_063f: leave.s IL_065f } // end .try finally { - IL_068e: ldloc.s V_65 - IL_0690: isinst [mscorlib]System.IDisposable - IL_0695: stloc.s V_71 - IL_0697: ldloc.s V_71 - IL_0699: brfalse.s IL_069d + IL_0641: ldloc.s V_57 + IL_0643: isinst [mscorlib]System.IDisposable + IL_0648: stloc.s V_63 + IL_064a: ldloc.s V_63 + IL_064c: brfalse.s IL_0650 - IL_069b: br.s IL_069f + IL_064e: br.s IL_0652 - IL_069d: br.s IL_06a9 + IL_0650: br.s IL_065c .line 100001,100001 : 0,0 '' - IL_069f: ldloc.s V_71 - IL_06a1: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_06a6: ldnull - IL_06a7: pop - IL_06a8: endfinally + IL_0652: ldloc.s V_63 + IL_0654: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0659: ldnull + IL_065a: pop + IL_065b: endfinally .line 100001,100001 : 0,0 '' - IL_06a9: ldnull - IL_06aa: pop - IL_06ab: endfinally + IL_065c: ldnull + IL_065d: pop + IL_065e: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_06ac: ldloc.s V_66 - IL_06ae: dup - IL_06af: stsfld float64 ''.$Linq101Aggregates01::averageLength@103 - IL_06b4: stloc.s averageLength + IL_065f: ldloc.s V_58 + IL_0661: dup + IL_0662: stsfld float64 ''.$Linq101Aggregates01::averageLength@103 + IL_0667: stloc.s averageLength .line 111,117 : 1,21 '' - IL_06b6: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_06bb: stloc.s V_72 - IL_06bd: ldloc.s V_72 - IL_06bf: ldloc.s V_72 - IL_06c1: ldloc.s V_72 - IL_06c3: ldloc.s V_72 - IL_06c5: ldloc.s V_72 - IL_06c7: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_06cc: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_06d1: ldloc.s V_72 - IL_06d3: newobj instance void Linq101Aggregates01/categories6@113::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_06d8: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0669: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_066e: stloc.s V_64 + IL_0670: ldloc.s V_64 + IL_0672: ldloc.s V_64 + IL_0674: ldloc.s V_64 + IL_0676: ldloc.s V_64 + IL_0678: ldloc.s V_64 + IL_067a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_067f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0684: ldloc.s V_64 + IL_0686: newobj instance void Linq101Aggregates01/categories6@113::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_068b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_06dd: newobj instance void Linq101Aggregates01/'categories6@114-1'::.ctor() - IL_06e2: newobj instance void Linq101Aggregates01/'categories6@114-2'::.ctor() - IL_06e7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0690: newobj instance void Linq101Aggregates01/'categories6@114-1'::.ctor() + IL_0695: newobj instance void Linq101Aggregates01/'categories6@114-2'::.ctor() + IL_069a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_06ec: ldloc.s V_72 - IL_06ee: newobj instance void Linq101Aggregates01/'categories6@114-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_06f3: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_069f: ldloc.s V_64 + IL_06a1: newobj instance void Linq101Aggregates01/'categories6@114-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_06a6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_06f8: newobj instance void Linq101Aggregates01/'categories6@116-4'::.ctor() - IL_06fd: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_06ab: newobj instance void Linq101Aggregates01/'categories6@116-4'::.ctor() + IL_06b0: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0702: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0707: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_070c: dup - IL_070d: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories6@111 - IL_0712: stloc.s categories6 - IL_0714: ret + IL_06b5: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_06ba: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_06bf: dup + IL_06c0: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories6@111 + IL_06c5: stloc.s categories6 + IL_06c7: ret } // end of method $Linq101Aggregates01::main@ } // end of class ''.$Linq101Aggregates01 From ce84fa157f8877e355090f40202aed2745a3b0aa Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 17 Aug 2017 19:26:01 +1000 Subject: [PATCH 095/120] Code review changes from dsyme Per https://github.com/Microsoft/visualfsharp/pull/2745#pullrequestreview-56398032 --- src/fsharp/FSharp.Core/iseq.fs | 283 +++++++++++++++++++-------------- 1 file changed, 165 insertions(+), 118 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index eef8522082b..1e9d75602bf 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -20,48 +20,56 @@ namespace Microsoft.FSharp.Collections module ISeq = open IEnumerator + /// Base classes and helpers for object expressions that represent the Activitys in + /// the ISeq chain module Core = + /// Single value Tuple. + /// Allows null reference type values as key in Dictionary. [] - type Value<'a> = - val mutable _1 : 'a - new (a:'a) = { _1 = a } + type Value<'T> = + val mutable _1 : 'T + new (a:'T) = { _1 = a } + /// 2-Value Tuple. [] - type Values<'a,'b> = - val mutable _1 : 'a - val mutable _2 : 'b - new (a:'a, b: 'b) = { _1 = a; _2 = b } + type Values<'T1,'T2> = + val mutable _1 : 'T1 + val mutable _2 : 'T2 + new (a:'T1, b: 'T2) = { _1 = a; _2 = b } + /// 3-Value Tuple. [] - type Values<'a,'b,'c> = - val mutable _1 : 'a - val mutable _2 : 'b - val mutable _3 : 'c - new (a:'a, b:'b, c:'c) = { _1 = a; _2 = b; _3 = c } + type Values<'T1,'T2,'T3> = + val mutable _1 : 'T1 + val mutable _2 : 'T2 + val mutable _3 : 'T3 + new (a:'T1, b:'T2, c:'T3) = { _1 = a; _2 = b; _3 = c } + /// Base class for chaining mapping or filtering operation within the ISeq pipeline [] type Transform<'T,'U,'State> = inherit Activity<'T,'U> - + new (next:Activity, initState:'State) = { - inherit Activity<'T,'U> () State = initState Next = next } - - val mutable State : 'State - val Next : Activity + + val mutable State : 'State + val Next : Activity override this.ChainComplete terminatingIdx = this.Next.ChainComplete terminatingIdx override this.ChainDispose () = this.Next.ChainDispose () + /// Base class for chaining mapping or filtering operation that require some post processing + /// (i.e. Disposal and/or post conditional checks) within the ISeq pipeline [] type TransformWithPostProcessing<'T,'U,'State>(next:Activity, initState:'State) = inherit Transform<'T,'U,'State>(next, initState) - abstract OnComplete : PipeIdx -> unit + abstract OnComplete : pipeIdx:PipeIdx -> unit abstract OnDispose : unit -> unit override this.ChainComplete terminatingIdx = @@ -71,6 +79,7 @@ namespace Microsoft.FSharp.Collections try this.OnDispose () finally this.Next.ChainDispose () + /// Base class for folding operation within the ISeq pipeline [] type FolderWithState<'T,'Result,'State> = inherit Folder<'T,'Result> @@ -82,11 +91,13 @@ namespace Microsoft.FSharp.Collections State = initState } + /// Base class for folding operation that require some post processing + /// (i.e. Disposal and/or post conditional checks) within the ISeq pipeline [] type FolderWithPostProcessing<'T,'Result,'State>(initResult,initState) = inherit FolderWithState<'T,'Result,'State>(initResult,initState) - abstract OnComplete : PipeIdx -> unit + abstract OnComplete : pipeIdx:PipeIdx -> unit abstract OnDispose : unit -> unit override this.ChainComplete terminatingIdx = @@ -102,12 +113,16 @@ namespace Microsoft.FSharp.Collections // ineffictive ** let inline avoid boolean = match boolean with true -> true | false -> false - let inline valueComparer<'T when 'T : equality> ()= + let inline valueComparer<'T when 'T : equality> () = let c = HashIdentity.Structural<'T> { new IEqualityComparer> with member __.GetHashCode o = c.GetHashCode o._1 member __.Equals (lhs,rhs) = c.Equals (lhs._1, rhs._1) } + /// Usually the implementation of GetEnumerator is handled by the ISeq<'T>.Fold operation, + /// but there can be cases where it is more efficent to provide a specific IEnumerator, and + /// only defer to the ISeq<'T> interface for its specific operations (this is the case with + /// the scan function) [] type PreferGetEnumerator<'T>() = inherit EnumerableBase<'T>() @@ -126,25 +141,25 @@ namespace Microsoft.FSharp.Collections let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance [] - let singleton<'T> (x:'T) : ISeq<'T> = upcast (new SingletonEnumerable<_>(x)) + let singleton<'T> (x:'T) : ISeq<'T> = new SingletonEnumerable<_>(x) :> _ /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. /// i.e. usually iteration on calls the enumerator provied by GetEnumerator ensure that the /// list hasn't been modified (throwing an exception if it has), but such a check is not - /// performed in this case. If you want this funcitonality, then use the ofSeq function instead. + /// performed in this case. If you want this functionality, then use the ofSeq function instead. [] let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = - upcast (ThinResizeArrayEnumerable<'T> source) + ThinResizeArrayEnumerable<'T> source :> _ [] let ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source - upcast (ThinArrayEnumerable<'T> source) + ThinArrayEnumerable<'T> source :> _ [] let ofList (source:list<'T>) : ISeq<'T> = - upcast source + source :> _ [] let ofSeq (source:seq<'T>) : ISeq<'T> = @@ -152,12 +167,12 @@ namespace Microsoft.FSharp.Collections | :? ISeq<'T> as seq -> seq | :? array<'T> as array -> ofArray array | null -> nullArg "source" - | _ -> upcast (ThinEnumerable<'T> source) + | _ -> ThinEnumerable<'T> source :> _ [] let inline average (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'T,int> (LanguagePrimitives.GenericZero, 0) with + { new FolderWithPostProcessing<'T,'T,int> (LanguagePrimitives.GenericZero, 0) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result value this.State <- this.State + 1 @@ -167,12 +182,13 @@ namespace Microsoft.FSharp.Collections if this.State = 0 then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString this.Result <- LanguagePrimitives.DivideByInt<'T> this.Result this.State - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let inline averageBy (f:'T->'U) (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'U,int>(LanguagePrimitives.GenericZero,0) with + { new FolderWithPostProcessing<'T,'U,int>(LanguagePrimitives.GenericZero,0) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result (f value) this.State <- this.State + 1 @@ -182,12 +198,13 @@ namespace Microsoft.FSharp.Collections if this.State = 0 then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString this.Result <- LanguagePrimitives.DivideByInt<'U> this.Result this.State - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let exactlyOne (source:ISeq<'T>) : 'T = source.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>, Values(true, false)) with + { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>, Values(true, false)) with override this.ProcessNext value = if this.State._1 then this.State._1 <- false @@ -202,7 +219,8 @@ namespace Microsoft.FSharp.Collections invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString elif this.State._2 then invalidArg "source" (SR.GetString SR.inputSequenceTooLong) - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let inline fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:ISeq<'T>) : 'State = @@ -215,7 +233,7 @@ namespace Microsoft.FSharp.Collections [] let inline fold2<'T1,'T2,'State> (folder:'State->'T1->'T2->'State) (state:'State) (source1:ISeq<'T1>) (source2: ISeq<'T2>) = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<_,'State,IEnumerator<'T2>>(state,source2.GetEnumerator()) with + { new FolderWithPostProcessing<_,'State,IEnumerator<'T2>>(state,source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then this.Result <- folder this.Result value this.State.Current @@ -224,21 +242,22 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () - override this.OnDispose () = this.State.Dispose () }) + + override this.OnDispose () = this.State.Dispose () } :> _) [] let unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = - upcast (new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1)) + new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1) :> _ [] let initInfinite<'T> (f:int->'T) : ISeq<'T> = - upcast (new InitEnumerableDecider<'T>(Nullable (), f, 1)) + new InitEnumerableDecider<'T>(Nullable (), f, 1) :> _ [] let init<'T> (count:int) (f:int->'T) : ISeq<'T> = if count < 0 then invalidArgInputMustBeNonNegative "count" count elif count = 0 then empty else - upcast (new InitEnumerableDecider<'T>(Nullable count, f, 1)) + new InitEnumerableDecider<'T>(Nullable count, f, 1) :> _ [] let inline iter f (source:ISeq<'T>) = @@ -251,7 +270,7 @@ namespace Microsoft.FSharp.Collections [] let inline iter2 (f:'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,unit,IEnumerator<'U>> ((),source2.GetEnumerator()) with + { new FolderWithPostProcessing<'T,unit,IEnumerator<'U>> ((),source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then f value this.State.Current @@ -260,12 +279,13 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () - override this.OnDispose () = this.State.Dispose () }) + + override this.OnDispose () = this.State.Dispose () } :> _) [] let inline iteri2 (f:int->'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(0,source2.GetEnumerator())) with + { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(0,source2.GetEnumerator())) with override this.ProcessNext value = if this.State._2.MoveNext() then f this.State._1 value this.State._2.Current @@ -274,8 +294,10 @@ namespace Microsoft.FSharp.Collections else (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> + override this.OnComplete _ = () - override this.OnDispose () = this.State._2.Dispose () }) + + override this.OnDispose () = this.State._2.Dispose () } :> _) [] let tryHead (source:ISeq<'T>) = @@ -295,20 +317,20 @@ namespace Microsoft.FSharp.Collections [] let inline iteri f (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new FolderWithState<'T,unit,int> ((),0) with + { new FolderWithState<'T,unit,int> ((),0) with override this.ProcessNext value = f this.State value this.State <- this.State + 1 - Unchecked.defaultof<_> (* return value unused in Fold context *) }) + Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _) [] let inline except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = checkNonNull "itemsToExclude" itemsToExclude source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with + { new Transform<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with override this.ProcessNext (input:'T) : bool = - this.State.Value.Add input && TailCall.avoid (next.ProcessNext input) }} + this.State.Value.Add input && TailCall.avoid (next.ProcessNext input) } :> _} [] let inline exists f (source:ISeq<'T>) = @@ -323,7 +345,7 @@ namespace Microsoft.FSharp.Collections [] let inline exists2 (predicate:'T->'U->bool) (source1:ISeq<'T>) (source2: ISeq<'U>) : bool = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(false,source2.GetEnumerator()) with + { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(false,source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then if predicate value this.State.Current then @@ -334,7 +356,8 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () - override this.OnDispose () = this.State.Dispose () }) + + override this.OnDispose () = this.State.Dispose () } :> _) [] let inline contains element (source:ISeq<'T>) = @@ -359,7 +382,7 @@ namespace Microsoft.FSharp.Collections [] let inline forall2 predicate (source1:ISeq<'T>) (source2:ISeq<'U>) : bool = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(true,source2.GetEnumerator()) with + { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(true,source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then if not (predicate value this.State.Current) then @@ -370,53 +393,56 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () - override this.OnDispose () = this.State.Dispose () }) + + override this.OnDispose () = this.State.Dispose () } :> _) [] let inline filter<'T> (f:'T->bool) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = if f input then TailCall.avoid (next.ProcessNext input) - else false } } + else false } :> _} [] let inline map<'T,'U> (f:'T->'U) (source:ISeq<'T>) : ISeq<'U> = source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = - TailCall.avoid (next.ProcessNext (f input)) } } + TailCall.avoid (next.ProcessNext (f input)) } :> _ } [] let inline mapi f (source:ISeq<_>) = source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,int>(next, -1) with + { new Transform<'T,'V,int>(next, -1) with override this.ProcessNext (input:'T) : bool = this.State <- this.State + 1 - TailCall.avoid (next.ProcessNext (f this.State input)) } } + TailCall.avoid (next.ProcessNext (f this.State input)) } :> _ } [] let inline map2<'T,'U,'V> (map:'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = source1.PushTransform { new ITransformFactory<'T,'V> with override __.Compose outOfBand pipeIdx (next:Activity<'V,'W>) = - upcast { new TransformWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with + { new TransformWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with override this.ProcessNext input = if this.State.MoveNext () then TailCall.avoid (next.ProcessNext (map input this.State.Current)) else outOfBand.StopFurtherProcessing pipeIdx false + override this.OnComplete _ = () - override this.OnDispose () = this.State.Dispose () }} + + override this.OnDispose () = this.State.Dispose () } :> _ } [] let inline mapi2<'T,'U,'V> (map:int->'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = source1.PushTransform { new ITransformFactory<'T,'V> with override __.Compose<'W> outOfBand pipeIdx next = - upcast { new TransformWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with + { new TransformWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with override this.ProcessNext t = let idx : byref<_> = &this.State._1 let u = this.State._2 @@ -426,14 +452,16 @@ namespace Microsoft.FSharp.Collections else outOfBand.StopFurtherProcessing pipeIdx false + override this.OnDispose () = this.State._2.Dispose () - override this.OnComplete _ = () }} + + override this.OnComplete _ = () } :> _ } [] let inline map3<'T,'U,'V,'W>(map:'T->'U->'V->'W) (source1:ISeq<'T>) (source2:ISeq<'U>) (source3:ISeq<'V>) : ISeq<'W> = source1.PushTransform { new ITransformFactory<'T,'W> with override __.Compose<'X> outOfBand pipeIdx next = - upcast { new TransformWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with + { new TransformWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with override this.ProcessNext t = let u = this.State._1 let v = this.State._2 @@ -442,15 +470,17 @@ namespace Microsoft.FSharp.Collections else outOfBand.StopFurtherProcessing pipeIdx false + override this.OnComplete _ = () + override this.OnDispose () = this.State._1.Dispose () - this.State._2.Dispose () }} + this.State._2.Dispose () } :> _ } [] let inline compareWith (f:'T->'T->int) (source1:ISeq<'T>) (source2:ISeq<'T>) : int = source1.Fold (fun pipeIdx -> - upcast { new FolderWithPostProcessing<'T,int,IEnumerator<'T>>(0,source2.GetEnumerator()) with + { new FolderWithPostProcessing<'T,int,IEnumerator<'T>>(0,source2.GetEnumerator()) with override this.ProcessNext value = if not (this.State.MoveNext()) then this.Result <- 1 @@ -461,41 +491,43 @@ namespace Microsoft.FSharp.Collections this.Result <- c (this :> IOutOfBand).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) + override this.OnComplete _ = if this.Result = 0 && this.State.MoveNext() then this.Result <- -1 - override this.OnDispose () = this.State.Dispose () }) + + override this.OnDispose () = this.State.Dispose () } :> _) [] let inline choose (f:'T->option<'U>) (source:ISeq<'T>) : ISeq<'U> = source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = match f input with | Some value -> TailCall.avoid (next.ProcessNext value) - | None -> false } } + | None -> false } :> _ } [] let inline distinct (source:ISeq<'T>) : ISeq<'T> when 'T:equality = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with + { new Transform<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with override this.ProcessNext (input:'T) : bool = - this.State.Add input && TailCall.avoid (next.ProcessNext input) }} + this.State.Add input && TailCall.avoid (next.ProcessNext input) } :> _} [] let inline distinctBy (keyf:'T->'Key) (source:ISeq<'T>) :ISeq<'T> when 'Key:equality = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with + { new Transform<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with override this.ProcessNext (input:'T) : bool = - this.State.Add (keyf input) && TailCall.avoid (next.ProcessNext input) }} + this.State.Add (keyf input) && TailCall.avoid (next.ProcessNext input) } :> _} [] let inline max (source:ISeq<'T>) : 'T when 'T:comparison = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = if this.State then this.State <- false @@ -507,12 +539,13 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = if this.State then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let inline maxBy (f:'T->'U) (source:ISeq<'T>) : 'T when 'U:comparison = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof<'U>)) with + { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof<'U>)) with override this.ProcessNext value = match this.State._1, f value with | true, valueU -> @@ -528,12 +561,13 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = if this.State._1 then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let inline min (source:ISeq<'T>) : 'T when 'T:comparison = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = if this.State then this.State <- false @@ -545,12 +579,13 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = if this.State then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let inline minBy (f:'T->'U) (source:ISeq<'T>) : 'T = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof< 'U>)) with + { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof< 'U>)) with override this.ProcessNext value = match this.State._1, f value with | true, valueU -> @@ -566,13 +601,14 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = if this.State._1 then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let pairwise (source:ISeq<'T>) : ISeq<'T*'T> = source.PushTransform { new ITransformFactory<'T,'T*'T> with override __.Compose _ _ next = - upcast { new Transform<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with + { new Transform<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with // member this.isFirst = this.State._1 // member this.lastValue = this.State._2 override this.ProcessNext (input:'T) : bool = @@ -583,12 +619,12 @@ namespace Microsoft.FSharp.Collections else let currentPair = this.State._2, input this.State._2 <- input - TailCall.avoid (next.ProcessNext currentPair) }} + TailCall.avoid (next.ProcessNext currentPair) } :> _} [] let inline reduce (f:'T->'T->'T) (source: ISeq<'T>) : 'T = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = if this.State then this.State <- false @@ -600,11 +636,12 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = if this.State then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = - upcast (ThinConcatEnumerable (sources, id)) + ThinConcatEnumerable (sources, id) :> _ (* Represents the following seq comprehension, but they don't work at this level @@ -664,9 +701,9 @@ namespace Microsoft.FSharp.Collections [] let scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) : ISeq<'State> = - upcast { new PreferGetEnumerator<'State>() with + { new PreferGetEnumerator<'State>() with member this.GetEnumerator () = - upcast new ScanEnumerator<'T,'State>(folder, initialState, source) + new ScanEnumerator<'T,'State>(folder, initialState, source) :> _ member this.GetSeq () = let head = singleton initialState @@ -674,11 +711,11 @@ namespace Microsoft.FSharp.Collections source.PushTransform { new ITransformFactory<'T,'State> with override __.Compose _ _ next = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder - upcast { new Transform<'T,'V,'State>(next, initialState) with + { new Transform<'T,'V,'State>(next, initialState) with override this.ProcessNext (input:'T) : bool = this.State <- f.Invoke (this.State, input) - TailCall.avoid (next.ProcessNext this.State) } } - concat (ofList [ head ; tail ]) } + TailCall.avoid (next.ProcessNext this.State) } :> _ } + concat (ofList [ head ; tail ]) } :> _ [] let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = @@ -700,6 +737,7 @@ namespace Microsoft.FSharp.Collections let x = skipCount - this.State invalidOpFmt "{0}\ntried to skip {1} {2} past the end of the seq" [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] + override this.OnDispose () = () interface ISkipable with @@ -710,13 +748,13 @@ namespace Microsoft.FSharp.Collections else false } this <- skipper - upcast this } + this :> _ } [] let inline skipWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = - upcast { new Transform<'T,'V,bool>(next,true) with + { new Transform<'T,'V,bool>(next,true) with // member this.skip = this.State override this.ProcessNext (input:'T) : bool = if this.State then @@ -726,7 +764,7 @@ namespace Microsoft.FSharp.Collections else TailCall.avoid (next.ProcessNext input) else - TailCall.avoid (next.ProcessNext input) }} + TailCall.avoid (next.ProcessNext input) } :> _} [] let inline sum (source:ISeq<'T>) = @@ -754,7 +792,7 @@ namespace Microsoft.FSharp.Collections if takeCount = 0 then outOfBand.StopFurtherProcessing pipelineIdx - upcast { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with + { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = if this.State < takeCount then @@ -771,25 +809,26 @@ namespace Microsoft.FSharp.Collections let x = takeCount - this.State invalidOpFmt "tried to take {0} {1} past the end of the seq" [|SR.GetString SR.notEnoughElements; x; (if x=1 then "element" else "elements")|] - override this.OnDispose () = () }} + + override this.OnDispose () = () } :> _} [] let inline takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipeIdx next = - upcast { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext (input:'T) : bool = if predicate input then TailCall.avoid (next.ProcessNext input) else outOfBand.StopFurtherProcessing pipeIdx - false }} + false } :> _ } [] let tail (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose _ _ next = - upcast { new TransformWithPostProcessing<'T,'V,bool>(next,true) with + { new TransformWithPostProcessing<'T,'V,bool>(next,true) with // member this.isFirst = this.State override this.ProcessNext (input:'T) : bool = if this.State then @@ -797,16 +836,18 @@ namespace Microsoft.FSharp.Collections false else TailCall.avoid (next.ProcessNext input) + override this.OnComplete _ = if this.State then invalidArg "source" (SR.GetString SR.notEnoughElements) - override this.OnDispose () = () }} + + override this.OnDispose () = () } :> _ } [] let truncate (truncateCount:int) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipeIdx next = - upcast { new Transform<'T,'U,int>(next,(*count*)0) with + { new Transform<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = if this.State < truncateCount then @@ -816,7 +857,7 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext input) else outOfBand.StopFurtherProcessing pipeIdx - false }} + false } :> _ } [] let indexed source = @@ -846,7 +887,7 @@ namespace Microsoft.FSharp.Collections else false } this <- skipper - upcast this } + this :> _ } |> tryHead [] @@ -874,7 +915,7 @@ namespace Microsoft.FSharp.Collections [] let inline tryFindIndex (predicate:'T->bool) (source:ISeq<'T>) : int option = source.Fold (fun pipeIdx -> - upcast { new FolderWithState<'T, Option, int>(None, 0) with + { new FolderWithState<'T, Option, int>(None, 0) with // member this.index = this.State override this.ProcessNext value = if predicate value then @@ -882,12 +923,12 @@ namespace Microsoft.FSharp.Collections (this :> IOutOfBand).StopFurtherProcessing pipeIdx else this.State <- this.State + 1 - Unchecked.defaultof<_> (* return value unused in Fold context *) }) + Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _) [] let tryLast (source:ISeq<'T>) : 'T option = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,option<'T>,Values>(None,Values(true, Unchecked.defaultof<'T>)) with + { new FolderWithPostProcessing<'T,option<'T>,Values>(None,Values(true, Unchecked.defaultof<'T>)) with // member this.noItems = this.State._1 // memebr this.last = this.State._2 override this.ProcessNext value = @@ -895,10 +936,12 @@ namespace Microsoft.FSharp.Collections this.State._1 <- false this.State._2 <- value Unchecked.defaultof<_> (* return value unused in Fold context *) + override this.OnComplete _ = if not this.State._1 then this.Result <- Some this.State._2 - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _) [] let last (source:ISeq<_>) = @@ -913,7 +956,7 @@ namespace Microsoft.FSharp.Collections source.PushTransform { new ITransformFactory<'T,'T[]> with member __.Compose outOfBand pipeIdx next = - upcast { + { new Transform<'T,'U,Values<'T[],int,int>>(next,Values<'T[],int,int>(Array.zeroCreateUnchecked windowSize, 0, windowSize-1)) with override this.ProcessNext (input:'T) : bool = let circularBuffer = this.State._1 @@ -937,22 +980,22 @@ namespace Microsoft.FSharp.Collections let window = Array.zeroCreateUnchecked windowSize Array.Copy (circularBuffer, idx, window, 0, windowSize - idx) Array.Copy (circularBuffer, 0, window, windowSize - idx, idx) - TailCall.avoid (next.ProcessNext window) }} + TailCall.avoid (next.ProcessNext window) } :> _} [] let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = match source1 with | :? EnumerableBase<'T> as s -> s.Append source2 - | _ -> upcast (new AppendEnumerable<_>([source2; source1])) + | _ -> new AppendEnumerable<_>([source2; source1]) :> _ [] let delay (delayed:unit->ISeq<'T>) : ISeq<'T> = - upcast (DelayedEnumerable (delayed, 1)) + DelayedEnumerable (delayed, 1) :> _ module internal GroupBy = let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,ISeq<'Key*ISeq<'T>>,_>(Unchecked.defaultof<_>,Dictionary comparer) with + { new FolderWithPostProcessing<'T,ISeq<'Key*ISeq<'T>>,_>(Unchecked.defaultof<_>,Dictionary comparer) with override this.ProcessNext v = let safeKey = keyf v match this.State.TryGetValue safeKey with @@ -973,7 +1016,7 @@ namespace Microsoft.FSharp.Collections |> ofSeq |> map (fun kv -> getKey kv.Key, ofResizeArrayUnchecked kv.Value) - override this.OnDispose () = () }) + override this.OnDispose () = () } :> _ ) let inline byVal (keyf:'T->'Key) (source:ISeq<'T>) = delay (fun () -> impl HashIdentity.Structural<'Key> keyf id source) @@ -992,7 +1035,7 @@ namespace Microsoft.FSharp.Collections module CountBy = let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,ISeq<'Key*int>,_>(Unchecked.defaultof<_>,Dictionary comparer) with + { new FolderWithPostProcessing<'T,ISeq<'Key*int>,_>(Unchecked.defaultof<_>,Dictionary comparer) with override this.ProcessNext v = let safeKey = keyf v this.State.[safeKey] <- @@ -1007,7 +1050,7 @@ namespace Microsoft.FSharp.Collections |> ofSeq |> map (fun group -> getKey group.Key, group.Value) - override this.OnDispose () = () }) + override this.OnDispose () = () } :> _ ) let inline byVal (keyf:'T->'Key) (source:ISeq<'T>) = delay (fun () -> impl HashIdentity.Structural<'Key> keyf id source) @@ -1033,13 +1076,15 @@ namespace Microsoft.FSharp.Collections [] let toArray (source:ISeq<'T>) = source.Fold (fun _ -> - upcast { new FolderWithPostProcessing<'T,array<'T>,_>(Unchecked.defaultof<_>,ResizeArray ()) with + { new FolderWithPostProcessing<'T,array<'T>,_>(Unchecked.defaultof<_>,ResizeArray ()) with override this.ProcessNext v = this.State.Add v Unchecked.defaultof<_> (* return value unused in Fold context *) + override this.OnComplete _ = this.Result <- this.State.ToArray () - override this.OnDispose () = () }) + + override this.OnDispose () = () } :> _ ) [] let sortBy keyf source = @@ -1163,7 +1208,7 @@ namespace Microsoft.FSharp.Collections else None) - let cached : ISeq<'T> = upcast (new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1)) + let cached : ISeq<'T> = new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1) :> _ interface System.IDisposable with member __.Dispose() = @@ -1190,7 +1235,7 @@ namespace Microsoft.FSharp.Collections [] let cache (source:ISeq<'T>) : ISeq<'T> = - upcast (new CachedSeq<_> (source)) + new CachedSeq<_> (source) :> _ [] let collect f sources = map f sources |> concat @@ -1211,7 +1256,7 @@ namespace Microsoft.FSharp.Collections [] let replicate<'T> count (x:'T) : ISeq<'T> = if count < 0 then raise (ArgumentOutOfRangeException "count") - upcast (new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1)) + new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1) :> _ [] let isEmpty (source : ISeq<'T>) = @@ -1236,7 +1281,7 @@ namespace Microsoft.FSharp.Collections source.PushTransform { new ITransformFactory<'T,'T[]> with member __.Compose outOfBand pipeIdx next = - upcast { + { new TransformWithPostProcessing<'T,'U,Values<'T[],int>>(next,Values<'T[],int>(Array.zeroCreateUnchecked chunkSize, 0)) with override this.ProcessNext (input:'T) : bool = this.State._1.[this.State._2] <- input @@ -1247,11 +1292,13 @@ namespace Microsoft.FSharp.Collections let tmp = this.State._1 this.State._1 <- Array.zeroCreateUnchecked chunkSize TailCall.avoid (next.ProcessNext tmp) + override this.OnComplete _ = if this.State._2 > 0 then System.Array.Resize (&this.State._1, this.State._2) next.ProcessNext this.State._1 |> ignore - override this.OnDispose () = () }} + + override this.OnDispose () = () } :> _ } let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) |> ofSeq From cc54afce2bac11822d69be892291ef67f5728344 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 2 Sep 2017 19:12:31 +1000 Subject: [PATCH 096/120] ISeq implementation made internal where possible Due to a number of Seq inline functions, some functions still needed to be public --- src/fsharp/FSharp.Core/iseq.fs | 196 ++++++++++++++++---------------- src/fsharp/FSharp.Core/iseq.fsi | 182 ++++++++++++++--------------- 2 files changed, 189 insertions(+), 189 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 1e9d75602bf..d6ecba98e56 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -26,7 +26,7 @@ namespace Microsoft.FSharp.Collections /// Single value Tuple. /// Allows null reference type values as key in Dictionary. [] - type Value<'T> = + type internal Value<'T> = val mutable _1 : 'T new (a:'T) = { _1 = a } @@ -39,7 +39,7 @@ namespace Microsoft.FSharp.Collections /// 3-Value Tuple. [] - type Values<'T1,'T2,'T3> = + type internal Values<'T1,'T2,'T3> = val mutable _1 : 'T1 val mutable _2 : 'T2 val mutable _3 : 'T3 @@ -47,7 +47,7 @@ namespace Microsoft.FSharp.Collections /// Base class for chaining mapping or filtering operation within the ISeq pipeline [] - type Transform<'T,'U,'State> = + type internal Transform<'T,'U,'State> = inherit Activity<'T,'U> new (next:Activity, initState:'State) = { @@ -66,7 +66,7 @@ namespace Microsoft.FSharp.Collections /// Base class for chaining mapping or filtering operation that require some post processing /// (i.e. Disposal and/or post conditional checks) within the ISeq pipeline [] - type TransformWithPostProcessing<'T,'U,'State>(next:Activity, initState:'State) = + type internal TransformWithPostProcessing<'T,'U,'State>(next:Activity, initState:'State) = inherit Transform<'T,'U,'State>(next, initState) abstract OnComplete : pipeIdx:PipeIdx -> unit @@ -113,7 +113,7 @@ namespace Microsoft.FSharp.Collections // ineffictive ** let inline avoid boolean = match boolean with true -> true | false -> false - let inline valueComparer<'T when 'T : equality> () = + let inline internal valueComparer<'T when 'T : equality> () = let c = HashIdentity.Structural<'T> { new IEqualityComparer> with member __.GetHashCode o = c.GetHashCode o._1 @@ -124,7 +124,7 @@ namespace Microsoft.FSharp.Collections /// only defer to the ISeq<'T> interface for its specific operations (this is the case with /// the scan function) [] - type PreferGetEnumerator<'T>() = + type internal PreferGetEnumerator<'T>() = inherit EnumerableBase<'T>() abstract GetEnumerator: unit -> IEnumerator<'T> @@ -138,10 +138,10 @@ namespace Microsoft.FSharp.Collections member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) : 'Result = (this.GetSeq()).Fold f [] - let empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance + let internal empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance [] - let singleton<'T> (x:'T) : ISeq<'T> = new SingletonEnumerable<_>(x) :> _ + let internal singleton<'T> (x:'T) : ISeq<'T> = new SingletonEnumerable<_>(x) :> _ /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. @@ -149,16 +149,16 @@ namespace Microsoft.FSharp.Collections /// list hasn't been modified (throwing an exception if it has), but such a check is not /// performed in this case. If you want this functionality, then use the ofSeq function instead. [] - let ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = + let internal ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = ThinResizeArrayEnumerable<'T> source :> _ [] - let ofArray (source:array<'T>) : ISeq<'T> = + let internal ofArray (source:array<'T>) : ISeq<'T> = checkNonNull "source" source ThinArrayEnumerable<'T> source :> _ [] - let ofList (source:list<'T>) : ISeq<'T> = + let internal ofList (source:list<'T>) : ISeq<'T> = source :> _ [] @@ -202,7 +202,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let exactlyOne (source:ISeq<'T>) : 'T = + let internal exactlyOne (source:ISeq<'T>) : 'T = source.Fold (fun pipeIdx -> { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>, Values(true, false)) with override this.ProcessNext value = @@ -223,7 +223,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let inline fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:ISeq<'T>) : 'State = + let inline internal fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:ISeq<'T>) : 'State = source.Fold (fun _ -> { new Folder<'T,'State>(seed) with override this.ProcessNext value = @@ -231,7 +231,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline fold2<'T1,'T2,'State> (folder:'State->'T1->'T2->'State) (state:'State) (source1:ISeq<'T1>) (source2: ISeq<'T2>) = + let inline internal fold2<'T1,'T2,'State> (folder:'State->'T1->'T2->'State) (state:'State) (source1:ISeq<'T1>) (source2: ISeq<'T2>) = source1.Fold (fun pipeIdx -> { new FolderWithPostProcessing<_,'State,IEnumerator<'T2>>(state,source2.GetEnumerator()) with override this.ProcessNext value = @@ -246,21 +246,21 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = + let internal unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1) :> _ [] - let initInfinite<'T> (f:int->'T) : ISeq<'T> = + let internal initInfinite<'T> (f:int->'T) : ISeq<'T> = new InitEnumerableDecider<'T>(Nullable (), f, 1) :> _ [] - let init<'T> (count:int) (f:int->'T) : ISeq<'T> = + let internal init<'T> (count:int) (f:int->'T) : ISeq<'T> = if count < 0 then invalidArgInputMustBeNonNegative "count" count elif count = 0 then empty else new InitEnumerableDecider<'T>(Nullable count, f, 1) :> _ [] - let inline iter f (source:ISeq<'T>) = + let inline internal iter f (source:ISeq<'T>) = source.Fold (fun _ -> { new Folder<'T,unit> (()) with override this.ProcessNext value = @@ -268,7 +268,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline iter2 (f:'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = + let inline internal iter2 (f:'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = source1.Fold (fun pipeIdx -> { new FolderWithPostProcessing<'T,unit,IEnumerator<'U>> ((),source2.GetEnumerator()) with override this.ProcessNext value = @@ -283,7 +283,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline iteri2 (f:int->'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = + let inline internal iteri2 (f:int->'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = source1.Fold (fun pipeIdx -> { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(0,source2.GetEnumerator())) with override this.ProcessNext value = @@ -300,7 +300,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State._2.Dispose () } :> _) [] - let tryHead (source:ISeq<'T>) = + let internal tryHead (source:ISeq<'T>) = source.Fold (fun pipeIdx -> { new Folder<'T, Option<'T>> (None) with override this.ProcessNext value = @@ -309,13 +309,13 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let head (source:ISeq<_>) = + let internal head (source:ISeq<_>) = match tryHead source with | None -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | Some x -> x [] - let inline iteri f (source:ISeq<'T>) = + let inline internal iteri f (source:ISeq<'T>) = source.Fold (fun _ -> { new FolderWithState<'T,unit,int> ((),0) with override this.ProcessNext value = @@ -324,7 +324,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _) [] - let inline except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = + let inline internal except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = checkNonNull "itemsToExclude" itemsToExclude source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = @@ -333,7 +333,7 @@ namespace Microsoft.FSharp.Collections this.State.Value.Add input && TailCall.avoid (next.ProcessNext input) } :> _} [] - let inline exists f (source:ISeq<'T>) = + let inline internal exists f (source:ISeq<'T>) = source.Fold (fun pipeIdx -> { new Folder<'T, bool> (false) with override this.ProcessNext value = @@ -343,7 +343,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline exists2 (predicate:'T->'U->bool) (source1:ISeq<'T>) (source2: ISeq<'U>) : bool = + let inline internal exists2 (predicate:'T->'U->bool) (source1:ISeq<'T>) (source2: ISeq<'U>) : bool = source1.Fold (fun pipeIdx -> { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(false,source2.GetEnumerator()) with override this.ProcessNext value = @@ -370,7 +370,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline forall predicate (source:ISeq<'T>) = + let inline internal forall predicate (source:ISeq<'T>) = source.Fold (fun pipeIdx -> { new Folder<'T, bool> (true) with override this.ProcessNext value = @@ -380,7 +380,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline forall2 predicate (source1:ISeq<'T>) (source2:ISeq<'U>) : bool = + let inline internal forall2 predicate (source1:ISeq<'T>) (source2:ISeq<'U>) : bool = source1.Fold (fun pipeIdx -> { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(true,source2.GetEnumerator()) with override this.ProcessNext value = @@ -397,7 +397,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline filter<'T> (f:'T->bool) (source:ISeq<'T>) : ISeq<'T> = + let inline internal filter<'T> (f:'T->bool) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with @@ -406,7 +406,7 @@ namespace Microsoft.FSharp.Collections else false } :> _} [] - let inline map<'T,'U> (f:'T->'U) (source:ISeq<'T>) : ISeq<'U> = + let inline internal map<'T,'U> (f:'T->'U) (source:ISeq<'T>) : ISeq<'U> = source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with @@ -414,7 +414,7 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext (f input)) } :> _ } [] - let inline mapi f (source:ISeq<_>) = + let inline internal mapi f (source:ISeq<_>) = source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = { new Transform<'T,'V,int>(next, -1) with @@ -423,7 +423,7 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext (f this.State input)) } :> _ } [] - let inline map2<'T,'U,'V> (map:'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = + let inline internal map2<'T,'U,'V> (map:'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = source1.PushTransform { new ITransformFactory<'T,'V> with override __.Compose outOfBand pipeIdx (next:Activity<'V,'W>) = { new TransformWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with @@ -439,7 +439,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _ } [] - let inline mapi2<'T,'U,'V> (map:int->'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = + let inline internal mapi2<'T,'U,'V> (map:int->'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = source1.PushTransform { new ITransformFactory<'T,'V> with override __.Compose<'W> outOfBand pipeIdx next = { new TransformWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with @@ -458,7 +458,7 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = () } :> _ } [] - let inline map3<'T,'U,'V,'W>(map:'T->'U->'V->'W) (source1:ISeq<'T>) (source2:ISeq<'U>) (source3:ISeq<'V>) : ISeq<'W> = + let inline internal map3<'T,'U,'V,'W>(map:'T->'U->'V->'W) (source1:ISeq<'T>) (source2:ISeq<'U>) (source3:ISeq<'V>) : ISeq<'W> = source1.PushTransform { new ITransformFactory<'T,'W> with override __.Compose<'X> outOfBand pipeIdx next = { new TransformWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with @@ -478,7 +478,7 @@ namespace Microsoft.FSharp.Collections this.State._2.Dispose () } :> _ } [] - let inline compareWith (f:'T->'T->int) (source1:ISeq<'T>) (source2:ISeq<'T>) : int = + let inline internal compareWith (f:'T->'T->int) (source1:ISeq<'T>) (source2:ISeq<'T>) : int = source1.Fold (fun pipeIdx -> { new FolderWithPostProcessing<'T,int,IEnumerator<'T>>(0,source2.GetEnumerator()) with override this.ProcessNext value = @@ -499,7 +499,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline choose (f:'T->option<'U>) (source:ISeq<'T>) : ISeq<'U> = + let inline internal choose (f:'T->option<'U>) (source:ISeq<'T>) : ISeq<'U> = source.PushTransform { new ITransformFactory<'T,'U> with override __.Compose _ _ next = { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with @@ -509,7 +509,7 @@ namespace Microsoft.FSharp.Collections | None -> false } :> _ } [] - let inline distinct (source:ISeq<'T>) : ISeq<'T> when 'T:equality = + let inline internal distinct (source:ISeq<'T>) : ISeq<'T> when 'T:equality = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = { new Transform<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with @@ -517,7 +517,7 @@ namespace Microsoft.FSharp.Collections this.State.Add input && TailCall.avoid (next.ProcessNext input) } :> _} [] - let inline distinctBy (keyf:'T->'Key) (source:ISeq<'T>) :ISeq<'T> when 'Key:equality = + let inline internal distinctBy (keyf:'T->'Key) (source:ISeq<'T>) :ISeq<'T> when 'Key:equality = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = { new Transform<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with @@ -605,7 +605,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let pairwise (source:ISeq<'T>) : ISeq<'T*'T> = + let internal pairwise (source:ISeq<'T>) : ISeq<'T*'T> = source.PushTransform { new ITransformFactory<'T,'T*'T> with override __.Compose _ _ next = { new Transform<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with @@ -622,7 +622,7 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext currentPair) } :> _} [] - let inline reduce (f:'T->'T->'T) (source: ISeq<'T>) : 'T = + let inline internal reduce (f:'T->'T->'T) (source: ISeq<'T>) : 'T = source.Fold (fun _ -> { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = @@ -640,7 +640,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = + let internal concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = ThinConcatEnumerable (sources, id) :> _ (* @@ -654,7 +654,7 @@ namespace Microsoft.FSharp.Collections state <- f.Invoke (state, item) yield state } *) - type ScanEnumerator<'T,'State>(folder:'State->'T->'State, initialState:'State, enumerable:seq<'T>) = + type internal ScanEnumerator<'T,'State>(folder:'State->'T->'State, initialState:'State, enumerable:seq<'T>) = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder let mutable state = 0 (*Pre-start*) @@ -700,7 +700,7 @@ namespace Microsoft.FSharp.Collections enumerator.Dispose () [] - let scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) : ISeq<'State> = + let internal scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) : ISeq<'State> = { new PreferGetEnumerator<'State>() with member this.GetEnumerator () = new ScanEnumerator<'T,'State>(folder, initialState, source) :> _ @@ -718,7 +718,7 @@ namespace Microsoft.FSharp.Collections concat (ofList [ head ; tail ]) } :> _ [] - let skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = + let internal skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = let mutable this = Unchecked.defaultof> @@ -751,7 +751,7 @@ namespace Microsoft.FSharp.Collections this :> _ } [] - let inline skipWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = + let inline internal skipWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = { new Transform<'T,'V,bool>(next,true) with @@ -783,7 +783,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = + let internal take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = if takeCount < 0 then invalidArgInputMustBeNonNegative "count" takeCount elif takeCount = 0 then empty else @@ -813,7 +813,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _} [] - let inline takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = + let inline internal takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipeIdx next = { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with @@ -825,7 +825,7 @@ namespace Microsoft.FSharp.Collections false } :> _ } [] - let tail (source:ISeq<'T>) : ISeq<'T> = + let internal tail (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose _ _ next = { new TransformWithPostProcessing<'T,'V,bool>(next,true) with @@ -844,7 +844,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ } [] - let truncate (truncateCount:int) (source:ISeq<'T>) : ISeq<'T> = + let internal truncate (truncateCount:int) (source:ISeq<'T>) : ISeq<'T> = source.PushTransform { new ITransformFactory<'T,'T> with member __.Compose outOfBand pipeIdx next = { new Transform<'T,'U,int>(next,(*count*)0) with @@ -860,11 +860,11 @@ namespace Microsoft.FSharp.Collections false } :> _ } [] - let indexed source = + let internal indexed source = mapi (fun i x -> i,x) source [] - let tryItem index (source:ISeq<'T>) = + let internal tryItem index (source:ISeq<'T>) = if index < 0 then None else source.PushTransform { new ITransformFactory<'T,'T> with override __.Compose _ _ next = @@ -891,7 +891,7 @@ namespace Microsoft.FSharp.Collections |> tryHead [] - let inline tryPick f (source:ISeq<'T>) = + let inline internal tryPick f (source:ISeq<'T>) = source.Fold (fun pipeIdx -> { new Folder<'T, Option<'U>> (None) with override this.ProcessNext value = @@ -903,7 +903,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline tryFind f (source:ISeq<'T>) = + let inline internal tryFind f (source:ISeq<'T>) = source.Fold (fun pipeIdx -> { new Folder<'T, Option<'T>> (None) with override this.ProcessNext value = @@ -913,7 +913,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline tryFindIndex (predicate:'T->bool) (source:ISeq<'T>) : int option = + let inline internal tryFindIndex (predicate:'T->bool) (source:ISeq<'T>) : int option = source.Fold (fun pipeIdx -> { new FolderWithState<'T, Option, int>(None, 0) with // member this.index = this.State @@ -926,7 +926,7 @@ namespace Microsoft.FSharp.Collections Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _) [] - let tryLast (source:ISeq<'T>) : 'T option = + let internal tryLast (source:ISeq<'T>) : 'T option = source.Fold (fun _ -> { new FolderWithPostProcessing<'T,option<'T>,Values>(None,Values(true, Unchecked.defaultof<'T>)) with // member this.noItems = this.State._1 @@ -944,13 +944,13 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let last (source:ISeq<_>) = + let internal last (source:ISeq<_>) = match tryLast source with | None -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | Some x -> x [] - let windowed (windowSize:int) (source:ISeq<'T>) : ISeq<'T[]> = + let internal windowed (windowSize:int) (source:ISeq<'T>) : ISeq<'T[]> = if windowSize <= 0 then invalidArgFmt "windowSize" "{0}\nwindowSize = {1}" [|SR.GetString SR.inputMustBePositive; windowSize|] @@ -983,13 +983,13 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext window) } :> _} [] - let append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = + let internal append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = match source1 with | :? EnumerableBase<'T> as s -> s.Append source2 | _ -> new AppendEnumerable<_>([source2; source1]) :> _ [] - let delay (delayed:unit->ISeq<'T>) : ISeq<'T> = + let internal delay (delayed:unit->ISeq<'T>) : ISeq<'T> = DelayedEnumerable (delayed, 1) :> _ module internal GroupBy = @@ -1025,11 +1025,11 @@ namespace Microsoft.FSharp.Collections delay (fun () -> impl (valueComparer<'Key> ()) (keyf >> Value) (fun v -> v._1) source) [] - let inline groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (keyf:'T->'Key) (source:ISeq<'T>) = + let inline internal groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (keyf:'T->'Key) (source:ISeq<'T>) = GroupBy.byVal keyf source [] - let inline groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (keyf:'T->'Key) (source:ISeq<'T>) = + let inline internal groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (keyf:'T->'Key) (source:ISeq<'T>) = GroupBy.byRef keyf source module CountBy = @@ -1059,22 +1059,22 @@ namespace Microsoft.FSharp.Collections delay (fun () -> impl (valueComparer<'Key> ()) (keyf >> Value) (fun v -> v._1) source) [] - let inline countByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T -> 'Key) (source:ISeq<'T>) = + let inline internal countByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T -> 'Key) (source:ISeq<'T>) = CountBy.byVal projection source [] - let inline countByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T -> 'Key) (source:ISeq<'T>) = + let inline internal countByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T -> 'Key) (source:ISeq<'T>) = CountBy.byRef projection source [] - let length (source:ISeq<'T>) = + let internal length (source:ISeq<'T>) = match source with | :? EnumerableBase<'T> as s -> s.Length () | :? list<'T> as l -> l.Length | _ -> Microsoft.FSharp.Primitives.Basics.ISeq.length source [] - let toArray (source:ISeq<'T>) = + let internal toArray (source:ISeq<'T>) = source.Fold (fun _ -> { new FolderWithPostProcessing<'T,array<'T>,_>(Unchecked.defaultof<_>,ResizeArray ()) with override this.ProcessNext v = @@ -1087,14 +1087,14 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ ) [] - let sortBy keyf source = + let internal sortBy keyf source = delay (fun () -> let array = source |> toArray Array.stableSortInPlaceBy keyf array ofArray array) [] - let sort source = + let internal sort source = delay (fun () -> let array = source |> toArray Array.stableSortInPlace array @@ -1108,14 +1108,14 @@ namespace Microsoft.FSharp.Collections ofArray array) [] - let rev source = + let internal rev source = delay (fun () -> let array = source |> toArray Array.Reverse array ofArray array) [] - let permute f (source:ISeq<_>) = + let internal permute f (source:ISeq<_>) = delay (fun () -> source |> toArray @@ -1123,42 +1123,42 @@ namespace Microsoft.FSharp.Collections |> ofArray) [] - let scanBack<'T,'State> f (source:ISeq<'T>) (acc:'State) : ISeq<'State> = + let internal scanBack<'T,'State> f (source:ISeq<'T>) (acc:'State) : ISeq<'State> = delay (fun () -> let array = source |> toArray Array.scanSubRight f array 0 (array.Length - 1) acc |> ofArray) - let inline foldArraySubRight f (arr: 'T[]) start fin acc = + let inline internal foldArraySubRight f (arr: 'T[]) start fin acc = let mutable state = acc for i = fin downto start do state <- f arr.[i] state state [] - let inline foldBack<'T,'State> f (source: ISeq<'T>) (x:'State) = + let inline internal foldBack<'T,'State> f (source: ISeq<'T>) (x:'State) = let arr = toArray source let len = arr.Length foldArraySubRight f arr 0 (len - 1) x [] - let zip source1 source2 = + let internal zip source1 source2 = map2 (fun x y -> x,y) source1 source2 [] - let inline foldBack2<'T1,'T2,'State> f (source1:ISeq<'T1>) (source2:ISeq<'T2>) (x:'State) = + let inline internal foldBack2<'T1,'T2,'State> f (source1:ISeq<'T1>) (source2:ISeq<'T2>) (x:'State) = let zipped = zip source1 source2 foldBack ((<||) f) zipped x [] - let inline reduceBack f (source:ISeq<'T>) = + let inline internal reduceBack f (source:ISeq<'T>) = let arr = toArray source match arr.Length with | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | len -> foldArraySubRight f arr 0 (len - 2) arr.[len - 1] [] - type CachedSeq<'T>(source:ISeq<'T>) = + type internal CachedSeq<'T>(source:ISeq<'T>) = let sync = obj () // Wrap a seq to ensure that it is enumerated just once and only as far as is necessary. @@ -1234,21 +1234,21 @@ namespace Microsoft.FSharp.Collections member this.Clear() = (this :> IDisposable).Dispose () [] - let cache (source:ISeq<'T>) : ISeq<'T> = + let internal cache (source:ISeq<'T>) : ISeq<'T> = new CachedSeq<_> (source) :> _ [] - let collect f sources = map f sources |> concat + let internal collect f sources = map f sources |> concat [] - let allPairs (source1:ISeq<'T1>) (source2:ISeq<'T2>) : ISeq<'T1 * 'T2> = + let internal allPairs (source1:ISeq<'T1>) (source2:ISeq<'T2>) : ISeq<'T1 * 'T2> = checkNonNull "source1" source1 checkNonNull "source2" source2 let cached = cache source2 source1 |> collect (fun x -> cached |> map (fun y -> x,y)) [] - let toList (source : ISeq<'T>) = + let internal toList (source : ISeq<'T>) = match source with | :? list<'T> as lst -> lst | _ -> Microsoft.FSharp.Primitives.Basics.List.ofISeq source @@ -1259,7 +1259,7 @@ namespace Microsoft.FSharp.Collections new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1) :> _ [] - let isEmpty (source : ISeq<'T>) = + let internal isEmpty (source : ISeq<'T>) = match source with | :? list<'T> as lst -> lst.IsEmpty | _ -> @@ -1267,7 +1267,7 @@ namespace Microsoft.FSharp.Collections not (ie.MoveNext()) [] - let cast (source: IEnumerable) : ISeq<'T> = + let internal cast (source: IEnumerable) : ISeq<'T> = match source with | :? ISeq<'T> as s -> s | :? ISeq as s -> s |> map unbox // covariant on ref types @@ -1275,7 +1275,7 @@ namespace Microsoft.FSharp.Collections mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) |> ofSeq [] - let chunkBySize chunkSize (source : ISeq<'T>) : ISeq<'T[]> = + let internal chunkBySize chunkSize (source : ISeq<'T>) : ISeq<'T[]> = if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" [|SR.GetString SR.inputMustBePositive; chunkSize|] @@ -1300,25 +1300,25 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ } - let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) |> ofSeq + let internal mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) |> ofSeq [] - let splitInto count (source:ISeq<'T>) : ISeq<'T[]> = + let internal splitInto count (source:ISeq<'T>) : ISeq<'T[]> = if count <= 0 then invalidArgFmt "count" "{0}\ncount = {1}" [|SR.GetString SR.inputMustBePositive; count|] mkDelayedSeq (fun () -> source |> toArray |> Array.splitInto count :> seq<_>) - let inline indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) + let inline internal indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) [] - let find f source = + let internal find f source = match tryFind f source with | None -> indexNotFound() | Some x -> x [] - let findIndex p (source:ISeq<_>) = + let internal findIndex p (source:ISeq<_>) = use ie = source.GetEnumerator() let rec loop i = if ie.MoveNext() then @@ -1330,31 +1330,31 @@ namespace Microsoft.FSharp.Collections loop 0 [] - let findBack f source = + let internal findBack f source = source |> toArray |> Array.findBack f [] - let findIndexBack f source = + let internal findIndexBack f source = source |> toArray |> Array.findIndexBack f [] - let pick f source = + let internal pick f source = match tryPick f source with | None -> indexNotFound() | Some x -> x [] - let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = + let internal mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = let arr,state = source |> toArray |> Array.mapFold f acc ofArray arr, state [] - let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = + let internal mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = let array = source |> toArray let arr,state = Array.mapFoldBack f array acc ofArray arr, state - let rec nth index (e : IEnumerator<'T>) = + let rec internal nth index (e : IEnumerator<'T>) = if not (e.MoveNext()) then let shortBy = index + 1 invalidArgFmt "index" @@ -1364,7 +1364,7 @@ namespace Microsoft.FSharp.Collections else nth (index-1) e [] - let item i (source : ISeq<'T>) = + let internal item i (source : ISeq<'T>) = if i < 0 then invalidArgInputMustBeNonNegative "index" i use e = source.GetEnumerator() nth i e @@ -1380,13 +1380,13 @@ namespace Microsoft.FSharp.Collections sortWith compareDescending source [] - let tryFindBack f (source : ISeq<'T>) = + let internal tryFindBack f (source : ISeq<'T>) = source |> toArray |> Array.tryFindBack f [] - let tryFindIndexBack f (source : ISeq<'T>) = + let internal tryFindIndexBack f (source : ISeq<'T>) = source |> toArray |> Array.tryFindIndexBack f [] - let zip3 source1 source2 source3 = + let internal zip3 source1 source2 source3 = map2 (fun x (y,z) -> x,y,z) source1 (zip source2 source3) \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index 0c78d1e567e..fbdaca8d1f2 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -15,7 +15,7 @@ namespace Microsoft.FSharp.Collections /// Values is a mutable struct. It can be embedded within the folder type /// if two values are required for the calculation. [] - type Value<'a> = + type internal Value<'a> = new : a:'a -> Value<'a> val mutable _1: 'a @@ -30,7 +30,7 @@ namespace Microsoft.FSharp.Collections /// Values is a mutable struct. It can be embedded within the folder type /// if three values are required for the calculation. [] - type Values<'a,'b,'c> = + type internal Values<'a,'b,'c> = new : a:'a * b:'b * c:'c -> Values<'a,'b,'c> val mutable _1: 'a val mutable _2: 'b @@ -41,7 +41,7 @@ namespace Microsoft.FSharp.Collections /// is as a base class for an object expression that will be created /// in the ITransformFactory's Compose function. [] - type Transform<'T,'U,'State> = + type internal Transform<'T,'U,'State> = inherit Activity<'T,'U> new : next:Activity * 'State -> Transform<'T,'U,'State> val mutable State : 'State @@ -53,7 +53,7 @@ namespace Microsoft.FSharp.Collections /// is as a base class for an object expression that will be created /// in the ITransformFactory's Compose function. [] - type TransformWithPostProcessing<'T,'U,'State> = + type internal TransformWithPostProcessing<'T,'U,'State> = inherit Transform<'T,'U,'State> new : next:Activity * 'State -> TransformWithPostProcessing<'T,'U,'State> abstract OnComplete : PipeIdx -> unit @@ -88,13 +88,13 @@ namespace Microsoft.FSharp.Collections /// but doesn't check the version of the underlying object which means care has to be taken /// to ensure that it is not modified which the result ISeq exists. [] - val ofResizeArrayUnchecked : ResizeArray<'T> -> ISeq<'T> + val internal ofResizeArrayUnchecked : ResizeArray<'T> -> ISeq<'T> [] - val ofList : list<'T> -> ISeq<'T> + val internal ofList : list<'T> -> ISeq<'T> [] - val ofArray : array<'T> -> ISeq<'T> + val internal ofArray : array<'T> -> ISeq<'T> [] val ofSeq : seq<'T> -> ISeq<'T> @@ -112,91 +112,91 @@ namespace Microsoft.FSharp.Collections and ^U:(static member DivideByInt : ^U * int -> ^U) [] - val empty<'T> : ISeq<'T> + val internal empty<'T> : ISeq<'T> [] - val exactlyOne : ISeq<'T> -> 'T + val internal exactlyOne : ISeq<'T> -> 'T [] - val inline fold<'T,'State> : f:('State->'T->'State) -> seed:'State -> source:ISeq<'T> -> 'State + val inline internal fold<'T,'State> : f:('State->'T->'State) -> seed:'State -> source:ISeq<'T> -> 'State [] - val inline fold2<'T1,'T2,'State> : folder:('State->'T1->'T2->'State) -> state:'State -> source1: ISeq<'T1> -> source2: ISeq<'T2> -> 'State + val inline internal fold2<'T1,'T2,'State> : folder:('State->'T1->'T2->'State) -> state:'State -> source1: ISeq<'T1> -> source2: ISeq<'T2> -> 'State [] - val unfold : generator:('State -> option<'T*'State>) -> state:'State -> ISeq<'T> + val internal unfold : generator:('State -> option<'T*'State>) -> state:'State -> ISeq<'T> [] - val initInfinite : f:(int -> 'T) -> ISeq<'T> + val internal initInfinite : f:(int -> 'T) -> ISeq<'T> [] - val init : count:int -> f:(int -> 'T) -> ISeq<'T> + val internal init : count:int -> f:(int -> 'T) -> ISeq<'T> [] - val inline iter : f:('T -> unit) -> source:ISeq<'T> -> unit + val inline internal iter : f:('T -> unit) -> source:ISeq<'T> -> unit [] - val inline iter2 : f:('T->'U->unit) -> source1 : ISeq<'T> -> source2 : ISeq<'U> -> unit + val inline internal iter2 : f:('T->'U->unit) -> source1 : ISeq<'T> -> source2 : ISeq<'U> -> unit [] - val inline iteri2 : f:(int->'T->'U->unit) -> source1:ISeq<'T> -> source2:ISeq<'U> -> unit + val inline internal iteri2 : f:(int->'T->'U->unit) -> source1:ISeq<'T> -> source2:ISeq<'U> -> unit [] - val tryHead : ISeq<'T> -> option<'T> + val internal tryHead : ISeq<'T> -> option<'T> [] - val head: source:ISeq<'T> -> 'T + val internal head: source:ISeq<'T> -> 'T [] - val inline iteri : f:(int -> 'T -> unit) -> source:ISeq<'T> -> unit + val inline internal iteri : f:(int -> 'T -> unit) -> source:ISeq<'T> -> unit [] - val inline except : itemsToExclude:seq<'T> -> source:ISeq<'T> -> ISeq<'T> when 'T:equality + val inline internal except : itemsToExclude:seq<'T> -> source:ISeq<'T> -> ISeq<'T> when 'T:equality [] - val inline exists : f:('T -> bool) -> source:ISeq<'T> -> bool + val inline internal exists : f:('T -> bool) -> source:ISeq<'T> -> bool [] - val inline exists2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool + val inline internal exists2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool [] val inline contains : element:'T -> source:ISeq<'T> -> bool when 'T : equality [] - val inline forall : f:('T -> bool) -> source:ISeq<'T> -> bool + val inline internal forall : f:('T -> bool) -> source:ISeq<'T> -> bool [] - val inline forall2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool + val inline internal forall2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool [] - val inline filter : f:('T -> bool) -> source:ISeq<'T> -> ISeq<'T> + val inline internal filter : f:('T -> bool) -> source:ISeq<'T> -> ISeq<'T> [] - val inline map : f:('T -> 'U) -> source:ISeq<'T> -> ISeq<'U> + val inline internal map : f:('T -> 'U) -> source:ISeq<'T> -> ISeq<'U> [] - val inline mapi : f:(int->'a->'b) -> source: ISeq<'a> -> ISeq<'b> + val inline internal mapi : f:(int->'a->'b) -> source: ISeq<'a> -> ISeq<'b> [] - val inline map2<'T,'U,'V> : map:('T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> + val inline internal map2<'T,'U,'V> : map:('T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> [] - val inline mapi2<'T,'U,'V> : map:(int -> 'T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> + val inline internal mapi2<'T,'U,'V> : map:(int -> 'T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> [] - val inline map3<'T,'U,'V,'W> : map:('T->'U->'V->'W) -> source1:ISeq<'T> -> source2:ISeq<'U> -> source3:ISeq<'V> -> ISeq<'W> + val inline internal map3<'T,'U,'V,'W> : map:('T->'U->'V->'W) -> source1:ISeq<'T> -> source2:ISeq<'U> -> source3:ISeq<'V> -> ISeq<'W> [] - val inline compareWith : f:('T->'T->int) -> source1 :ISeq<'T> -> source2:ISeq<'T> -> int + val inline internal compareWith : f:('T->'T->int) -> source1 :ISeq<'T> -> source2:ISeq<'T> -> int [] - val inline choose : f:('a->option<'b>) -> source: ISeq<'a> -> ISeq<'b> + val inline internal choose : f:('a->option<'b>) -> source: ISeq<'a> -> ISeq<'b> [] - val inline distinct : source:ISeq<'T> -> ISeq<'T> when 'T:equality + val inline internal distinct : source:ISeq<'T> -> ISeq<'T> when 'T:equality [] - val inline distinctBy : keyf:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key:equality + val inline internal distinctBy : keyf:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key:equality [] val inline max : source:ISeq<'T> -> 'T when 'T:comparison @@ -211,19 +211,19 @@ namespace Microsoft.FSharp.Collections val inline minBy : f:('T->'U) -> source:ISeq<'T> -> 'T when 'U:comparison [] - val pairwise : source:ISeq<'T> -> ISeq<'T * 'T> + val internal pairwise : source:ISeq<'T> -> ISeq<'T * 'T> [] - val inline reduce : f:('T->'T->'T) -> source:ISeq<'T> -> 'T + val inline internal reduce : f:('T->'T->'T) -> source:ISeq<'T> -> 'T [] - val scan : folder:('State->'T->'State) -> initialState:'State -> source:ISeq<'T> -> ISeq<'State> + val internal scan : folder:('State->'T->'State) -> initialState:'State -> source:ISeq<'T> -> ISeq<'State> [] - val skip : skipCount:int -> source:ISeq<'T> -> ISeq<'T> + val internal skip : skipCount:int -> source:ISeq<'T> -> ISeq<'T> [] - val inline skipWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> + val inline internal skipWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> [] val inline sum : source:ISeq<'T> -> 'T @@ -236,97 +236,97 @@ namespace Microsoft.FSharp.Collections and ^U:(static member (+) : ^U * ^U -> ^U) [] - val take : takeCount:int -> source:ISeq<'T> -> ISeq<'T> + val internal take : takeCount:int -> source:ISeq<'T> -> ISeq<'T> [] - val inline takeWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> + val inline internal takeWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> [] - val tail : source:ISeq<'T> -> ISeq<'T> + val internal tail : source:ISeq<'T> -> ISeq<'T> [] - val truncate : truncateCount:int -> source:ISeq<'T> -> ISeq<'T> + val internal truncate : truncateCount:int -> source:ISeq<'T> -> ISeq<'T> [] - val indexed : source: ISeq<'a> -> ISeq + val internal indexed : source: ISeq<'a> -> ISeq [] - val tryItem : index:int -> source:ISeq<'T> -> option<'T> + val internal tryItem : index:int -> source:ISeq<'T> -> option<'T> [] - val inline tryPick : f:('T -> option<'U>) -> source:ISeq<'T> -> option<'U> + val inline internal tryPick : f:('T -> option<'U>) -> source:ISeq<'T> -> option<'U> [] - val inline tryFind : f:('T -> bool) -> source:ISeq<'T> -> option<'T> + val inline internal tryFind : f:('T -> bool) -> source:ISeq<'T> -> option<'T> [] - val inline tryFindIndex: predicate:('T->bool) -> source:ISeq<'T> -> option + val inline internal tryFindIndex: predicate:('T->bool) -> source:ISeq<'T> -> option [] - val last: source:ISeq<'T> -> 'T + val internal last: source:ISeq<'T> -> 'T [] - val tryLast : source:ISeq<'T> -> option<'T> + val internal tryLast : source:ISeq<'T> -> option<'T> [] - val windowed : windowSize:int -> source:ISeq<'T> -> ISeq> + val internal windowed : windowSize:int -> source:ISeq<'T> -> ISeq> [] - val concat : sources:ISeq<'Collection> -> ISeq<'T> when 'Collection :> ISeq<'T> + val internal concat : sources:ISeq<'Collection> -> ISeq<'T> when 'Collection :> ISeq<'T> [] - val append: source1:ISeq<'T> -> source2:ISeq<'T> -> ISeq<'T> + val internal append: source1:ISeq<'T> -> source2:ISeq<'T> -> ISeq<'T> [] - val delay : (unit -> ISeq<'T>) -> ISeq<'T> + val internal delay : (unit -> ISeq<'T>) -> ISeq<'T> [] - val inline groupByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : struct + val inline internal groupByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : struct [] - val inline groupByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : not struct + val inline internal groupByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : not struct [] - val inline countByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : struct + val inline internal countByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : struct [] - val inline countByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : not struct + val inline internal countByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : not struct [] - val length: source:ISeq<'T> -> int + val internal length: source:ISeq<'T> -> int [] - val toArray: source:ISeq<'T> -> array<'T> + val internal toArray: source:ISeq<'T> -> array<'T> [] - val sortBy : projection:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison + val internal sortBy : projection:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison [] - val sort : source:ISeq<'T> -> ISeq<'T> when 'T : comparison + val internal sort : source:ISeq<'T> -> ISeq<'T> when 'T : comparison [] val sortWith : comparer:('T->'T->int) -> source:ISeq<'T> -> ISeq<'T> [] - val rev: source:ISeq<'T> -> ISeq<'T> + val internal rev: source:ISeq<'T> -> ISeq<'T> [] - val permute: indexMap:(int->int) -> source:ISeq<'T> -> ISeq<'T> + val internal permute: indexMap:(int->int) -> source:ISeq<'T> -> ISeq<'T> [] - val scanBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> ISeq<'State> + val internal scanBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> ISeq<'State> [] - val zip: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> + val internal zip: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> [] - val inline reduceBack: reduction:('T->'T->'T) -> source:ISeq<'T> -> 'T + val inline internal reduceBack: reduction:('T->'T->'T) -> source:ISeq<'T> -> 'T [] - val inline foldBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> 'State + val inline internal foldBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> 'State [] - val inline foldBack2<'T1,'T2,'State> : folder:('T1->'T2->'State->'State) -> source1:ISeq<'T1> -> source2:ISeq<'T2> -> state:'State -> 'State + val inline internal foldBack2<'T1,'T2,'State> : folder:('T1->'T2->'State->'State) -> source1:ISeq<'T1> -> source2:ISeq<'T2> -> state:'State -> 'State module internal GroupBy = val inline byVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality @@ -337,58 +337,58 @@ namespace Microsoft.FSharp.Collections val inline byRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality [] - val cache: source:ISeq<'T> -> ISeq<'T> + val internal cache: source:ISeq<'T> -> ISeq<'T> [] - val collect: mapping:('T -> 'Collection) -> source:ISeq<'T> -> ISeq<'U> when 'Collection :> ISeq<'U> + val internal collect: mapping:('T -> 'Collection) -> source:ISeq<'T> -> ISeq<'U> when 'Collection :> ISeq<'U> [] - val allPairs: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> + val internal allPairs: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> [] - val toList: source:ISeq<'T> -> 'T list + val internal toList: source:ISeq<'T> -> 'T list [] - val replicate: count:int -> initial:'T -> ISeq<'T> + val internal replicate: count:int -> initial:'T -> ISeq<'T> [] - val isEmpty: source:ISeq<'T> -> bool + val internal isEmpty: source:ISeq<'T> -> bool [] - val cast: source:IEnumerable -> ISeq<'T> + val internal cast: source:IEnumerable -> ISeq<'T> [] - val chunkBySize: chunkSize:int -> source:ISeq<'T> -> ISeq<'T[]> + val internal chunkBySize: chunkSize:int -> source:ISeq<'T> -> ISeq<'T[]> [] - val splitInto: count:int -> source:ISeq<'T> -> ISeq<'T[]> + val internal splitInto: count:int -> source:ISeq<'T> -> ISeq<'T[]> [] - val find: predicate:('T -> bool) -> source:ISeq<'T> -> 'T + val internal find: predicate:('T -> bool) -> source:ISeq<'T> -> 'T [] - val findBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T + val internal findBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T [] - val findIndex: predicate:('T -> bool) -> source:ISeq<'T> -> int + val internal findIndex: predicate:('T -> bool) -> source:ISeq<'T> -> int [] - val findIndexBack: predicate:('T -> bool) -> source:ISeq<'T> -> int + val internal findIndexBack: predicate:('T -> bool) -> source:ISeq<'T> -> int [] - val pick: chooser:('T -> 'U option) -> source:ISeq<'T> -> 'U + val internal pick: chooser:('T -> 'U option) -> source:ISeq<'T> -> 'U [] - val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:ISeq<'T> -> ISeq<'Result> * 'State + val internal mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:ISeq<'T> -> ISeq<'Result> * 'State [] - val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:ISeq<'T> -> state:'State -> ISeq<'Result> * 'State + val internal mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:ISeq<'T> -> state:'State -> ISeq<'Result> * 'State [] - val item: index:int -> source:ISeq<'T> -> 'T + val internal item: index:int -> source:ISeq<'T> -> 'T [] - val singleton: value:'T -> ISeq<'T> + val internal singleton: value:'T -> ISeq<'T> [] val inline sortDescending : source:ISeq<'T> -> ISeq<'T> when 'T : comparison @@ -397,10 +397,10 @@ namespace Microsoft.FSharp.Collections val inline sortByDescending : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison [] - val tryFindBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T option + val internal tryFindBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T option [] - val tryFindIndexBack : predicate:('T -> bool) -> source:ISeq<'T> -> int option + val internal tryFindIndexBack : predicate:('T -> bool) -> source:ISeq<'T> -> int option [] - val zip3: source1:ISeq<'T1> -> source2:ISeq<'T2> -> source3:ISeq<'T3> -> ISeq<'T1 * 'T2 * 'T3> + val internal zip3: source1:ISeq<'T1> -> source2:ISeq<'T2> -> source3:ISeq<'T3> -> ISeq<'T1 * 'T2 * 'T3> From 53d36eca6c40ea44635a01629b5db732f8d26c89 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 11:26:35 +1000 Subject: [PATCH 097/120] #if'd out the ISeq testing (internal Seq impl) If we are never to make this code public, then it can be deleted. --- .../FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs | 4 ++++ .../FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs | 4 ++++ .../Microsoft.FSharp.Collections/ISeqProperties.fs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs index 65531fdf073..dfb91a6fd71 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs @@ -7,6 +7,8 @@ open NUnit.Framework open FSharp.Core.Unittests.LibraryTestFx +#if ISeqIsPublic + // Various tests for the: // Microsoft.FSharp.Collections.iseq type @@ -1164,3 +1166,5 @@ type ISeqModule() = //let nullSeq:iseq<'a> = null //CheckThrowsArgumentNullException (fun () -> ISeq.contains 5 nullSeq |> ignore) + +#endif \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs index e6a16911496..e7e78342659 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs @@ -7,6 +7,8 @@ open NUnit.Framework open FSharp.Core.Unittests.LibraryTestFx +#if ISeqIsPublic + //type iseq<'a> = ISeq.Core.ISeq<'a> type ISeqWindowedTestInput<'t> = @@ -1839,3 +1841,5 @@ type ISeqModule2() = // Index greater than length let resultIndexGreater = ISeq.tryItem 31 (iseq { 10..20 }) Assert.AreEqual(None, resultIndexGreater) + +#endif \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs index d37172bf0b9..49170f565a7 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs @@ -8,6 +8,8 @@ open NUnit.Framework open FsCheck open Utils +#if ISeqIsPublic + let sortByStable<'a when 'a : comparison> (xs : 'a []) = let indexed = xs|> ISeq.ofSeq |> ISeq.indexed let sorted = indexed |> ISeq.sortBy snd @@ -37,3 +39,5 @@ let distinctByStable<'a when 'a : comparison> (xs : 'a []) = let ``ISeq.distinctBy is stable`` () = Check.QuickThrowOnFailure distinctByStable Check.QuickThrowOnFailure distinctByStable + +#endif \ No newline at end of file From 23fff01ac2b6099d339d8451f077c42bc2038dd8 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 12:15:37 +1000 Subject: [PATCH 098/120] Fixed build order in FSharp.Core.BuildFromSource --- .../FSharp.Core.BuildFromSource.fsproj | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/fsharp/FSharp.Core/FSharp.Core.BuildFromSource.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.BuildFromSource.fsproj index 568a78ef099..3c13b5ab6f1 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.BuildFromSource.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.BuildFromSource.fsproj @@ -63,12 +63,30 @@ Collections/collections.fs + + Collections/list.fsi + + + Collections/list.fs + + + Collections/array.fsi + + + Collections/array.fs + Collections/seqcore.fsi Collections/seqcore.fs + + Collections/iseq.fsi + + + Collections/iseq.fs + Collections/seq.fsi @@ -81,18 +99,6 @@ Collections/string.fs - - Collections/list.fsi - - - Collections/list.fs - - - Collections/array.fsi - - - Collections/array.fs - Collections/array3.fsi From 849bd662c4f3649c0379fa29d545064824ad886b Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 16:15:38 +1000 Subject: [PATCH 099/120] Fix after rebase --- src/fsharp/FSharp.Core/set.fs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/fsharp/FSharp.Core/set.fs b/src/fsharp/FSharp.Core/set.fs index 142dc2d7baa..37b43926587 100644 --- a/src/fsharp/FSharp.Core/set.fs +++ b/src/fsharp/FSharp.Core/set.fs @@ -495,27 +495,12 @@ namespace Microsoft.FSharp.Collections let res = Array.zeroCreate n copyToArray s res 0; res -<<<<<<< HEAD - - - - let rec mkFromEnumerator comparer acc (e: IEnumerator<_>) = - if e.MoveNext() then - mkFromEnumerator comparer (add comparer e.Current acc) e - else acc - - let ofSeq comparer (c: IEnumerable<_>) = - use ie = c.GetEnumerator() - mkFromEnumerator comparer SetEmpty ie -======= let ofSeq comparer (c : IEnumerable<_>) = Seq.fold (fun acc k -> add comparer k acc) SetEmpty c ->>>>>>> Map/Set use Seq.fold to utilize ISeq implementation let ofArray comparer l = Array.fold (fun acc k -> add comparer k acc) SetEmpty l - [] [] [>)>] From 9757a7ae259eb441ddc4ef198d9b66ee268c6100 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 16:17:47 +1000 Subject: [PATCH 100/120] Updated Linq101Aggregates01.il.bsl --- .../Linq101Aggregates01.il.bsl | 3734 ++++++++--------- 1 file changed, 1779 insertions(+), 1955 deletions(-) diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl index 75db60c1178..b2b14612cb1 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl @@ -45,13 +45,13 @@ // Offset: 0x00000618 Length: 0x00000211 } .module Linq101Aggregates01.exe -// MVID: {599414C4-D281-4783-A745-0383C4149459} +// MVID: {59B770B7-D281-4783-A745-0383B770B759} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x01520000 +// Image base: 0x013F0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -133,22 +133,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 12,12 : 9,33 '' @@ -237,12 +233,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -264,27 +258,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -348,47 +337,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/uniqueFactors@12::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/uniqueFactors@12::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method uniqueFactors@12::get_CheckClose .method public strict virtual instance int32 @@ -396,12 +390,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/uniqueFactors@12::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/uniqueFactors@12::current + IL_0006: ret } // end of method uniqueFactors@12::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -409,20 +402,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldc.i4.0 IL_0001: ldc.i4.0 - IL_0002: ldc.i4.0 - IL_0003: ldnull + IL_0002: ldnull + IL_0003: ldc.i4.0 IL_0004: ldc.i4.0 - IL_0005: ldc.i4.0 - IL_0006: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, + IL_0005: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000b: ret + IL_000a: ret } // end of method uniqueFactors@12::GetFreshEnumerator } // end of class uniqueFactors@12 @@ -499,22 +491,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 21,21 : 9,28 '' @@ -603,12 +591,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -630,27 +616,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -714,47 +695,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/numSum@21::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/numSum@21::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method numSum@21::get_CheckClose .method public strict virtual instance int32 @@ -762,12 +748,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/numSum@21::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/numSum@21::current + IL_0006: ret } // end of method numSum@21::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -775,20 +760,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldc.i4.0 IL_0001: ldc.i4.0 - IL_0002: ldc.i4.0 - IL_0003: ldnull + IL_0002: ldnull + IL_0003: ldc.i4.0 IL_0004: ldc.i4.0 - IL_0005: ldc.i4.0 - IL_0006: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, + IL_0005: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000b: ret + IL_000a: ret } // end of method numSum@21::GetFreshEnumerator } // end of class numSum@21 @@ -811,12 +795,11 @@ .method public strict virtual instance int32 Invoke(int32 n) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 22,22 : 15,16 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'numSum@22-1'::Invoke } // end of class 'numSum@22-1' @@ -825,46 +808,45 @@ extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 - IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::f - IL_0007: nop - IL_0008: ldarg.0 - IL_0009: ldc.i4.0 - IL_000a: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) - IL_000f: ldarg.0 - IL_0010: pop - IL_0011: ret + IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::projection + IL_0007: ldarg.0 + IL_0008: ldc.i4.0 + IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_000e: ldarg.0 + IL_000f: pop + IL_0010: ret } // end of method 'numSum@22-3'::.ctor .method public hidebysig virtual instance bool - ProcessNext(int32 input) cil managed + ProcessNext(int32 'value') cil managed { - // Code size 29 (0x1d) + // Code size 28 (0x1c) .maxstack 8 - .line 22,22 : 9,16 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.0 IL_0001: ldarg.0 IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::f + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::projection IL_000d: ldarg.1 IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0013: add.ovf IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) IL_0019: nop - IL_001a: nop - IL_001b: ldc.i4.0 - IL_001c: ret + .line 22,22 : 9,16 '' + IL_001a: ldc.i4.0 + IL_001b: ret } // end of method 'numSum@22-3'::ProcessNext } // end of class 'numSum@22-3' @@ -872,12 +854,12 @@ .class auto ansi serializable sealed nested assembly beforefieldinit 'numSum@22-2' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -887,21 +869,20 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::f + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::projection IL_000d: ret } // end of method 'numSum@22-2'::.ctor .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 Invoke(int32 _arg1) cil managed { - // Code size 13 (0xd) + // Code size 12 (0xc) .maxstack 8 .line 22,22 : 9,16 '' - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::f - IL_0007: newobj instance void Linq101Aggregates01/'numSum@22-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_000c: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::projection + IL_0006: newobj instance void Linq101Aggregates01/'numSum@22-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000b: ret } // end of method 'numSum@22-2'::Invoke } // end of class 'numSum@22-2' @@ -978,22 +959,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 30,30 : 9,26 '' @@ -1082,12 +1059,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -1109,27 +1084,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -1193,47 +1163,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/totalChars@30::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/totalChars@30::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method totalChars@30::get_CheckClose .method public strict virtual instance string @@ -1241,12 +1216,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string Linq101Aggregates01/totalChars@30::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld string Linq101Aggregates01/totalChars@30::current + IL_0006: ret } // end of method totalChars@30::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -1254,20 +1228,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldnull IL_0001: ldnull IL_0002: ldnull - IL_0003: ldnull - IL_0004: ldc.i4.0 - IL_0005: ldnull - IL_0006: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, + IL_0003: ldc.i4.0 + IL_0004: ldnull + IL_0005: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_000b: ret + IL_000a: ret } // end of method totalChars@30::GetFreshEnumerator } // end of class totalChars@30 @@ -1290,13 +1263,12 @@ .method public strict virtual instance int32 Invoke(string w) cil managed { - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 .line 31,31 : 16,24 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0007: ret + IL_0000: ldarg.1 + IL_0001: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0006: ret } // end of method 'totalChars@31-1'::Invoke } // end of class 'totalChars@31-1' @@ -1305,46 +1277,45 @@ extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 - IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::f - IL_0007: nop - IL_0008: ldarg.0 - IL_0009: ldc.i4.0 - IL_000a: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) - IL_000f: ldarg.0 - IL_0010: pop - IL_0011: ret + IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::projection + IL_0007: ldarg.0 + IL_0008: ldc.i4.0 + IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_000e: ldarg.0 + IL_000f: pop + IL_0010: ret } // end of method 'totalChars@31-3'::.ctor .method public hidebysig virtual instance bool - ProcessNext(string input) cil managed + ProcessNext(string 'value') cil managed { - // Code size 29 (0x1d) + // Code size 28 (0x1c) .maxstack 8 - .line 31,31 : 9,25 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.0 IL_0001: ldarg.0 IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::f + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::projection IL_000d: ldarg.1 IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0013: add.ovf IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) IL_0019: nop - IL_001a: nop - IL_001b: ldc.i4.0 - IL_001c: ret + .line 31,31 : 9,25 '' + IL_001a: ldc.i4.0 + IL_001b: ret } // end of method 'totalChars@31-3'::ProcessNext } // end of class 'totalChars@31-3' @@ -1352,12 +1323,12 @@ .class auto ansi serializable sealed nested assembly beforefieldinit 'totalChars@31-2' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1367,21 +1338,20 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::f + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::projection IL_000d: ret } // end of method 'totalChars@31-2'::.ctor .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 Invoke(int32 _arg1) cil managed { - // Code size 13 (0xd) + // Code size 12 (0xc) .maxstack 8 .line 31,31 : 9,25 '' - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::f - IL_0007: newobj instance void Linq101Aggregates01/'totalChars@31-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_000c: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::projection + IL_0006: newobj instance void Linq101Aggregates01/'totalChars@31-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000b: ret } // end of method 'totalChars@31-2'::Invoke } // end of class 'totalChars@31-2' @@ -1408,20 +1378,19 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 39,39 : 9,29 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 40,40 : 9,32 '' - IL_0003: ldarg.0 - IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories@39::builder@ - IL_0009: ldloc.0 - IL_000a: tail. - IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0011: ret + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories@39::builder@ + IL_0008: ldloc.0 + IL_0009: tail. + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0010: ret } // end of method categories@39::Invoke } // end of class categories@39 @@ -1444,12 +1413,11 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 40,40 : 20,21 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'categories@40-1'::Invoke } // end of class 'categories@40-1' @@ -1472,14 +1440,13 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 40,40 : 22,32 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0008: ret } // end of method 'categories@40-2'::Invoke } // end of class 'categories@40-2' @@ -1561,22 +1528,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 42,42 : 13,26 '' @@ -1666,12 +1629,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -1693,27 +1654,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -1777,47 +1733,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/sum@42::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/sum@42::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method sum@42::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -1825,12 +1786,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/sum@42::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/sum@42::current + IL_0006: ret } // end of method sum@42::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -1838,23 +1798,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/sum@42::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/sum@42::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method sum@42::GetFreshEnumerator } // end of class sum@42 @@ -1877,14 +1836,13 @@ .method public strict virtual instance int32 Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 43,43 : 19,33 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance int32 [Utils]Utils/Product::get_UnitsInStock() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance int32 [Utils]Utils/Product::get_UnitsInStock() + IL_0008: ret } // end of method 'sum@43-1'::Invoke } // end of class 'sum@43-1' @@ -1893,46 +1851,45 @@ extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 - IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::f - IL_0007: nop - IL_0008: ldarg.0 - IL_0009: ldc.i4.0 - IL_000a: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) - IL_000f: ldarg.0 - IL_0010: pop - IL_0011: ret + IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::projection + IL_0007: ldarg.0 + IL_0008: ldc.i4.0 + IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_000e: ldarg.0 + IL_000f: pop + IL_0010: ret } // end of method 'sum@43-3'::.ctor .method public hidebysig virtual instance bool - ProcessNext(class [Utils]Utils/Product input) cil managed + ProcessNext(class [Utils]Utils/Product 'value') cil managed { - // Code size 29 (0x1d) + // Code size 28 (0x1c) .maxstack 8 - .line 43,43 : 13,33 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.0 IL_0001: ldarg.0 IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::f + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::projection IL_000d: ldarg.1 IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0013: add.ovf IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) IL_0019: nop - IL_001a: nop - IL_001b: ldc.i4.0 - IL_001c: ret + .line 43,43 : 13,33 '' + IL_001a: ldc.i4.0 + IL_001b: ret } // end of method 'sum@43-3'::ProcessNext } // end of class 'sum@43-3' @@ -1940,12 +1897,12 @@ .class auto ansi serializable sealed nested assembly beforefieldinit 'sum@43-2' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -1955,21 +1912,20 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::f + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::projection IL_000d: ret } // end of method 'sum@43-2'::.ctor .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 Invoke(int32 _arg1) cil managed { - // Code size 13 (0xd) + // Code size 12 (0xc) .maxstack 8 .line 43,43 : 13,33 '' - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::f - IL_0007: newobj instance void Linq101Aggregates01/'sum@43-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_000c: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::projection + IL_0006: newobj instance void Linq101Aggregates01/'sum@43-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000b: ret } // end of method 'sum@43-2'::Invoke } // end of class 'sum@43-2' @@ -1996,7 +1952,7 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,int32>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 109 (0x6d) + // Code size 108 (0x6c) .maxstack 10 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] int32 sum, @@ -2006,62 +1962,60 @@ [5] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_5, [6] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_6) .line 40,40 : 38,39 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 - IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0008: stloc.2 - IL_0009: ldloc.2 - IL_000a: stloc.3 - IL_000b: ldloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0007: stloc.2 + IL_0008: ldloc.2 + IL_0009: stloc.3 + IL_000a: ldloc.0 + IL_000b: ldnull IL_000c: ldnull IL_000d: ldnull - IL_000e: ldnull - IL_000f: ldc.i4.0 - IL_0010: ldnull - IL_0011: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000e: ldc.i4.0 + IL_000f: ldnull + IL_0010: newobj instance void Linq101Aggregates01/sum@42::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0016: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001b: stloc.s V_4 - IL_001d: newobj instance void Linq101Aggregates01/'sum@43-1'::.ctor() - IL_0022: stloc.s V_5 - IL_0024: ldloc.s V_4 - IL_0026: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_002b: stloc.s V_6 - IL_002d: ldloc.s V_6 - IL_002f: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_0034: brfalse.s IL_0038 - - IL_0036: br.s IL_0043 - - .line 100001,100001 : 0,0 '' - IL_0038: ldstr "source" - IL_003d: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_0042: throw - - .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_0043: nop - IL_0044: ldloc.s V_6 - IL_0046: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_004b: ldloc.s V_5 - IL_004d: newobj instance void Linq101Aggregates01/'sum@43-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0052: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0057: stloc.1 + IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001a: stloc.s V_4 + IL_001c: newobj instance void Linq101Aggregates01/'sum@43-1'::.ctor() + IL_0021: stloc.s V_5 + IL_0023: ldloc.s V_4 + IL_0025: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_002a: stloc.s V_6 + IL_002c: ldloc.s V_6 + IL_002e: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_0033: brfalse.s IL_0037 + + IL_0035: br.s IL_0042 + + .line 100001,100001 : 0,0 '' + IL_0037: ldstr "source" + IL_003c: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_0041: throw + + .line 100001,100001 : 0,0 '' + IL_0042: nop + IL_0043: ldloc.s V_6 + IL_0045: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_004a: ldloc.s V_5 + IL_004c: newobj instance void Linq101Aggregates01/'sum@43-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0051: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0056: stloc.1 .line 45,45 : 9,28 '' - IL_0058: ldarg.0 - IL_0059: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories@40-3'::builder@ - IL_005e: ldloc.0 - IL_005f: ldloc.1 - IL_0060: newobj instance void class [mscorlib]System.Tuple`2,int32>::.ctor(!0, + IL_0057: ldarg.0 + IL_0058: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories@40-3'::builder@ + IL_005d: ldloc.0 + IL_005e: ldloc.1 + IL_005f: newobj instance void class [mscorlib]System.Tuple`2,int32>::.ctor(!0, !1) - IL_0065: tail. - IL_0067: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,int32>,object>(!!0) - IL_006c: ret + IL_0064: tail. + IL_0066: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,int32>,object>(!!0) + IL_006b: ret } // end of method 'categories@40-3'::Invoke } // end of class 'categories@40-3' @@ -2084,24 +2038,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,int32> tupledArg) cil managed { - // Code size 28 (0x1c) + // Code size 27 (0x1b) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] int32 sum) - .line 45,45 : 17,27 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,int32>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,int32>::get_Item2() IL_000d: stloc.1 - IL_000e: nop - IL_000f: ldloc.0 - IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0015: ldloc.1 - IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + .line 45,45 : 17,27 '' + IL_000e: ldloc.0 + IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0014: ldloc.1 + IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001b: ret + IL_001a: ret } // end of method 'categories@45-4'::Invoke } // end of class 'categories@45-4' @@ -2178,22 +2132,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 49,49 : 22,41 '' @@ -2282,12 +2232,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -2309,27 +2257,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -2393,47 +2336,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/minNum@49::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/minNum@49::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method minNum@49::get_CheckClose .method public strict virtual instance int32 @@ -2441,12 +2389,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/minNum@49::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/minNum@49::current + IL_0006: ret } // end of method minNum@49::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -2454,20 +2401,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldc.i4.0 IL_0001: ldc.i4.0 - IL_0002: ldc.i4.0 - IL_0003: ldnull + IL_0002: ldnull + IL_0003: ldc.i4.0 IL_0004: ldc.i4.0 - IL_0005: ldc.i4.0 - IL_0006: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, + IL_0005: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000b: ret + IL_000a: ret } // end of method minNum@49::GetFreshEnumerator } // end of class minNum@49 @@ -2490,12 +2436,11 @@ .method public strict virtual instance int32 Invoke(int32 n) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 49,49 : 48,49 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'minNum@49-1'::Invoke } // end of class 'minNum@49-1' @@ -2572,22 +2517,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 52,52 : 28,45 '' @@ -2676,12 +2617,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -2703,27 +2642,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -2787,47 +2721,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/shortestWord@52::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/shortestWord@52::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method shortestWord@52::get_CheckClose .method public strict virtual instance string @@ -2835,12 +2774,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string Linq101Aggregates01/shortestWord@52::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld string Linq101Aggregates01/shortestWord@52::current + IL_0006: ret } // end of method shortestWord@52::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -2848,20 +2786,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldnull IL_0001: ldnull IL_0002: ldnull - IL_0003: ldnull - IL_0004: ldc.i4.0 - IL_0005: ldnull - IL_0006: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, + IL_0003: ldc.i4.0 + IL_0004: ldnull + IL_0005: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_000b: ret + IL_000a: ret } // end of method shortestWord@52::GetFreshEnumerator } // end of class shortestWord@52 @@ -2884,13 +2821,12 @@ .method public strict virtual instance int32 Invoke(string w) cil managed { - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 .line 52,52 : 52,60 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0007: ret + IL_0000: ldarg.1 + IL_0001: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0006: ret } // end of method 'shortestWord@52-1'::Invoke } // end of class 'shortestWord@52-1' @@ -2917,20 +2853,19 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 57,57 : 9,29 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 58,58 : 9,32 '' - IL_0003: ldarg.0 - IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories2@57::builder@ - IL_0009: ldloc.0 - IL_000a: tail. - IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0011: ret + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories2@57::builder@ + IL_0008: ldloc.0 + IL_0009: tail. + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0010: ret } // end of method categories2@57::Invoke } // end of class categories2@57 @@ -2953,12 +2888,11 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 58,58 : 20,21 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'categories2@58-1'::Invoke } // end of class 'categories2@58-1' @@ -2981,14 +2915,13 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 58,58 : 22,32 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0008: ret } // end of method 'categories2@58-2'::Invoke } // end of class 'categories2@58-2' @@ -3070,22 +3003,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 59,59 : 27,40 '' @@ -3175,12 +3104,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -3202,27 +3129,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -3286,47 +3208,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/min@59::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/min@59::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method min@59::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -3334,12 +3261,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/min@59::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/min@59::current + IL_0006: ret } // end of method min@59::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -3347,23 +3273,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/min@59::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/min@59::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method min@59::GetFreshEnumerator } // end of class min@59 @@ -3386,14 +3311,13 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 59,59 : 47,58 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0008: ret } // end of method 'min@59-1'::Invoke } // end of class 'min@59-1' @@ -3420,45 +3344,44 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 58 (0x3a) + // Code size 57 (0x39) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min, [2] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) .line 58,58 : 38,39 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 - IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0008: stloc.2 - IL_0009: ldloc.2 - IL_000a: ldloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0007: stloc.2 + IL_0008: ldloc.2 + IL_0009: ldloc.0 + IL_000a: ldnull IL_000b: ldnull IL_000c: ldnull - IL_000d: ldnull - IL_000e: ldc.i4.0 - IL_000f: ldnull - IL_0010: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000d: ldc.i4.0 + IL_000e: ldnull + IL_000f: newobj instance void Linq101Aggregates01/min@59::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001a: newobj instance void Linq101Aggregates01/'min@59-1'::.ctor() - IL_001f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0019: newobj instance void Linq101Aggregates01/'min@59-1'::.ctor() + IL_001e: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0024: stloc.1 + IL_0023: stloc.1 .line 60,60 : 9,28 '' - IL_0025: ldarg.0 - IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories2@58-3'::builder@ - IL_002b: ldloc.0 - IL_002c: ldloc.1 - IL_002d: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, + IL_0024: ldarg.0 + IL_0025: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories2@58-3'::builder@ + IL_002a: ldloc.0 + IL_002b: ldloc.1 + IL_002c: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, !1) - IL_0032: tail. - IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) - IL_0039: ret + IL_0031: tail. + IL_0033: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) + IL_0038: ret } // end of method 'categories2@58-3'::Invoke } // end of class 'categories2@58-3' @@ -3481,24 +3404,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal> tupledArg) cil managed { - // Code size 28 (0x1c) + // Code size 27 (0x1b) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min) - .line 60,60 : 17,27 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item2() IL_000d: stloc.1 - IL_000e: nop - IL_000f: ldloc.0 - IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0015: ldloc.1 - IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + .line 60,60 : 17,27 '' + IL_000e: ldloc.0 + IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0014: ldloc.1 + IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001b: ret + IL_001a: ret } // end of method 'categories2@60-4'::Invoke } // end of class 'categories2@60-4' @@ -3525,20 +3448,19 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 66,66 : 9,29 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 67,67 : 9,32 '' - IL_0003: ldarg.0 - IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories3@66::builder@ - IL_0009: ldloc.0 - IL_000a: tail. - IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0011: ret + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories3@66::builder@ + IL_0008: ldloc.0 + IL_0009: tail. + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0010: ret } // end of method categories3@66::Invoke } // end of class categories3@66 @@ -3561,12 +3483,11 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 67,67 : 20,21 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'categories3@67-1'::Invoke } // end of class 'categories3@67-1' @@ -3589,14 +3510,13 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 67,67 : 22,32 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0008: ret } // end of method 'categories3@67-2'::Invoke } // end of class 'categories3@67-2' @@ -3616,16 +3536,15 @@ } // end of method 'min@68-2'::.ctor .method assembly hidebysig instance valuetype [mscorlib]System.Decimal - Invoke(class [Utils]Utils/Product arg) cil managed + Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 68,68 : 46,57 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0008: ret } // end of method 'min@68-2'::Invoke } // end of class 'min@68-2' @@ -3707,22 +3626,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 69,69 : 40,53 '' @@ -3812,12 +3727,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -3839,27 +3752,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -3923,47 +3831,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/cheapestProducts@69::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/cheapestProducts@69::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method cheapestProducts@69::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -3971,12 +3884,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/cheapestProducts@69::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/cheapestProducts@69::current + IL_0006: ret } // end of method cheapestProducts@69::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -3984,23 +3896,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/cheapestProducts@69::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/cheapestProducts@69::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method cheapestProducts@69::GetFreshEnumerator } // end of class cheapestProducts@69 @@ -4027,17 +3938,16 @@ .method public strict virtual instance bool Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 19 (0x13) + // Code size 18 (0x12) .maxstack 8 .line 69,69 : 61,78 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0007: ldarg.0 - IL_0008: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'cheapestProducts@69-1'::min - IL_000d: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, + IL_0000: ldarg.1 + IL_0001: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0006: ldarg.0 + IL_0007: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'cheapestProducts@69-1'::min + IL_000c: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_0012: ret + IL_0011: ret } // end of method 'cheapestProducts@69-1'::Invoke } // end of class 'cheapestProducts@69-1' @@ -4064,60 +3974,59 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 88 (0x58) + // Code size 87 (0x57) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min, [2] class [mscorlib]System.Collections.Generic.IEnumerable`1 cheapestProducts, [3] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) .line 67,67 : 38,39 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 68,68 : 9,58 '' - IL_0003: ldloc.0 - IL_0004: newobj instance void Linq101Aggregates01/'min@68-2'::.ctor() - IL_0009: ldftn instance valuetype [mscorlib]System.Decimal Linq101Aggregates01/'min@68-2'::Invoke(class [Utils]Utils/Product) - IL_000f: newobj instance void class [mscorlib]System.Func`2::.ctor(object, + IL_0002: ldloc.0 + IL_0003: newobj instance void Linq101Aggregates01/'min@68-2'::.ctor() + IL_0008: ldftn instance valuetype [mscorlib]System.Decimal Linq101Aggregates01/'min@68-2'::Invoke(class [Utils]Utils/Product) + IL_000e: newobj instance void class [mscorlib]System.Func`2::.ctor(object, native int) - IL_0014: call valuetype [mscorlib]System.Decimal [System.Core]System.Linq.Enumerable::Min(class [mscorlib]System.Collections.Generic.IEnumerable`1, + IL_0013: call valuetype [mscorlib]System.Decimal [System.Core]System.Linq.Enumerable::Min(class [mscorlib]System.Collections.Generic.IEnumerable`1, class [mscorlib]System.Func`2) - IL_0019: stloc.1 + IL_0018: stloc.1 .line 70,70 : 9,41 '' - IL_001a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_001f: stloc.3 - IL_0020: ldloc.3 - IL_0021: ldloc.0 + IL_0019: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_001e: stloc.3 + IL_001f: ldloc.3 + IL_0020: ldloc.0 + IL_0021: ldnull IL_0022: ldnull IL_0023: ldnull - IL_0024: ldnull - IL_0025: ldc.i4.0 - IL_0026: ldnull - IL_0027: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0024: ldc.i4.0 + IL_0025: ldnull + IL_0026: newobj instance void Linq101Aggregates01/cheapestProducts@69::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_002c: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0031: ldloc.1 - IL_0032: newobj instance void Linq101Aggregates01/'cheapestProducts@69-1'::.ctor(valuetype [mscorlib]System.Decimal) - IL_0037: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_002b: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0030: ldloc.1 + IL_0031: newobj instance void Linq101Aggregates01/'cheapestProducts@69-1'::.ctor(valuetype [mscorlib]System.Decimal) + IL_0036: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_003c: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_0041: stloc.2 + IL_003b: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_0040: stloc.2 .line 70,70 : 9,41 '' - IL_0042: ldarg.0 - IL_0043: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories3@67-3'::builder@ - IL_0048: ldloc.0 - IL_0049: ldloc.1 - IL_004a: ldloc.2 - IL_004b: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, + IL_0041: ldarg.0 + IL_0042: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories3@67-3'::builder@ + IL_0047: ldloc.0 + IL_0048: ldloc.1 + IL_0049: ldloc.2 + IL_004a: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, !1, !2) - IL_0050: tail. - IL_0052: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) - IL_0057: ret + IL_004f: tail. + IL_0051: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) + IL_0056: ret } // end of method 'categories3@67-3'::Invoke } // end of class 'categories3@67-3' @@ -4140,12 +4049,12 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2> Invoke(class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed { - // Code size 35 (0x23) + // Code size 34 (0x22) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal min, [2] class [mscorlib]System.Collections.Generic.IEnumerable`1 cheapestProducts) - .line 70,70 : 17,40 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item1() IL_0006: stloc.0 @@ -4155,13 +4064,13 @@ IL_000e: ldarg.1 IL_000f: call instance !2 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item3() IL_0014: stloc.2 - IL_0015: nop - IL_0016: ldloc.0 - IL_0017: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_001c: ldloc.2 - IL_001d: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, + .line 70,70 : 17,40 '' + IL_0015: ldloc.0 + IL_0016: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_001b: ldloc.2 + IL_001c: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, !1) - IL_0022: ret + IL_0021: ret } // end of method 'categories3@70-4'::Invoke } // end of class 'categories3@70-4' @@ -4238,22 +4147,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 74,74 : 22,41 '' @@ -4342,12 +4247,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -4369,27 +4272,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -4453,47 +4351,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/maxNum@74::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/maxNum@74::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method maxNum@74::get_CheckClose .method public strict virtual instance int32 @@ -4501,12 +4404,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/maxNum@74::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/maxNum@74::current + IL_0006: ret } // end of method maxNum@74::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -4514,20 +4416,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldc.i4.0 IL_0001: ldc.i4.0 - IL_0002: ldc.i4.0 - IL_0003: ldnull + IL_0002: ldnull + IL_0003: ldc.i4.0 IL_0004: ldc.i4.0 - IL_0005: ldc.i4.0 - IL_0006: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, + IL_0005: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_000b: ret + IL_000a: ret } // end of method maxNum@74::GetFreshEnumerator } // end of class maxNum@74 @@ -4550,12 +4451,11 @@ .method public strict virtual instance int32 Invoke(int32 n) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 74,74 : 48,49 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'maxNum@74-1'::Invoke } // end of class 'maxNum@74-1' @@ -4632,22 +4532,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0095 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0084 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b6 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 77,77 : 29,46 '' @@ -4736,12 +4632,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -4763,27 +4657,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -4847,47 +4736,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/longestLength@77::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/longestLength@77::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method longestLength@77::get_CheckClose .method public strict virtual instance string @@ -4895,12 +4789,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string Linq101Aggregates01/longestLength@77::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld string Linq101Aggregates01/longestLength@77::current + IL_0006: ret } // end of method longestLength@77::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -4908,20 +4801,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 12 (0xc) + // Code size 11 (0xb) .maxstack 9 - IL_0000: nop + IL_0000: ldnull IL_0001: ldnull IL_0002: ldnull - IL_0003: ldnull - IL_0004: ldc.i4.0 - IL_0005: ldnull - IL_0006: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, + IL_0003: ldc.i4.0 + IL_0004: ldnull + IL_0005: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_000b: ret + IL_000a: ret } // end of method longestLength@77::GetFreshEnumerator } // end of class longestLength@77 @@ -4944,13 +4836,12 @@ .method public strict virtual instance int32 Invoke(string w) cil managed { - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 .line 77,77 : 53,61 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0007: ret + IL_0000: ldarg.1 + IL_0001: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0006: ret } // end of method 'longestLength@77-1'::Invoke } // end of class 'longestLength@77-1' @@ -4977,20 +4868,19 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 82,82 : 9,29 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 83,83 : 9,32 '' - IL_0003: ldarg.0 - IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories4@82::builder@ - IL_0009: ldloc.0 - IL_000a: tail. - IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0011: ret + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories4@82::builder@ + IL_0008: ldloc.0 + IL_0009: tail. + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0010: ret } // end of method categories4@82::Invoke } // end of class categories4@82 @@ -5013,12 +4903,11 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 83,83 : 20,21 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'categories4@83-1'::Invoke } // end of class 'categories4@83-1' @@ -5041,14 +4930,13 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 83,83 : 22,32 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0008: ret } // end of method 'categories4@83-2'::Invoke } // end of class 'categories4@83-2' @@ -5130,22 +5018,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 84,84 : 42,55 '' @@ -5235,12 +5119,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -5262,27 +5144,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -5346,47 +5223,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/mostExpensivePrice@84::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/mostExpensivePrice@84::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method mostExpensivePrice@84::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -5394,12 +5276,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensivePrice@84::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensivePrice@84::current + IL_0006: ret } // end of method mostExpensivePrice@84::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -5407,23 +5288,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensivePrice@84::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensivePrice@84::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method mostExpensivePrice@84::GetFreshEnumerator } // end of class mostExpensivePrice@84 @@ -5446,14 +5326,13 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 84,84 : 62,73 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0008: ret } // end of method 'mostExpensivePrice@84-1'::Invoke } // end of class 'mostExpensivePrice@84-1' @@ -5480,45 +5359,44 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 58 (0x3a) + // Code size 57 (0x39) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal mostExpensivePrice, [2] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder builder@) .line 83,83 : 38,39 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 - IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0008: stloc.2 - IL_0009: ldloc.2 - IL_000a: ldloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0007: stloc.2 + IL_0008: ldloc.2 + IL_0009: ldloc.0 + IL_000a: ldnull IL_000b: ldnull IL_000c: ldnull - IL_000d: ldnull - IL_000e: ldc.i4.0 - IL_000f: ldnull - IL_0010: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000d: ldc.i4.0 + IL_000e: ldnull + IL_000f: newobj instance void Linq101Aggregates01/mostExpensivePrice@84::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001a: newobj instance void Linq101Aggregates01/'mostExpensivePrice@84-1'::.ctor() - IL_001f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0019: newobj instance void Linq101Aggregates01/'mostExpensivePrice@84-1'::.ctor() + IL_001e: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0024: stloc.1 + IL_0023: stloc.1 .line 85,85 : 9,43 '' - IL_0025: ldarg.0 - IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories4@83-3'::builder@ - IL_002b: ldloc.0 - IL_002c: ldloc.1 - IL_002d: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, + IL_0024: ldarg.0 + IL_0025: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories4@83-3'::builder@ + IL_002a: ldloc.0 + IL_002b: ldloc.1 + IL_002c: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, !1) - IL_0032: tail. - IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) - IL_0039: ret + IL_0031: tail. + IL_0033: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) + IL_0038: ret } // end of method 'categories4@83-3'::Invoke } // end of class 'categories4@83-3' @@ -5541,24 +5419,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal> tupledArg) cil managed { - // Code size 28 (0x1c) + // Code size 27 (0x1b) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal mostExpensivePrice) - .line 85,85 : 17,42 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item2() IL_000d: stloc.1 - IL_000e: nop - IL_000f: ldloc.0 - IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0015: ldloc.1 - IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + .line 85,85 : 17,42 '' + IL_000e: ldloc.0 + IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0014: ldloc.1 + IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001b: ret + IL_001a: ret } // end of method 'categories4@85-4'::Invoke } // end of class 'categories4@85-4' @@ -5585,20 +5463,19 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 91,91 : 9,29 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 92,92 : 9,32 '' - IL_0003: ldarg.0 - IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories5@91::builder@ - IL_0009: ldloc.0 - IL_000a: tail. - IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0011: ret + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories5@91::builder@ + IL_0008: ldloc.0 + IL_0009: tail. + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0010: ret } // end of method categories5@91::Invoke } // end of class categories5@91 @@ -5621,12 +5498,11 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 92,92 : 20,21 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'categories5@92-1'::Invoke } // end of class 'categories5@92-1' @@ -5649,14 +5525,13 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 92,92 : 22,32 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0008: ret } // end of method 'categories5@92-2'::Invoke } // end of class 'categories5@92-2' @@ -5738,22 +5613,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 93,93 : 32,45 '' @@ -5843,12 +5714,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -5870,27 +5739,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -5954,47 +5818,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/maxPrice@93::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/maxPrice@93::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method maxPrice@93::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -6002,12 +5871,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/maxPrice@93::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/maxPrice@93::current + IL_0006: ret } // end of method maxPrice@93::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -6015,23 +5883,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/maxPrice@93::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/maxPrice@93::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method maxPrice@93::GetFreshEnumerator } // end of class maxPrice@93 @@ -6054,14 +5921,13 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 93,93 : 52,63 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0008: ret } // end of method 'maxPrice@93-1'::Invoke } // end of class 'maxPrice@93-1' @@ -6143,22 +6009,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 94,94 : 45,58 '' @@ -6248,12 +6110,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -6275,27 +6135,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -6359,47 +6214,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/mostExpensiveProducts@94::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/mostExpensiveProducts@94::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method mostExpensiveProducts@94::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -6407,12 +6267,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensiveProducts@94::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/mostExpensiveProducts@94::current + IL_0006: ret } // end of method mostExpensiveProducts@94::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -6420,23 +6279,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensiveProducts@94::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/mostExpensiveProducts@94::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method mostExpensiveProducts@94::GetFreshEnumerator } // end of class mostExpensiveProducts@94 @@ -6463,17 +6321,16 @@ .method public strict virtual instance bool Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 19 (0x13) + // Code size 18 (0x12) .maxstack 8 .line 94,94 : 66,88 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0007: ldarg.0 - IL_0008: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'mostExpensiveProducts@94-1'::maxPrice - IL_000d: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, + IL_0000: ldarg.1 + IL_0001: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0006: ldarg.0 + IL_0007: ldfld valuetype [mscorlib]System.Decimal Linq101Aggregates01/'mostExpensiveProducts@94-1'::maxPrice + IL_000c: call bool [mscorlib]System.Decimal::op_Equality(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_0012: ret + IL_0011: ret } // end of method 'mostExpensiveProducts@94-1'::Invoke } // end of class 'mostExpensiveProducts@94-1' @@ -6500,7 +6357,7 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 101 (0x65) + // Code size 100 (0x64) .maxstack 11 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal maxPrice, @@ -6508,64 +6365,63 @@ [3] class [mscorlib]System.Collections.Generic.IEnumerable`1 mostExpensiveProducts, [4] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_4) .line 92,92 : 38,39 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 - IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0008: stloc.2 - IL_0009: ldloc.2 - IL_000a: ldloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0007: stloc.2 + IL_0008: ldloc.2 + IL_0009: ldloc.0 + IL_000a: ldnull IL_000b: ldnull IL_000c: ldnull - IL_000d: ldnull - IL_000e: ldc.i4.0 - IL_000f: ldnull - IL_0010: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000d: ldc.i4.0 + IL_000e: ldnull + IL_000f: newobj instance void Linq101Aggregates01/maxPrice@93::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001a: newobj instance void Linq101Aggregates01/'maxPrice@93-1'::.ctor() - IL_001f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0019: newobj instance void Linq101Aggregates01/'maxPrice@93-1'::.ctor() + IL_001e: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0024: stloc.1 + IL_0023: stloc.1 .line 95,95 : 9,46 '' - IL_0025: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_002a: stloc.s V_4 - IL_002c: ldloc.s V_4 - IL_002e: ldloc.0 + IL_0024: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0029: stloc.s V_4 + IL_002b: ldloc.s V_4 + IL_002d: ldloc.0 + IL_002e: ldnull IL_002f: ldnull IL_0030: ldnull - IL_0031: ldnull - IL_0032: ldc.i4.0 - IL_0033: ldnull - IL_0034: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0031: ldc.i4.0 + IL_0032: ldnull + IL_0033: newobj instance void Linq101Aggregates01/mostExpensiveProducts@94::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0039: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_003e: ldloc.1 - IL_003f: newobj instance void Linq101Aggregates01/'mostExpensiveProducts@94-1'::.ctor(valuetype [mscorlib]System.Decimal) - IL_0044: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0038: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_003d: ldloc.1 + IL_003e: newobj instance void Linq101Aggregates01/'mostExpensiveProducts@94-1'::.ctor(valuetype [mscorlib]System.Decimal) + IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Where(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0049: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_004e: stloc.3 + IL_0048: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_004d: stloc.3 .line 95,95 : 9,46 '' - IL_004f: ldarg.0 - IL_0050: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories5@92-3'::builder@ - IL_0055: ldloc.0 - IL_0056: ldloc.1 - IL_0057: ldloc.3 - IL_0058: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, + IL_004e: ldarg.0 + IL_004f: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories5@92-3'::builder@ + IL_0054: ldloc.0 + IL_0055: ldloc.1 + IL_0056: ldloc.3 + IL_0057: newobj instance void class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::.ctor(!0, !1, !2) - IL_005d: tail. - IL_005f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) - IL_0064: ret + IL_005c: tail. + IL_005e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(!!0) + IL_0063: ret } // end of method 'categories5@92-3'::Invoke } // end of class 'categories5@92-3' @@ -6588,12 +6444,12 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2> Invoke(class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1> tupledArg) cil managed { - // Code size 35 (0x23) + // Code size 34 (0x22) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal maxPrice, [2] class [mscorlib]System.Collections.Generic.IEnumerable`1 mostExpensiveProducts) - .line 95,95 : 17,45 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item1() IL_0006: stloc.0 @@ -6603,13 +6459,13 @@ IL_000e: ldarg.1 IL_000f: call instance !2 class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>::get_Item3() IL_0014: stloc.2 - IL_0015: nop - IL_0016: ldloc.0 - IL_0017: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_001c: ldloc.2 - IL_001d: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, + .line 95,95 : 17,45 '' + IL_0015: ldloc.0 + IL_0016: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_001b: ldloc.2 + IL_001c: newobj instance void class [mscorlib]System.Tuple`2>::.ctor(!0, !1) - IL_0022: ret + IL_0021: ret } // end of method 'categories5@95-4'::Invoke } // end of class 'categories5@95-4' @@ -6686,22 +6542,18 @@ IL_001f: br.s IL_002a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br IL_00a8 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br.s IL_0087 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002a: nop IL_002b: br IL_00c9 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0030: nop .line 100,100 : 26,46 '' @@ -6790,12 +6642,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0091 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -6817,27 +6667,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -6901,47 +6746,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/averageNum@100::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/averageNum@100::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method averageNum@100::get_CheckClose .method public strict virtual instance float64 @@ -6949,12 +6799,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld float64 Linq101Aggregates01/averageNum@100::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld float64 Linq101Aggregates01/averageNum@100::current + IL_0006: ret } // end of method averageNum@100::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -6962,20 +6811,19 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 36 (0x24) + // Code size 35 (0x23) .maxstack 9 - IL_0000: nop - IL_0001: ldc.r8 0.0 - IL_000a: ldc.r8 0.0 - IL_0013: ldnull - IL_0014: ldc.i4.0 - IL_0015: ldc.r8 0.0 - IL_001e: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, + IL_0000: ldc.r8 0.0 + IL_0009: ldc.r8 0.0 + IL_0012: ldnull + IL_0013: ldc.i4.0 + IL_0014: ldc.r8 0.0 + IL_001d: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, float64, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, float64) - IL_0023: ret + IL_0022: ret } // end of method averageNum@100::GetFreshEnumerator } // end of class averageNum@100 @@ -6998,12 +6846,11 @@ .method public strict virtual instance float64 Invoke(float64 n) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 100,100 : 57,58 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'averageNum@100-1'::Invoke } // end of class 'averageNum@100-1' @@ -7030,29 +6877,28 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,object> Invoke(string _arg1) cil managed { - // Code size 32 (0x20) + // Code size 31 (0x1f) .maxstack 7 .locals init ([0] string w, [1] float64 wl) .line 105,105 : 9,26 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 106,106 : 9,35 '' - IL_0003: ldloc.0 - IL_0004: callvirt instance int32 [mscorlib]System.String::get_Length() - IL_0009: conv.r8 - IL_000a: stloc.1 + IL_0002: ldloc.0 + IL_0003: callvirt instance int32 [mscorlib]System.String::get_Length() + IL_0008: conv.r8 + IL_0009: stloc.1 .line 107,107 : 9,21 '' - IL_000b: ldarg.0 - IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/averageLength@105::builder@ - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_000a: ldarg.0 + IL_000b: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/averageLength@105::builder@ + IL_0010: ldloc.0 + IL_0011: ldloc.1 + IL_0012: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_0018: tail. - IL_001a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,object>(!!0) - IL_001f: ret + IL_0017: tail. + IL_0019: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,object>(!!0) + IL_001e: ret } // end of method averageLength@105::Invoke } // end of class averageLength@105 @@ -7075,20 +6921,20 @@ .method public strict virtual instance float64 Invoke(class [mscorlib]System.Tuple`2 tupledArg) cil managed { - // Code size 17 (0x11) + // Code size 16 (0x10) .maxstack 5 .locals init ([0] string w, [1] float64 wl) - .line 107,107 : 19,21 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2::get_Item2() IL_000d: stloc.1 - IL_000e: nop - IL_000f: ldloc.1 - IL_0010: ret + .line 107,107 : 19,21 '' + IL_000e: ldloc.1 + IL_000f: ret } // end of method 'averageLength@107-1'::Invoke } // end of class 'averageLength@107-1' @@ -7115,20 +6961,19 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 Invoke(class [Utils]Utils/Product _arg1) cil managed { - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 6 .locals init ([0] class [Utils]Utils/Product p) .line 113,113 : 9,29 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 .line 114,114 : 9,32 '' - IL_0003: ldarg.0 - IL_0004: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories6@113::builder@ - IL_0009: ldloc.0 - IL_000a: tail. - IL_000c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) - IL_0011: ret + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/categories6@113::builder@ + IL_0008: ldloc.0 + IL_0009: tail. + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield(!!0) + IL_0010: ret } // end of method categories6@113::Invoke } // end of class categories6@113 @@ -7151,12 +6996,11 @@ .method public strict virtual instance class [Utils]Utils/Product Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 3 (0x3) + // Code size 2 (0x2) .maxstack 8 .line 114,114 : 20,21 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: ret + IL_0000: ldarg.1 + IL_0001: ret } // end of method 'categories6@114-1'::Invoke } // end of class 'categories6@114-1' @@ -7179,14 +7023,13 @@ .method public strict virtual instance string Invoke(class [Utils]Utils/Product p) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 114,114 : 22,32 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance string [Utils]Utils/Product::get_Category() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance string [Utils]Utils/Product::get_Category() + IL_0008: ret } // end of method 'categories6@114-2'::Invoke } // end of class 'categories6@114-2' @@ -7268,22 +7111,18 @@ IL_001f: br.s IL_0027 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0021: nop IL_0022: br.s IL_0096 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0024: nop IL_0025: br.s IL_0085 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0027: nop IL_0028: br IL_00b7 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_002d: nop .line 115,115 : 36,49 '' @@ -7373,12 +7212,10 @@ IL_0015) IL_0013: br.s IL_001b - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0015: nop IL_0016: br IL_0089 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_001b: nop .try @@ -7400,27 +7237,22 @@ IL_003f: br.s IL_004a - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0041: nop IL_0042: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0044: nop IL_0045: br.s IL_004f - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_0047: nop IL_0048: br.s IL_004e - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004a: nop IL_004b: br.s IL_0063 - .line 100001,100001 : 0,0 '' .line 100001,100001 : 0,0 '' IL_004d: nop .line 100001,100001 : 0,0 '' @@ -7484,47 +7316,52 @@ .method public strict virtual instance bool get_CheckClose() cil managed { - // Code size 57 (0x39) + // Code size 56 (0x38) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld int32 Linq101Aggregates01/averagePrice@115::pc - IL_0007: switch ( - IL_001e, - IL_0020, - IL_0022, - IL_0024) - IL_001c: br.s IL_0032 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldfld int32 Linq101Aggregates01/averagePrice@115::pc + IL_0006: switch ( + IL_001d, + IL_001f, + IL_0021, + IL_0023) + IL_001b: br.s IL_0031 - IL_001e: br.s IL_0026 + IL_001d: br.s IL_0025 - IL_0020: br.s IL_0029 + IL_001f: br.s IL_0028 - IL_0022: br.s IL_002c + IL_0021: br.s IL_002b - IL_0024: br.s IL_002f + IL_0023: br.s IL_002e - IL_0026: nop - IL_0027: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_0036 - IL_0029: nop - IL_002a: br.s IL_0035 + .line 100001,100001 : 0,0 '' + IL_0028: nop + IL_0029: br.s IL_0034 - IL_002c: nop - IL_002d: br.s IL_0033 + .line 100001,100001 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0032 - IL_002f: nop - IL_0030: br.s IL_0037 + .line 100001,100001 : 0,0 '' + IL_002e: nop + IL_002f: br.s IL_0036 - IL_0032: nop - IL_0033: ldc.i4.1 - IL_0034: ret + .line 100001,100001 : 0,0 '' + IL_0031: nop + IL_0032: ldc.i4.1 + IL_0033: ret - IL_0035: ldc.i4.1 - IL_0036: ret + IL_0034: ldc.i4.1 + IL_0035: ret - IL_0037: ldc.i4.0 - IL_0038: ret + IL_0036: ldc.i4.0 + IL_0037: ret } // end of method averagePrice@115::get_CheckClose .method public strict virtual instance class [Utils]Utils/Product @@ -7532,12 +7369,11 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 8 (0x8) + // Code size 7 (0x7) .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [Utils]Utils/Product Linq101Aggregates01/averagePrice@115::current - IL_0007: ret + IL_0000: ldarg.0 + IL_0001: ldfld class [Utils]Utils/Product Linq101Aggregates01/averagePrice@115::current + IL_0006: ret } // end of method averagePrice@115::get_LastGenerated .method public strict virtual instance class [mscorlib]System.Collections.Generic.IEnumerator`1 @@ -7545,23 +7381,22 @@ { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 18 (0x12) + // Code size 17 (0x11) .maxstack 10 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/averagePrice@115::g + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Core]System.Linq.IGrouping`2 Linq101Aggregates01/averagePrice@115::g + IL_0006: ldnull IL_0007: ldnull IL_0008: ldnull - IL_0009: ldnull - IL_000a: ldc.i4.0 - IL_000b: ldnull - IL_000c: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_0009: ldc.i4.0 + IL_000a: ldnull + IL_000b: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0011: ret + IL_0010: ret } // end of method averagePrice@115::GetFreshEnumerator } // end of class averagePrice@115 @@ -7584,14 +7419,13 @@ .method public strict virtual instance valuetype [mscorlib]System.Decimal Invoke(class [Utils]Utils/Product x) cil managed { - // Code size 10 (0xa) + // Code size 9 (0x9) .maxstack 8 .line 115,115 : 60,71 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: tail. - IL_0004: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() - IL_0009: ret + IL_0000: ldarg.1 + IL_0001: tail. + IL_0003: callvirt instance valuetype [mscorlib]System.Decimal [Utils]Utils/Product::get_UnitPrice() + IL_0008: ret } // end of method 'averagePrice@115-1'::Invoke } // end of class 'averagePrice@115-1' @@ -7618,7 +7452,7 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,valuetype [mscorlib]System.Decimal>,object> Invoke(class [System.Core]System.Linq.IGrouping`2 _arg2) cil managed { - // Code size 233 (0xe9) + // Code size 232 (0xe8) .maxstack 10 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal averagePrice, @@ -7635,149 +7469,146 @@ [12] int32 V_12, [13] class [mscorlib]System.IDisposable V_13) .line 114,114 : 38,39 '' - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: stloc.0 - IL_0003: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0008: stloc.2 - IL_0009: ldloc.2 - IL_000a: stloc.3 - IL_000b: ldloc.0 + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0007: stloc.2 + IL_0008: ldloc.2 + IL_0009: stloc.3 + IL_000a: ldloc.0 + IL_000b: ldnull IL_000c: ldnull IL_000d: ldnull - IL_000e: ldnull - IL_000f: ldc.i4.0 - IL_0010: ldnull - IL_0011: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, + IL_000e: ldc.i4.0 + IL_000f: ldnull + IL_0010: newobj instance void Linq101Aggregates01/averagePrice@115::.ctor(class [System.Core]System.Linq.IGrouping`2, class [Utils]Utils/Product, class [Utils]Utils/Product, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, class [Utils]Utils/Product) - IL_0016: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_001b: stloc.s V_4 - IL_001d: newobj instance void Linq101Aggregates01/'averagePrice@115-1'::.ctor() - IL_0022: stloc.s V_5 - IL_0024: ldloc.s V_4 - IL_0026: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_002b: stloc.s V_6 - IL_002d: ldloc.s V_6 - IL_002f: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_0034: brfalse.s IL_0038 + IL_0015: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_001a: stloc.s V_4 + IL_001c: newobj instance void Linq101Aggregates01/'averagePrice@115-1'::.ctor() + IL_0021: stloc.s V_5 + IL_0023: ldloc.s V_4 + IL_0025: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_002a: stloc.s V_6 + IL_002c: ldloc.s V_6 + IL_002e: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_0033: brfalse.s IL_0037 - IL_0036: br.s IL_0043 + IL_0035: br.s IL_0042 .line 100001,100001 : 0,0 '' - IL_0038: ldstr "source" - IL_003d: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_0042: throw + IL_0037: ldstr "source" + IL_003c: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_0041: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_0043: nop - IL_0044: ldloc.s V_6 - IL_0046: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_004b: stloc.s V_7 + IL_0042: nop + IL_0043: ldloc.s V_6 + IL_0045: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_004a: stloc.s V_7 .try { + IL_004c: ldc.i4.0 IL_004d: ldc.i4.0 IL_004e: ldc.i4.0 IL_004f: ldc.i4.0 IL_0050: ldc.i4.0 - IL_0051: ldc.i4.0 - IL_0052: newobj instance void [mscorlib]System.Decimal::.ctor(int32, + IL_0051: newobj instance void [mscorlib]System.Decimal::.ctor(int32, int32, int32, bool, uint8) - IL_0057: stloc.s V_9 - IL_0059: ldc.i4.0 - IL_005a: stloc.s V_10 - IL_005c: ldloc.s V_7 - IL_005e: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0063: brfalse.s IL_0085 - - IL_0065: ldloc.s V_9 - IL_0067: ldloc.s V_5 - IL_0069: ldloc.s V_7 - IL_006b: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0070: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0075: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::op_Addition(valuetype [mscorlib]System.Decimal, + IL_0056: stloc.s V_9 + IL_0058: ldc.i4.0 + IL_0059: stloc.s V_10 + IL_005b: ldloc.s V_7 + IL_005d: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0062: brfalse.s IL_0084 + + IL_0064: ldloc.s V_9 + IL_0066: ldloc.s V_5 + IL_0068: ldloc.s V_7 + IL_006a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() + IL_006f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0074: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::op_Addition(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_007a: stloc.s V_9 + IL_0079: stloc.s V_9 .line 115,115 : 50,71 '' - IL_007c: ldloc.s V_10 - IL_007e: ldc.i4.1 - IL_007f: add - IL_0080: stloc.s V_10 + IL_007b: ldloc.s V_10 + IL_007d: ldc.i4.1 + IL_007e: add + IL_007f: stloc.s V_10 .line 100001,100001 : 0,0 '' - IL_0082: nop - IL_0083: br.s IL_005c + IL_0081: nop + IL_0082: br.s IL_005b - IL_0085: ldloc.s V_10 - IL_0087: brtrue.s IL_008b + IL_0084: ldloc.s V_10 + IL_0086: brtrue.s IL_008a - IL_0089: br.s IL_008d + IL_0088: br.s IL_008c - IL_008b: br.s IL_0098 + IL_008a: br.s IL_0097 .line 100001,100001 : 0,0 '' - IL_008d: ldstr "source" - IL_0092: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_0097: throw + IL_008c: ldstr "source" + IL_0091: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_0096: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_0098: nop - IL_0099: ldloc.s V_9 - IL_009b: stloc.s V_11 - IL_009d: ldloc.s V_10 - IL_009f: stloc.s V_12 - IL_00a1: ldloc.s V_11 - IL_00a3: ldloc.s V_12 - IL_00a5: call valuetype [mscorlib]System.Decimal [mscorlib]System.Convert::ToDecimal(int32) - IL_00aa: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::Divide(valuetype [mscorlib]System.Decimal, + IL_0097: nop + IL_0098: ldloc.s V_9 + IL_009a: stloc.s V_11 + IL_009c: ldloc.s V_10 + IL_009e: stloc.s V_12 + IL_00a0: ldloc.s V_11 + IL_00a2: ldloc.s V_12 + IL_00a4: call valuetype [mscorlib]System.Decimal [mscorlib]System.Convert::ToDecimal(int32) + IL_00a9: call valuetype [mscorlib]System.Decimal [mscorlib]System.Decimal::Divide(valuetype [mscorlib]System.Decimal, valuetype [mscorlib]System.Decimal) - IL_00af: stloc.s V_8 - IL_00b1: leave.s IL_00d1 + IL_00ae: stloc.s V_8 + IL_00b0: leave.s IL_00d0 } // end .try finally { - IL_00b3: ldloc.s V_7 - IL_00b5: isinst [mscorlib]System.IDisposable - IL_00ba: stloc.s V_13 - IL_00bc: ldloc.s V_13 - IL_00be: brfalse.s IL_00c2 + IL_00b2: ldloc.s V_7 + IL_00b4: isinst [mscorlib]System.IDisposable + IL_00b9: stloc.s V_13 + IL_00bb: ldloc.s V_13 + IL_00bd: brfalse.s IL_00c1 - IL_00c0: br.s IL_00c4 + IL_00bf: br.s IL_00c3 - IL_00c2: br.s IL_00ce + IL_00c1: br.s IL_00cd .line 100001,100001 : 0,0 '' - IL_00c4: ldloc.s V_13 - IL_00c6: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_00cb: ldnull - IL_00cc: pop - IL_00cd: endfinally + IL_00c3: ldloc.s V_13 + IL_00c5: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_00ca: ldnull + IL_00cb: pop + IL_00cc: endfinally .line 100001,100001 : 0,0 '' - IL_00ce: ldnull - IL_00cf: pop - IL_00d0: endfinally + IL_00cd: ldnull + IL_00ce: pop + IL_00cf: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_00d1: ldloc.s V_8 - IL_00d3: stloc.1 + IL_00d0: ldloc.s V_8 + IL_00d2: stloc.1 .line 116,116 : 9,37 '' - IL_00d4: ldarg.0 - IL_00d5: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories6@114-3'::builder@ - IL_00da: ldloc.0 - IL_00db: ldloc.1 - IL_00dc: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, + IL_00d3: ldarg.0 + IL_00d4: ldfld class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder Linq101Aggregates01/'categories6@114-3'::builder@ + IL_00d9: ldloc.0 + IL_00da: ldloc.1 + IL_00db: newobj instance void class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::.ctor(!0, !1) - IL_00e1: tail. - IL_00e3: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) - IL_00e8: ret + IL_00e0: tail. + IL_00e2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Yield,valuetype [mscorlib]System.Decimal>,object>(!!0) + IL_00e7: ret } // end of method 'categories6@114-3'::Invoke } // end of class 'categories6@114-3' @@ -7800,24 +7631,24 @@ .method public strict virtual instance class [mscorlib]System.Tuple`2 Invoke(class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal> tupledArg) cil managed { - // Code size 28 (0x1c) + // Code size 27 (0x1b) .maxstack 6 .locals init ([0] class [System.Core]System.Linq.IGrouping`2 g, [1] valuetype [mscorlib]System.Decimal averagePrice) - .line 116,116 : 17,36 '' + .line 100001,100001 : 0,0 '' IL_0000: ldarg.1 IL_0001: call instance !0 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item1() IL_0006: stloc.0 IL_0007: ldarg.1 IL_0008: call instance !1 class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>::get_Item2() IL_000d: stloc.1 - IL_000e: nop - IL_000f: ldloc.0 - IL_0010: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() - IL_0015: ldloc.1 - IL_0016: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + .line 116,116 : 17,36 '' + IL_000e: ldloc.0 + IL_000f: callvirt instance !0 class [System.Core]System.Linq.IGrouping`2::get_Key() + IL_0014: ldloc.1 + IL_0015: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_001b: ret + IL_001a: ret } // end of method 'categories6@116-4'::Invoke } // end of class 'categories6@116-4' @@ -8165,7 +7996,7 @@ .method public static void main@() cil managed { .entrypoint - // Code size 1736 (0x6c8) + // Code size 1735 (0x6c7) .maxstack 13 .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 factorsOf300, [1] int32 uniqueFactors, @@ -8233,724 +8064,717 @@ [63] class [mscorlib]System.IDisposable V_63, [64] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_64) .line 8,8 : 1,31 '' - IL_0000: nop + IL_0000: ldc.i4.2 IL_0001: ldc.i4.2 - IL_0002: ldc.i4.2 - IL_0003: ldc.i4.3 + IL_0002: ldc.i4.3 + IL_0003: ldc.i4.5 IL_0004: ldc.i4.5 - IL_0005: ldc.i4.5 - IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0005: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_000a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0010: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0015: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0014: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_001a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0019: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_001f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_001e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0024: dup - IL_0025: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::factorsOf300@8 - IL_002a: stloc.0 + IL_0023: dup + IL_0024: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::factorsOf300@8 + IL_0029: stloc.0 .line 10,14 : 1,20 '' - IL_002b: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0030: stloc.s builder@ - IL_0032: ldloc.s builder@ + IL_002a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_002f: stloc.s builder@ + IL_0031: ldloc.s builder@ + IL_0033: ldc.i4.0 IL_0034: ldc.i4.0 - IL_0035: ldc.i4.0 - IL_0036: ldnull + IL_0035: ldnull + IL_0036: ldc.i4.0 IL_0037: ldc.i4.0 - IL_0038: ldc.i4.0 - IL_0039: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, + IL_0038: newobj instance void Linq101Aggregates01/uniqueFactors@12::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_003e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Distinct(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2) - IL_0048: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_004d: call int32 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Length(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0052: dup - IL_0053: stsfld int32 ''.$Linq101Aggregates01::uniqueFactors@10 - IL_0058: stloc.1 + IL_003d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0042: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Distinct(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2) + IL_0047: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_004c: call int32 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Length(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0051: dup + IL_0052: stsfld int32 ''.$Linq101Aggregates01::uniqueFactors@10 + IL_0057: stloc.1 .line 17,17 : 1,47 '' - IL_0059: ldc.i4.5 - IL_005a: ldc.i4.4 - IL_005b: ldc.i4.1 - IL_005c: ldc.i4.3 - IL_005d: ldc.i4.s 9 - IL_005f: ldc.i4.8 - IL_0060: ldc.i4.6 - IL_0061: ldc.i4.7 - IL_0062: ldc.i4.2 - IL_0063: ldc.i4.0 - IL_0064: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0069: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0058: ldc.i4.5 + IL_0059: ldc.i4.4 + IL_005a: ldc.i4.1 + IL_005b: ldc.i4.3 + IL_005c: ldc.i4.s 9 + IL_005e: ldc.i4.8 + IL_005f: ldc.i4.6 + IL_0060: ldc.i4.7 + IL_0061: ldc.i4.2 + IL_0062: ldc.i4.0 + IL_0063: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0068: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_006e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_006d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0072: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0078: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0077: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_007d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_007c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0082: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0081: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0087: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0086: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_008c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_008b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0091: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0090: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0096: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0095: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_009b: dup - IL_009c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers@17 - IL_00a1: stloc.2 - IL_00a2: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_00a7: stloc.s V_21 - IL_00a9: ldloc.s V_21 - IL_00ab: stloc.s V_22 + IL_009a: dup + IL_009b: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers@17 + IL_00a0: stloc.2 + IL_00a1: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_00a6: stloc.s V_21 + IL_00a8: ldloc.s V_21 + IL_00aa: stloc.s V_22 + IL_00ac: ldc.i4.0 IL_00ad: ldc.i4.0 - IL_00ae: ldc.i4.0 - IL_00af: ldnull + IL_00ae: ldnull + IL_00af: ldc.i4.0 IL_00b0: ldc.i4.0 - IL_00b1: ldc.i4.0 - IL_00b2: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, + IL_00b1: newobj instance void Linq101Aggregates01/numSum@21::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_00b7: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_00bc: stloc.s V_23 - IL_00be: newobj instance void Linq101Aggregates01/'numSum@22-1'::.ctor() - IL_00c3: stloc.s V_24 - IL_00c5: ldloc.s V_23 - IL_00c7: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_00cc: stloc.s V_25 - IL_00ce: ldloc.s V_25 - IL_00d0: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_00d5: brfalse.s IL_00d9 - - IL_00d7: br.s IL_00e4 + IL_00b6: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_00bb: stloc.s V_23 + IL_00bd: newobj instance void Linq101Aggregates01/'numSum@22-1'::.ctor() + IL_00c2: stloc.s V_24 + IL_00c4: ldloc.s V_23 + IL_00c6: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_00cb: stloc.s V_25 + IL_00cd: ldloc.s V_25 + IL_00cf: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_00d4: brfalse.s IL_00d8 + + IL_00d6: br.s IL_00e3 .line 100001,100001 : 0,0 '' - IL_00d9: ldstr "source" - IL_00de: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_00e3: throw + IL_00d8: ldstr "source" + IL_00dd: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_00e2: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_00e4: nop - IL_00e5: ldloc.s V_25 - IL_00e7: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_00ec: ldloc.s V_24 - IL_00ee: newobj instance void Linq101Aggregates01/'numSum@22-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_00f3: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_00f8: dup - IL_00f9: stsfld int32 ''.$Linq101Aggregates01::numSum@19 - IL_00fe: stloc.3 + IL_00e3: nop + IL_00e4: ldloc.s V_25 + IL_00e6: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_00eb: ldloc.s V_24 + IL_00ed: newobj instance void Linq101Aggregates01/'numSum@22-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_00f2: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_00f7: dup + IL_00f8: stsfld int32 ''.$Linq101Aggregates01::numSum@19 + IL_00fd: stloc.3 .line 26,26 : 1,45 '' - IL_00ff: ldstr "cherry" - IL_0104: ldstr "apple" - IL_0109: ldstr "blueberry" - IL_010e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0113: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_00fe: ldstr "cherry" + IL_0103: ldstr "apple" + IL_0108: ldstr "blueberry" + IL_010d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0112: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0118: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0117: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_011d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_011c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0122: dup - IL_0123: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::words@26 - IL_0128: stloc.s words - IL_012a: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_012f: stloc.s V_26 - IL_0131: ldloc.s V_26 - IL_0133: stloc.s V_27 + IL_0121: dup + IL_0122: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::words@26 + IL_0127: stloc.s words + IL_0129: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_012e: stloc.s V_26 + IL_0130: ldloc.s V_26 + IL_0132: stloc.s V_27 + IL_0134: ldnull IL_0135: ldnull IL_0136: ldnull - IL_0137: ldnull - IL_0138: ldc.i4.0 - IL_0139: ldnull - IL_013a: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, + IL_0137: ldc.i4.0 + IL_0138: ldnull + IL_0139: newobj instance void Linq101Aggregates01/totalChars@30::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_013f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0144: stloc.s V_28 - IL_0146: newobj instance void Linq101Aggregates01/'totalChars@31-1'::.ctor() - IL_014b: stloc.s V_29 - IL_014d: ldloc.s V_28 - IL_014f: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_0154: stloc.s V_30 - IL_0156: ldloc.s V_30 - IL_0158: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_015d: brfalse.s IL_0161 - - IL_015f: br.s IL_016c + IL_013e: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0143: stloc.s V_28 + IL_0145: newobj instance void Linq101Aggregates01/'totalChars@31-1'::.ctor() + IL_014a: stloc.s V_29 + IL_014c: ldloc.s V_28 + IL_014e: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_0153: stloc.s V_30 + IL_0155: ldloc.s V_30 + IL_0157: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_015c: brfalse.s IL_0160 + + IL_015e: br.s IL_016b .line 100001,100001 : 0,0 '' - IL_0161: ldstr "source" - IL_0166: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_016b: throw + IL_0160: ldstr "source" + IL_0165: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_016a: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_016c: nop - IL_016d: ldloc.s V_30 - IL_016f: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0174: ldloc.s V_29 - IL_0176: newobj instance void Linq101Aggregates01/'totalChars@31-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_017b: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0180: dup - IL_0181: stsfld int32 ''.$Linq101Aggregates01::totalChars@28 - IL_0186: stloc.s totalChars + IL_016b: nop + IL_016c: ldloc.s V_30 + IL_016e: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0173: ldloc.s V_29 + IL_0175: newobj instance void Linq101Aggregates01/'totalChars@31-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_017a: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_017f: dup + IL_0180: stsfld int32 ''.$Linq101Aggregates01::totalChars@28 + IL_0185: stloc.s totalChars .line 35,35 : 1,32 '' - IL_0188: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [Utils]Utils::getProductList() - IL_018d: dup - IL_018e: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::products@35 - IL_0193: stloc.s products + IL_0187: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [Utils]Utils::getProductList() + IL_018c: dup + IL_018d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::products@35 + IL_0192: stloc.s products .line 37,46 : 1,21 '' - IL_0195: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_019a: stloc.s V_31 - IL_019c: ldloc.s V_31 - IL_019e: ldloc.s V_31 - IL_01a0: ldloc.s V_31 - IL_01a2: ldloc.s V_31 - IL_01a4: ldloc.s V_31 - IL_01a6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_01ab: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_01b0: ldloc.s V_31 - IL_01b2: newobj instance void Linq101Aggregates01/categories@39::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_01b7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0194: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0199: stloc.s V_31 + IL_019b: ldloc.s V_31 + IL_019d: ldloc.s V_31 + IL_019f: ldloc.s V_31 + IL_01a1: ldloc.s V_31 + IL_01a3: ldloc.s V_31 + IL_01a5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_01aa: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_01af: ldloc.s V_31 + IL_01b1: newobj instance void Linq101Aggregates01/categories@39::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_01b6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_01bc: newobj instance void Linq101Aggregates01/'categories@40-1'::.ctor() - IL_01c1: newobj instance void Linq101Aggregates01/'categories@40-2'::.ctor() - IL_01c6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_01bb: newobj instance void Linq101Aggregates01/'categories@40-1'::.ctor() + IL_01c0: newobj instance void Linq101Aggregates01/'categories@40-2'::.ctor() + IL_01c5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_01cb: ldloc.s V_31 - IL_01cd: newobj instance void Linq101Aggregates01/'categories@40-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_01d2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,int32>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_01ca: ldloc.s V_31 + IL_01cc: newobj instance void Linq101Aggregates01/'categories@40-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_01d1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,int32>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_01d7: newobj instance void Linq101Aggregates01/'categories@45-4'::.ctor() - IL_01dc: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,int32>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_01d6: newobj instance void Linq101Aggregates01/'categories@45-4'::.ctor() + IL_01db: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,int32>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_01e1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_01e6: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_01eb: dup - IL_01ec: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories@37 - IL_01f1: stloc.s categories - IL_01f3: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_01f8: stloc.s V_32 - IL_01fa: ldloc.s V_32 + IL_01e0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_01e5: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_01ea: dup + IL_01eb: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories@37 + IL_01f0: stloc.s categories + IL_01f2: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_01f7: stloc.s V_32 + IL_01f9: ldloc.s V_32 + IL_01fb: ldc.i4.0 IL_01fc: ldc.i4.0 - IL_01fd: ldc.i4.0 - IL_01fe: ldnull + IL_01fd: ldnull + IL_01fe: ldc.i4.0 IL_01ff: ldc.i4.0 - IL_0200: ldc.i4.0 - IL_0201: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, + IL_0200: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_0206: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_020b: newobj instance void Linq101Aggregates01/'minNum@49-1'::.ctor() - IL_0210: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0205: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_020a: newobj instance void Linq101Aggregates01/'minNum@49-1'::.ctor() + IL_020f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0215: dup - IL_0216: stsfld int32 ''.$Linq101Aggregates01::minNum@49 - IL_021b: stloc.s minNum - IL_021d: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0222: stloc.s V_33 - IL_0224: ldloc.s V_33 + IL_0214: dup + IL_0215: stsfld int32 ''.$Linq101Aggregates01::minNum@49 + IL_021a: stloc.s minNum + IL_021c: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0221: stloc.s V_33 + IL_0223: ldloc.s V_33 + IL_0225: ldnull IL_0226: ldnull IL_0227: ldnull - IL_0228: ldnull - IL_0229: ldc.i4.0 - IL_022a: ldnull - IL_022b: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, + IL_0228: ldc.i4.0 + IL_0229: ldnull + IL_022a: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_0230: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0235: newobj instance void Linq101Aggregates01/'shortestWord@52-1'::.ctor() - IL_023a: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_022f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0234: newobj instance void Linq101Aggregates01/'shortestWord@52-1'::.ctor() + IL_0239: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_023f: dup - IL_0240: stsfld int32 ''.$Linq101Aggregates01::shortestWord@52 - IL_0245: stloc.s shortestWord + IL_023e: dup + IL_023f: stsfld int32 ''.$Linq101Aggregates01::shortestWord@52 + IL_0244: stloc.s shortestWord .line 55,61 : 1,21 '' - IL_0247: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_024c: stloc.s V_34 - IL_024e: ldloc.s V_34 - IL_0250: ldloc.s V_34 - IL_0252: ldloc.s V_34 - IL_0254: ldloc.s V_34 - IL_0256: ldloc.s V_34 - IL_0258: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_025d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0262: ldloc.s V_34 - IL_0264: newobj instance void Linq101Aggregates01/categories2@57::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0269: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0246: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_024b: stloc.s V_34 + IL_024d: ldloc.s V_34 + IL_024f: ldloc.s V_34 + IL_0251: ldloc.s V_34 + IL_0253: ldloc.s V_34 + IL_0255: ldloc.s V_34 + IL_0257: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_025c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0261: ldloc.s V_34 + IL_0263: newobj instance void Linq101Aggregates01/categories2@57::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0268: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_026e: newobj instance void Linq101Aggregates01/'categories2@58-1'::.ctor() - IL_0273: newobj instance void Linq101Aggregates01/'categories2@58-2'::.ctor() - IL_0278: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_026d: newobj instance void Linq101Aggregates01/'categories2@58-1'::.ctor() + IL_0272: newobj instance void Linq101Aggregates01/'categories2@58-2'::.ctor() + IL_0277: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_027d: ldloc.s V_34 - IL_027f: newobj instance void Linq101Aggregates01/'categories2@58-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0284: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_027c: ldloc.s V_34 + IL_027e: newobj instance void Linq101Aggregates01/'categories2@58-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0283: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0289: newobj instance void Linq101Aggregates01/'categories2@60-4'::.ctor() - IL_028e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0288: newobj instance void Linq101Aggregates01/'categories2@60-4'::.ctor() + IL_028d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0293: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0298: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_029d: dup - IL_029e: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories2@55 - IL_02a3: stloc.s categories2 + IL_0292: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_0297: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_029c: dup + IL_029d: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories2@55 + IL_02a2: stloc.s categories2 .line 64,71 : 1,21 '' - IL_02a5: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_02aa: stloc.s V_35 - IL_02ac: ldloc.s V_35 - IL_02ae: ldloc.s V_35 - IL_02b0: ldloc.s V_35 - IL_02b2: ldloc.s V_35 - IL_02b4: ldloc.s V_35 - IL_02b6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_02bb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_02c0: ldloc.s V_35 - IL_02c2: newobj instance void Linq101Aggregates01/categories3@66::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_02c7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02a4: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_02a9: stloc.s V_35 + IL_02ab: ldloc.s V_35 + IL_02ad: ldloc.s V_35 + IL_02af: ldloc.s V_35 + IL_02b1: ldloc.s V_35 + IL_02b3: ldloc.s V_35 + IL_02b5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_02ba: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_02bf: ldloc.s V_35 + IL_02c1: newobj instance void Linq101Aggregates01/categories3@66::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_02c6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_02cc: newobj instance void Linq101Aggregates01/'categories3@67-1'::.ctor() - IL_02d1: newobj instance void Linq101Aggregates01/'categories3@67-2'::.ctor() - IL_02d6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02cb: newobj instance void Linq101Aggregates01/'categories3@67-1'::.ctor() + IL_02d0: newobj instance void Linq101Aggregates01/'categories3@67-2'::.ctor() + IL_02d5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_02db: ldloc.s V_35 - IL_02dd: newobj instance void Linq101Aggregates01/'categories3@67-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_02e2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02da: ldloc.s V_35 + IL_02dc: newobj instance void Linq101Aggregates01/'categories3@67-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_02e1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_02e7: newobj instance void Linq101Aggregates01/'categories3@70-4'::.ctor() - IL_02ec: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02e6: newobj instance void Linq101Aggregates01/'categories3@70-4'::.ctor() + IL_02eb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_02f1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_02f6: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_02fb: dup - IL_02fc: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories3@64 - IL_0301: stloc.s categories3 - IL_0303: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0308: stloc.s V_36 - IL_030a: ldloc.s V_36 + IL_02f0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_02f5: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_02fa: dup + IL_02fb: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories3@64 + IL_0300: stloc.s categories3 + IL_0302: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0307: stloc.s V_36 + IL_0309: ldloc.s V_36 + IL_030b: ldc.i4.0 IL_030c: ldc.i4.0 - IL_030d: ldc.i4.0 - IL_030e: ldnull + IL_030d: ldnull + IL_030e: ldc.i4.0 IL_030f: ldc.i4.0 - IL_0310: ldc.i4.0 - IL_0311: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, + IL_0310: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_0316: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_031b: newobj instance void Linq101Aggregates01/'maxNum@74-1'::.ctor() - IL_0320: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0315: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_031a: newobj instance void Linq101Aggregates01/'maxNum@74-1'::.ctor() + IL_031f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0325: dup - IL_0326: stsfld int32 ''.$Linq101Aggregates01::maxNum@74 - IL_032b: stloc.s maxNum - IL_032d: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0332: stloc.s V_37 - IL_0334: ldloc.s V_37 + IL_0324: dup + IL_0325: stsfld int32 ''.$Linq101Aggregates01::maxNum@74 + IL_032a: stloc.s maxNum + IL_032c: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0331: stloc.s V_37 + IL_0333: ldloc.s V_37 + IL_0335: ldnull IL_0336: ldnull IL_0337: ldnull - IL_0338: ldnull - IL_0339: ldc.i4.0 - IL_033a: ldnull - IL_033b: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, + IL_0338: ldc.i4.0 + IL_0339: ldnull + IL_033a: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_0340: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0345: newobj instance void Linq101Aggregates01/'longestLength@77-1'::.ctor() - IL_034a: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_033f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0344: newobj instance void Linq101Aggregates01/'longestLength@77-1'::.ctor() + IL_0349: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_034f: dup - IL_0350: stsfld int32 ''.$Linq101Aggregates01::longestLength@77 - IL_0355: stloc.s longestLength + IL_034e: dup + IL_034f: stsfld int32 ''.$Linq101Aggregates01::longestLength@77 + IL_0354: stloc.s longestLength .line 80,86 : 1,21 '' - IL_0357: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_035c: stloc.s V_38 - IL_035e: ldloc.s V_38 - IL_0360: ldloc.s V_38 - IL_0362: ldloc.s V_38 - IL_0364: ldloc.s V_38 - IL_0366: ldloc.s V_38 - IL_0368: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_036d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0372: ldloc.s V_38 - IL_0374: newobj instance void Linq101Aggregates01/categories4@82::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0379: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0356: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_035b: stloc.s V_38 + IL_035d: ldloc.s V_38 + IL_035f: ldloc.s V_38 + IL_0361: ldloc.s V_38 + IL_0363: ldloc.s V_38 + IL_0365: ldloc.s V_38 + IL_0367: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_036c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0371: ldloc.s V_38 + IL_0373: newobj instance void Linq101Aggregates01/categories4@82::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0378: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_037e: newobj instance void Linq101Aggregates01/'categories4@83-1'::.ctor() - IL_0383: newobj instance void Linq101Aggregates01/'categories4@83-2'::.ctor() - IL_0388: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_037d: newobj instance void Linq101Aggregates01/'categories4@83-1'::.ctor() + IL_0382: newobj instance void Linq101Aggregates01/'categories4@83-2'::.ctor() + IL_0387: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_038d: ldloc.s V_38 - IL_038f: newobj instance void Linq101Aggregates01/'categories4@83-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0394: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_038c: ldloc.s V_38 + IL_038e: newobj instance void Linq101Aggregates01/'categories4@83-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0393: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0399: newobj instance void Linq101Aggregates01/'categories4@85-4'::.ctor() - IL_039e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0398: newobj instance void Linq101Aggregates01/'categories4@85-4'::.ctor() + IL_039d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_03a3: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_03a8: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_03ad: dup - IL_03ae: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories4@80 - IL_03b3: stloc.s categories4 + IL_03a2: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_03a7: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_03ac: dup + IL_03ad: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories4@80 + IL_03b2: stloc.s categories4 .line 89,96 : 1,21 '' - IL_03b5: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_03ba: stloc.s V_39 - IL_03bc: ldloc.s V_39 - IL_03be: ldloc.s V_39 - IL_03c0: ldloc.s V_39 - IL_03c2: ldloc.s V_39 - IL_03c4: ldloc.s V_39 - IL_03c6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_03cb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_03d0: ldloc.s V_39 - IL_03d2: newobj instance void Linq101Aggregates01/categories5@91::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_03d7: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03b4: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_03b9: stloc.s V_39 + IL_03bb: ldloc.s V_39 + IL_03bd: ldloc.s V_39 + IL_03bf: ldloc.s V_39 + IL_03c1: ldloc.s V_39 + IL_03c3: ldloc.s V_39 + IL_03c5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_03ca: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_03cf: ldloc.s V_39 + IL_03d1: newobj instance void Linq101Aggregates01/categories5@91::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_03d6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_03dc: newobj instance void Linq101Aggregates01/'categories5@92-1'::.ctor() - IL_03e1: newobj instance void Linq101Aggregates01/'categories5@92-2'::.ctor() - IL_03e6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03db: newobj instance void Linq101Aggregates01/'categories5@92-1'::.ctor() + IL_03e0: newobj instance void Linq101Aggregates01/'categories5@92-2'::.ctor() + IL_03e5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_03eb: ldloc.s V_39 - IL_03ed: newobj instance void Linq101Aggregates01/'categories5@92-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_03f2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03ea: ldloc.s V_39 + IL_03ec: newobj instance void Linq101Aggregates01/'categories5@92-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_03f1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_03f7: newobj instance void Linq101Aggregates01/'categories5@95-4'::.ctor() - IL_03fc: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03f6: newobj instance void Linq101Aggregates01/'categories5@95-4'::.ctor() + IL_03fb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0401: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0406: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_040b: dup - IL_040c: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories5@89 - IL_0411: stloc.s categories5 + IL_0400: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_0405: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_040a: dup + IL_040b: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories5@89 + IL_0410: stloc.s categories5 .line 99,99 : 1,66 '' - IL_0413: ldc.r8 5. - IL_041c: ldc.r8 4. - IL_0425: ldc.r8 1. - IL_042e: ldc.r8 3. - IL_0437: ldc.r8 9. - IL_0440: ldc.r8 8. - IL_0449: ldc.r8 6. - IL_0452: ldc.r8 7. - IL_045b: ldc.r8 2. - IL_0464: ldc.r8 0.0 - IL_046d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0472: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0412: ldc.r8 5. + IL_041b: ldc.r8 4. + IL_0424: ldc.r8 1. + IL_042d: ldc.r8 3. + IL_0436: ldc.r8 9. + IL_043f: ldc.r8 8. + IL_0448: ldc.r8 6. + IL_0451: ldc.r8 7. + IL_045a: ldc.r8 2. + IL_0463: ldc.r8 0.0 + IL_046c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0471: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0477: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0476: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_047c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_047b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0481: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0480: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0486: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0485: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_048b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_048a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0490: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_048f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0495: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0494: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_049a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0499: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_049f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_049e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04a4: dup - IL_04a5: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers2@99 - IL_04aa: stloc.s numbers2 - IL_04ac: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_04b1: stloc.s V_40 - IL_04b3: ldloc.s V_40 - IL_04b5: stloc.s V_41 - IL_04b7: ldc.r8 0.0 - IL_04c0: ldc.r8 0.0 - IL_04c9: ldnull - IL_04ca: ldc.i4.0 - IL_04cb: ldc.r8 0.0 - IL_04d4: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, + IL_04a3: dup + IL_04a4: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers2@99 + IL_04a9: stloc.s numbers2 + IL_04ab: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_04b0: stloc.s V_40 + IL_04b2: ldloc.s V_40 + IL_04b4: stloc.s V_41 + IL_04b6: ldc.r8 0.0 + IL_04bf: ldc.r8 0.0 + IL_04c8: ldnull + IL_04c9: ldc.i4.0 + IL_04ca: ldc.r8 0.0 + IL_04d3: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, float64, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, float64) - IL_04d9: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_04de: stloc.s V_42 - IL_04e0: newobj instance void Linq101Aggregates01/'averageNum@100-1'::.ctor() - IL_04e5: stloc.s V_43 - IL_04e7: ldloc.s V_42 - IL_04e9: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_04ee: stloc.s V_44 - IL_04f0: ldloc.s V_44 - IL_04f2: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_04f7: brfalse.s IL_04fb - - IL_04f9: br.s IL_0506 + IL_04d8: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_04dd: stloc.s V_42 + IL_04df: newobj instance void Linq101Aggregates01/'averageNum@100-1'::.ctor() + IL_04e4: stloc.s V_43 + IL_04e6: ldloc.s V_42 + IL_04e8: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_04ed: stloc.s V_44 + IL_04ef: ldloc.s V_44 + IL_04f1: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_04f6: brfalse.s IL_04fa + + IL_04f8: br.s IL_0505 .line 100001,100001 : 0,0 '' - IL_04fb: ldstr "source" - IL_0500: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_0505: throw + IL_04fa: ldstr "source" + IL_04ff: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_0504: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_0506: nop - IL_0507: ldloc.s V_44 - IL_0509: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_050e: stloc.s V_45 + IL_0505: nop + IL_0506: ldloc.s V_44 + IL_0508: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_050d: stloc.s V_45 .try { - IL_0510: ldc.r8 0.0 - IL_0519: stloc.s V_47 - IL_051b: ldc.i4.0 - IL_051c: stloc.s V_48 - IL_051e: ldloc.s V_45 - IL_0520: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0525: brfalse.s IL_0543 - - IL_0527: ldloc.s V_47 - IL_0529: ldloc.s V_43 - IL_052b: ldloc.s V_45 - IL_052d: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0532: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0537: add - IL_0538: stloc.s V_47 + IL_050f: ldc.r8 0.0 + IL_0518: stloc.s V_47 + IL_051a: ldc.i4.0 + IL_051b: stloc.s V_48 + IL_051d: ldloc.s V_45 + IL_051f: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0524: brfalse.s IL_0542 + + IL_0526: ldloc.s V_47 + IL_0528: ldloc.s V_43 + IL_052a: ldloc.s V_45 + IL_052c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0531: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0536: add + IL_0537: stloc.s V_47 .line 100,100 : 47,58 '' - IL_053a: ldloc.s V_48 - IL_053c: ldc.i4.1 - IL_053d: add - IL_053e: stloc.s V_48 + IL_0539: ldloc.s V_48 + IL_053b: ldc.i4.1 + IL_053c: add + IL_053d: stloc.s V_48 .line 100001,100001 : 0,0 '' - IL_0540: nop - IL_0541: br.s IL_051e + IL_053f: nop + IL_0540: br.s IL_051d - IL_0543: ldloc.s V_48 - IL_0545: brtrue.s IL_0549 + IL_0542: ldloc.s V_48 + IL_0544: brtrue.s IL_0548 - IL_0547: br.s IL_054b + IL_0546: br.s IL_054a - IL_0549: br.s IL_0556 + IL_0548: br.s IL_0555 .line 100001,100001 : 0,0 '' - IL_054b: ldstr "source" - IL_0550: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_0555: throw + IL_054a: ldstr "source" + IL_054f: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_0554: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_0556: nop - IL_0557: ldloc.s V_47 - IL_0559: stloc.s V_49 - IL_055b: ldloc.s V_48 - IL_055d: stloc.s V_50 - IL_055f: ldloc.s V_49 - IL_0561: ldloc.s V_50 - IL_0563: conv.r8 - IL_0564: div - IL_0565: stloc.s V_46 - IL_0567: leave.s IL_0587 + IL_0555: nop + IL_0556: ldloc.s V_47 + IL_0558: stloc.s V_49 + IL_055a: ldloc.s V_48 + IL_055c: stloc.s V_50 + IL_055e: ldloc.s V_49 + IL_0560: ldloc.s V_50 + IL_0562: conv.r8 + IL_0563: div + IL_0564: stloc.s V_46 + IL_0566: leave.s IL_0586 } // end .try finally { - IL_0569: ldloc.s V_45 - IL_056b: isinst [mscorlib]System.IDisposable - IL_0570: stloc.s V_51 - IL_0572: ldloc.s V_51 - IL_0574: brfalse.s IL_0578 + IL_0568: ldloc.s V_45 + IL_056a: isinst [mscorlib]System.IDisposable + IL_056f: stloc.s V_51 + IL_0571: ldloc.s V_51 + IL_0573: brfalse.s IL_0577 - IL_0576: br.s IL_057a + IL_0575: br.s IL_0579 - IL_0578: br.s IL_0584 + IL_0577: br.s IL_0583 .line 100001,100001 : 0,0 '' - IL_057a: ldloc.s V_51 - IL_057c: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0581: ldnull - IL_0582: pop - IL_0583: endfinally + IL_0579: ldloc.s V_51 + IL_057b: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0580: ldnull + IL_0581: pop + IL_0582: endfinally .line 100001,100001 : 0,0 '' - IL_0584: ldnull - IL_0585: pop - IL_0586: endfinally + IL_0583: ldnull + IL_0584: pop + IL_0585: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_0587: ldloc.s V_46 - IL_0589: dup - IL_058a: stsfld float64 ''.$Linq101Aggregates01::averageNum@100 - IL_058f: stloc.s averageNum - IL_0591: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0596: stloc.s V_52 - IL_0598: ldloc.s V_52 - IL_059a: stloc.s V_53 - IL_059c: ldloc.s V_52 - IL_059e: ldloc.s V_52 - IL_05a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_words() - IL_05a5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_05aa: ldloc.s V_52 - IL_05ac: newobj instance void Linq101Aggregates01/averageLength@105::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_05b1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0586: ldloc.s V_46 + IL_0588: dup + IL_0589: stsfld float64 ''.$Linq101Aggregates01::averageNum@100 + IL_058e: stloc.s averageNum + IL_0590: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0595: stloc.s V_52 + IL_0597: ldloc.s V_52 + IL_0599: stloc.s V_53 + IL_059b: ldloc.s V_52 + IL_059d: ldloc.s V_52 + IL_059f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_words() + IL_05a4: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_05a9: ldloc.s V_52 + IL_05ab: newobj instance void Linq101Aggregates01/averageLength@105::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_05b0: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_05b6: stloc.s V_54 - IL_05b8: newobj instance void Linq101Aggregates01/'averageLength@107-1'::.ctor() - IL_05bd: stloc.s V_55 - IL_05bf: ldloc.s V_54 - IL_05c1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_05c6: stloc.s V_56 - IL_05c8: ldloc.s V_56 - IL_05ca: box class [mscorlib]System.Collections.Generic.IEnumerable`1> - IL_05cf: brfalse.s IL_05d3 - - IL_05d1: br.s IL_05de + IL_05b5: stloc.s V_54 + IL_05b7: newobj instance void Linq101Aggregates01/'averageLength@107-1'::.ctor() + IL_05bc: stloc.s V_55 + IL_05be: ldloc.s V_54 + IL_05c0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_05c5: stloc.s V_56 + IL_05c7: ldloc.s V_56 + IL_05c9: box class [mscorlib]System.Collections.Generic.IEnumerable`1> + IL_05ce: brfalse.s IL_05d2 + + IL_05d0: br.s IL_05dd .line 100001,100001 : 0,0 '' - IL_05d3: ldstr "source" - IL_05d8: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_05dd: throw + IL_05d2: ldstr "source" + IL_05d7: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_05dc: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_05de: nop - IL_05df: ldloc.s V_56 - IL_05e1: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1>::GetEnumerator() - IL_05e6: stloc.s V_57 + IL_05dd: nop + IL_05de: ldloc.s V_56 + IL_05e0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1>::GetEnumerator() + IL_05e5: stloc.s V_57 .try { - IL_05e8: ldc.r8 0.0 - IL_05f1: stloc.s V_59 - IL_05f3: ldc.i4.0 - IL_05f4: stloc.s V_60 - IL_05f6: ldloc.s V_57 - IL_05f8: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_05fd: brfalse.s IL_061b - - IL_05ff: ldloc.s V_59 - IL_0601: ldloc.s V_55 - IL_0603: ldloc.s V_57 - IL_0605: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1>::get_Current() - IL_060a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64>::Invoke(!0) - IL_060f: add - IL_0610: stloc.s V_59 + IL_05e7: ldc.r8 0.0 + IL_05f0: stloc.s V_59 + IL_05f2: ldc.i4.0 + IL_05f3: stloc.s V_60 + IL_05f5: ldloc.s V_57 + IL_05f7: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_05fc: brfalse.s IL_061a + + IL_05fe: ldloc.s V_59 + IL_0600: ldloc.s V_55 + IL_0602: ldloc.s V_57 + IL_0604: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1>::get_Current() + IL_0609: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64>::Invoke(!0) + IL_060e: add + IL_060f: stloc.s V_59 .line 107,107 : 9,21 '' - IL_0612: ldloc.s V_60 - IL_0614: ldc.i4.1 - IL_0615: add - IL_0616: stloc.s V_60 + IL_0611: ldloc.s V_60 + IL_0613: ldc.i4.1 + IL_0614: add + IL_0615: stloc.s V_60 .line 100001,100001 : 0,0 '' - IL_0618: nop - IL_0619: br.s IL_05f6 + IL_0617: nop + IL_0618: br.s IL_05f5 - IL_061b: ldloc.s V_60 - IL_061d: brtrue.s IL_0621 + IL_061a: ldloc.s V_60 + IL_061c: brtrue.s IL_0620 - IL_061f: br.s IL_0623 + IL_061e: br.s IL_0622 - IL_0621: br.s IL_062e + IL_0620: br.s IL_062d .line 100001,100001 : 0,0 '' - IL_0623: ldstr "source" - IL_0628: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_062d: throw + IL_0622: ldstr "source" + IL_0627: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_062c: throw .line 100001,100001 : 0,0 '' - .line 100001,100001 : 0,0 '' - IL_062e: nop - IL_062f: ldloc.s V_59 - IL_0631: stloc.s V_61 - IL_0633: ldloc.s V_60 - IL_0635: stloc.s V_62 - IL_0637: ldloc.s V_61 - IL_0639: ldloc.s V_62 - IL_063b: conv.r8 - IL_063c: div - IL_063d: stloc.s V_58 - IL_063f: leave.s IL_065f + IL_062d: nop + IL_062e: ldloc.s V_59 + IL_0630: stloc.s V_61 + IL_0632: ldloc.s V_60 + IL_0634: stloc.s V_62 + IL_0636: ldloc.s V_61 + IL_0638: ldloc.s V_62 + IL_063a: conv.r8 + IL_063b: div + IL_063c: stloc.s V_58 + IL_063e: leave.s IL_065e } // end .try finally { - IL_0641: ldloc.s V_57 - IL_0643: isinst [mscorlib]System.IDisposable - IL_0648: stloc.s V_63 - IL_064a: ldloc.s V_63 - IL_064c: brfalse.s IL_0650 + IL_0640: ldloc.s V_57 + IL_0642: isinst [mscorlib]System.IDisposable + IL_0647: stloc.s V_63 + IL_0649: ldloc.s V_63 + IL_064b: brfalse.s IL_064f - IL_064e: br.s IL_0652 + IL_064d: br.s IL_0651 - IL_0650: br.s IL_065c + IL_064f: br.s IL_065b .line 100001,100001 : 0,0 '' - IL_0652: ldloc.s V_63 - IL_0654: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0659: ldnull - IL_065a: pop - IL_065b: endfinally + IL_0651: ldloc.s V_63 + IL_0653: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0658: ldnull + IL_0659: pop + IL_065a: endfinally .line 100001,100001 : 0,0 '' - IL_065c: ldnull - IL_065d: pop - IL_065e: endfinally + IL_065b: ldnull + IL_065c: pop + IL_065d: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_065f: ldloc.s V_58 - IL_0661: dup - IL_0662: stsfld float64 ''.$Linq101Aggregates01::averageLength@103 - IL_0667: stloc.s averageLength + IL_065e: ldloc.s V_58 + IL_0660: dup + IL_0661: stsfld float64 ''.$Linq101Aggregates01::averageLength@103 + IL_0666: stloc.s averageLength .line 111,117 : 1,21 '' - IL_0669: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_066e: stloc.s V_64 - IL_0670: ldloc.s V_64 - IL_0672: ldloc.s V_64 - IL_0674: ldloc.s V_64 - IL_0676: ldloc.s V_64 - IL_0678: ldloc.s V_64 - IL_067a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_067f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0684: ldloc.s V_64 - IL_0686: newobj instance void Linq101Aggregates01/categories6@113::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_068b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0668: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_066d: stloc.s V_64 + IL_066f: ldloc.s V_64 + IL_0671: ldloc.s V_64 + IL_0673: ldloc.s V_64 + IL_0675: ldloc.s V_64 + IL_0677: ldloc.s V_64 + IL_0679: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_067e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0683: ldloc.s V_64 + IL_0685: newobj instance void Linq101Aggregates01/categories6@113::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_068a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0690: newobj instance void Linq101Aggregates01/'categories6@114-1'::.ctor() - IL_0695: newobj instance void Linq101Aggregates01/'categories6@114-2'::.ctor() - IL_069a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_068f: newobj instance void Linq101Aggregates01/'categories6@114-1'::.ctor() + IL_0694: newobj instance void Linq101Aggregates01/'categories6@114-2'::.ctor() + IL_0699: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_069f: ldloc.s V_64 - IL_06a1: newobj instance void Linq101Aggregates01/'categories6@114-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_06a6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_069e: ldloc.s V_64 + IL_06a0: newobj instance void Linq101Aggregates01/'categories6@114-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_06a5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_06ab: newobj instance void Linq101Aggregates01/'categories6@116-4'::.ctor() - IL_06b0: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_06aa: newobj instance void Linq101Aggregates01/'categories6@116-4'::.ctor() + IL_06af: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_06b5: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_06ba: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_06bf: dup - IL_06c0: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories6@111 - IL_06c5: stloc.s categories6 - IL_06c7: ret + IL_06b4: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_06b9: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_06be: dup + IL_06bf: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories6@111 + IL_06c4: stloc.s categories6 + IL_06c6: ret } // end of method $Linq101Aggregates01::main@ } // end of class ''.$Linq101Aggregates01 From 8c2105aefb483f1992db6e10cc5810e9bb483ac1 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 16:50:41 +1000 Subject: [PATCH 101/120] Fixed SurfaceArea file --- .../SurfaceArea.net40.fs | 125 ------------------ 1 file changed, 125 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index 8af75a20fff..e6d1339a853 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -310,32 +310,6 @@ Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() @@ -343,130 +317,31 @@ Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType( Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T3]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cast[T](System.Collections.IEnumerable) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TCollection]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Empty[T]() -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfArray[T](T[]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Replicate[T](Int32, T) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Singleton[T](T) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], TState) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) From 9735bd14ca3270c748fc44b49c018b8bd97e8b37 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 17:06:00 +1000 Subject: [PATCH 102/120] Matched signature argument names --- src/fsharp/FSharp.Core/iseq.fs | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index d6ecba98e56..77db866aed1 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -141,7 +141,7 @@ namespace Microsoft.FSharp.Collections let internal empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance [] - let internal singleton<'T> (x:'T) : ISeq<'T> = new SingletonEnumerable<_>(x) :> _ + let internal singleton<'T> (value:'T) : ISeq<'T> = new SingletonEnumerable<_>(value) :> _ /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. @@ -1018,11 +1018,11 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ ) - let inline byVal (keyf:'T->'Key) (source:ISeq<'T>) = - delay (fun () -> impl HashIdentity.Structural<'Key> keyf id source) + let inline byVal (projection:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl HashIdentity.Structural<'Key> projection id source) - let inline byRef (keyf:'T->'Key) (source:ISeq<'T>) = - delay (fun () -> impl (valueComparer<'Key> ()) (keyf >> Value) (fun v -> v._1) source) + let inline byRef (projection:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl (valueComparer<'Key> ()) (projection >> Value) (fun v -> v._1) source) [] let inline internal groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (keyf:'T->'Key) (source:ISeq<'T>) = @@ -1052,11 +1052,11 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ ) - let inline byVal (keyf:'T->'Key) (source:ISeq<'T>) = - delay (fun () -> impl HashIdentity.Structural<'Key> keyf id source) + let inline byVal (projection:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl HashIdentity.Structural<'Key> projection id source) - let inline byRef (keyf:'T->'Key) (source:ISeq<'T>) = - delay (fun () -> impl (valueComparer<'Key> ()) (keyf >> Value) (fun v -> v._1) source) + let inline byRef (projection:'T->'Key) (source:ISeq<'T>) = + delay (fun () -> impl (valueComparer<'Key> ()) (projection >> Value) (fun v -> v._1) source) [] let inline internal countByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T -> 'Key) (source:ISeq<'T>) = @@ -1087,10 +1087,10 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ ) [] - let internal sortBy keyf source = + let internal sortBy projection source = delay (fun () -> let array = source |> toArray - Array.stableSortInPlaceBy keyf array + Array.stableSortInPlaceBy projection array ofArray array) [] @@ -1101,10 +1101,10 @@ namespace Microsoft.FSharp.Collections ofArray array) [] - let sortWith f source = + let sortWith comparer source = delay (fun () -> let array = source |> toArray - Array.stableSortInPlaceWith f array + Array.stableSortInPlaceWith comparer array ofArray array) [] @@ -1115,18 +1115,18 @@ namespace Microsoft.FSharp.Collections ofArray array) [] - let internal permute f (source:ISeq<_>) = + let internal permute indexMap (source:ISeq<_>) = delay (fun () -> source |> toArray - |> Array.permute f + |> Array.permute indexMap |> ofArray) [] - let internal scanBack<'T,'State> f (source:ISeq<'T>) (acc:'State) : ISeq<'State> = + let internal scanBack<'T,'State> folder (source:ISeq<'T>) (state:'State) : ISeq<'State> = delay (fun () -> let array = source |> toArray - Array.scanSubRight f array 0 (array.Length - 1) acc + Array.scanSubRight folder array 0 (array.Length - 1) state |> ofArray) let inline internal foldArraySubRight f (arr: 'T[]) start fin acc = @@ -1151,11 +1151,11 @@ namespace Microsoft.FSharp.Collections foldBack ((<||) f) zipped x [] - let inline internal reduceBack f (source:ISeq<'T>) = + let inline internal reduceBack reduction (source:ISeq<'T>) = let arr = toArray source match arr.Length with | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString - | len -> foldArraySubRight f arr 0 (len - 2) arr.[len - 1] + | len -> foldArraySubRight reduction arr 0 (len - 2) arr.[len - 1] [] type internal CachedSeq<'T>(source:ISeq<'T>) = @@ -1254,9 +1254,9 @@ namespace Microsoft.FSharp.Collections | _ -> Microsoft.FSharp.Primitives.Basics.List.ofISeq source [] - let replicate<'T> count (x:'T) : ISeq<'T> = + let replicate<'T> count (initial:'T) : ISeq<'T> = if count < 0 then raise (ArgumentOutOfRangeException "count") - new InitEnumerable<'T,'T>(Nullable count, (fun _ -> x), IdentityFactory.Instance, 1) :> _ + new InitEnumerable<'T,'T>(Nullable count, (fun _ -> initial), IdentityFactory.Instance, 1) :> _ [] let internal isEmpty (source : ISeq<'T>) = @@ -1338,20 +1338,20 @@ namespace Microsoft.FSharp.Collections source |> toArray |> Array.findIndexBack f [] - let internal pick f source = - match tryPick f source with + let internal pick chooser source = + match tryPick chooser source with | None -> indexNotFound() | Some x -> x [] - let internal mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = - let arr,state = source |> toArray |> Array.mapFold f acc + let internal mapFold<'T,'State,'Result> (mapping:'State->'T->'Result*'State) state source = + let arr,state = source |> toArray |> Array.mapFold mapping state ofArray arr, state [] - let internal mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = + let internal mapFoldBack<'T,'State,'Result> (mapping:'T->'State->'Result*'State) source state = let array = source |> toArray - let arr,state = Array.mapFoldBack f array acc + let arr,state = Array.mapFoldBack mapping array state ofArray arr, state let rec internal nth index (e : IEnumerator<'T>) = @@ -1375,17 +1375,17 @@ namespace Microsoft.FSharp.Collections sortWith compareDescending source [] - let inline sortByDescending keyf source = - let inline compareDescending a b = compare (keyf b) (keyf a) + let inline sortByDescending projection source = + let inline compareDescending a b = compare (projection b) (projection a) sortWith compareDescending source [] - let internal tryFindBack f (source : ISeq<'T>) = - source |> toArray |> Array.tryFindBack f + let internal tryFindBack predicate (source : ISeq<'T>) = + source |> toArray |> Array.tryFindBack predicate [] - let internal tryFindIndexBack f (source : ISeq<'T>) = - source |> toArray |> Array.tryFindIndexBack f + let internal tryFindIndexBack predicate (source : ISeq<'T>) = + source |> toArray |> Array.tryFindIndexBack predicate [] let internal zip3 source1 source2 source3 = From 8551cd259a56c39c58b6bc9ee8f762f61588c582 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 17:24:29 +1000 Subject: [PATCH 103/120] Matching arguments to signature file names --- src/fsharp/FSharp.Core/iseq.fs | 40 ++++++++++++++++----------------- src/fsharp/FSharp.Core/iseq.fsi | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 77db866aed1..7a7fedd5b65 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1025,12 +1025,12 @@ namespace Microsoft.FSharp.Collections delay (fun () -> impl (valueComparer<'Key> ()) (projection >> Value) (fun v -> v._1) source) [] - let inline internal groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (keyf:'T->'Key) (source:ISeq<'T>) = - GroupBy.byVal keyf source + let inline internal groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T->'Key) (source:ISeq<'T>) = + GroupBy.byVal projection source [] - let inline internal groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (keyf:'T->'Key) (source:ISeq<'T>) = - GroupBy.byRef keyf source + let inline internal groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T->'Key) (source:ISeq<'T>) = + GroupBy.byRef projection source module CountBy = let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = @@ -1136,19 +1136,19 @@ namespace Microsoft.FSharp.Collections state [] - let inline internal foldBack<'T,'State> f (source: ISeq<'T>) (x:'State) = + let inline internal foldBack<'T,'State> folder (source: ISeq<'T>) (state:'State) = let arr = toArray source let len = arr.Length - foldArraySubRight f arr 0 (len - 1) x + foldArraySubRight folder arr 0 (len - 1) state [] let internal zip source1 source2 = map2 (fun x y -> x,y) source1 source2 [] - let inline internal foldBack2<'T1,'T2,'State> f (source1:ISeq<'T1>) (source2:ISeq<'T2>) (x:'State) = + let inline internal foldBack2<'T1,'T2,'State> folder (source1:ISeq<'T1>) (source2:ISeq<'T2>) (state:'State) = let zipped = zip source1 source2 - foldBack ((<||) f) zipped x + foldBack ((<||) folder) zipped state [] let inline internal reduceBack reduction (source:ISeq<'T>) = @@ -1238,7 +1238,7 @@ namespace Microsoft.FSharp.Collections new CachedSeq<_> (source) :> _ [] - let internal collect f sources = map f sources |> concat + let internal collect mapping source = map mapping source |> concat [] let internal allPairs (source1:ISeq<'T1>) (source2:ISeq<'T2>) : ISeq<'T1 * 'T2> = @@ -1312,17 +1312,17 @@ namespace Microsoft.FSharp.Collections let inline internal indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException(SR.GetString(SR.keyNotFoundAlt))) [] - let internal find f source = - match tryFind f source with + let internal find predicate source = + match tryFind predicate source with | None -> indexNotFound() | Some x -> x [] - let internal findIndex p (source:ISeq<_>) = + let internal findIndex predicate (source:ISeq<_>) = use ie = source.GetEnumerator() let rec loop i = if ie.MoveNext() then - if p ie.Current then + if predicate ie.Current then i else loop (i+1) else @@ -1330,12 +1330,12 @@ namespace Microsoft.FSharp.Collections loop 0 [] - let internal findBack f source = - source |> toArray |> Array.findBack f + let internal findBack predicate source = + source |> toArray |> Array.findBack predicate [] - let internal findIndexBack f source = - source |> toArray |> Array.findIndexBack f + let internal findIndexBack predicate source = + source |> toArray |> Array.findIndexBack predicate [] let internal pick chooser source = @@ -1364,10 +1364,10 @@ namespace Microsoft.FSharp.Collections else nth (index-1) e [] - let internal item i (source : ISeq<'T>) = - if i < 0 then invalidArgInputMustBeNonNegative "index" i + let internal item index (source : ISeq<'T>) = + if index < 0 then invalidArgInputMustBeNonNegative "index" index use e = source.GetEnumerator() - nth i e + nth index e [] let inline sortDescending source = diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index fbdaca8d1f2..b499a755ab4 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -163,7 +163,7 @@ namespace Microsoft.FSharp.Collections val inline contains : element:'T -> source:ISeq<'T> -> bool when 'T : equality [] - val inline internal forall : f:('T -> bool) -> source:ISeq<'T> -> bool + val inline internal forall : predicate:('T -> bool) -> source:ISeq<'T> -> bool [] val inline internal forall2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool From 28e8dc91cb249c1ffe2f072b5b8706b03087d8d3 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 17:44:04 +1000 Subject: [PATCH 104/120] More matching arguments names to signatures --- src/fsharp/FSharp.Core/seq.fs | 80 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index c97b6ff3b5f..ab523aa7510 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -67,8 +67,8 @@ namespace Microsoft.FSharp.Collections let delay generator = mkDelayedSeq generator [] - let unfold f x = - ISeq.unfold f x :> seq<_> + let unfold generator state = + ISeq.unfold generator state :> seq<_> [] let empty<'T> = (EmptyEnumerable :> seq<'T>) @@ -97,12 +97,12 @@ namespace Microsoft.FSharp.Collections IEnumerator.nth index e [] - let tryItem i (source : seq<'T>) = + let tryItem index (source : seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.tryItem i arr - | :? list<'T> as lst -> List.tryItem i lst - | raw -> ISeq.tryItem i (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.tryItem index arr + | :? list<'T> as lst -> List.tryItem index lst + | raw -> ISeq.tryItem index (rawOrOriginal raw original) [] let nth index (source : seq<'T>) = item index source @@ -197,12 +197,12 @@ namespace Microsoft.FSharp.Collections source |> ISeq.cast :> seq<_> [] - let tryPick f (source : seq<'T>) = + let tryPick chooser (source : seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.tryPick f arr - | :? list<'T> as lst -> List.tryPick f lst - | raw -> ISeq.tryPick f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.tryPick chooser arr + | :? list<'T> as lst -> List.tryPick chooser lst + | raw -> ISeq.tryPick chooser (rawOrOriginal raw original) [] let pick f source = @@ -213,12 +213,12 @@ namespace Microsoft.FSharp.Collections | raw -> ISeq.pick f (rawOrOriginal raw original) [] - let tryFind f (source : seq<'T>) = + let tryFind predicate (source : seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.tryFind f arr - | :? list<'T> as lst -> List.tryFind f lst - | raw -> ISeq.tryFind f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.tryFind predicate arr + | :? list<'T> as lst -> List.tryFind predicate lst + | raw -> ISeq.tryFind predicate (rawOrOriginal raw original) [] let find f source = @@ -321,44 +321,44 @@ namespace Microsoft.FSharp.Collections ISeq.reduceBack f (toISeq source) [] - let singleton x = - ISeq.singleton x :> seq<_> + let singleton value = + ISeq.singleton value :> seq<_> [] - let truncate n (source: seq<'T>) = - ISeq.truncate n (toISeq source) :> seq<_> + let truncate count (source: seq<'T>) = + ISeq.truncate count (toISeq source) :> seq<_> [] let pairwise (source: seq<'T>) = ISeq.pairwise (toISeq source) :> seq<_> [] - let scan<'T,'State> f (z:'State) (source : seq<'T>) = - ISeq.scan f z (toISeq source) :> seq<_> + let scan<'T,'State> folder (state:'State) (source : seq<'T>) = + ISeq.scan folder state (toISeq source) :> seq<_> [] - let tryFindBack f (source : seq<'T>) = - ISeq.tryFindBack f (toISeq source) + let tryFindBack predicate (source : seq<'T>) = + ISeq.tryFindBack predicate (toISeq source) [] let findBack f source = ISeq.findBack f (toISeq source) [] - let scanBack<'T,'State> f (source : seq<'T>) (acc:'State) = - ISeq.scanBack f (toISeq source) acc :> seq<_> + let scanBack<'T,'State> folder (source:seq<'T>) (state:'State) = + ISeq.scanBack folder (toISeq source) state :> seq<_> [] let findIndex p (source:seq<_>) = ISeq.findIndex p (toISeq source) [] - let tryFindIndex p (source:seq<_>) = - ISeq.tryFindIndex p (toISeq source) + let tryFindIndex predicate (source:seq<_>) = + ISeq.tryFindIndex predicate (toISeq source) [] - let tryFindIndexBack f (source : seq<'T>) = - ISeq.tryFindIndexBack f (toISeq source) + let tryFindIndexBack predicate (source : seq<'T>) = + ISeq.tryFindIndexBack predicate (toISeq source) [] let findIndexBack f source = @@ -408,20 +408,20 @@ namespace Microsoft.FSharp.Collections ISeq.distinctBy keyf (toISeq source) :> seq<_> [] - let sortBy keyf source = - ISeq.sortBy keyf (toISeq source) :> seq<_> + let sortBy projection source = + ISeq.sortBy projection (toISeq source) :> seq<_> [] let sort source = ISeq.sort (toISeq source) :> seq<_> [] - let sortWith f source = - ISeq.sortWith f (toISeq source) :> seq<_> + let sortWith comparer source = + ISeq.sortWith comparer (toISeq source) :> seq<_> [] - let inline sortByDescending keyf source = - ISeq.sortByDescending keyf (toISeq source) :> seq<_> + let inline sortByDescending projection source = + ISeq.sortByDescending projection (toISeq source) :> seq<_> [] let inline sortDescending source = @@ -442,8 +442,8 @@ namespace Microsoft.FSharp.Collections ISeq.sum (toISeq source) [] - let inline sumBy (f : 'T -> ^U) (source: seq<'T>) : ^U = - ISeq.sumBy f (toISeq source) + let inline sumBy (projection : 'T -> ^U) (source: seq<'T>) : ^U = + ISeq.sumBy projection (toISeq source) [] let inline average (source: seq< ^a>) : ^a = @@ -470,16 +470,16 @@ namespace Microsoft.FSharp.Collections ISeq.maxBy f (toISeq source) [] - let takeWhile p (source: seq<_>) = - ISeq.takeWhile p (toISeq source) :> seq<_> + let takeWhile predicate (source: seq<_>) = + ISeq.takeWhile predicate (toISeq source) :> seq<_> [] let skip count (source: seq<_>) = ISeq.skip count (toISeq source) :> seq<_> [] - let skipWhile p (source: seq<_>) = - ISeq.skipWhile p (toISeq source) :> seq<_> + let skipWhile predicate (source: seq<_>) = + ISeq.skipWhile predicate (toISeq source) :> seq<_> [] let forall2 p (source1: seq<_>) (source2: seq<_>) = From b812c58d72cb5b44d03a0c50b88c873aadb9654e Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 17:58:52 +1000 Subject: [PATCH 105/120] Yet more arg names to signatures --- src/fsharp/FSharp.Core/seq.fs | 88 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index ab523aa7510..6bd880b6131 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -82,12 +82,12 @@ namespace Microsoft.FSharp.Collections ISeq.init count f :> seq<_> [] - let iter f (source : seq<'T>) = + let iter action (source:seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.iter f arr - | :? list<'T> as lst -> List.iter f lst - | raw -> ISeq.iter f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.iter action arr + | :? list<'T> as lst -> List.iter action lst + | raw -> ISeq.iter action (rawOrOriginal raw original) [] let item index (source : seq<'T>) = @@ -108,13 +108,13 @@ namespace Microsoft.FSharp.Collections let nth index (source : seq<'T>) = item index source [] - let iteri f (source : seq<'T>) = + let iteri action (source:seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.iteri f arr - | :? list<'T> as lst -> List.iteri f lst + | :? array<'T> as arr -> Array.iteri action arr + | :? list<'T> as lst -> List.iteri action lst | raw -> - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt action ISeq.iteri (fun idx a -> f.Invoke (idx,a)) (rawOrOriginal raw original) [] @@ -138,13 +138,13 @@ namespace Microsoft.FSharp.Collections | raw -> ISeq.forall f (rawOrOriginal raw original) [] - let iter2 f (source1 : seq<_>) (source2 : seq<_>) = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + let iter2 action (source1:seq<_>) (source2:seq<_>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt action ISeq.iter2 (fun a b -> f.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] - let iteri2 f (source1 : seq<_>) (source2 : seq<_>) = - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f + let iteri2 action (source1 : seq<_>) (source2 : seq<_>) = + let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt action ISeq.iteri2 (fun idx a b -> f.Invoke(idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] @@ -155,26 +155,26 @@ namespace Microsoft.FSharp.Collections let where predicate source = filter predicate source [] - let map f source = - ISeq.map f (toISeq source) :> seq<_> + let map mapping source = + ISeq.map mapping (toISeq source) :> seq<_> [] - let mapi f source = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + let mapi mapping source = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapping ISeq.mapi (fun idx a ->f.Invoke(idx,a)) (toISeq source) :> seq<_> [] - let mapi2 f source1 source2 = - let f = OptimizedClosures.FSharpFunc.Adapt f + let mapi2 mapping source1 source2 = + let f = OptimizedClosures.FSharpFunc.Adapt mapping ISeq.mapi2 (fun idx a b -> f.Invoke (idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] - let map2 f source1 source2 = - ISeq.map2 f (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> + let map2 mapping source1 source2 = + ISeq.map2 mapping (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] - let map3 f source1 source2 source3 = - ISeq.map3 f (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> + let map3 mapping source1 source2 source3 = + ISeq.map3 mapping (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> [] let choose f source = @@ -205,12 +205,12 @@ namespace Microsoft.FSharp.Collections | raw -> ISeq.tryPick chooser (rawOrOriginal raw original) [] - let pick f source = + let pick chooser source = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.pick f arr - | :? list<'T> as lst -> List.pick f lst - | raw -> ISeq.pick f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.pick chooser arr + | :? list<'T> as lst -> List.pick chooser lst + | raw -> ISeq.pick chooser (rawOrOriginal raw original) [] let tryFind predicate (source : seq<'T>) = @@ -267,18 +267,18 @@ namespace Microsoft.FSharp.Collections ISeq.fold2 (fun acc item1 item2 -> f.Invoke (acc, item1, item2)) state (source1 |> toISeq1) (source2 |> toISeq2) [] - let reduce f (source : seq<'T>) = + let reduce reduction (source : seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.reduce f arr - | :? list<'T> as lst -> List.reduce f lst + | :? array<'T> as arr -> Array.reduce reduction arr + | :? list<'T> as lst -> List.reduce reduction lst | raw -> - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt reduction ISeq.reduce (fun acc item -> f.Invoke (acc, item)) (rawOrOriginal raw original) [] - let replicate count x = - ISeq.replicate count x :> seq<_> + let replicate count initial = + ISeq.replicate count initial :> seq<_> [] let append (source1: seq<'T>) (source2: seq<'T>) = @@ -317,8 +317,8 @@ namespace Microsoft.FSharp.Collections ISeq.foldBack2 f (toISeq1 source1) (toISeq2 source2) x [] - let reduceBack f (source : seq<'T>) = - ISeq.reduceBack f (toISeq source) + let reduceBack reduction (source:seq<'T>) = + ISeq.reduceBack reduction (toISeq source) [] let singleton value = @@ -458,16 +458,16 @@ namespace Microsoft.FSharp.Collections ISeq.min (toISeq source) [] - let inline minBy (f : 'T -> 'U) (source: seq<'T>) : 'T = - ISeq.minBy f (toISeq source) + let inline minBy (projection:'T->'U) (source:seq<'T>) : 'T = + ISeq.minBy projection (toISeq source) [] let inline max (source: seq<_>) = ISeq.max (toISeq source) [] - let inline maxBy (f : 'T -> 'U) (source: seq<'T>) : 'T = - ISeq.maxBy f (toISeq source) + let inline maxBy (projection:'T->'U) (source:seq<'T>) : 'T = + ISeq.maxBy projection (toISeq source) [] let takeWhile predicate (source: seq<_>) = @@ -540,16 +540,16 @@ namespace Microsoft.FSharp.Collections ISeq.rev (toISeq source) :> seq<_> [] - let permute f (source : seq<_>) = - ISeq.permute f (toISeq source) :> seq<_> + let permute indexMap (source : seq<_>) = + ISeq.permute indexMap (toISeq source) :> seq<_> [] - let mapFold<'T,'State,'Result> (f: 'State -> 'T -> 'Result * 'State) acc source = - ISeq.mapFold f acc (toISeq source) |> fun (iseq, state) -> iseq :> seq<_>, state + let mapFold<'T,'State,'Result> (mapping:'State->'T->'Result*'State) state source = + ISeq.mapFold mapping state (toISeq source) |> fun (iseq, state) -> iseq :> seq<_>, state [] - let mapFoldBack<'T,'State,'Result> (f: 'T -> 'State -> 'Result * 'State) source acc = - ISeq.mapFoldBack f (toISeq source) acc |> fun (iseq, state) -> iseq :> seq<_>, state + let mapFoldBack<'T,'State,'Result> (mapping:'T->'State->'Result*'State) source state = + ISeq.mapFoldBack mapping (toISeq source) state |> fun (iseq, state) -> iseq :> seq<_>, state [] let except (itemsToExclude: seq<'T>) (source: seq<'T>) = From 372207988fa25732daeb6eb527991fad924e7761 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 18:11:07 +1000 Subject: [PATCH 106/120] And more matching arg names --- src/fsharp/FSharp.Core/seq.fs | 84 +++++++++++++++++------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 6bd880b6131..1bfd5b4fe22 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -74,12 +74,12 @@ namespace Microsoft.FSharp.Collections let empty<'T> = (EmptyEnumerable :> seq<'T>) [] - let initInfinite f = - ISeq.initInfinite f :> seq<_> + let initInfinite initializer = + ISeq.initInfinite initializer :> seq<_> [] - let init count f = - ISeq.init count f :> seq<_> + let init count initializer = + ISeq.init count initializer :> seq<_> [] let iter action (source:seq<'T>) = @@ -118,24 +118,24 @@ namespace Microsoft.FSharp.Collections ISeq.iteri (fun idx a -> f.Invoke (idx,a)) (rawOrOriginal raw original) [] - let exists f (source : seq<'T>) = + let exists predicate (source:seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.exists f arr - | :? list<'T> as lst -> List.exists f lst - | raw -> ISeq.exists f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.exists predicate arr + | :? list<'T> as lst -> List.exists predicate lst + | raw -> ISeq.exists predicate (rawOrOriginal raw original) [] let inline contains element (source : seq<'T>) = ISeq.contains element (toISeq source) [] - let forall f (source : seq<'T>) = + let forall predicate (source:seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.forall f arr - | :? list<'T> as lst -> List.forall f lst - | raw -> ISeq.forall f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.forall predicate arr + | :? list<'T> as lst -> List.forall predicate lst + | raw -> ISeq.forall predicate (rawOrOriginal raw original) [] let iter2 action (source1:seq<_>) (source2:seq<_>) = @@ -148,8 +148,8 @@ namespace Microsoft.FSharp.Collections ISeq.iteri2 (fun idx a b -> f.Invoke(idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] - let filter f source = - ISeq.filter f (toISeq source) :> seq<_> + let filter predicate source = + ISeq.filter predicate (toISeq source) :> seq<_> [] let where predicate source = filter predicate source @@ -221,12 +221,12 @@ namespace Microsoft.FSharp.Collections | raw -> ISeq.tryFind predicate (rawOrOriginal raw original) [] - let find f source = + let find predicate source = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.find f arr - | :? list<'T> as lst -> List.find f lst - | raw -> ISeq.find f (rawOrOriginal raw original) + | :? array<'T> as arr -> Array.find predicate arr + | :? list<'T> as lst -> List.find predicate lst + | raw -> ISeq.find predicate (rawOrOriginal raw original) [] let take count (source : seq<'T>) = @@ -252,18 +252,18 @@ namespace Microsoft.FSharp.Collections ISeq.length (toISeq source) [] - let fold<'T,'State> f (x:'State) (source : seq<'T>) = + let fold<'T,'State> folder (state:'State) (source:seq<'T>) = let original = toISeq source match getRaw original with - | :? array<'T> as arr -> Array.fold f x arr - | :? list<'T> as lst -> List.fold f x lst + | :? array<'T> as arr -> Array.fold folder state arr + | :? list<'T> as lst -> List.fold folder state lst | raw -> - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f - ISeq.fold (fun acc item -> f.Invoke (acc, item)) x (rawOrOriginal raw original) + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder + ISeq.fold (fun acc item -> f.Invoke (acc, item)) state (rawOrOriginal raw original) [] - let fold2<'T1,'T2,'State> f (state:'State) (source1: seq<'T1>) (source2: seq<'T2>) = - let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt f + let fold2<'T1,'T2,'State> folder (state:'State) (source1:seq<'T1>) (source2:seq<'T2>) = + let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt folder ISeq.fold2 (fun acc item1 item2 -> f.Invoke (acc, item1, item2)) state (source1 |> toISeq1) (source2 |> toISeq2) [] @@ -309,12 +309,12 @@ namespace Microsoft.FSharp.Collections ISeq.toArray (toISeq source) [] - let foldBack<'T,'State> f (source : seq<'T>) (x:'State) = - ISeq.foldBack f (toISeq source) x + let foldBack<'T,'State> folder (source:seq<'T>) (state:'State) = + ISeq.foldBack folder (toISeq source) state [] - let foldBack2<'T1,'T2,'State> f (source1 : seq<'T1>) (source2 : seq<'T2>) (x:'State) = - ISeq.foldBack2 f (toISeq1 source1) (toISeq2 source2) x + let foldBack2<'T1,'T2,'State> folder (source1:seq<'T1>) (source2:seq<'T2>) (state:'State) = + ISeq.foldBack2 folder (toISeq1 source1) (toISeq2 source2) state [] let reduceBack reduction (source:seq<'T>) = @@ -341,16 +341,16 @@ namespace Microsoft.FSharp.Collections ISeq.tryFindBack predicate (toISeq source) [] - let findBack f source = - ISeq.findBack f (toISeq source) + let findBack predicate source = + ISeq.findBack predicate (toISeq source) [] let scanBack<'T,'State> folder (source:seq<'T>) (state:'State) = ISeq.scanBack folder (toISeq source) state :> seq<_> [] - let findIndex p (source:seq<_>) = - ISeq.findIndex p (toISeq source) + let findIndex predicate (source:seq<_>) = + ISeq.findIndex predicate (toISeq source) [] let tryFindIndex predicate (source:seq<_>) = @@ -361,8 +361,8 @@ namespace Microsoft.FSharp.Collections ISeq.tryFindIndexBack predicate (toISeq source) [] - let findIndexBack f source = - ISeq.findIndexBack f (toISeq source) + let findIndexBack predicate source = + ISeq.findIndexBack predicate (toISeq source) // windowed : int -> seq<'T> -> seq<'T[]> [] @@ -384,7 +384,7 @@ namespace Microsoft.FSharp.Collections mkSeq (fun () -> source.GetEnumerator()) [] - let groupBy (keyf:'T->'Key) (seq:seq<'T>) = + let groupBy (projection:'T->'Key) (source:seq<'T>) = delay (fun () -> let grouped = #if FX_RESHAPED_REFLECTION @@ -392,8 +392,8 @@ namespace Microsoft.FSharp.Collections #else if typeof<'Key>.IsValueType #endif - then seq |> toISeq |> ISeq.GroupBy.byVal keyf - else seq |> toISeq |> ISeq.GroupBy.byRef keyf + then source |> toISeq |> ISeq.GroupBy.byVal projection + else source |> toISeq |> ISeq.GroupBy.byRef projection grouped |> ISeq.map (fun (key,value) -> key, value :> seq<_>) @@ -482,13 +482,13 @@ namespace Microsoft.FSharp.Collections ISeq.skipWhile predicate (toISeq source) :> seq<_> [] - let forall2 p (source1: seq<_>) (source2: seq<_>) = - let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt p + let forall2 predicate (source1:seq<_>) (source2:seq<_>) = + let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt predicate ISeq.forall2 (fun a b -> p.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] - let exists2 p (source1: seq<_>) (source2: seq<_>) = - let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt p + let exists2 predicate (source1:seq<_>) (source2:seq<_>) = + let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt predicate ISeq.exists2 (fun a b -> p.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] From ea5f04e488bdcaeef2ebc3d331f00a6aefab7af2 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 18:22:42 +1000 Subject: [PATCH 107/120] Final (hopefully) changes for arg names --- src/fsharp/FSharp.Core/seq.fs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 1bfd5b4fe22..d98e13e26d1 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -126,8 +126,8 @@ namespace Microsoft.FSharp.Collections | raw -> ISeq.exists predicate (rawOrOriginal raw original) [] - let inline contains element (source : seq<'T>) = - ISeq.contains element (toISeq source) + let inline contains value (source:seq<'T>) = + ISeq.contains value (toISeq source) [] let forall predicate (source:seq<'T>) = @@ -177,8 +177,8 @@ namespace Microsoft.FSharp.Collections ISeq.map3 mapping (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> [] - let choose f source = - ISeq.choose f (toISeq source) :> seq<_> + let choose chooser source = + ISeq.choose chooser (toISeq source) :> seq<_> [] let indexed source = @@ -288,8 +288,8 @@ namespace Microsoft.FSharp.Collections let collect mapping source = map mapping source |> concat [] - let compareWith (f:'T -> 'T -> int) (source1 : seq<'T>) (source2: seq<'T>) = - let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt f + let compareWith (comparer:'T->'T->int) (source1:seq<'T>) (source2:seq<'T>) = + let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt comparer ISeq.compareWith (fun a b -> f.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) [] @@ -404,8 +404,8 @@ namespace Microsoft.FSharp.Collections ISeq.distinct (toISeq source) :> seq<_> [] - let distinctBy keyf source = - ISeq.distinctBy keyf (toISeq source) :> seq<_> + let distinctBy projection source = + ISeq.distinctBy projection (toISeq source) :> seq<_> [] let sortBy projection source = @@ -428,33 +428,33 @@ namespace Microsoft.FSharp.Collections ISeq.sortDescending (toISeq source) :> seq<_> [] - let countBy (keyf:'T->'Key) (source:seq<'T>) = + let countBy (projection:'T->'Key) (source:seq<'T>) = #if FX_RESHAPED_REFLECTION if (typeof<'Key>).GetTypeInfo().IsValueType #else if typeof<'Key>.IsValueType #endif - then ISeq.CountBy.byVal keyf (toISeq source) :> seq<_> - else ISeq.CountBy.byRef keyf (toISeq source) :> seq<_> + then ISeq.CountBy.byVal projection (toISeq source) :> seq<_> + else ISeq.CountBy.byRef projection (toISeq source) :> seq<_> [] let inline sum (source: seq< ^a>) : ^a = ISeq.sum (toISeq source) [] - let inline sumBy (projection : 'T -> ^U) (source: seq<'T>) : ^U = + let inline sumBy (projection:'T-> ^U) (source:seq<'T>) : ^U = ISeq.sumBy projection (toISeq source) [] - let inline average (source: seq< ^a>) : ^a = + let inline average (source:seq< ^a>) : ^a = ISeq.average (toISeq source) [] - let inline averageBy (f : 'T -> ^U) (source: seq< 'T >) : ^U = - ISeq.averageBy f (toISeq source) + let inline averageBy (projection:'T-> ^U) (source:seq<'T>) : ^U = + ISeq.averageBy projection (toISeq source) [] - let inline min (source: seq<_>) = + let inline min (source:seq<_>) = ISeq.min (toISeq source) [] From 8606e4ea37aa12a0847a536b8257e71dac91fe51 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 18:30:31 +1000 Subject: [PATCH 108/120] Set.fs matching arg names --- src/fsharp/FSharp.Core/set.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/set.fs b/src/fsharp/FSharp.Core/set.fs index 37b43926587..add41d89a8d 100644 --- a/src/fsharp/FSharp.Core/set.fs +++ b/src/fsharp/FSharp.Core/set.fs @@ -826,7 +826,7 @@ namespace Microsoft.FSharp.Collections let toSeq (set: Set<'T>) = (set:> seq<'T>) [] - let ofSeq (c : seq<_>) = new Set<_>(c) + let ofSeq (elements:seq<_>) = new Set<_>(elements) [] let difference (set1: Set<'T>) (set2: Set<'T>) = set1 - set2 From 148f3ca684d147563ee6a88ca5b5a197f826b1a4 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 12 Sep 2017 19:31:02 +1000 Subject: [PATCH 109/120] Added extra comment re: code review --- src/fsharp/FSharp.Core/iseq.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 7a7fedd5b65..96e4b09c1ee 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -110,7 +110,9 @@ namespace Microsoft.FSharp.Collections module internal TailCall = // used for performance reasons; these are not recursive calls, so should be safe // ** it should be noted that potential changes to the f# compiler may render this function - // ineffictive ** + // ineffective - i.e. this function shouldn't do anything, it just happens to be complex + // enough to fool the compiler into erasing it's behaviour, but making the calling + // function invalid for tail call optimization (No invesigation beyond observing behaviour) ** let inline avoid boolean = match boolean with true -> true | false -> false let inline internal valueComparer<'T when 'T : equality> () = From ed86b3a3de6f7d2d2e4f0ee06d7418fcb4192129 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Wed, 13 Sep 2017 17:52:10 +1000 Subject: [PATCH 110/120] Made FinaliseConstruct public --- src/fsharp/FSharp.Core/seqcore.fs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index a1b772161dc..e321b992097 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -278,10 +278,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable activity = Unchecked.defaultof> - member __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':Activity<'T,'U>) = activity <- activity' - override this.Activity = upcast activity + override __.Activity = upcast activity member private this.MoveNext () = if this.HaltedIdx = 0 && source.MoveNext () then @@ -374,9 +374,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable active = EmptyEnumerators.Element let mutable activity = Unchecked.defaultof> - override this.Activity = upcast activity + override __.Activity = upcast activity - member __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':Activity<'T,'U>) = activity <- activity' member private this.MoveNext () = @@ -536,10 +536,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable idx = 0 let mutable activity = Unchecked.defaultof> - member __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':Activity<'T,'U>) = activity <- activity' - override this.Activity = upcast activity + override __.Activity = upcast activity member private this.MoveNext () = if this.HaltedIdx = 0 && idx < array.Length then @@ -625,10 +625,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable idx = 0 let mutable activity = Unchecked.defaultof> - member __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':Activity<'T,'U>) = activity <- activity' - override this.Activity = upcast activity + override __.Activity = upcast activity member private this.MoveNext () = if this.HaltedIdx = 0 && idx < array.Count then @@ -688,10 +688,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable activity = Unchecked.defaultof> - member __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':Activity<'T,'U>) = activity <- activity' - override this.Activity = upcast activity + override __.Activity = upcast activity member private this.MoveNext () = if this.HaltedIdx <> 0 then @@ -765,7 +765,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable activity = Unchecked.defaultof> let mutable isSkipping = Unchecked.defaultofbool> - member __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':Activity<'T,'U>) = activity <- activity' isSkipping <- @@ -773,8 +773,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition | :? ISkipable as skip -> skip.CanSkip | _ -> fun () -> false - - override this.Activity = upcast activity + override __.Activity = upcast activity member private this.MoveNext () = if this.HaltedIdx = 0 && idx < terminatingIdx then From dc70212bd7edd4b33257a8f4b1268e45e960bc1d Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Thu, 14 Sep 2017 19:09:41 +1000 Subject: [PATCH 111/120] type-based optimizations for toList, toArray, rev --- src/fsharp/FSharp.Core/seq.fs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index d98e13e26d1..2ccb6be8d0c 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -285,7 +285,8 @@ namespace Microsoft.FSharp.Collections ISeq.append (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> [] - let collect mapping source = map mapping source |> concat + let collect mapping source = + map mapping source |> concat [] let compareWith (comparer:'T->'T->int) (source1:seq<'T>) (source2:seq<'T>) = @@ -298,7 +299,11 @@ namespace Microsoft.FSharp.Collections [] let toList (source : seq<'T>) = - ISeq.toList (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.toList arr + | :? list<'T> as lst -> lst + | raw -> ISeq.toList (rawOrOriginal raw original) [] let ofArray (source : 'T array) = @@ -306,7 +311,11 @@ namespace Microsoft.FSharp.Collections [] let toArray (source : seq<'T>) = - ISeq.toArray (toISeq source) + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.copy arr + | :? list<'T> as lst -> List.toArray lst + | raw -> ISeq.toArray (rawOrOriginal raw original) [] let foldBack<'T,'State> folder (source:seq<'T>) (state:'State) = @@ -537,7 +546,12 @@ namespace Microsoft.FSharp.Collections [] let rev source = - ISeq.rev (toISeq source) :> seq<_> + ISeq.delay (fun () -> + let original = toISeq source + match getRaw original with + | :? array<'T> as arr -> Array.rev arr |> ISeq.ofArray + | :? list<'T> as lst -> List.rev lst :> _ + | raw -> ISeq.rev (rawOrOriginal raw original)) :> seq<_> [] let permute indexMap (source : seq<_>) = From dc1d61bcb527eeaff39c2ff13520abf44b69c017 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Sat, 23 Sep 2017 17:47:03 +1000 Subject: [PATCH 112/120] Optimization for toArray for ICollection Had been in previous implementation --- src/fsharp/FSharp.Core/seq.fs | 6 ++++++ src/fsharp/FSharp.Core/seqcore.fs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 2ccb6be8d0c..5911b7efd48 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -315,6 +315,12 @@ namespace Microsoft.FSharp.Collections match getRaw original with | :? array<'T> as arr -> Array.copy arr | :? list<'T> as lst -> List.toArray lst + | :? ICollection<'T> as res -> + // Directly create an array and copy ourselves. + // This avoids an extra copy if using ResizeArray in fallback below. + let arr = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked res.Count + res.CopyTo(arr, 0) + arr | raw -> ISeq.toArray (rawOrOriginal raw original) [] diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index e321b992097..f74dcf22267 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -479,6 +479,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition count <- count + 1 count + override __.GetRaw () = enumerable + interface IEnumerable<'T> with member __.GetEnumerator () = enumerable.GetEnumerator () From 05c37b00baef55d4a580a5983815e2d9ec03a6e7 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 26 Sep 2017 17:11:51 +1000 Subject: [PATCH 113/120] Tighter Fold operation for GeneratedSequenceXXX --- src/fsharp/FSharp.Core/seqcore.fs | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index f74dcf22267..acf00837dee 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -1174,6 +1174,26 @@ namespace Microsoft.FSharp.Core.CompilerServices abstract CheckClose: bool abstract LastGenerated : 'T + static member CreateRedirect e (active:GeneratedSequenceBase<'T>) = + { new GeneratedSequenceBase<'T>() with + member __.GetFreshEnumerator() = e + member __.GenerateNext(_) = if e.MoveNext() then 1 else 0 + member __.Close() = try e.Dispose() finally active.Close() + member __.CheckClose = true + member __.LastGenerated = e.Current } + + static member Fold<'U, 'Result> (result:Folder<'U, 'Result>) (consumer:Activity<'T,'U>) (active:GeneratedSequenceBase<'T>) = + if result.HaltedIdx = 0 then + let mutable target = null + match active.GenerateNext(&target) with + | 1 -> + GeneratedSequenceBase.Fold result consumer active + | 2 -> + match target.GetEnumerator() with + | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g + | e -> GeneratedSequenceBase.CreateRedirect e active + | _ (*0*) -> () + //[] member x.MoveNextImpl() = let active = @@ -1184,18 +1204,11 @@ namespace Microsoft.FSharp.Core.CompilerServices | 1 -> true | 2 -> - match target.GetEnumerator() with - | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> - redirectTo <- g - | e -> - redirectTo <- - { new GeneratedSequenceBase<'T>() with - member x.GetFreshEnumerator() = e - member x.GenerateNext(_) = if e.MoveNext() then 1 else 0 - member x.Close() = try e.Dispose() finally active.Close() - member x.CheckClose = true - member x.LastGenerated = e.Current } redirect <- true + redirectTo <- + match target.GetEnumerator() with + | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g + | e -> GeneratedSequenceBase.CreateRedirect e active x.MoveNextImpl() | _ (* 0 *) -> false @@ -1225,9 +1238,7 @@ namespace Microsoft.FSharp.Core.CompilerServices try use maybeGeneratedSequenceBase = this.GetFreshEnumerator () match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as e -> // avoids two virtual function calls - while result.HaltedIdx = 0 && e.MoveNextImpl () do - result.ProcessNext (e.GetCurrent ()) |> ignore + | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Fold result result e | e -> while result.HaltedIdx = 0 && e.MoveNext () do result.ProcessNext e.Current |> ignore @@ -1264,9 +1275,7 @@ namespace Microsoft.FSharp.Core.CompilerServices try use maybeGeneratedSequenceBase = generatedSequence.GetFreshEnumerator () match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as e -> - while result.HaltedIdx = 0 && e.MoveNextImpl () do - consumer.ProcessNext (e.GetCurrent ()) |> ignore + | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Fold result consumer e | e -> while result.HaltedIdx = 0 && e.MoveNext () do consumer.ProcessNext e.Current |> ignore From cb13d0524516d667b312fddf0b6298d51ae333d1 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 26 Sep 2017 17:43:20 +1000 Subject: [PATCH 114/120] Lost in checkin... --- src/fsharp/FSharp.Core/seqcore.fs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index acf00837dee..2282f3fdb33 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -1187,11 +1187,14 @@ namespace Microsoft.FSharp.Core.CompilerServices let mutable target = null match active.GenerateNext(&target) with | 1 -> + consumer.ProcessNext active.LastGenerated |> ignore GeneratedSequenceBase.Fold result consumer active | 2 -> + let redirect = match target.GetEnumerator() with | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g | e -> GeneratedSequenceBase.CreateRedirect e active + GeneratedSequenceBase.Fold result consumer redirect | _ (*0*) -> () //[] From d4a53a0df34eb472b6be671d79c4d4e50e039699 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 26 Sep 2017 17:44:01 +1000 Subject: [PATCH 115/120] Remove temp array in rev --- src/fsharp/FSharp.Core/iseq.fs | 37 +++++++++++++++++---------------- src/fsharp/FSharp.Core/iseq.fsi | 3 +++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 96e4b09c1ee..025a1236550 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -1075,18 +1075,19 @@ namespace Microsoft.FSharp.Collections | :? list<'T> as l -> l.Length | _ -> Microsoft.FSharp.Primitives.Basics.ISeq.length source - [] - let internal toArray (source:ISeq<'T>) = + [] + let internal toResizeArray (source:ISeq<'T>) = source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,array<'T>,_>(Unchecked.defaultof<_>,ResizeArray ()) with + { new Folder<'T,ResizeArray<'T>>(ResizeArray ()) with override this.ProcessNext v = - this.State.Add v - Unchecked.defaultof<_> (* return value unused in Fold context *) - - override this.OnComplete _ = - this.Result <- this.State.ToArray () - - override this.OnDispose () = () } :> _ ) + this.Result.Add v + Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _ ) + + [] + let internal toArray (source:ISeq<'T>) = + source + |> toResizeArray + |> fun a -> a.ToArray () [] let internal sortBy projection source = @@ -1112,9 +1113,9 @@ namespace Microsoft.FSharp.Collections [] let internal rev source = delay (fun () -> - let array = source |> toArray - Array.Reverse array - ofArray array) + let array = source |> toResizeArray + array.Reverse () + ofResizeArrayUnchecked array) [] let internal permute indexMap (source:ISeq<_>) = @@ -1131,7 +1132,7 @@ namespace Microsoft.FSharp.Collections Array.scanSubRight folder array 0 (array.Length - 1) state |> ofArray) - let inline internal foldArraySubRight f (arr: 'T[]) start fin acc = + let inline internal foldArraySubRight f (arr:ResizeArray<'T>) start fin acc = let mutable state = acc for i = fin downto start do state <- f arr.[i] state @@ -1139,8 +1140,8 @@ namespace Microsoft.FSharp.Collections [] let inline internal foldBack<'T,'State> folder (source: ISeq<'T>) (state:'State) = - let arr = toArray source - let len = arr.Length + let arr = toResizeArray source + let len = arr.Count foldArraySubRight folder arr 0 (len - 1) state [] @@ -1154,8 +1155,8 @@ namespace Microsoft.FSharp.Collections [] let inline internal reduceBack reduction (source:ISeq<'T>) = - let arr = toArray source - match arr.Length with + let arr = toResizeArray source + match arr.Count with | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | len -> foldArraySubRight reduction arr 0 (len - 2) arr.[len - 1] diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index b499a755ab4..c990f87cf6d 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -298,6 +298,9 @@ namespace Microsoft.FSharp.Collections [] val internal toArray: source:ISeq<'T> -> array<'T> + [] + val internal toResizeArray: source:ISeq<'T> -> ResizeArray<'T> + [] val internal sortBy : projection:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison From 574aabc074011de57620a542a1f92d0730331f59 Mon Sep 17 00:00:00 2001 From: Paul Westcott Date: Tue, 26 Sep 2017 19:19:47 +1000 Subject: [PATCH 116/120] Refactoring cleanup of GeneratedSequenceBase --- src/fsharp/FSharp.Core/seqcore.fs | 47 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 2282f3fdb33..faaf0d5a09e 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -1182,39 +1182,40 @@ namespace Microsoft.FSharp.Core.CompilerServices member __.CheckClose = true member __.LastGenerated = e.Current } - static member Fold<'U, 'Result> (result:Folder<'U, 'Result>) (consumer:Activity<'T,'U>) (active:GeneratedSequenceBase<'T>) = + static member GetRedirect (target:IEnumerable<'T>) (active:GeneratedSequenceBase<'T>) = + match target.GetEnumerator() with + | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g + | e -> GeneratedSequenceBase.CreateRedirect e active + + static member Fold<'U, 'Result> (result:Folder<'U,'Result>) (consumer:Activity<'T,'U>) (active:GeneratedSequenceBase<'T>) = if result.HaltedIdx = 0 then let mutable target = null - match active.GenerateNext(&target) with + match active.GenerateNext (&target) with | 1 -> consumer.ProcessNext active.LastGenerated |> ignore GeneratedSequenceBase.Fold result consumer active | 2 -> - let redirect = - match target.GetEnumerator() with - | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g - | e -> GeneratedSequenceBase.CreateRedirect e active - GeneratedSequenceBase.Fold result consumer redirect + GeneratedSequenceBase.Fold result consumer (GeneratedSequenceBase.GetRedirect target active) | _ (*0*) -> () + static member Count (active:GeneratedSequenceBase<'T>) count = + let mutable target = null + match active.GenerateNext (&target) with + | 1 -> GeneratedSequenceBase.Count active (count+1) + | 2 -> GeneratedSequenceBase.Count (GeneratedSequenceBase.GetRedirect target active) count + | _ (*0*) -> count + //[] member x.MoveNextImpl() = - let active = - if redirect then redirectTo - else x + let active = if redirect then redirectTo else x let mutable target = null - match active.GenerateNext(&target) with - | 1 -> - true + match active.GenerateNext (&target) with + | 1 -> true | 2 -> redirect <- true - redirectTo <- - match target.GetEnumerator() with - | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g - | e -> GeneratedSequenceBase.CreateRedirect e active + redirectTo <- GeneratedSequenceBase.GetRedirect target active x.MoveNextImpl() - | _ (* 0 *) -> - false + | _ (*0*) -> false interface IEnumerable<'T> with member x.GetEnumerator() = x.GetFreshEnumerator() @@ -1253,15 +1254,13 @@ namespace Microsoft.FSharp.Core.CompilerServices override this.Length () = use maybeGeneratedSequenceBase = this.GetFreshEnumerator () - let mutable count = 0 match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as e -> - while e.MoveNextImpl () do - count <- count + 1 + | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Count e 0 | e -> + let mutable count = 0 while e.MoveNext () do count <- count + 1 - count + count and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) From 2b3c65833da8b4d9f53e725b58cf8c54762ed763 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 8 May 2018 16:55:39 +0100 Subject: [PATCH 117/120] integrate and apply renamings --- .../ISeqModule.fs | 1170 ----------- .../ISeqModule2.fs | 1845 ----------------- src/fsharp/FSharp.Core/array.fs | 2 +- src/fsharp/FSharp.Core/iseq.fs | 551 ++--- src/fsharp/FSharp.Core/iseq.fsi | 260 +-- src/fsharp/FSharp.Core/local.fs | 132 +- src/fsharp/FSharp.Core/local.fsi | 11 +- src/fsharp/FSharp.Core/prim-types.fs | 127 +- src/fsharp/FSharp.Core/prim-types.fsi | 66 +- src/fsharp/FSharp.Core/seq.fs | 246 +-- src/fsharp/FSharp.Core/seqcore.fs | 275 ++- src/fsharp/FSharp.Core/seqcore.fsi | 62 +- .../FSharp.Core.Unittests.fsproj | 6 +- .../IConsumableSeqModule.fs | 1170 +++++++++++ .../IConsumableSeqModule2.fs | 1845 +++++++++++++++++ .../IConsumableSeqProperties.fs | 22 +- .../SurfaceArea.coreclr.fs | 456 ++-- .../SurfaceArea.net40.fs | 206 +- .../Linq101Aggregates01.il.bsl | 54 +- .../fsharpqa/Source/Misc/LongSourceFile01.fs | 430 ++-- 20 files changed, 4454 insertions(+), 4482 deletions(-) delete mode 100644 src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs delete mode 100644 src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs create mode 100644 tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule.fs create mode 100644 tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule2.fs rename src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs => tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqProperties.fs (54%) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs deleted file mode 100644 index dfb91a6fd71..00000000000 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule.fs +++ /dev/null @@ -1,1170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections - -open System -open NUnit.Framework - -open FSharp.Core.Unittests.LibraryTestFx - -#if ISeqIsPublic - -// Various tests for the: -// Microsoft.FSharp.Collections.iseq type - -(* -[Test Strategy] -Make sure each method works on: -* Integer ISeq (value type) -* String ISeq (reference type) -* Empty ISeq (0 elements) -* Null ISeq (null) -*) - -type iseq<'a> = FSharp.Collections.SeqComposition.ISeq<'a> - -[] -type ISeqModule() = - let iseq (x:seq<_>) = x |> ISeq.ofSeq - - [] - member this.AllPairs() = - - // integer ISeq - let resultInt = ISeq.allPairs (iseq [1..7]) (iseq [11..17]) - let expectedInt = - iseq <| seq { for i in 1..7 do - for j in 11..17 do - yield i, j } - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr = ISeq.allPairs (iseq ["str3";"str4"]) (iseq ["str1";"str2"]) - let expectedStr = iseq ["str3","str1";"str3","str2";"str4","str1";"str4","str2"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - VerifySeqsEqual ISeq.empty <| ISeq.allPairs ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty <| ISeq.allPairs (iseq { 1..7 }) ISeq.empty - VerifySeqsEqual ISeq.empty <| ISeq.allPairs ISeq.empty (iseq { 1..7 }) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.allPairs null null |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.allPairs null (iseq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.allPairs (iseq [1..7]) null |> ignore) - () - - [] - member this.CachedSeq_Clear() = - - let evaluatedItems : int list ref = ref [] - let cachedSeq = - ISeq.initInfinite (fun i -> evaluatedItems := i :: !evaluatedItems; i) - |> ISeq.cache - - // Verify no items have been evaluated from the ISeq yet - Assert.AreEqual(List.length !evaluatedItems, 0) - - // Force evaluation of 10 elements - ISeq.take 10 cachedSeq - |> ISeq.toList - |> ignore - - // verify ref clear switch length - Assert.AreEqual(List.length !evaluatedItems, 10) - - // Force evaluation of 10 elements - ISeq.take 10 cachedSeq - |> ISeq.toList - |> ignore - - // Verify ref clear switch length (should be cached) - Assert.AreEqual(List.length !evaluatedItems, 10) - - - // Clear - (box cachedSeq :?> System.IDisposable) .Dispose() - - // Force evaluation of 10 elements - ISeq.take 10 cachedSeq - |> ISeq.toList - |> ignore - - // Verify length of evaluatedItemList is 20 - Assert.AreEqual(List.length !evaluatedItems, 20) - () - - [] - member this.Append() = - - // empty ISeq - let emptySeq1 = ISeq.empty - let emptySeq2 = ISeq.empty - let appendEmptySeq = ISeq.append emptySeq1 emptySeq2 - let expectResultEmpty = ISeq.empty - - VerifySeqsEqual expectResultEmpty appendEmptySeq - - // Integer ISeq - let integerSeq1:iseq = iseq [0..4] - let integerSeq2:iseq = iseq [5..9] - - let appendIntergerSeq = ISeq.append integerSeq1 integerSeq2 - - let expectResultInteger = iseq <| seq { for i in 0..9 -> i} - - VerifySeqsEqual expectResultInteger appendIntergerSeq - - - // String ISeq - let stringSeq1:iseq = iseq ["1";"2"] - let stringSeq2:iseq = iseq ["3";"4"] - - let appendStringSeq = ISeq.append stringSeq1 stringSeq2 - - let expectedResultString = iseq ["1";"2";"3";"4"] - - VerifySeqsEqual expectedResultString appendStringSeq - - // null ISeq - let nullSeq1 = iseq [null;null] - - let nullSeq2 =iseq [null;null] - - let appendNullSeq = ISeq.append nullSeq1 nullSeq2 - - let expectedResultNull = iseq [ null;null;null;null] - - VerifySeqsEqual expectedResultNull appendNullSeq - - () - - [] - member this.replicate() = - // replicate should create multiple copies of the given value - Assert.IsTrue(ISeq.isEmpty <| ISeq.replicate 0 null) - Assert.IsTrue(ISeq.isEmpty <| ISeq.replicate 0 1) - Assert.AreEqual(null, ISeq.head <| ISeq.replicate 1 null) - Assert.AreEqual(["1";"1"],ISeq.replicate 2 "1" |> ISeq.toList) - - CheckThrowsArgumentException (fun () -> ISeq.replicate -1 null |> ignore) - - - [] - member this.Average() = - // empty ISeq - let emptySeq:iseq = ISeq.empty - - CheckThrowsArgumentException (fun () -> ISeq.average emptySeq |> ignore) - - - // double ISeq - let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] - - let averageDouble = ISeq.average doubleSeq - - Assert.IsFalse( averageDouble <> 2.5) - - // float32 ISeq - let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] - - let averageFloat = ISeq.average floatSeq - - Assert.IsFalse( averageFloat <> 5.0f) - - // decimal ISeq - let decimalSeq:iseq = iseq [ 0M;19M;19.03M] - - let averageDecimal = ISeq.average decimalSeq - - Assert.IsFalse( averageDecimal <> 12.676666666666666666666666667M ) - - //// null ISeq - //let nullSeq:iseq = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.average nullSeq |> ignore) - () - - - [] - member this.AverageBy() = - // empty ISeq - let emptySeq:iseq = ISeq.empty - - CheckThrowsArgumentException (fun () -> ISeq.averageBy (fun x -> x+1.0) emptySeq |> ignore) - - // double ISeq - let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] - - let averageDouble = ISeq.averageBy (fun x -> x-2.0) doubleSeq - - Assert.IsFalse( averageDouble <> 0.5 ) - - // float32 ISeq - let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] - - let averageFloat = ISeq.averageBy (fun x -> x*3.3f) floatSeq - - Assert.IsFalse( averageFloat <> 16.5f ) - - // decimal ISeq - let decimalSeq:iseq = iseq [ 0M;19M;19.03M] - - let averageDecimal = ISeq.averageBy (fun x -> x/10.7M) decimalSeq - - Assert.IsFalse( averageDecimal <> 1.1847352024922118380062305296M ) - - //// null ISeq - //let nullSeq:iseq = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.averageBy (fun (x:double)->x+4.0) nullSeq |> ignore) - () - - [] - member this.Cache() = - // empty ISeq - let emptySeq:iseq = ISeq.empty - - let cacheEmpty = ISeq.cache emptySeq - - let expectedResultEmpty = ISeq.empty - - VerifySeqsEqual expectedResultEmpty cacheEmpty - - // double ISeq - let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] - - let cacheDouble = ISeq.cache doubleSeq - - VerifySeqsEqual doubleSeq cacheDouble - - - // float32 ISeq - let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] - - let cacheFloat = ISeq.cache floatSeq - - VerifySeqsEqual floatSeq cacheFloat - - // decimal ISeq - let decimalSeq:iseq = iseq [ 0M; 19M; 19.03M] - - let cacheDecimal = ISeq.cache decimalSeq - - VerifySeqsEqual decimalSeq cacheDecimal - - // null ISeq - let nullSeq = iseq [null] - - let cacheNull = ISeq.cache nullSeq - - VerifySeqsEqual nullSeq cacheNull - () - - [] - member this.Case() = - - // integer ISeq - let integerArray = [|1;2|] - let integerSeq = ISeq.cast integerArray - - let expectedIntegerSeq = iseq [1;2] - - VerifySeqsEqual expectedIntegerSeq integerSeq - - // string ISeq - let stringArray = [|"a";"b"|] - let stringSeq = ISeq.cast stringArray - - let expectedStringSeq = iseq["a";"b"] - - VerifySeqsEqual expectedStringSeq stringSeq - - // empty ISeq - let emptySeq = ISeq.cast ISeq.empty - let expectedEmptySeq = ISeq.empty - - VerifySeqsEqual expectedEmptySeq ISeq.empty - - // null ISeq - let nullArray = [|null;null|] - let NullSeq = ISeq.cast nullArray - let expectedNullSeq = iseq [null;null] - - VerifySeqsEqual expectedNullSeq NullSeq - - CheckThrowsExn(fun () -> - let strings = - integerArray - |> ISeq.cast - for o in strings do ()) - - CheckThrowsExn(fun () -> - let strings = - integerArray - |> ISeq.cast - :> System.Collections.IEnumerable // without this upcast the for loop throws, so it should with this upcast too - for o in strings do ()) - - () - - [] - member this.Choose() = - - // int ISeq - let intSeq = iseq [1..20] - let funcInt x = if (x%5=0) then Some x else None - let intChoosed = ISeq.choose funcInt intSeq - let expectedIntChoosed = iseq <| seq { for i = 1 to 4 do yield i*5} - - - - VerifySeqsEqual expectedIntChoosed intChoosed - - // string ISeq - let stringSrc = iseq ["list";"List"] - let funcString x = match x with - | "list"-> Some x - | "List" -> Some x - | _ -> None - let strChoosed = ISeq.choose funcString stringSrc - let expectedStrChoose = iseq ["list";"List"] - - VerifySeqsEqual expectedStrChoose strChoosed - - // empty ISeq - let emptySeq = ISeq.empty - let emptyChoosed = ISeq.choose funcInt emptySeq - - let expectedEmptyChoose = ISeq.empty - - VerifySeqsEqual expectedEmptyChoose emptySeq - - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.choose funcInt nullSeq |> ignore) - () - - [] - member this.ChunkBySize() = - - let verify expected actual = - ISeq.zip expected actual - |> ISeq.iter ((<||) VerifySeqsEqual) - - // int ISeq - verify (iseq [[1..4];[5..8]]) <| ISeq.chunkBySize 4 (iseq {1..8}) - verify (iseq [[1..4];[5..8];[9..10]]) <| ISeq.chunkBySize 4 (iseq {1..10}) - verify (iseq [[1]; [2]; [3]; [4]]) <| ISeq.chunkBySize 1 (iseq {1..4}) - - ISeq.chunkBySize 2 (ISeq.initInfinite id) - |> ISeq.take 3 - |> verify (iseq [[0;1];[2;3];[4;5]]) - - ISeq.chunkBySize 1 (ISeq.initInfinite id) - |> ISeq.take 5 - |> verify (iseq [[0];[1];[2];[3];[4]]) - - // string ISeq - verify (iseq [["a"; "b"];["c";"d"];["e"]]) <| ISeq.chunkBySize 2 (iseq ["a";"b";"c";"d";"e"]) - - // empty ISeq - verify ISeq.empty <| ISeq.chunkBySize 3 ISeq.empty - - //// null ISeq - //let nullSeq:iseq<_> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.chunkBySize 3 nullSeq |> ignore) - - // invalidArg - CheckThrowsArgumentException (fun () -> ISeq.chunkBySize 0 (iseq {1..10}) |> ignore) - CheckThrowsArgumentException (fun () -> ISeq.chunkBySize -1 (iseq {1..10}) |> ignore) - - () - - [] - member this.SplitInto() = - - let verify expected actual = - ISeq.zip expected actual - |> ISeq.iter ((<||) VerifySeqsEqual) - - // int ISeq - ISeq.splitInto 3 (iseq {1..10}) |> verify (iseq [ {1..4}; {5..7}; {8..10} ]) - ISeq.splitInto 3 (iseq {1..11}) |> verify (iseq [ {1..4}; {5..8}; {9..11} ]) - ISeq.splitInto 3 (iseq {1..12}) |> verify (iseq [ {1..4}; {5..8}; {9..12} ]) - - ISeq.splitInto 4 (iseq {1..5}) |> verify (iseq [ [1..2]; [3]; [4]; [5] ]) - ISeq.splitInto 20 (iseq {1..4}) |> verify (iseq [ [1]; [2]; [3]; [4] ]) - - // string ISeq - ISeq.splitInto 3 (iseq ["a";"b";"c";"d";"e"]) |> verify (iseq [ ["a"; "b"]; ["c";"d"]; ["e"] ]) - - // empty ISeq - VerifySeqsEqual [] <| ISeq.splitInto 3 (iseq []) - - //// null ISeq - //let nullSeq:iseq<_> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.splitInto 3 nullSeq |> ignore) - - // invalidArg - CheckThrowsArgumentException (fun () -> ISeq.splitInto 0 (iseq [1..10]) |> ignore) - CheckThrowsArgumentException (fun () -> ISeq.splitInto -1 (iseq [1..10]) |> ignore) - - () - - [] - member this.Compare() = - - // int ISeq - let intSeq1 = iseq [1;3;7;9] - let intSeq2 = iseq [2;4;6;8] - let funcInt x y = if (x>y) then x else 0 - let intcompared = ISeq.compareWith funcInt intSeq1 intSeq2 - - Assert.IsFalse( intcompared <> 7 ) - - // string ISeq - let stringSeq1 = iseq ["a"; "b"] - let stringSeq2 = iseq ["c"; "d"] - let funcString x y = match (x,y) with - | "a", "c" -> 0 - | "b", "d" -> 1 - |_ -> -1 - let strcompared = ISeq.compareWith funcString stringSeq1 stringSeq2 - Assert.IsFalse( strcompared <> 1 ) - - // empty ISeq - let emptySeq = ISeq.empty - let emptycompared = ISeq.compareWith funcInt emptySeq emptySeq - - Assert.IsFalse( emptycompared <> 0 ) - - //// null ISeq - //let nullSeq:iseq = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt nullSeq emptySeq |> ignore) - //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt emptySeq nullSeq |> ignore) - //CheckThrowsArgumentNullException (fun () -> ISeq.compareWith funcInt nullSeq nullSeq |> ignore) - - () - - [] - member this.Concat() = - // integer ISeq - let seqInt = - iseq <| seq { for i in 0..9 do - yield iseq <| seq {for j in 0..9 do - yield i*10+j}} - let conIntSeq = ISeq.concat seqInt - let expectedIntSeq = iseq <| seq { for i in 0..99 do yield i} - - VerifySeqsEqual expectedIntSeq conIntSeq - - // string ISeq - let strSeq = - iseq <| seq { for a in 'a' .. 'b' do - for b in 'a' .. 'b' do - yield iseq [a; b] } - - let conStrSeq = ISeq.concat strSeq - let expectedStrSeq = iseq ['a';'a';'a';'b';'b';'a';'b';'b';] - VerifySeqsEqual expectedStrSeq conStrSeq - - // Empty ISeq - let emptySeqs = iseq [iseq[ ISeq.empty;ISeq.empty];iseq[ ISeq.empty;ISeq.empty]] - let conEmptySeq = ISeq.concat emptySeqs - let expectedEmptySeq =iseq <| seq { for i in 1..4 do yield ISeq.empty} - - VerifySeqsEqual expectedEmptySeq conEmptySeq - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.concat nullSeq |> ignore) - - () - - [] - member this.CountBy() = - // integer ISeq - let funcIntCount_by (x:int) = x%3 - let seqInt = - iseq <| seq { for i in 0..9 do - yield i} - let countIntSeq = ISeq.countByVal funcIntCount_by seqInt - - let expectedIntSeq = iseq [0,4;1,3;2,3] - - VerifySeqsEqual expectedIntSeq countIntSeq - - // string ISeq - let funcStrCount_by (s:string) = s.IndexOf("key") - let strSeq = iseq [ "key";"blank key";"key";"blank blank key"] - - let countStrSeq = ISeq.countByVal funcStrCount_by strSeq - let expectedStrSeq = iseq [0,2;6,1;12,1] - VerifySeqsEqual expectedStrSeq countStrSeq - - // Empty ISeq - let emptySeq = ISeq.empty - let countEmptySeq = ISeq.countByVal funcIntCount_by emptySeq - let expectedEmptySeq =iseq [] - - VerifySeqsEqual expectedEmptySeq countEmptySeq - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.countBy funcIntCount_by nullSeq |> ignore) - () - - [] - member this.Distinct() = - - // integer ISeq - let IntDistinctSeq = - iseq <| seq { for i in 0..9 do - yield i % 3 } - - let DistinctIntSeq = ISeq.distinct IntDistinctSeq - - let expectedIntSeq = iseq [0;1;2] - - VerifySeqsEqual expectedIntSeq DistinctIntSeq - - // string ISeq - let strDistinctSeq = iseq ["elementDup"; "ele1"; "ele2"; "elementDup"] - - let DistnctStrSeq = ISeq.distinct strDistinctSeq - let expectedStrSeq = iseq ["elementDup"; "ele1"; "ele2"] - VerifySeqsEqual expectedStrSeq DistnctStrSeq - - // Empty ISeq - let emptySeq : iseq = ISeq.empty - let distinctEmptySeq : iseq = ISeq.distinct emptySeq - let expectedEmptySeq : iseq = iseq [] - - VerifySeqsEqual expectedEmptySeq distinctEmptySeq - - //// null ISeq - //let nullSeq:iseq = null - - //CheckThrowsArgumentNullException(fun () -> ISeq.distinct nullSeq |> ignore) - () - - [] - member this.DistinctBy () = - // integer ISeq - let funcInt x = x % 3 - let IntDistinct_bySeq = - iseq <| seq { for i in 0..9 do - yield i } - - let distinct_byIntSeq = ISeq.distinctBy funcInt IntDistinct_bySeq - - let expectedIntSeq = iseq [0;1;2] - - VerifySeqsEqual expectedIntSeq distinct_byIntSeq - - // string ISeq - let funcStrDistinct (s:string) = s.IndexOf("key") - let strSeq = iseq [ "key"; "blank key"; "key dup"; "blank key dup"] - - let DistnctStrSeq = ISeq.distinctBy funcStrDistinct strSeq - let expectedStrSeq = iseq ["key"; "blank key"] - VerifySeqsEqual expectedStrSeq DistnctStrSeq - - // Empty ISeq - let emptySeq : iseq = ISeq.empty - let distinct_byEmptySeq : iseq = ISeq.distinctBy funcInt emptySeq - let expectedEmptySeq : iseq = iseq [] - - VerifySeqsEqual expectedEmptySeq distinct_byEmptySeq - - //// null ISeq - //let nullSeq : iseq<'a> = null - - //CheckThrowsArgumentNullException(fun () -> ISeq.distinctBy funcInt nullSeq |> ignore) - () - - [] - member this.Except() = - // integer ISeq - let intSeq1 = iseq <| seq { yield! {1..100} - yield! {1..100} } - let intSeq2 = {1..10} - let expectedIntSeq = {11..100} - - VerifySeqsEqual expectedIntSeq <| ISeq.except intSeq2 intSeq1 - - // string ISeq - let strSeq1 = iseq ["a"; "b"; "c"; "d"; "a"] - let strSeq2 = iseq ["b"; "c"] - let expectedStrSeq = iseq ["a"; "d"] - - VerifySeqsEqual expectedStrSeq <| ISeq.except strSeq2 strSeq1 - - // double ISeq - // Sequences with nan do not behave, due to the F# generic equality comparisons -// let floatSeq1 = iseq [1.0; 1.0; System.Double.MaxValue; nan; nan] -// -// VerifySeqsEqual [1.0; System.Double.MaxValue; nan; nan] <| ISeq.except [] floatSeq1 -// VerifySeqsEqual [1.0; System.Double.MaxValue] <| ISeq.except [nan] floatSeq1 - - // empty ISeq - let emptyIntSeq = ISeq.empty - VerifySeqsEqual {1..100} <| ISeq.except emptyIntSeq intSeq1 - VerifySeqsEqual emptyIntSeq <| ISeq.except intSeq1 emptyIntSeq - VerifySeqsEqual emptyIntSeq <| ISeq.except emptyIntSeq emptyIntSeq - VerifySeqsEqual emptyIntSeq <| ISeq.except intSeq1 intSeq1 - - //// null ISeq - //let nullSeq : iseq = null - //CheckThrowsArgumentNullException(fun () -> ISeq.except nullSeq emptyIntSeq |> ignore) - //CheckThrowsArgumentNullException(fun () -> ISeq.except emptyIntSeq nullSeq |> ignore) - //CheckThrowsArgumentNullException(fun () -> ISeq.except nullSeq nullSeq |> ignore) - - () - - [] - member this.Exists() = - - // Integer ISeq - let funcInt x = (x % 2 = 0) - let IntexistsSeq = - iseq <| seq { for i in 0..9 do - yield i} - - let ifExistInt = ISeq.exists funcInt IntexistsSeq - - Assert.IsTrue( ifExistInt) - - // String ISeq - let funcStr (s:string) = s.Contains("key") - let strSeq = iseq ["key"; "blank key"] - - let ifExistStr = ISeq.exists funcStr strSeq - - Assert.IsTrue( ifExistStr) - - // Empty ISeq - let emptySeq = ISeq.empty - let ifExistsEmpty = ISeq.exists funcInt emptySeq - - Assert.IsFalse( ifExistsEmpty) - - - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.exists funcInt nullSeq |> ignore) - () - - [] - member this.Exists2() = - // Integer ISeq - let funcInt x y = (x+y)%3=0 - let Intexists2Seq1 = iseq [1;3;7] - let Intexists2Seq2 = iseq [1;6;3] - - let ifExist2Int = ISeq.exists2 funcInt Intexists2Seq1 Intexists2Seq2 - Assert.IsTrue( ifExist2Int) - - // String ISeq - let funcStr s1 s2 = ((s1 + s2) = "CombinedString") - let strSeq1 = iseq [ "Combined"; "Not Combined"] - let strSeq2 = iseq ["String"; "Other String"] - let ifexists2Str = ISeq.exists2 funcStr strSeq1 strSeq2 - Assert.IsTrue(ifexists2Str) - - // Empty ISeq - let emptySeq = ISeq.empty - let ifexists2Empty = ISeq.exists2 funcInt emptySeq emptySeq - Assert.IsFalse( ifexists2Empty) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.exists2 funcInt nullSeq nullSeq |> ignore) - () - - - [] - member this.Filter() = - // integer ISeq - let funcInt x = if (x % 5 = 0) then true else false - let IntSeq = - iseq <| seq { for i in 1..20 do - yield i } - - let filterIntSeq = ISeq.filter funcInt IntSeq - - let expectedfilterInt = iseq [ 5;10;15;20] - - VerifySeqsEqual expectedfilterInt filterIntSeq - - // string ISeq - let funcStr (s:string) = s.Contains("Expected Content") - let strSeq = iseq [ "Expected Content"; "Not Expected"; "Expected Content"; "Not Expected"] - - let filterStrSeq = ISeq.filter funcStr strSeq - - let expectedfilterStr = iseq ["Expected Content"; "Expected Content"] - - VerifySeqsEqual expectedfilterStr filterStrSeq - // Empty ISeq - let emptySeq = ISeq.empty - let filterEmptySeq = ISeq.filter funcInt emptySeq - - let expectedEmptySeq =iseq [] - - VerifySeqsEqual expectedEmptySeq filterEmptySeq - - - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.filter funcInt nullSeq |> ignore) - () - - [] - member this.Find() = - - // integer ISeq - let funcInt x = if (x % 5 = 0) then true else false - let IntSeq = - iseq <| seq { for i in 1..20 do - yield i } - - let findInt = ISeq.find funcInt IntSeq - Assert.AreEqual(findInt, 5) - - // string ISeq - let funcStr (s:string) = s.Contains("Expected Content") - let strSeq = iseq [ "Expected Content";"Not Expected"] - - let findStr = ISeq.find funcStr strSeq - Assert.AreEqual(findStr, "Expected Content") - - // Empty ISeq - let emptySeq = ISeq.empty - - CheckThrowsKeyNotFoundException(fun () -> ISeq.find funcInt emptySeq |> ignore) - - // null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.find funcInt nullSeq |> ignore) - () - - [] - member this.FindBack() = - // integer ISeq - let funcInt x = x % 5 = 0 - Assert.AreEqual(20, ISeq.findBack funcInt <| (iseq <| seq { 1..20 })) - Assert.AreEqual(15, ISeq.findBack funcInt <| (iseq <| seq { 1..19 })) - Assert.AreEqual(5, ISeq.findBack funcInt <| (iseq <| seq { 5..9 })) - - // string ISeq - let funcStr (s:string) = s.Contains("Expected") - let strSeq = iseq [ "Not Expected"; "Expected Content"] - let findStr = ISeq.findBack funcStr strSeq - Assert.AreEqual("Expected Content", findStr) - - // Empty ISeq - let emptySeq = ISeq.empty - CheckThrowsKeyNotFoundException(fun () -> ISeq.findBack funcInt emptySeq |> ignore) - - // Not found - let emptySeq = ISeq.empty - CheckThrowsKeyNotFoundException(fun () -> iseq <| seq { 1..20 } |> ISeq.findBack (fun _ -> false) |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.findBack funcInt nullSeq |> ignore) - () - - [] - member this.FindIndex() = - - // integer ISeq - let digits = [1 .. 100] |> ISeq.ofList - let idx = digits |> ISeq.findIndex (fun i -> i.ToString().Length > 1) - Assert.AreEqual(idx, 9) - - // empty ISeq - CheckThrowsKeyNotFoundException(fun () -> ISeq.findIndex (fun i -> true) ISeq.empty |> ignore) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.findIndex (fun i -> true) null |> ignore) - () - - [] - member this.Permute() = - let mapIndex i = (i + 1) % 4 - - // integer iseq - let intSeq = iseq <| seq { 1..4 } - let resultInt = ISeq.permute mapIndex intSeq - VerifySeqsEqual (iseq [4;1;2;3]) resultInt - - // string iseq - let resultStr = ISeq.permute mapIndex (iseq [|"Lists"; "are"; "commonly"; "list" |]) - VerifySeqsEqual (iseq ["list"; "Lists"; "are"; "commonly" ]) resultStr - - // empty iseq - let resultEpt = ISeq.permute mapIndex (iseq [||]) - VerifySeqsEqual ISeq.empty resultEpt - - //// null iseq - //let nullSeq = null:string[] - //CheckThrowsArgumentNullException (fun () -> ISeq.permute mapIndex nullSeq |> ignore) - - // argument exceptions - CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 10) (iseq [0..9]) |> ISeq.iter ignore) - CheckThrowsArgumentException (fun () -> ISeq.permute (fun _ -> 0) (iseq [0..9]) |> ISeq.iter ignore) - () - - [] - member this.FindIndexBack() = - // integer ISeq - let digits = iseq <| seq { 1..100 } - let idx = digits |> ISeq.findIndexBack (fun i -> i.ToString().Length = 1) - Assert.AreEqual(idx, 8) - - // string ISeq - let funcStr (s:string) = s.Contains("Expected") - let strSeq = iseq [ "Not Expected"; "Expected Content" ] - let findStr = ISeq.findIndexBack funcStr strSeq - Assert.AreEqual(1, findStr) - - // empty ISeq - CheckThrowsKeyNotFoundException(fun () -> ISeq.findIndexBack (fun i -> true) ISeq.empty |> ignore) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.findIndexBack (fun i -> true) null |> ignore) - () - - [] - member this.Pick() = - - let digits = [| 1 .. 10 |] |> ISeq.ofArray - let result = ISeq.pick (fun i -> if i > 5 then Some(i.ToString()) else None) digits - Assert.AreEqual(result, "6") - - // Empty iseq (Bugged, 4173) - CheckThrowsKeyNotFoundException (fun () -> ISeq.pick (fun i -> Some('a')) (iseq ([| |] : int[])) |> ignore) - - //// Null - //CheckThrowsArgumentNullException (fun () -> ISeq.pick (fun i -> Some(i + 0)) null |> ignore) - () - - [] - member this.Fold() = - let funcInt x y = x+y - - let IntSeq = - iseq <| seq { for i in 1..10 do - yield i} - - let foldInt = ISeq.fold funcInt 1 IntSeq - if foldInt <> 56 then Assert.Fail() - - // string ISeq - let funcStr (x:string) (y:string) = x+y - let strSeq = iseq ["B"; "C"; "D" ; "E"] - let foldStr = ISeq.fold funcStr "A" strSeq - - if foldStr <> "ABCDE" then Assert.Fail() - - - // Empty ISeq - let emptySeq = ISeq.empty - let foldEmpty = ISeq.fold funcInt 1 emptySeq - if foldEmpty <> 1 then Assert.Fail() - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.fold funcInt 1 nullSeq |> ignore) - () - - - - [] - member this.Fold2() = - Assert.AreEqual([(3,5); (2,3); (1,1)],ISeq.fold2 (fun acc x y -> (x,y)::acc) [] (iseq [ 1..3 ]) (iseq [1..2..6])) - - // integer List - let funcInt x y z = x + y + z - let resultInt = ISeq.fold2 funcInt 9 (iseq [ 1..10 ]) (iseq [1..2..20]) - Assert.AreEqual(164, resultInt) - - // string List - let funcStr x y z = x + y + z - let resultStr = ISeq.fold2 funcStr "*" (iseq ["a"; "b"; "c" ; "d" ]) (iseq ["A"; "B"; "C" ; "D" ] ) - Assert.AreEqual("*aAbBcCdD", resultStr) - - // empty List - let emptyArr:int list = [ ] - let resultEpt = ISeq.fold2 funcInt 5 (iseq emptyArr) (iseq emptyArr) - Assert.AreEqual(5, resultEpt) - - Assert.AreEqual(0,ISeq.fold2 funcInt 0 ISeq.empty (iseq [1])) - Assert.AreEqual(-1,ISeq.fold2 funcInt -1 (iseq [1]) ISeq.empty) - - Assert.AreEqual(2,ISeq.fold2 funcInt 0 (iseq [1;2]) (iseq [1])) - Assert.AreEqual(4,ISeq.fold2 funcInt 0 (iseq [1]) (iseq [3;6])) - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 nullSeq (iseq [1]) |> ignore) - //CheckThrowsArgumentNullException (fun () -> ISeq.fold2 funcInt 0 (iseq [1]) nullSeq |> ignore) - () - - [] - member this.FoldBack() = - // int ISeq - let funcInt x y = x-y - let IntSeq = iseq <| seq { 1..4 } - let foldInt = ISeq.foldBack funcInt IntSeq 6 - Assert.AreEqual((1-(2-(3-(4-6)))), foldInt) - - // string ISeq - let funcStr (x:string) (y:string) = y.Remove(0,x.Length) - let strSeq = iseq [ "A"; "B"; "C"; "D" ] - let foldStr = ISeq.foldBack funcStr strSeq "ABCDE" - Assert.AreEqual("E", foldStr) - - // single element - let funcStr2 elem acc = sprintf "%s%s" elem acc - let strSeq2 = iseq [ "A" ] - let foldStr2 = ISeq.foldBack funcStr2 strSeq2 "X" - Assert.AreEqual("AX", foldStr2) - - // Empty ISeq - let emptySeq = ISeq.empty - let foldEmpty = ISeq.foldBack funcInt emptySeq 1 - Assert.AreEqual(1, foldEmpty) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack funcInt nullSeq 1 |> ignore) - - // Validate that foldBack with the cons operator and the empty list returns a copy of the sequence - let cons x y = x :: y - let identityFoldr = ISeq.foldBack cons IntSeq [] - Assert.AreEqual([1;2;3;4], identityFoldr) - - () - - [] - member this.foldBack2() = - // int ISeq - let funcInt x y z = x + y + z - let intSeq = iseq <| seq { 1..10 } - let resultInt = ISeq.foldBack2 funcInt intSeq (iseq <| seq { 1..2..20 }) 9 - Assert.AreEqual(164, resultInt) - - // string ISeq - let funcStr = sprintf "%s%s%s" - let strSeq = iseq [ "A"; "B"; "C"; "D" ] - let resultStr = ISeq.foldBack2 funcStr strSeq (iseq [ "a"; "b"; "c"; "d"]) "*" - Assert.AreEqual("AaBbCcDd*", resultStr) - - // single element - let strSeqSingle = iseq [ "X" ] - Assert.AreEqual("XAZ", ISeq.foldBack2 funcStr strSeqSingle strSeq "Z") - Assert.AreEqual("AXZ", ISeq.foldBack2 funcStr strSeq strSeqSingle "Z") - Assert.AreEqual("XYZ", ISeq.foldBack2 funcStr strSeqSingle (iseq [ "Y" ]) "Z") - - // empty ISeq - let emptySeq = ISeq.empty - Assert.AreEqual(1, ISeq.foldBack2 funcInt emptySeq emptySeq 1) - Assert.AreEqual(1, ISeq.foldBack2 funcInt emptySeq intSeq 1) - Assert.AreEqual(1, ISeq.foldBack2 funcInt intSeq emptySeq 1) - - // infinite ISeq - let infiniteSeq = ISeq.initInfinite (fun i -> 2 * i + 1) - Assert.AreEqual(164, ISeq.foldBack2 funcInt intSeq infiniteSeq 9) - Assert.AreEqual(164, ISeq.foldBack2 funcInt infiniteSeq intSeq 9) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt nullSeq intSeq 1 |> ignore) - //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt intSeq nullSeq 1 |> ignore) - //CheckThrowsArgumentNullException (fun () -> ISeq.foldBack2 funcInt nullSeq nullSeq 1 |> ignore) - - () - - [] - member this.ForAll() = - - let funcInt x = if x%2 = 0 then true else false - let IntSeq = - iseq <| seq { for i in 1..10 do - yield i*2} - let for_allInt = ISeq.forall funcInt IntSeq - - if for_allInt <> true then Assert.Fail() - - - // string ISeq - let funcStr (x:string) = x.Contains("a") - let strSeq = iseq ["a"; "ab"; "abc" ; "abcd"] - let for_allStr = ISeq.forall funcStr strSeq - - if for_allStr <> true then Assert.Fail() - - - // Empty ISeq - let emptySeq = ISeq.empty - let for_allEmpty = ISeq.forall funcInt emptySeq - - if for_allEmpty <> true then Assert.Fail() - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.forall funcInt nullSeq |> ignore) - () - - [] - member this.ForAll2() = - - let funcInt x y = if (x+y)%2 = 0 then true else false - let IntSeq = - iseq <| seq { for i in 1..10 do - yield i} - - let for_all2Int = ISeq.forall2 funcInt IntSeq IntSeq - - if for_all2Int <> true then Assert.Fail() - - // string ISeq - let funcStr (x:string) (y:string) = (x+y).Length = 5 - let strSeq1 = iseq ["a"; "ab"; "abc" ; "abcd"] - let strSeq2 = iseq ["abcd"; "abc"; "ab" ; "a"] - let for_all2Str = ISeq.forall2 funcStr strSeq1 strSeq2 - - if for_all2Str <> true then Assert.Fail() - - // Empty ISeq - let emptySeq = ISeq.empty - let for_all2Empty = ISeq.forall2 funcInt emptySeq emptySeq - - if for_all2Empty <> true then Assert.Fail() - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.forall2 funcInt nullSeq nullSeq |> ignore) - - [] - member this.GroupBy() = - - let funcInt x = x%5 - - let IntSeq = - iseq <| seq { for i in 0 .. 9 do - yield i } - - let group_byInt = ISeq.groupByVal funcInt IntSeq |> ISeq.map (fun (i, v) -> i, ISeq.toList v) - - let expectedIntSeq = - iseq <| seq { for i in 0..4 do - yield i, [i; i+5] } - - VerifySeqsEqual group_byInt expectedIntSeq - - // string ISeq - let funcStr (x:string) = x.Length - let strSeq = iseq ["length7"; "length 8"; "length7" ; "length 9"] - - let group_byStr = ISeq.groupByVal funcStr strSeq |> ISeq.map (fun (i, v) -> i, ISeq.toList v) - let expectedStrSeq = - iseq <| seq { - yield 7, ["length7"; "length7"] - yield 8, ["length 8"] - yield 9, ["length 9"] } - - VerifySeqsEqual expectedStrSeq group_byStr - - // Empty ISeq - let emptySeq = ISeq.empty - let group_byEmpty = ISeq.groupByVal funcInt emptySeq - let expectedEmptySeq = iseq [] - - VerifySeqsEqual expectedEmptySeq group_byEmpty - - //// null ISeq - //let nullSeq:iseq<'a> = null - //let group_byNull = ISeq.groupBy funcInt nullSeq - //CheckThrowsArgumentNullException (fun () -> ISeq.iter (fun _ -> ()) group_byNull) - () - - [] - member this.DisposalOfUnstartedEnumerator() = - let run = ref false - let f() = iseq <| seq { - try - () - finally - run := true - } - - f().GetEnumerator().Dispose() - Assert.IsFalse(!run) - - [] - member this.WeirdLocalNames() = - - let f pc = iseq <| seq { - yield pc - yield (pc+1) - yield (pc+2) - } - - let l = f 3 |> ISeq.toList - Assert.AreEqual([3;4;5], l) - - let f i = iseq <| seq { - let pc = i*2 - yield pc - yield (pc+1) - yield (pc+2) - } - let l = f 3 |> ISeq.toList - Assert.AreEqual([6;7;8], l) - - [] - member this.Contains() = - - // Integer ISeq - let intSeq = iseq <| seq { 0..9 } - - let ifContainsInt = ISeq.contains 5 intSeq - - Assert.IsTrue(ifContainsInt) - - // String ISeq - let strSeq = iseq ["key"; "blank key"] - - let ifContainsStr = ISeq.contains "key" strSeq - - Assert.IsTrue(ifContainsStr) - - // Empty ISeq - let emptySeq = ISeq.empty - let ifContainsEmpty = ISeq.contains 5 emptySeq - - Assert.IsFalse(ifContainsEmpty) - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.contains 5 nullSeq |> ignore) - -#endif \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs deleted file mode 100644 index e7e78342659..00000000000 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqModule2.fs +++ /dev/null @@ -1,1845 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections - -open System -open NUnit.Framework - -open FSharp.Core.Unittests.LibraryTestFx - -#if ISeqIsPublic - -//type iseq<'a> = ISeq.Core.ISeq<'a> - -type ISeqWindowedTestInput<'t> = - { - InputSeq : iseq<'t> - WindowSize : int - ExpectedSeq : iseq<'t[]> - Exception : Type option - } - -[] -type ISeqModule2() = - let iseq (x:seq<_>) = x |> ISeq.ofSeq - - [] - member this.Hd() = - - let IntSeq = - iseq <| seq { for i in 0 .. 9 do - yield i } - - if ISeq.head IntSeq <> 0 then Assert.Fail() - - // string ISeq - let strSeq = iseq ["first"; "second"; "third"] - if ISeq.head strSeq <> "first" then Assert.Fail() - - // Empty ISeq - let emptySeq = ISeq.empty - CheckThrowsArgumentException ( fun() -> ISeq.head emptySeq) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.head nullSeq) - () - - [] - member this.TryHead() = - // int ISeq - let IntSeq = - iseq <| seq { for i in 0 .. 9 -> i } - - let intResult = ISeq.tryHead IntSeq - - // string ISeq - let strResult = ISeq.tryHead (iseq ["first"; "second"; "third"]) - Assert.AreEqual("first", strResult.Value) - - // Empty ISeq - let emptyResult = ISeq.tryHead ISeq.empty - Assert.AreEqual(None, emptyResult) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.head nullSeq) - () - - [] - member this.Tl() = - // integer iseq - let resultInt = ISeq.tail <| (iseq <| seq { 1..10 } ) - Assert.AreEqual(Array.ofSeq (iseq <| seq { 2..10 }), Array.ofSeq resultInt) - - // string iseq - let resultStr = ISeq.tail <| (iseq <| seq { yield "a"; yield "b"; yield "c"; yield "d" }) - Assert.AreEqual(Array.ofSeq (iseq <| seq { yield "b"; yield "c" ; yield "d" }), Array.ofSeq resultStr) - - // 1-element iseq - let resultStr2 = ISeq.tail <| (iseq <| seq { yield "a" }) - Assert.AreEqual(Array.ofSeq (ISeq.empty : iseq), Array.ofSeq resultStr2) - - //CheckThrowsArgumentNullException(fun () -> ISeq.tail null |> ignore) - CheckThrowsArgumentException(fun () -> ISeq.tail ISeq.empty |> ISeq.iter (fun _ -> failwith "Should not be reached")) - () - - [] - member this.Last() = - - let IntSeq = - iseq <| seq { for i in 0 .. 9 do - yield i } - - if ISeq.last IntSeq <> 9 then Assert.Fail() - - // string ISeq - let strSeq = iseq ["first"; "second"; "third"] - if ISeq.last strSeq <> "third" then Assert.Fail() - - // Empty ISeq - let emptySeq = ISeq.empty - CheckThrowsArgumentException ( fun() -> ISeq.last emptySeq) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.last nullSeq) - () - - [] - member this.TryLast() = - - let IntSeq = - iseq <| seq { for i in 0 .. 9 -> i } - - let intResult = ISeq.tryLast IntSeq - Assert.AreEqual(9, intResult.Value) - - // string ISeq - let strResult = ISeq.tryLast (iseq ["first"; "second"; "third"]) - Assert.AreEqual("third", strResult.Value) - - // Empty ISeq - let emptyResult = ISeq.tryLast ISeq.empty - Assert.IsTrue(emptyResult.IsNone) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.tryLast nullSeq |> ignore) - () - - [] - member this.ExactlyOne() = - - let IntSeq = - iseq <| seq { for i in 7 .. 7 do - yield i } - - if ISeq.exactlyOne IntSeq <> 7 then Assert.Fail() - - // string ISeq - let strSeq = iseq ["second"] - if ISeq.exactlyOne strSeq <> "second" then Assert.Fail() - - // Empty ISeq - let emptySeq = ISeq.empty - CheckThrowsArgumentException ( fun() -> ISeq.exactlyOne emptySeq) - - // non-singleton ISeq - let emptySeq = ISeq.empty - CheckThrowsArgumentException ( fun() -> ISeq.exactlyOne (iseq [ 0 .. 1 ]) |> ignore ) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.exactlyOne nullSeq) - () - - - [] - member this.Init() = - - let funcInt x = x - let init_finiteInt = ISeq.init 9 funcInt - let expectedIntSeq = iseq [ 0..8] - - VerifySeqsEqual expectedIntSeq init_finiteInt - - - // string ISeq - let funcStr x = x.ToString() - let init_finiteStr = ISeq.init 5 funcStr - let expectedStrSeq = iseq ["0";"1";"2";"3";"4"] - - VerifySeqsEqual expectedStrSeq init_finiteStr - - // null ISeq - let funcNull x = null - let init_finiteNull = ISeq.init 3 funcNull - let expectedNullSeq = iseq [ null;null;null] - - VerifySeqsEqual expectedNullSeq init_finiteNull - () - - [] - member this.InitInfinite() = - - let funcInt x = x - let init_infiniteInt = ISeq.initInfinite funcInt - let resultint = ISeq.find (fun x -> x =100) init_infiniteInt - - Assert.AreEqual(100,resultint) - - - // string ISeq - let funcStr x = x.ToString() - let init_infiniteStr = ISeq.initInfinite funcStr - let resultstr = ISeq.find (fun x -> x = "100") init_infiniteStr - - Assert.AreEqual("100",resultstr) - - - [] - member this.IsEmpty() = - - //iseq int - let seqint = iseq [1;2;3] - let is_emptyInt = ISeq.isEmpty seqint - - Assert.IsFalse(is_emptyInt) - - //iseq str - let seqStr = iseq["first";"second"] - let is_emptyStr = ISeq.isEmpty seqStr - - Assert.IsFalse(is_emptyInt) - - //iseq empty - let seqEmpty = ISeq.empty - let is_emptyEmpty = ISeq.isEmpty seqEmpty - Assert.IsTrue(is_emptyEmpty) - - ////iseq null - //let seqnull:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.isEmpty seqnull |> ignore) - () - - [] - member this.Iter() = - //iseq int - let seqint = iseq [ 1..3] - let cacheint = ref 0 - - let funcint x = cacheint := !cacheint + x - ISeq.iter funcint seqint - Assert.AreEqual(6,!cacheint) - - //iseq str - let seqStr = iseq ["first";"second"] - let cachestr =ref "" - let funcstr x = cachestr := !cachestr+x - ISeq.iter funcstr seqStr - - Assert.AreEqual("firstsecond",!cachestr) - - // empty array - let emptyseq = ISeq.empty - let resultEpt = ref 0 - ISeq.iter (fun x -> Assert.Fail()) emptyseq - - //// null seqay - //let nullseq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.iter funcint nullseq |> ignore) - () - - [] - member this.Iter2() = - - //iseq int - let seqint = iseq [ 1..3] - let cacheint = ref 0 - - let funcint x y = cacheint := !cacheint + x+y - ISeq.iter2 funcint seqint seqint - Assert.AreEqual(12,!cacheint) - - //iseq str - let seqStr = iseq ["first";"second"] - let cachestr =ref "" - let funcstr x y = cachestr := !cachestr+x+y - ISeq.iter2 funcstr seqStr seqStr - - Assert.AreEqual("firstfirstsecondsecond",!cachestr) - - // empty array - let emptyseq = ISeq.empty - let resultEpt = ref 0 - ISeq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq - - //// null seqay - //let nullseq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.iter2 funcint nullseq nullseq |> ignore) - - () - - [] - member this.Iteri() = - - // iseq int - let seqint = iseq [ 1..10] - let cacheint = ref 0 - - let funcint x y = cacheint := !cacheint + x+y - ISeq.iteri funcint seqint - Assert.AreEqual(100,!cacheint) - - // iseq str - let seqStr = iseq ["first";"second"] - let cachestr =ref 0 - let funcstr (x:int) (y:string) = cachestr := !cachestr+ x + y.Length - ISeq.iteri funcstr seqStr - - Assert.AreEqual(12,!cachestr) - - // empty array - let emptyseq = ISeq.empty - let resultEpt = ref 0 - ISeq.iteri funcint emptyseq - Assert.AreEqual(0,!resultEpt) - - //// null seqay - //let nullseq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.iteri funcint nullseq |> ignore) - () - - [] - member this.Iteri2() = - - //iseq int - let seqint = iseq [ 1..3] - let cacheint = ref 0 - - let funcint x y z = cacheint := !cacheint + x + y + z - ISeq.iteri2 funcint seqint seqint - Assert.AreEqual(15,!cacheint) - - //iseq str - let seqStr = iseq ["first";"second"] - let cachestr = ref 0 - let funcstr (x:int) (y:string) (z:string) = cachestr := !cachestr + x + y.Length + z.Length - ISeq.iteri2 funcstr seqStr seqStr - - Assert.AreEqual(23,!cachestr) - - // empty iseq - let emptyseq = ISeq.empty - let resultEpt = ref 0 - ISeq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq - - //// null iseq - //let nullseq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.iteri2 funcint nullseq nullseq |> ignore) - - // len1 <> len2 - let shorterSeq = iseq <| seq { 1..3 } - let longerSeq = iseq <| seq { 2..2..100 } - - let testSeqLengths seq1 seq2 = - let cache = ref 0 - let f x y z = cache := !cache + x + y + z - ISeq.iteri2 f seq1 seq2 - !cache - - Assert.AreEqual(21, testSeqLengths shorterSeq longerSeq) - Assert.AreEqual(21, testSeqLengths longerSeq shorterSeq) - - () - - [] - member this.Length() = - - // integer iseq - let resultInt = ISeq.length (iseq {1..8}) - if resultInt <> 8 then Assert.Fail() - - // string ISeq - let resultStr = ISeq.length (iseq ["Lists"; "are"; "commonly" ; "list" ]) - if resultStr <> 4 then Assert.Fail() - - // empty ISeq - let resultEpt = ISeq.length ISeq.empty - if resultEpt <> 0 then Assert.Fail() - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.length nullSeq |> ignore) - - () - - [] - member this.Map() = - - // integer ISeq - let funcInt x = - match x with - | _ when x % 2 = 0 -> 10*x - | _ -> x - - let resultInt = ISeq.map funcInt (iseq { 1..10 }) - let expectedint = iseq [1;20;3;40;5;60;7;80;9;100] - - VerifySeqsEqual expectedint resultInt - - // string ISeq - let funcStr (x:string) = x.ToLower() - let resultStr = ISeq.map funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) - let expectedSeq = iseq ["lists"; "are"; "commonly" ; "list"] - - VerifySeqsEqual expectedSeq resultStr - - // empty ISeq - let resultEpt = ISeq.map funcInt ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.map funcStr nullSeq |> ignore) - - () - - [] - member this.Map2() = - // integer ISeq - let funcInt x y = x+y - let resultInt = ISeq.map2 funcInt (iseq { 1..10 }) (iseq {2..2..20}) - let expectedint = iseq [3;6;9;12;15;18;21;24;27;30] - - VerifySeqsEqual expectedint resultInt - - // string ISeq - let funcStr (x:int) (y:string) = x+y.Length - let resultStr = ISeq.map2 funcStr (iseq[3;6;9;11]) (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) - let expectedSeq = iseq [8;9;17;15] - - VerifySeqsEqual expectedSeq resultStr - - // empty ISeq - let resultEpt = ISeq.map2 funcInt ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //let nullSeq:iseq<'a> = null - //let validSeq = iseq [1] - //CheckThrowsArgumentNullException (fun () -> ISeq.map2 funcInt nullSeq validSeq |> ignore) - - () - - [] - member this.Map3() = - // Integer iseq - let funcInt a b c = (a + b) * c - let resultInt = ISeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..9 }) (iseq { 3..10 }) - let expectedInt = iseq [9; 20; 35; 54; 77; 104; 135; 170] - VerifySeqsEqual expectedInt resultInt - - // First iseq is shorter - VerifySeqsEqual (iseq [9; 20]) (ISeq.map3 funcInt (iseq { 1..2 }) (iseq { 2..9 }) (iseq { 3..10 })) - // Second iseq is shorter - VerifySeqsEqual (iseq [9; 20; 35]) (ISeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..4 }) (iseq { 3..10 })) - // Third iseq is shorter - VerifySeqsEqual (iseq [9; 20; 35; 54]) (ISeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..6 }) (iseq { 3..6 })) - - // String iseq - let funcStr a b c = a + b + c - let resultStr = ISeq.map3 funcStr (iseq ["A";"B";"C";"D"]) (iseq ["a";"b";"c";"d"]) (iseq ["1";"2";"3";"4"]) - let expectedStr = iseq ["Aa1";"Bb2";"Cc3";"Dd4"] - VerifySeqsEqual expectedStr resultStr - - // Empty iseq - let resultEmpty = ISeq.map3 funcStr ISeq.empty ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty resultEmpty - - //// Null iseq - //let nullSeq = null : iseq<_> - //let nonNullSeq = iseq [1] - //CheckThrowsArgumentNullException (fun () -> ISeq.map3 funcInt nullSeq nonNullSeq nullSeq |> ignore) - - () - - [] - member this.MapFold() = - // integer ISeq - let funcInt acc x = if x % 2 = 0 then 10*x, acc + 1 else x, acc - let resultInt,resultIntAcc = ISeq.mapFold funcInt 100 <| (iseq <| seq { 1..10 }) - VerifySeqsEqual (iseq [ 1;20;3;40;5;60;7;80;9;100 ]) resultInt - Assert.AreEqual(105, resultIntAcc) - - // string ISeq - let funcStr acc (x:string) = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x - let resultStr,resultStrAcc = ISeq.mapFold funcStr "" <| iseq [ "";"BB";"C";"" ] - VerifySeqsEqual (iseq [ "empty";"bb";"c";"empty" ]) resultStr - Assert.AreEqual("BBC", resultStrAcc) - - // empty ISeq - let resultEpt,resultEptAcc = ISeq.mapFold funcInt 100 ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - Assert.AreEqual(100, resultEptAcc) - - //// null ISeq - //let nullArr = null:iseq - //CheckThrowsArgumentNullException (fun () -> ISeq.mapFold funcStr "" nullArr |> ignore) - - () - - [] - member this.MapFoldBack() = - // integer ISeq - let funcInt x acc = if acc < 105 then 10*x, acc + 2 else x, acc - let resultInt,resultIntAcc = ISeq.mapFoldBack funcInt (iseq <| seq { 1..10 }) 100 - VerifySeqsEqual (iseq [ 1;2;3;4;5;6;7;80;90;100 ]) resultInt - Assert.AreEqual(106, resultIntAcc) - - // string ISeq - let funcStr (x:string) acc = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x - let resultStr,resultStrAcc = ISeq.mapFoldBack funcStr (iseq [ "";"BB";"C";"" ]) "" - VerifySeqsEqual (iseq [ "empty";"bb";"c";"empty" ]) resultStr - Assert.AreEqual("CBB", resultStrAcc) - - // empty ISeq - let resultEpt,resultEptAcc = ISeq.mapFoldBack funcInt ISeq.empty 100 - VerifySeqsEqual ISeq.empty resultEpt - Assert.AreEqual(100, resultEptAcc) - - //// null ISeq - //let nullArr = null:iseq - //CheckThrowsArgumentNullException (fun () -> ISeq.mapFoldBack funcStr nullArr "" |> ignore) - - () - - member private this.MapWithSideEffectsTester (map : (int -> int) -> iseq -> iseq) expectExceptions = - let i = ref 0 - let f x = i := !i + 1; x*x - let e = ((iseq [1;2]) |> map f).GetEnumerator() - - if expectExceptions then - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(0, !i) - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(2, !i) - if expectExceptions then - CheckThrowsInvalidOperationExn (fun _ -> e.Current |> ignore) - Assert.AreEqual(2, !i) - - - i := 0 - let e = ((iseq []) |> map f).GetEnumerator() - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - - - member private this.MapWithExceptionTester (map : (int -> int) -> iseq -> iseq) = - let raiser x = if x > 0 then raise(NotSupportedException()) else x - let e = (map raiser (iseq [0; 1])).GetEnumerator() - Assert.IsTrue(e.MoveNext()) // should not throw - Assert.AreEqual(0, e.Current) - CheckThrowsNotSupportedException(fun _ -> e.MoveNext() |> ignore) - Assert.AreEqual(0, e.Current) // should not throw - - [] - member this.MapWithSideEffects () = - this.MapWithSideEffectsTester ISeq.map true - - [] - member this.MapWithException () = - this.MapWithExceptionTester ISeq.map - - - [] - member this.SingletonCollectWithSideEffects () = - this.MapWithSideEffectsTester (fun f-> ISeq.collect (f >> ISeq.singleton)) true - - [] - member this.SingletonCollectWithException () = - this.MapWithExceptionTester (fun f-> ISeq.collect (f >> ISeq.singleton)) - -#if !FX_NO_LINQ - [] - member this.SystemLinqSelectWithSideEffects () = - this.MapWithSideEffectsTester (fun f s -> iseq <| System.Linq.Enumerable.Select(s, Func<_,_>(f))) false - - [] - member this.SystemLinqSelectWithException () = - this.MapWithExceptionTester (fun f s -> iseq <| System.Linq.Enumerable.Select(s, Func<_,_>(f))) -#endif - - [] - member this.MapiWithSideEffects () = - let i = ref 0 - let f _ x = i := !i + 1; x*x - let e = ((iseq [1;2]) |> ISeq.mapi f).GetEnumerator() - - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(0, !i) - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(2, !i) - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(2, !i) - - i := 0 - let e = ((iseq []) |> ISeq.mapi f).GetEnumerator() - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - - [] - member this.Map2WithSideEffects () = - let i = ref 0 - let f x y = i := !i + 1; x*x - let e = (ISeq.map2 f (iseq [1;2]) (iseq [1;2])).GetEnumerator() - - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(0, !i) - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(2,!i) - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(2, !i) - - i := 0 - let e = (ISeq.map2 f (iseq []) (iseq [])).GetEnumerator() - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - - [] - member this.Mapi2WithSideEffects () = - let i = ref 0 - let f _ x y = i := !i + 1; x*x - let e = (ISeq.mapi2 f (iseq [1;2]) (iseq [1;2])).GetEnumerator() - - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(0, !i) - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - let _ = e.Current - Assert.AreEqual(1, !i) - - if not (e.MoveNext()) then Assert.Fail() - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - let _ = e.Current - Assert.AreEqual(2, !i) - - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(2,!i) - CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) - Assert.AreEqual(2, !i) - - i := 0 - let e = (ISeq.mapi2 f (iseq []) (iseq [])).GetEnumerator() - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - if e.MoveNext() then Assert.Fail() - Assert.AreEqual(0,!i) - - [] - member this.Collect() = - // integer ISeq - let funcInt x = iseq [x+1] - let resultInt = ISeq.collect funcInt (iseq { 1..10 }) - - let expectedint = iseq <| seq {2..11} - - VerifySeqsEqual expectedint resultInt - -//#if !FX_NO_CHAR_PARSE -// // string ISeq -// let funcStr (y:string) = y+"ist" - -// let resultStr = ISeq.collect funcStr (iseq ["L"]) - - -// let expectedSeq = iseq ['L';'i';'s';'t'] - -// VerifySeqsEqual expectedSeq resultStr -//#endif - // empty ISeq - let resultEpt = ISeq.collect funcInt ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.collect funcInt nullSeq |> ignore) - - () - - [] - member this.Mapi() = - - // integer ISeq - let funcInt x y = x+y - let resultInt = ISeq.mapi funcInt (iseq { 10..2..20 } ) - let expectedint = iseq [10;13;16;19;22;25] - - VerifySeqsEqual expectedint resultInt - - // string ISeq - let funcStr (x:int) (y:string) =x+y.Length - - let resultStr = ISeq.mapi funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) - let expectedStr = iseq [5;4;10;7] - - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.mapi funcInt ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //let nullSeq:iseq<'a> = null - - //CheckThrowsArgumentNullException (fun () -> ISeq.mapi funcInt nullSeq |> ignore) - - () - - [] - member this.Mapi2() = - // integer ISeq - let funcInt x y z = x+y+z - let resultInt = ISeq.mapi2 funcInt (iseq { 1..10 }) (iseq {2..2..20}) - let expectedint = iseq [3;7;11;15;19;23;27;31;35;39] - - VerifySeqsEqual expectedint resultInt - - // string ISeq - let funcStr (x:int) (y:int) (z:string) = x+y+z.Length - let resultStr = ISeq.mapi2 funcStr (iseq[3;6;9;11]) (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) - let expectedSeq = iseq [8;10;19;18] - - VerifySeqsEqual expectedSeq resultStr - - // empty ISeq - let resultEpt = ISeq.mapi2 funcInt ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //let nullSeq:iseq<'a> = null - //let validSeq = iseq [1] - //CheckThrowsArgumentNullException (fun () -> ISeq.mapi2 funcInt nullSeq validSeq |> ignore) - - // len1 <> len2 - let shorterSeq = iseq <| seq { 1..10 } - let longerSeq = iseq <| seq { 2..20 } - - let testSeqLengths seq1 seq2 = - let f x y z = x + y + z - ISeq.mapi2 f seq1 seq2 - - VerifySeqsEqual (iseq [3;6;9;12;15;18;21;24;27;30]) (testSeqLengths shorterSeq longerSeq) - VerifySeqsEqual (iseq [3;6;9;12;15;18;21;24;27;30]) (testSeqLengths longerSeq shorterSeq) - - [] - member this.Indexed() = - - // integer ISeq - let resultInt = ISeq.indexed (iseq { 10..2..20 }) - let expectedint = iseq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)] - - VerifySeqsEqual expectedint resultInt - - // string ISeq - let resultStr = ISeq.indexed (iseq ["Lists"; "Are"; "Commonly"; "List" ]) - let expectedStr = iseq [(0,"Lists");(1,"Are");(2,"Commonly");(3,"List")] - - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.indexed ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.indexed nullSeq |> ignore) - - () - - [] - member this.Max() = - // integer ISeq - let resultInt = ISeq.max (iseq { 10..20 } ) - - Assert.AreEqual(20,resultInt) - - // string ISeq - - let resultStr = ISeq.max (iseq ["Lists"; "Are"; "MaxString" ; "List" ]) - Assert.AreEqual("MaxString",resultStr) - - // empty ISeq - CheckThrowsArgumentException(fun () -> ISeq.max ( ISeq.empty : iseq) |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.max nullSeq |> ignore) - - () - - [] - member this.MaxBy() = - - // integer ISeq - let funcInt x = x % 8 - let resultInt = ISeq.maxBy funcInt (iseq { 2..2..20 } ) - Assert.AreEqual(6,resultInt) - - // string ISeq - let funcStr (x:string) =x.Length - let resultStr = ISeq.maxBy funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) - Assert.AreEqual("Commonly",resultStr) - - // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.maxBy funcInt (ISeq.empty : iseq) |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.maxBy funcInt nullSeq |> ignore) - - () - - [] - member this.MinBy() = - - // integer ISeq - let funcInt x = x % 8 - let resultInt = ISeq.minBy funcInt (iseq { 2..2..20 } ) - Assert.AreEqual(8,resultInt) - - // string ISeq - let funcStr (x:string) =x.Length - let resultStr = ISeq.minBy funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) - Assert.AreEqual("Are",resultStr) - - // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.minBy funcInt (ISeq.empty : iseq) |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.minBy funcInt nullSeq |> ignore) - - () - - - [] - member this.Min() = - - // integer ISeq - let resultInt = ISeq.min (iseq { 10..20 } ) - Assert.AreEqual(10,resultInt) - - // string ISeq - let resultStr = ISeq.min (iseq ["Lists"; "Are"; "minString" ; "List" ]) - Assert.AreEqual("Are",resultStr) - - // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.min (ISeq.empty : iseq) |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.min nullSeq |> ignore) - - () - - [] - member this.Item() = - // integer ISeq - let resultInt = ISeq.item 3 (iseq { 10..20 }) - Assert.AreEqual(13, resultInt) - - // string ISeq - let resultStr = ISeq.item 2 (iseq ["Lists"; "Are"; "Cool" ; "List" ]) - Assert.AreEqual("Cool", resultStr) - - // empty ISeq - CheckThrowsArgumentException(fun () -> ISeq.item 0 (ISeq.empty : iseq) |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () ->ISeq.item 3 nullSeq |> ignore) - - // Negative index - for i = -1 downto -10 do - CheckThrowsArgumentException (fun () -> ISeq.item i (iseq { 10 .. 20 }) |> ignore) - - // Out of range - for i = 11 to 20 do - CheckThrowsArgumentException (fun () -> ISeq.item i (iseq { 10 .. 20 }) |> ignore) - - [] - member this.``item should fail with correct number of missing elements``() = - try - ISeq.item 0 (iseq (Array.zeroCreate 0)) |> ignore - failwith "error expected" - with - | exn when exn.Message.Contains("seq was short by 1 element") -> () - - try - ISeq.item 2 (iseq (Array.zeroCreate 0)) |> ignore - failwith "error expected" - with - | exn when exn.Message.Contains("seq was short by 3 elements") -> () - - [] - member this.Of_Array() = - // integer ISeq - let resultInt = ISeq.ofArray [|1..10|] - let expectedInt = {1..10} - - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr = ISeq.ofArray [|"Lists"; "Are"; "ofArrayString" ; "List" |] - let expectedStr = iseq ["Lists"; "Are"; "ofArrayString" ; "List" ] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.ofArray [| |] - VerifySeqsEqual resultEpt ISeq.empty - - () - - [] - member this.Of_List() = - // integer ISeq - let resultInt = ISeq.ofList [1..10] - let expectedInt = {1..10} - - VerifySeqsEqual expectedInt resultInt - - // string ISeq - - let resultStr =ISeq.ofList ["Lists"; "Are"; "ofListString" ; "List" ] - let expectedStr = iseq ["Lists"; "Are"; "ofListString" ; "List" ] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.ofList [] - VerifySeqsEqual resultEpt ISeq.empty - () - - - [] - member this.Pairwise() = - // integer ISeq - let resultInt = ISeq.pairwise (iseq {1..3}) - - let expectedInt = iseq [1,2;2,3] - - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr =ISeq.pairwise (iseq ["str1"; "str2";"str3" ]) - let expectedStr = iseq ["str1","str2";"str2","str3"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.pairwise (iseq [] ) - VerifySeqsEqual resultEpt ISeq.empty - - () - - [] - member this.Reduce() = - - // integer ISeq - let resultInt = ISeq.reduce (fun x y -> x/y) (iseq [5*4*3*2; 4;3;2;1]) - Assert.AreEqual(5,resultInt) - - // string ISeq - let resultStr = ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) (iseq ["ABCDE";"A"; "B"; "C" ; "D" ]) - Assert.AreEqual("E",resultStr) - - // empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.reduce (fun x y -> x/y) ISeq.empty |> ignore) - - //// null ISeq - //let nullSeq : iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullSeq |> ignore) - () - - [] - member this.ReduceBack() = - // int ISeq - let funcInt x y = x - y - let IntSeq = iseq <| seq { 1..4 } - let reduceInt = ISeq.reduceBack funcInt IntSeq - Assert.AreEqual((1-(2-(3-4))), reduceInt) - - // string ISeq - let funcStr (x:string) (y:string) = y.Remove(0,x.Length) - let strSeq = iseq [ "A"; "B"; "C"; "D" ; "ABCDE" ] - let reduceStr = ISeq.reduceBack funcStr strSeq - Assert.AreEqual("E", reduceStr) - - // string ISeq - let funcStr2 elem acc = sprintf "%s%s" elem acc - let strSeq2 = iseq [ "A" ] - let reduceStr2 = ISeq.reduceBack funcStr2 strSeq2 - Assert.AreEqual("A", reduceStr2) - - // Empty ISeq - CheckThrowsArgumentException (fun () -> ISeq.reduceBack funcInt ISeq.empty |> ignore) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.reduceBack funcInt nullSeq |> ignore) - - () - - [] - member this.Rev() = - // integer ISeq - let resultInt = ISeq.rev (iseq [5;4;3;2;1]) - VerifySeqsEqual (iseq[1;2;3;4;5]) resultInt - - // string ISeq - let resultStr = ISeq.rev (iseq ["A"; "B"; "C" ; "D" ]) - VerifySeqsEqual (iseq["D";"C";"B";"A"]) resultStr - - // empty ISeq - VerifySeqsEqual ISeq.empty (ISeq.rev ISeq.empty) - - //// null ISeq - //let nullSeq : iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.rev nullSeq |> ignore) - () - - [] - member this.Scan() = - // integer ISeq - let funcInt x y = x+y - let resultInt = ISeq.scan funcInt 9 (iseq {1..10}) - let expectedInt = iseq [9;10;12;15;19;24;30;37;45;54;64] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let funcStr x y = x+y - let resultStr =ISeq.scan funcStr "x" (iseq ["str1"; "str2";"str3" ]) - - let expectedStr = iseq ["x";"xstr1"; "xstr1str2";"xstr1str2str3"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.scan funcInt 5 ISeq.empty - - VerifySeqsEqual resultEpt (iseq [ 5]) - - //// null ISeq - //let seqNull:iseq<'a> = null - //CheckThrowsArgumentNullException(fun() -> ISeq.scan funcInt 5 seqNull |> ignore) - () - - [] - member this.ScanBack() = - // integer ISeq - let funcInt x y = x+y - let resultInt = ISeq.scanBack funcInt (iseq { 1..10 }) 9 - let expectedInt = iseq [64;63;61;58;54;49;43;36;28;19;9] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let funcStr x y = x+y - let resultStr = ISeq.scanBack funcStr (iseq ["A";"B";"C";"D"]) "X" - let expectedStr = iseq ["ABCDX";"BCDX";"CDX";"DX";"X"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.scanBack funcInt ISeq.empty 5 - let expectedEpt = iseq [5] - VerifySeqsEqual expectedEpt resultEpt - - //// null ISeq - //let seqNull:iseq<'a> = null - //CheckThrowsArgumentNullException(fun() -> ISeq.scanBack funcInt seqNull 5 |> ignore) - - // exception cases - let funcEx x (s:'State) = raise <| new System.FormatException() : 'State - // calling scanBack with funcEx does not throw - let resultEx = ISeq.scanBack funcEx (iseq <| seq {1..10}) 0 - // reading from resultEx throws - CheckThrowsFormatException(fun() -> ISeq.head resultEx |> ignore) - - // Result consumes entire input sequence as soon as it is accesses an element - let i = ref 0 - let funcState x s = (i := !i + x); x+s - let resultState = ISeq.scanBack funcState (iseq <| seq {1..3}) 0 - Assert.AreEqual(0, !i) - use e = resultState.GetEnumerator() - Assert.AreEqual(6, !i) - - () - - [] - member this.Singleton() = - // integer ISeq - let resultInt = ISeq.singleton 1 - - let expectedInt = iseq [1] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr =ISeq.singleton "str1" - let expectedStr = iseq ["str1"] - VerifySeqsEqual expectedStr resultStr - - // null ISeq - let resultNull = ISeq.singleton null - let expectedNull = iseq [null] - VerifySeqsEqual expectedNull resultNull - () - - - [] - member this.Skip() = - - // integer ISeq - let resultInt = ISeq.skip 2 (iseq [1;2;3;4]) - let expectedInt = iseq [3;4] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr =ISeq.skip 2 (iseq ["str1";"str2";"str3";"str4"]) - let expectedStr = iseq ["str3";"str4"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.skip 0 ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.skip 1 null |> ignore) - () - - [] - member this.Skip_While() = - - // integer ISeq - let funcInt x = (x < 3) - let resultInt = ISeq.skipWhile funcInt (iseq [1;2;3;4;5;6]) - let expectedInt = iseq [3;4;5;6] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let funcStr (x:string) = x.Contains(".") - let resultStr =ISeq.skipWhile funcStr (iseq [".";"asdfasdf.asdfasdf";"";"";"";"";"";"";"";"";""]) - let expectedStr = iseq ["";"";"";"";"";"";"";"";""] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.skipWhile funcInt ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.skipWhile funcInt null |> ignore) - () - - [] - member this.Sort() = - - // integer ISeq - let resultInt = ISeq.sort (iseq [1;3;2;4;6;5;7]) - let expectedInt = {1..7} - VerifySeqsEqual expectedInt resultInt - - // string ISeq - - let resultStr =ISeq.sort (iseq ["str1";"str3";"str2";"str4"]) - let expectedStr = iseq ["str1";"str2";"str3";"str4"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.sort ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.sort null |> ignore) - () - - [] - member this.SortBy() = - - // integer ISeq - let funcInt x = Math.Abs(x-5) - let resultInt = ISeq.sortBy funcInt (iseq [1;2;4;5;7]) - let expectedInt = iseq [5;4;7;2;1] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let funcStr (x:string) = x.IndexOf("key") - let resultStr =ISeq.sortBy funcStr (iseq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) - - let expectedStr = iseq ["(key)str";"s(key)tr";"st(key)r";"str(key)"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.sortBy funcInt ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.sortBy funcInt null |> ignore) - () - - [] - member this.SortDescending() = - - // integer ISeq - let resultInt = ISeq.sortDescending (iseq [1;3;2;Int32.MaxValue;4;6;Int32.MinValue;5;7;0]) - let expectedInt = iseq <| seq { - yield Int32.MaxValue; - yield! iseq{ 7..-1..0 } - yield Int32.MinValue - } - VerifySeqsEqual expectedInt resultInt - - // string ISeq - - let resultStr = ISeq.sortDescending (iseq ["str1";null;"str3";"";"Str1";"str2";"str4"]) - let expectedStr = iseq ["str4";"str3";"str2";"str1";"Str1";"";null] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.sortDescending ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - // tuple ISeq - let tupSeq = (iseq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) - let resultTup = ISeq.sortDescending tupSeq - let expectedTup = (iseq[(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) - VerifySeqsEqual expectedTup resultTup - - // float ISeq - let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon - let floatSeq = iseq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] - let resultFloat = ISeq.sortDescending floatSeq - let expectedFloat = iseq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] - VerifySeqsEqual expectedFloat resultFloat - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.sort null |> ignore) - () - - [] - member this.SortByDescending() = - - // integer ISeq - let funcInt x = Math.Abs(x-5) - let resultInt = ISeq.sortByDescending funcInt (iseq [1;2;4;5;7]) - let expectedInt = iseq [1;2;7;4;5] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let funcStr (x:string) = x.IndexOf("key") - let resultStr =ISeq.sortByDescending funcStr (iseq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) - - let expectedStr = iseq ["str(key)";"st(key)r";"s(key)tr";"(key)str"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.sortByDescending funcInt ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - // tuple ISeq - let tupSeq = (iseq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) - let resultTup = ISeq.sortByDescending snd tupSeq - let expectedTup = (iseq[(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")]) - VerifySeqsEqual expectedTup resultTup - - // float ISeq - let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon - let floatSeq = iseq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] - let resultFloat = ISeq.sortByDescending id floatSeq - let expectedFloat = iseq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] - VerifySeqsEqual expectedFloat resultFloat - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.sortByDescending funcInt null |> ignore) - () - - member this.SortWith() = - - // integer ISeq - let intComparer a b = compare (a%3) (b%3) - let resultInt = ISeq.sortWith intComparer (iseq <| seq {0..10}) - let expectedInt = iseq [0;3;6;9;1;4;7;10;2;5;8] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr = ISeq.sortWith compare (iseq ["str1";"str3";"str2";"str4"]) - let expectedStr = iseq ["str1";"str2";"str3";"str4"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.sortWith intComparer ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.sortWith intComparer null |> ignore) - - () - - [] - member this.Sum() = - - // integer ISeq - let resultInt = ISeq.sum (iseq [1..10]) - Assert.AreEqual(55,resultInt) - - // float32 ISeq - let floatSeq = (iseq [ 1.2f;3.5f;6.7f ]) - let resultFloat = ISeq.sum floatSeq - if resultFloat <> 11.4f then Assert.Fail() - - // double ISeq - let doubleSeq = (iseq [ 1.0;8.0 ]) - let resultDouble = ISeq.sum doubleSeq - if resultDouble <> 9.0 then Assert.Fail() - - // decimal ISeq - let decimalSeq = (iseq [ 0M;19M;19.03M ]) - let resultDecimal = ISeq.sum decimalSeq - if resultDecimal <> 38.03M then Assert.Fail() - - - // empty float32 ISeq - let emptyFloatSeq = ISeq.empty - let resultEptFloat = ISeq.sum emptyFloatSeq - if resultEptFloat <> 0.0f then Assert.Fail() - - // empty double ISeq - let emptyDoubleSeq = ISeq.empty - let resultDouEmp = ISeq.sum emptyDoubleSeq - if resultDouEmp <> 0.0 then Assert.Fail() - - // empty decimal ISeq - let emptyDecimalSeq = ISeq.empty - let resultDecEmp = ISeq.sum emptyDecimalSeq - if resultDecEmp <> 0M then Assert.Fail() - - () - - [] - member this.SumBy() = - - // integer ISeq - let resultInt = ISeq.sumBy int (iseq [1..10]) - Assert.AreEqual(55,resultInt) - - // float32 ISeq - let floatSeq = (iseq [ 1.2f;3.5f;6.7f ]) - let resultFloat = ISeq.sumBy float32 floatSeq - if resultFloat <> 11.4f then Assert.Fail() - - // double ISeq - let doubleSeq = (iseq [ 1.0;8.0 ]) - let resultDouble = ISeq.sumBy double doubleSeq - if resultDouble <> 9.0 then Assert.Fail() - - // decimal ISeq - let decimalSeq = (iseq [ 0M;19M;19.03M ]) - let resultDecimal = ISeq.sumBy decimal decimalSeq - if resultDecimal <> 38.03M then Assert.Fail() - - // empty float32 ISeq - let emptyFloatSeq = ISeq.empty - let resultEptFloat = ISeq.sumBy float32 emptyFloatSeq - if resultEptFloat <> 0.0f then Assert.Fail() - - // empty double ISeq - let emptyDoubleSeq = ISeq.empty - let resultDouEmp = ISeq.sumBy double emptyDoubleSeq - if resultDouEmp <> 0.0 then Assert.Fail() - - // empty decimal ISeq - let emptyDecimalSeq = ISeq.empty - let resultDecEmp = ISeq.sumBy decimal emptyDecimalSeq - if resultDecEmp <> 0M then Assert.Fail() - - () - - [] - member this.Take() = - // integer ISeq - - let resultInt = ISeq.take 3 (iseq [1;2;4;5;7]) - - let expectedInt = iseq [1;2;4] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - - let resultStr =ISeq.take 2(iseq ["str1";"str2";"str3";"str4"]) - - let expectedStr = iseq ["str1";"str2"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.take 0 ISeq.empty - - VerifySeqsEqual resultEpt ISeq.empty - - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.take 1 null |> ignore) - () - - [] - member this.takeWhile() = - // integer ISeq - let funcInt x = (x < 6) - let resultInt = ISeq.takeWhile funcInt (iseq [1;2;4;5;6;7]) - - let expectedInt = iseq [1;2;4;5] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let funcStr (x:string) = (x.Length < 4) - let resultStr =ISeq.takeWhile funcStr (iseq ["a"; "ab"; "abc"; "abcd"; "abcde"]) - - let expectedStr = iseq ["a"; "ab"; "abc"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.takeWhile funcInt ISeq.empty - VerifySeqsEqual resultEpt ISeq.empty - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.takeWhile funcInt null |> ignore) - () - - [] - member this.ToArray() = - // integer ISeq - let resultInt = ISeq.toArray(iseq [1;2;4;5;7]) - - let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) - - // string ISeq - let resultStr =ISeq.toArray (iseq ["str1";"str2";"str3"]) - - let expectedStr = [|"str1";"str2";"str3"|] - Assert.AreEqual(expectedStr,resultStr) - - // empty ISeq - let resultEpt = ISeq.toArray ISeq.empty - Assert.AreEqual([||],resultEpt) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.toArray null |> ignore) - () - - [] - member this.ToArrayFromICollection() = - let inputCollection = ResizeArray(iseq [1;2;4;5;7]) - let resultInt = ISeq.toArray((iseq inputCollection)) - let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) - - [] - member this.ToArrayEmptyInput() = - let resultInt = ISeq.toArray(ISeq.empty) - let expectedInt = Array.empty - Assert.AreEqual(expectedInt,resultInt) - - [] - member this.ToArrayFromArray() = - let resultInt = ISeq.toArray((iseq [|1;2;4;5;7|])) - let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) - - [] - member this.ToArrayFromList() = - let resultInt = ISeq.toArray((iseq [1;2;4;5;7])) - let expectedInt = [|1;2;4;5;7|] - Assert.AreEqual(expectedInt,resultInt) - - [] - member this.ToList() = - // integer ISeq - let resultInt = ISeq.toList (iseq [1;2;4;5;7]) - let expectedInt = [1;2;4;5;7] - Assert.AreEqual(expectedInt,resultInt) - - // string ISeq - let resultStr =ISeq.toList (iseq ["str1";"str2";"str3"]) - let expectedStr = ["str1";"str2";"str3"] - Assert.AreEqual(expectedStr,resultStr) - - // empty ISeq - let resultEpt = ISeq.toList ISeq.empty - Assert.AreEqual([],resultEpt) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.toList null |> ignore) - () - - [] - member this.Truncate() = - // integer ISeq - let resultInt = ISeq.truncate 3 (iseq [1;2;4;5;7]) - let expectedInt = [1;2;4] - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr =ISeq.truncate 2 (iseq ["str1";"str2";"str3"]) - let expectedStr = ["str1";"str2"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.truncate 0 ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.truncate 1 null |> ignore) - - // negative count - VerifySeqsEqual ISeq.empty <| ISeq.truncate -1 (iseq [1;2;4;5;7]) - VerifySeqsEqual ISeq.empty <| ISeq.truncate System.Int32.MinValue (iseq [1;2;4;5;7]) - - () - - [] - member this.tryFind() = - // integer ISeq - let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (iseq [1;2;4;5;7]) - Assert.AreEqual(Some(2), resultInt) - - // integer ISeq - None - let resultInt = ISeq.tryFind (fun x -> (x%2=0)) (iseq [1;3;5;7]) - Assert.AreEqual(None, resultInt) - - // string ISeq - let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str2";"str3"]) - Assert.AreEqual(Some("str2"),resultStr) - - // string ISeq - None - let resultStr = ISeq.tryFind (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str4";"str3"]) - Assert.AreEqual(None,resultStr) - - - // empty ISeq - let resultEpt = ISeq.tryFind (fun x -> (x%2=0)) ISeq.empty - Assert.AreEqual(None,resultEpt) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.tryFind (fun x -> (x%2=0)) null |> ignore) - () - - [] - member this.TryFindBack() = - // integer ISeq - let resultInt = ISeq.tryFindBack (fun x -> (x%2=0)) (iseq [1;2;4;5;7]) - Assert.AreEqual(Some 4, resultInt) - - // integer ISeq - None - let resultInt = ISeq.tryFindBack (fun x -> (x%2=0)) (iseq [1;3;5;7]) - Assert.AreEqual(None, resultInt) - - // string ISeq - let resultStr = ISeq.tryFindBack (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str2";"str2x";"str3"]) - Assert.AreEqual(Some "str2x", resultStr) - - // string ISeq - None - let resultStr = ISeq.tryFindBack (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str4";"str3"]) - Assert.AreEqual(None, resultStr) - - // empty ISeq - let resultEpt = ISeq.tryFindBack (fun x -> (x%2=0)) ISeq.empty - Assert.AreEqual(None, resultEpt) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.tryFindBack (fun x -> (x%2=0)) null |> ignore) - () - - [] - member this.TryFindIndex() = - - // integer ISeq - let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) (iseq [8; 9; 10]) - Assert.AreEqual(Some(2), resultInt) - - // integer ISeq - None - let resultInt = ISeq.tryFindIndex (fun x -> (x % 5 = 0)) (iseq [9;3;11]) - Assert.AreEqual(None, resultInt) - - // string ISeq - let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str2"; "str3"]) - Assert.AreEqual(Some(1),resultStr) - - // string ISeq - None - let resultStr = ISeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str4"; "str3"]) - Assert.AreEqual(None,resultStr) - - - // empty ISeq - let resultEpt = ISeq.tryFindIndex (fun x -> (x%2=0)) ISeq.empty - Assert.AreEqual(None, resultEpt) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.tryFindIndex (fun x -> (x % 2 = 0)) null |> ignore) - () - - [] - member this.TryFindIndexBack() = - - // integer ISeq - let resultInt = ISeq.tryFindIndexBack (fun x -> (x % 5 = 0)) (iseq [5; 9; 10; 12]) - Assert.AreEqual(Some(2), resultInt) - - // integer ISeq - None - let resultInt = ISeq.tryFindIndexBack (fun x -> (x % 5 = 0)) (iseq [9;3;11]) - Assert.AreEqual(None, resultInt) - - // string ISeq - let resultStr = ISeq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str2"; "str2x"; "str3"]) - Assert.AreEqual(Some(2), resultStr) - - // string ISeq - None - let resultStr = ISeq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str4"; "str3"]) - Assert.AreEqual(None, resultStr) - - // empty ISeq - let resultEpt = ISeq.tryFindIndexBack (fun x -> (x%2=0)) ISeq.empty - Assert.AreEqual(None, resultEpt) - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.tryFindIndexBack (fun x -> (x % 2 = 0)) null |> ignore) - () - - [] - member this.Unfold() = - // integer ISeq - - let resultInt = ISeq.unfold (fun x -> if x = 1 then Some(7,2) else None) 1 - - VerifySeqsEqual (iseq [7]) resultInt - - // string ISeq - let resultStr =ISeq.unfold (fun (x:string) -> if x.Contains("unfold") then Some("a","b") else None) "unfold" - VerifySeqsEqual (iseq ["a"]) resultStr - () - - - [] - member this.Windowed() = - - let testWindowed config = - try - config.InputSeq - |> ISeq.windowed config.WindowSize - |> VerifySeqsEqual config.ExpectedSeq - with - | _ when Option.isNone config.Exception -> Assert.Fail() - | e when e.GetType() = (Option.get config.Exception) -> () - | _ -> Assert.Fail() - - { - InputSeq = iseq [1..10] - WindowSize = 1 - ExpectedSeq = iseq <| seq { for i in 1..10 do yield [| i |] } - Exception = None - } |> testWindowed - { - InputSeq = iseq [1..10] - WindowSize = 5 - ExpectedSeq = iseq <| seq { for i in 1..6 do yield [| i; i+1; i+2; i+3; i+4 |] } - Exception = None - } |> testWindowed - { - InputSeq = iseq [1..10] - WindowSize = 10 - ExpectedSeq = iseq <| seq { yield [| 1 .. 10 |] } - Exception = None - } |> testWindowed - { - InputSeq = iseq [1..10] - WindowSize = 25 - ExpectedSeq = ISeq.empty - Exception = None - } |> testWindowed - { - InputSeq = iseq ["str1";"str2";"str3";"str4"] - WindowSize = 2 - ExpectedSeq = iseq [ [|"str1";"str2"|];[|"str2";"str3"|];[|"str3";"str4"|]] - Exception = None - } |> testWindowed - { - InputSeq = ISeq.empty - WindowSize = 2 - ExpectedSeq = ISeq.empty - Exception = None - } |> testWindowed - //{ - // InputSeq = null - // WindowSize = 2 - // ExpectedSeq = ISeq.empty - // Exception = Some typeof - //} |> testWindowed - { - InputSeq = iseq [1..10] - WindowSize = 0 - ExpectedSeq = ISeq.empty - Exception = Some typeof - } |> testWindowed - - () - - [] - member this.Zip() = - - // integer ISeq - let resultInt = ISeq.zip (iseq [1..7]) (iseq [11..17]) - let expectedInt = - iseq <| seq { for i in 1..7 do - yield i, i+10 } - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr =ISeq.zip (iseq ["str3";"str4"]) (iseq ["str1";"str2"]) - let expectedStr = iseq ["str3","str1";"str4","str2"] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.zip ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.zip null null |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip null (iseq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip (iseq [1..7]) null |> ignore) - () - - [] - member this.Zip3() = - // integer ISeq - let resultInt = ISeq.zip3 (iseq [1..7]) (iseq [11..17]) (iseq [21..27]) - let expectedInt = - iseq <| seq { for i in 1..7 do - yield i, (i + 10), (i + 20) } - VerifySeqsEqual expectedInt resultInt - - // string ISeq - let resultStr =ISeq.zip3 (iseq ["str1";"str2"]) (iseq ["str11";"str12"]) (iseq ["str21";"str22"]) - let expectedStr = iseq ["str1","str11","str21";"str2","str12","str22" ] - VerifySeqsEqual expectedStr resultStr - - // empty ISeq - let resultEpt = ISeq.zip3 ISeq.empty ISeq.empty ISeq.empty - VerifySeqsEqual ISeq.empty resultEpt - - //// null ISeq - //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 null null null |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 null (iseq [1..7]) (iseq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 (iseq [1..7]) null (iseq [1..7]) |> ignore) - //CheckThrowsArgumentNullException(fun() -> ISeq.zip3 (iseq [1..7]) (iseq [1..7]) null |> ignore) - () - - [] - member this.tryPick() = - // integer ISeq - let resultInt = ISeq.tryPick (fun x-> if x = 1 then Some("got") else None) (iseq [1..5]) - - Assert.AreEqual(Some("got"),resultInt) - - // string ISeq - let resultStr = ISeq.tryPick (fun x-> if x = "Are" then Some("got") else None) (iseq ["Lists"; "Are"]) - Assert.AreEqual(Some("got"),resultStr) - - // empty ISeq - let resultEpt = ISeq.tryPick (fun x-> if x = 1 then Some("got") else None) ISeq.empty - Assert.IsNull(resultEpt) - - //// null ISeq - //let nullSeq : iseq<'a> = null - //let funcNull x = Some(1) - - //CheckThrowsArgumentNullException(fun () -> ISeq.tryPick funcNull nullSeq |> ignore) - - () - - [] - member this.tryItem() = - // integer ISeq - let resultInt = ISeq.tryItem 3 (iseq { 10..20 }) - Assert.AreEqual(Some(13), resultInt) - - // string ISeq - let resultStr = ISeq.tryItem 2 (iseq ["Lists"; "Are"; "Cool"; "List" ]) - Assert.AreEqual(Some("Cool"), resultStr) - - // empty ISeq - let resultEmpty = ISeq.tryItem 0 ISeq.empty - Assert.AreEqual(None, resultEmpty) - - //// null ISeq - //let nullSeq:iseq<'a> = null - //CheckThrowsArgumentNullException (fun () -> ISeq.tryItem 3 nullSeq |> ignore) - - // Negative index - let resultNegativeIndex = ISeq.tryItem -1 (iseq { 10..20 }) - Assert.AreEqual(None, resultNegativeIndex) - - // Index greater than length - let resultIndexGreater = ISeq.tryItem 31 (iseq { 10..20 }) - Assert.AreEqual(None, resultIndexGreater) - -#endif \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/array.fs b/src/fsharp/FSharp.Core/array.fs index 31ce42a0999..271d9cf9529 100644 --- a/src/fsharp/FSharp.Core/array.fs +++ b/src/fsharp/FSharp.Core/array.fs @@ -1255,7 +1255,7 @@ namespace Microsoft.FSharp.Collections checkNonNull "arrays" arrays match arrays with | :? ('T[][]) as ts -> ts |> transposeArrays // avoid a clone, since we only read the array - | _ -> arrays |> Seq.toArray |> transposeArrays + | _ -> arrays |> Microsoft.FSharp.Primitives.Basics.Array.ofSeq |> transposeArrays [] let truncate count (array:'T[]) = diff --git a/src/fsharp/FSharp.Core/iseq.fs b/src/fsharp/FSharp.Core/iseq.fs index 025a1236550..290a1038c98 100644 --- a/src/fsharp/FSharp.Core/iseq.fs +++ b/src/fsharp/FSharp.Core/iseq.fs @@ -12,16 +12,17 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Control open Microsoft.FSharp.Collections + open Microsoft.FSharp.Primitives open Microsoft.FSharp.Primitives.Basics open Microsoft.FSharp.Collections.SeqComposition open Microsoft.FSharp.Collections.SeqComposition.Core [] - module ISeq = + module IConsumableSeq = open IEnumerator /// Base classes and helpers for object expressions that represent the Activitys in - /// the ISeq chain + /// the IConsumableSeq chain module Core = /// Single value Tuple. /// Allows null reference type values as key in Dictionary. @@ -45,29 +46,30 @@ namespace Microsoft.FSharp.Collections val mutable _3 : 'T3 new (a:'T1, b:'T2, c:'T3) = { _1 = a; _2 = b; _3 = c } - /// Base class for chaining mapping or filtering operation within the ISeq pipeline + /// Base class for chaining mapping or filtering operation within the IConsumableSeq pipeline [] - type internal Transform<'T,'U,'State> = - inherit Activity<'T,'U> + type internal SeqTransformActivity<'T,'U,'State> = + inherit SeqConsumerActivity<'T,'U> - new (next:Activity, initState:'State) = { + new (next:SeqConsumerActivity, initState:'State) = { State = initState Next = next } val mutable State : 'State - val Next : Activity + val Next : SeqConsumerActivity override this.ChainComplete terminatingIdx = this.Next.ChainComplete terminatingIdx + override this.ChainDispose () = this.Next.ChainDispose () /// Base class for chaining mapping or filtering operation that require some post processing - /// (i.e. Disposal and/or post conditional checks) within the ISeq pipeline + /// (i.e. Disposal and/or post conditional checks) within the IConsumableSeq pipeline [] - type internal TransformWithPostProcessing<'T,'U,'State>(next:Activity, initState:'State) = - inherit Transform<'T,'U,'State>(next, initState) + type internal SeqTransformActivityWithPostProcessing<'T,'U,'State>(next:SeqConsumerActivity, initState:'State) = + inherit SeqTransformActivity<'T,'U,'State>(next, initState) abstract OnComplete : pipeIdx:PipeIdx -> unit abstract OnDispose : unit -> unit @@ -75,33 +77,35 @@ namespace Microsoft.FSharp.Collections override this.ChainComplete terminatingIdx = this.OnComplete terminatingIdx this.Next.ChainComplete terminatingIdx + override this.ChainDispose () = try this.OnDispose () finally this.Next.ChainDispose () - /// Base class for folding operation within the ISeq pipeline + /// Base class for folding operation within the IConsumableSeq pipeline [] - type FolderWithState<'T,'Result,'State> = - inherit Folder<'T,'Result> + type SeqConsumerWithState<'T,'Result,'State> = + inherit SeqConsumer<'T,'Result> val mutable State : 'State new (initalResult,initState) = { - inherit Folder<'T,'Result>(initalResult) + inherit SeqConsumer<'T,'Result>(initalResult) State = initState } /// Base class for folding operation that require some post processing - /// (i.e. Disposal and/or post conditional checks) within the ISeq pipeline + /// (i.e. Disposal and/or post conditional checks) within the IConsumableSeq pipeline [] - type FolderWithPostProcessing<'T,'Result,'State>(initResult,initState) = - inherit FolderWithState<'T,'Result,'State>(initResult,initState) + type SeqConsumerWithPostProcessing<'T,'Result,'State>(initResult,initState) = + inherit SeqConsumerWithState<'T,'Result,'State>(initResult,initState) abstract OnComplete : pipeIdx:PipeIdx -> unit abstract OnDispose : unit -> unit override this.ChainComplete terminatingIdx = this.OnComplete terminatingIdx + override this.ChainDispose () = this.OnDispose () @@ -121,60 +125,60 @@ namespace Microsoft.FSharp.Collections member __.GetHashCode o = c.GetHashCode o._1 member __.Equals (lhs,rhs) = c.Equals (lhs._1, rhs._1) } - /// Usually the implementation of GetEnumerator is handled by the ISeq<'T>.Fold operation, + /// Usually the implementation of GetEnumerator is handled by the IConsumableSeq<'T>.Consume operation, /// but there can be cases where it is more efficent to provide a specific IEnumerator, and - /// only defer to the ISeq<'T> interface for its specific operations (this is the case with + /// only defer to the IConsumableSeq<'T> interface for its specific operations (this is the case with /// the scan function) [] type internal PreferGetEnumerator<'T>() = inherit EnumerableBase<'T>() abstract GetEnumerator: unit -> IEnumerator<'T> - abstract GetSeq : unit -> ISeq<'T> + abstract GetSeq : unit -> IConsumableSeq<'T> interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = this.GetEnumerator () - interface ISeq<'T> with - member this.PushTransform<'U> (next:ITransformFactory<'T,'U>) : ISeq<'U> = (this.GetSeq()).PushTransform next - member this.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) : 'Result = (this.GetSeq()).Fold f + interface IConsumableSeq<'T> with + member this.Transform<'U> (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = (this.GetSeq()).Transform next + member this.Consume<'Result> (f:PipeIdx->SeqConsumer<'T,'Result>) : 'Result = (this.GetSeq()).Consume f [] let internal empty<'T> = Microsoft.FSharp.Collections.SeqComposition.Core.EmptyEnumerable<'T>.Instance [] - let internal singleton<'T> (value:'T) : ISeq<'T> = new SingletonEnumerable<_>(value) :> _ + let internal singleton<'T> (value:'T) : IConsumableSeq<'T> = new SingletonEnumerable<_>(value) :> _ - /// wraps a ResizeArray in the ISeq framework. Care must be taken that the underlying ResizeArray - /// is not modified whilst it can be accessed as the ISeq, so check on version is performed. + /// wraps a ResizeArray in the IConsumableSeq framework. Care must be taken that the underlying ResizeArray + /// is not modified whilst it can be accessed as the IConsumableSeq, so check on version is performed. /// i.e. usually iteration on calls the enumerator provied by GetEnumerator ensure that the /// list hasn't been modified (throwing an exception if it has), but such a check is not /// performed in this case. If you want this functionality, then use the ofSeq function instead. [] - let internal ofResizeArrayUnchecked (source:ResizeArray<'T>) : ISeq<'T> = + let internal ofResizeArrayUnchecked (source:ResizeArray<'T>) : IConsumableSeq<'T> = ThinResizeArrayEnumerable<'T> source :> _ [] - let internal ofArray (source:array<'T>) : ISeq<'T> = + let internal ofArray (source:array<'T>) : IConsumableSeq<'T> = checkNonNull "source" source ThinArrayEnumerable<'T> source :> _ [] - let internal ofList (source:list<'T>) : ISeq<'T> = + let internal ofList (source:list<'T>) : IConsumableSeq<'T> = source :> _ [] - let ofSeq (source:seq<'T>) : ISeq<'T> = + let ofSeq (source:seq<'T>) : IConsumableSeq<'T> = match source with - | :? ISeq<'T> as seq -> seq + | :? IConsumableSeq<'T> as seq -> seq | :? array<'T> as array -> ofArray array | null -> nullArg "source" | _ -> ThinEnumerable<'T> source :> _ [] - let inline average (source:ISeq<'T>) = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'T,int> (LanguagePrimitives.GenericZero, 0) with + let inline average (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'T,int> (LanguagePrimitives.GenericZero, 0) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result value this.State <- this.State + 1 @@ -188,9 +192,9 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let inline averageBy (f:'T->'U) (source:ISeq<'T>) = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'U,int>(LanguagePrimitives.GenericZero,0) with + let inline averageBy (f:'T->'U) (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'U,int>(LanguagePrimitives.GenericZero,0) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result (f value) this.State <- this.State + 1 @@ -204,16 +208,16 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let internal exactlyOne (source:ISeq<'T>) : 'T = - source.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>, Values(true, false)) with + let internal exactlyOne (source:IConsumableSeq<'T>) : 'T = + source.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>, Values(true, false)) with override this.ProcessNext value = if this.State._1 then this.State._1 <- false this.Result <- value else this.State._2 <- true - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = @@ -225,22 +229,22 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let inline internal fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:ISeq<'T>) : 'State = - source.Fold (fun _ -> - { new Folder<'T,'State>(seed) with + let inline internal fold<'T,'State> (f:'State->'T->'State) (seed:'State) (source:IConsumableSeq<'T>) : 'State = + source.Consume (fun _ -> + { new SeqConsumer<'T,'State>(seed) with override this.ProcessNext value = this.Result <- f this.Result value Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal fold2<'T1,'T2,'State> (folder:'State->'T1->'T2->'State) (state:'State) (source1:ISeq<'T1>) (source2: ISeq<'T2>) = - source1.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<_,'State,IEnumerator<'T2>>(state,source2.GetEnumerator()) with + let inline internal fold2<'T1,'T2,'State> (folder:'State->'T1->'T2->'State) (state:'State) (source1:IConsumableSeq<'T1>) (source2: IConsumableSeq<'T2>) = + source1.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<_,'State,IEnumerator<'T2>>(state,source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then this.Result <- folder this.Result value this.State.Current else - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -248,36 +252,36 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let internal unfold (generator:'State->option<'T * 'State>) (state:'State) : ISeq<'T> = - new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityFactory.Instance, 1) :> _ + let internal unfold (generator:'State->option<'T * 'State>) (state:'State) : IConsumableSeq<'T> = + new UnfoldEnumerable<'T,'T,'State>(generator, state, IdentityTransform.Instance, 1) :> _ [] - let internal initInfinite<'T> (f:int->'T) : ISeq<'T> = + let internal initInfinite<'T> (f:int->'T) : IConsumableSeq<'T> = new InitEnumerableDecider<'T>(Nullable (), f, 1) :> _ [] - let internal init<'T> (count:int) (f:int->'T) : ISeq<'T> = + let internal init<'T> (count:int) (f:int->'T) : IConsumableSeq<'T> = if count < 0 then invalidArgInputMustBeNonNegative "count" count elif count = 0 then empty else new InitEnumerableDecider<'T>(Nullable count, f, 1) :> _ [] - let inline internal iter f (source:ISeq<'T>) = - source.Fold (fun _ -> - { new Folder<'T,unit> (()) with + let inline internal iter action (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumer<'T,unit> (()) with override this.ProcessNext value = - f value + action value Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal iter2 (f:'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = - source1.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<'T,unit,IEnumerator<'U>> ((),source2.GetEnumerator()) with + let inline internal iter2 (action:'T->'U->unit) (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'U>) : unit = + source1.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<'T,unit,IEnumerator<'U>> ((),source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then - f value this.State.Current + action value this.State.Current else - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -285,16 +289,16 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline internal iteri2 (f:int->'T->'U->unit) (source1:ISeq<'T>) (source2:ISeq<'U>) : unit = - source1.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<'T,unit,Values>>((),Values<_,_>(0,source2.GetEnumerator())) with + let inline internal iteri2 (action:int->'T->'U->unit) (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'U>) : unit = + source1.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<'T,unit,Values>>((),Values<_,_>(0,source2.GetEnumerator())) with override this.ProcessNext value = if this.State._2.MoveNext() then - f this.State._1 value this.State._2.Current + action this.State._1 value this.State._2.Current this.State._1 <- this.State._1 + 1 Unchecked.defaultof<_> else - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> override this.OnComplete _ = () @@ -302,59 +306,60 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State._2.Dispose () } :> _) [] - let internal tryHead (source:ISeq<'T>) = - source.Fold (fun pipeIdx -> - { new Folder<'T, Option<'T>> (None) with + let internal tryHead (source:IConsumableSeq<'T>) = + source.Consume (fun pipeIdx -> + { new SeqConsumer<'T, Option<'T>> (None) with override this.ProcessNext value = this.Result <- Some value - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let internal head (source:ISeq<_>) = + let internal head (source:IConsumableSeq<_>) = match tryHead source with | None -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | Some x -> x [] - let inline internal iteri f (source:ISeq<'T>) = - source.Fold (fun _ -> - { new FolderWithState<'T,unit,int> ((),0) with + let inline internal iteri action (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumerWithState<'T,unit,int> ((),0) with override this.ProcessNext value = - f this.State value + action this.State value this.State <- this.State + 1 Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _) [] - let inline internal except (itemsToExclude: seq<'T>) (source:ISeq<'T>) : ISeq<'T> when 'T:equality = + let inline internal except (itemsToExclude: seq<'T>) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> when 'T:equality = checkNonNull "itemsToExclude" itemsToExclude - source.PushTransform { new ITransformFactory<'T,'T> with + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - { new Transform<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with + { new SeqTransformActivity<'T,'V,Lazy>>(next,lazy(HashSet<'T>(itemsToExclude,HashIdentity.Structural<'T>))) with override this.ProcessNext (input:'T) : bool = this.State.Value.Add input && TailCall.avoid (next.ProcessNext input) } :> _} [] - let inline internal exists f (source:ISeq<'T>) = - source.Fold (fun pipeIdx -> - { new Folder<'T, bool> (false) with + let inline internal exists predicate (source:IConsumableSeq<'T>) = + source.Consume (fun pipeIdx -> + { new SeqConsumer<'T, bool> (false) with override this.ProcessNext value = - if f value then + if predicate value then this.Result <- true - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal exists2 (predicate:'T->'U->bool) (source1:ISeq<'T>) (source2: ISeq<'U>) : bool = - source1.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(false,source2.GetEnumerator()) with + let inline internal exists2 (predicate:'T->'U->bool) (source1:IConsumableSeq<'T>) (source2: IConsumableSeq<'U>) : bool = + source1.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<'T,bool,IEnumerator<'U>>(false,source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then if predicate value this.State.Current then this.Result <- true - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx else - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -362,36 +367,36 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline contains element (source:ISeq<'T>) = - source.Fold (fun pipeIdx -> - { new Folder<'T, bool> (false) with + let inline contains element (source:IConsumableSeq<'T>) = + source.Consume (fun pipeIdx -> + { new SeqConsumer<'T, bool> (false) with override this.ProcessNext value = if element = value then this.Result <- true - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal forall predicate (source:ISeq<'T>) = - source.Fold (fun pipeIdx -> - { new Folder<'T, bool> (true) with + let inline internal forall predicate (source:IConsumableSeq<'T>) = + source.Consume (fun pipeIdx -> + { new SeqConsumer<'T, bool> (true) with override this.ProcessNext value = if not (predicate value) then this.Result <- false - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal forall2 predicate (source1:ISeq<'T>) (source2:ISeq<'U>) : bool = - source1.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<'T,bool,IEnumerator<'U>>(true,source2.GetEnumerator()) with + let inline internal forall2 predicate (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'U>) : bool = + source1.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<'T,bool,IEnumerator<'U>>(true,source2.GetEnumerator()) with override this.ProcessNext value = if this.State.MoveNext() then if not (predicate value this.State.Current) then this.Result <- false - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx else - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = () @@ -399,39 +404,43 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline internal filter<'T> (f:'T->bool) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new ITransformFactory<'T,'T> with + let inline internal filter<'T> (predicate:'T->bool) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new SeqTransformActivity<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = - if f input then TailCall.avoid (next.ProcessNext input) + if predicate input then TailCall.avoid (next.ProcessNext input) else false } :> _} [] - let inline internal map<'T,'U> (f:'T->'U) (source:ISeq<'T>) : ISeq<'U> = - source.PushTransform { new ITransformFactory<'T,'U> with + let inline internal map<'T,'U> (mapping:'T->'U) (source:IConsumableSeq<'T>) : IConsumableSeq<'U> = + source.Transform + { new ISeqTransform<'T,'U> with override __.Compose _ _ next = - { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new SeqTransformActivity<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = - TailCall.avoid (next.ProcessNext (f input)) } :> _ } + TailCall.avoid (next.ProcessNext (mapping input)) } :> _ } [] - let inline internal mapi f (source:ISeq<_>) = - source.PushTransform { new ITransformFactory<'T,'U> with + let inline internal mapi mapping (source:IConsumableSeq<_>) = + source.Transform + { new ISeqTransform<'T,'U> with override __.Compose _ _ next = - { new Transform<'T,'V,int>(next, -1) with + { new SeqTransformActivity<'T,'V,int>(next, -1) with override this.ProcessNext (input:'T) : bool = this.State <- this.State + 1 - TailCall.avoid (next.ProcessNext (f this.State input)) } :> _ } + TailCall.avoid (next.ProcessNext (mapping this.State input)) } :> _ } [] - let inline internal map2<'T,'U,'V> (map:'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = - source1.PushTransform { new ITransformFactory<'T,'V> with - override __.Compose outOfBand pipeIdx (next:Activity<'V,'W>) = - { new TransformWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with + let inline internal map2<'T,'U,'V> (mapping:'T->'U->'V) (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'U>) : IConsumableSeq<'V> = + source1.Transform + { new ISeqTransform<'T,'V> with + override __.Compose outOfBand pipeIdx (next:SeqConsumerActivity<'V,'W>) = + { new SeqTransformActivityWithPostProcessing<'T,'W, IEnumerator<'U>>(next, (source2.GetEnumerator ())) with override this.ProcessNext input = if this.State.MoveNext () then - TailCall.avoid (next.ProcessNext (map input this.State.Current)) + TailCall.avoid (next.ProcessNext (mapping input this.State.Current)) else outOfBand.StopFurtherProcessing pipeIdx false @@ -441,16 +450,17 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _ } [] - let inline internal mapi2<'T,'U,'V> (map:int->'T->'U->'V) (source1:ISeq<'T>) (source2:ISeq<'U>) : ISeq<'V> = - source1.PushTransform { new ITransformFactory<'T,'V> with + let inline internal mapi2<'T,'U,'V> (mapping:int->'T->'U->'V) (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'U>) : IConsumableSeq<'V> = + source1.Transform + { new ISeqTransform<'T,'V> with override __.Compose<'W> outOfBand pipeIdx next = - { new TransformWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with + { new SeqTransformActivityWithPostProcessing<'T,'W, Values>>(next, Values<_,_>(-1,source2.GetEnumerator ())) with override this.ProcessNext t = let idx : byref<_> = &this.State._1 let u = this.State._2 if u.MoveNext () then idx <- idx + 1 - TailCall.avoid (next.ProcessNext (map idx t u.Current)) + TailCall.avoid (next.ProcessNext (mapping idx t u.Current)) else outOfBand.StopFurtherProcessing pipeIdx false @@ -460,15 +470,16 @@ namespace Microsoft.FSharp.Collections override this.OnComplete _ = () } :> _ } [] - let inline internal map3<'T,'U,'V,'W>(map:'T->'U->'V->'W) (source1:ISeq<'T>) (source2:ISeq<'U>) (source3:ISeq<'V>) : ISeq<'W> = - source1.PushTransform { new ITransformFactory<'T,'W> with + let inline internal map3<'T,'U,'V,'W>(mapping:'T->'U->'V->'W) (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'U>) (source3:IConsumableSeq<'V>) : IConsumableSeq<'W> = + source1.Transform + { new ISeqTransform<'T,'W> with override __.Compose<'X> outOfBand pipeIdx next = - { new TransformWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with + { new SeqTransformActivityWithPostProcessing<'T,'X,Values,IEnumerator<'V>>>(next,Values<_,_>(source2.GetEnumerator(),source3.GetEnumerator())) with override this.ProcessNext t = let u = this.State._1 let v = this.State._2 if u.MoveNext() && v.MoveNext () then - TailCall.avoid (next.ProcessNext (map t u.Current v.Current)) + TailCall.avoid (next.ProcessNext (mapping t u.Current v.Current)) else outOfBand.StopFurtherProcessing pipeIdx false @@ -480,18 +491,18 @@ namespace Microsoft.FSharp.Collections this.State._2.Dispose () } :> _ } [] - let inline internal compareWith (f:'T->'T->int) (source1:ISeq<'T>) (source2:ISeq<'T>) : int = - source1.Fold (fun pipeIdx -> - { new FolderWithPostProcessing<'T,int,IEnumerator<'T>>(0,source2.GetEnumerator()) with + let inline internal compareWith (comparer:'T->'T->int) (source1:IConsumableSeq<'T>) (source2:IConsumableSeq<'T>) : int = + source1.Consume (fun pipeIdx -> + { new SeqConsumerWithPostProcessing<'T,int,IEnumerator<'T>>(0,source2.GetEnumerator()) with override this.ProcessNext value = if not (this.State.MoveNext()) then this.Result <- 1 - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx else - let c = f value this.State.Current + let c = comparer value this.State.Current if c <> 0 then this.Result <- c - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) override this.OnComplete _ = @@ -501,35 +512,38 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = this.State.Dispose () } :> _) [] - let inline internal choose (f:'T->option<'U>) (source:ISeq<'T>) : ISeq<'U> = - source.PushTransform { new ITransformFactory<'T,'U> with + let inline internal choose (f:'T->option<'U>) (source:IConsumableSeq<'T>) : IConsumableSeq<'U> = + source.Transform + { new ISeqTransform<'T,'U> with override __.Compose _ _ next = - { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new SeqTransformActivity<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext input = match f input with | Some value -> TailCall.avoid (next.ProcessNext value) | None -> false } :> _ } [] - let inline internal distinct (source:ISeq<'T>) : ISeq<'T> when 'T:equality = - source.PushTransform { new ITransformFactory<'T,'T> with + let inline internal distinct (source:IConsumableSeq<'T>) : IConsumableSeq<'T> when 'T:equality = + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - { new Transform<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with + { new SeqTransformActivity<'T,'V,HashSet<'T>>(next,HashSet HashIdentity.Structural) with override this.ProcessNext (input:'T) : bool = this.State.Add input && TailCall.avoid (next.ProcessNext input) } :> _} [] - let inline internal distinctBy (keyf:'T->'Key) (source:ISeq<'T>) :ISeq<'T> when 'Key:equality = - source.PushTransform { new ITransformFactory<'T,'T> with + let inline internal distinctBy (keyf:'T->'Key) (source:IConsumableSeq<'T>) :IConsumableSeq<'T> when 'Key:equality = + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - { new Transform<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with + { new SeqTransformActivity<'T,'V,HashSet<'Key>> (next,HashSet HashIdentity.Structural) with override this.ProcessNext (input:'T) : bool = this.State.Add (keyf input) && TailCall.avoid (next.ProcessNext input) } :> _} [] - let inline max (source:ISeq<'T>) : 'T when 'T:comparison = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + let inline max (source:IConsumableSeq<'T>) : 'T when 'T:comparison = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = if this.State then this.State <- false @@ -545,9 +559,9 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let inline maxBy (f:'T->'U) (source:ISeq<'T>) : 'T when 'U:comparison = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof<'U>)) with + let inline maxBy (f:'T->'U) (source:IConsumableSeq<'T>) : 'T when 'U:comparison = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof<'U>)) with override this.ProcessNext value = match this.State._1, f value with | true, valueU -> @@ -567,9 +581,9 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let inline min (source:ISeq<'T>) : 'T when 'T:comparison = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + let inline min (source:IConsumableSeq<'T>) : 'T when 'T:comparison = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = if this.State then this.State <- false @@ -585,9 +599,9 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let inline minBy (f:'T->'U) (source:ISeq<'T>) : 'T = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof< 'U>)) with + let inline minBy (f:'T->'U) (source:IConsumableSeq<'T>) : 'T = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'T,Values>(Unchecked.defaultof<'T>,Values<_,_>(true,Unchecked.defaultof< 'U>)) with override this.ProcessNext value = match this.State._1, f value with | true, valueU -> @@ -607,10 +621,11 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let internal pairwise (source:ISeq<'T>) : ISeq<'T*'T> = - source.PushTransform { new ITransformFactory<'T,'T*'T> with + let internal pairwise (source:IConsumableSeq<'T>) : IConsumableSeq<'T*'T> = + source.Transform + { new ISeqTransform<'T,'T*'T> with override __.Compose _ _ next = - { new Transform<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with + { new SeqTransformActivity<'T,'U,Values>(next, Values(true, Unchecked.defaultof<'T>)) with // member this.isFirst = this.State._1 // member this.lastValue = this.State._2 override this.ProcessNext (input:'T) : bool = @@ -624,9 +639,9 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext currentPair) } :> _} [] - let inline internal reduce (f:'T->'T->'T) (source: ISeq<'T>) : 'T = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with + let inline internal reduce (f:'T->'T->'T) (source: IConsumableSeq<'T>) : 'T = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,'T,bool>(Unchecked.defaultof<'T>,true) with override this.ProcessNext value = if this.State then this.State <- false @@ -642,7 +657,7 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let internal concat (sources:ISeq<#ISeq<'T>>) : ISeq<'T> = + let internal concat (sources:IConsumableSeq<#IConsumableSeq<'T>>) : IConsumableSeq<'T> = ThinConcatEnumerable (sources, id) :> _ (* @@ -702,7 +717,7 @@ namespace Microsoft.FSharp.Collections enumerator.Dispose () [] - let internal scan (folder:'State->'T->'State) (initialState:'State) (source:ISeq<'T>) : ISeq<'State> = + let internal scan (folder:'State->'T->'State) (initialState:'State) (source:IConsumableSeq<'T>) : IConsumableSeq<'State> = { new PreferGetEnumerator<'State>() with member this.GetEnumerator () = new ScanEnumerator<'T,'State>(folder, initialState, source) :> _ @@ -710,22 +725,24 @@ namespace Microsoft.FSharp.Collections member this.GetSeq () = let head = singleton initialState let tail = - source.PushTransform { new ITransformFactory<'T,'State> with + source.Transform + { new ISeqTransform<'T,'State> with override __.Compose _ _ next = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder - { new Transform<'T,'V,'State>(next, initialState) with + { new SeqTransformActivity<'T,'V,'State>(next, initialState) with override this.ProcessNext (input:'T) : bool = this.State <- f.Invoke (this.State, input) TailCall.avoid (next.ProcessNext this.State) } :> _ } concat (ofList [ head ; tail ]) } :> _ [] - let internal skip (skipCount:int) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new ITransformFactory<'T,'T> with + let internal skip (skipCount:int) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - let mutable this = Unchecked.defaultof> + let mutable this = Unchecked.defaultof> let skipper = - { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with + { new SeqTransformActivityWithPostProcessing<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = if this.State < skipCount then @@ -753,10 +770,11 @@ namespace Microsoft.FSharp.Collections this :> _ } [] - let inline internal skipWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new ITransformFactory<'T,'T> with + let inline internal skipWhile (predicate:'T->bool) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - { new Transform<'T,'V,bool>(next,true) with + { new SeqTransformActivity<'T,'V,bool>(next,true) with // member this.skip = this.State override this.ProcessNext (input:'T) : bool = if this.State then @@ -769,32 +787,33 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext input) } :> _} [] - let inline sum (source:ISeq<'T>) = - source.Fold (fun _ -> - { new Folder<'T,'T> (LanguagePrimitives.GenericZero) with + let inline sum (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumer<'T,'T> (LanguagePrimitives.GenericZero) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result value Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline sumBy (f:'T->'U) (source:ISeq<'T>) = - source.Fold (fun _ -> - { new Folder<'T,'U> (LanguagePrimitives.GenericZero<'U>) with + let inline sumBy (f:'T->'U) (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumer<'T,'U> (LanguagePrimitives.GenericZero<'U>) with override this.ProcessNext value = this.Result <- Checked.(+) this.Result (f value) Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let internal take (takeCount:int) (source:ISeq<'T>) : ISeq<'T> = + let internal take (takeCount:int) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = if takeCount < 0 then invalidArgInputMustBeNonNegative "count" takeCount elif takeCount = 0 then empty else - source.PushTransform { new ITransformFactory<'T,'T> with + source.Transform + { new ISeqTransform<'T,'T> with member __.Compose outOfBand pipelineIdx next = if takeCount = 0 then outOfBand.StopFurtherProcessing pipelineIdx - { new TransformWithPostProcessing<'T,'U,int>(next,(*count*)0) with + { new SeqTransformActivityWithPostProcessing<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = if this.State < takeCount then @@ -815,10 +834,11 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _} [] - let inline internal takeWhile (predicate:'T->bool) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new ITransformFactory<'T,'T> with + let inline internal takeWhile (predicate:'T->bool) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = + source.Transform + { new ISeqTransform<'T,'T> with member __.Compose outOfBand pipeIdx next = - { new Transform<'T,'V,NoValue>(next,Unchecked.defaultof) with + { new SeqTransformActivity<'T,'V,NoValue>(next,Unchecked.defaultof) with override __.ProcessNext (input:'T) : bool = if predicate input then TailCall.avoid (next.ProcessNext input) @@ -827,10 +847,11 @@ namespace Microsoft.FSharp.Collections false } :> _ } [] - let internal tail (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new ITransformFactory<'T,'T> with + let internal tail (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = + source.Transform + { new ISeqTransform<'T,'T> with member __.Compose _ _ next = - { new TransformWithPostProcessing<'T,'V,bool>(next,true) with + { new SeqTransformActivityWithPostProcessing<'T,'V,bool>(next,true) with // member this.isFirst = this.State override this.ProcessNext (input:'T) : bool = if this.State then @@ -846,10 +867,11 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ } [] - let internal truncate (truncateCount:int) (source:ISeq<'T>) : ISeq<'T> = - source.PushTransform { new ITransformFactory<'T,'T> with + let internal truncate (truncateCount:int) (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = + source.Transform + { new ISeqTransform<'T,'T> with member __.Compose outOfBand pipeIdx next = - { new Transform<'T,'U,int>(next,(*count*)0) with + { new SeqTransformActivity<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = if this.State < truncateCount then @@ -866,13 +888,14 @@ namespace Microsoft.FSharp.Collections mapi (fun i x -> i,x) source [] - let internal tryItem index (source:ISeq<'T>) = + let internal tryItem index (source:IConsumableSeq<'T>) = if index < 0 then None else - source.PushTransform { new ITransformFactory<'T,'T> with + source.Transform + { new ISeqTransform<'T,'T> with override __.Compose _ _ next = - let mutable this = Unchecked.defaultof> + let mutable this = Unchecked.defaultof> let skipper = - { new Transform<'T,'U,int>(next,(*count*)0) with + { new SeqTransformActivity<'T,'U,int>(next,(*count*)0) with // member this.count = this.State override this.ProcessNext (input:'T) : bool = if this.State < index then @@ -893,44 +916,44 @@ namespace Microsoft.FSharp.Collections |> tryHead [] - let inline internal tryPick f (source:ISeq<'T>) = - source.Fold (fun pipeIdx -> - { new Folder<'T, Option<'U>> (None) with + let inline internal tryPick f (source:IConsumableSeq<'T>) = + source.Consume (fun pipeIdx -> + { new SeqConsumer<'T, Option<'U>> (None) with override this.ProcessNext value = match f value with | (Some _) as some -> this.Result <- some - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx | None -> () Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal tryFind f (source:ISeq<'T>) = - source.Fold (fun pipeIdx -> - { new Folder<'T, Option<'T>> (None) with + let inline internal tryFind f (source:IConsumableSeq<'T>) = + source.Consume (fun pipeIdx -> + { new SeqConsumer<'T, Option<'T>> (None) with override this.ProcessNext value = if f value then this.Result <- Some value - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx Unchecked.defaultof<_> (* return value unused in Fold context *) }) [] - let inline internal tryFindIndex (predicate:'T->bool) (source:ISeq<'T>) : int option = - source.Fold (fun pipeIdx -> - { new FolderWithState<'T, Option, int>(None, 0) with + let inline internal tryFindIndex (predicate:'T->bool) (source:IConsumableSeq<'T>) : int option = + source.Consume (fun pipeIdx -> + { new SeqConsumerWithState<'T, Option, int>(None, 0) with // member this.index = this.State override this.ProcessNext value = if predicate value then this.Result <- Some this.State - (this :> IOutOfBand).StopFurtherProcessing pipeIdx + (this :> ISeqConsumer).StopFurtherProcessing pipeIdx else this.State <- this.State + 1 Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _) [] - let internal tryLast (source:ISeq<'T>) : 'T option = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,option<'T>,Values>(None,Values(true, Unchecked.defaultof<'T>)) with + let internal tryLast (source:IConsumableSeq<'T>) : 'T option = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,option<'T>,Values>(None,Values(true, Unchecked.defaultof<'T>)) with // member this.noItems = this.State._1 // memebr this.last = this.State._2 override this.ProcessNext value = @@ -946,20 +969,21 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _) [] - let internal last (source:ISeq<_>) = + let internal last (source:IConsumableSeq<_>) = match tryLast source with | None -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | Some x -> x [] - let internal windowed (windowSize:int) (source:ISeq<'T>) : ISeq<'T[]> = + let internal windowed (windowSize:int) (source:IConsumableSeq<'T>) : IConsumableSeq<'T[]> = if windowSize <= 0 then invalidArgFmt "windowSize" "{0}\nwindowSize = {1}" [|SR.GetString SR.inputMustBePositive; windowSize|] - source.PushTransform { new ITransformFactory<'T,'T[]> with + source.Transform + { new ISeqTransform<'T,'T[]> with member __.Compose outOfBand pipeIdx next = { - new Transform<'T,'U,Values<'T[],int,int>>(next,Values<'T[],int,int>(Array.zeroCreateUnchecked windowSize, 0, windowSize-1)) with + new SeqTransformActivity<'T,'U,Values<'T[],int,int>>(next,Values<'T[],int,int>(Array.zeroCreateUnchecked windowSize, 0, windowSize-1)) with override this.ProcessNext (input:'T) : bool = let circularBuffer = this.State._1 let idx : byref<_> = &this.State._2 @@ -985,19 +1009,19 @@ namespace Microsoft.FSharp.Collections TailCall.avoid (next.ProcessNext window) } :> _} [] - let internal append (source1:ISeq<'T>) (source2: ISeq<'T>) : ISeq<'T> = + let internal append (source1:IConsumableSeq<'T>) (source2: IConsumableSeq<'T>) : IConsumableSeq<'T> = match source1 with | :? EnumerableBase<'T> as s -> s.Append source2 | _ -> new AppendEnumerable<_>([source2; source1]) :> _ [] - let internal delay (delayed:unit->ISeq<'T>) : ISeq<'T> = + let internal delay (delayed:unit->IConsumableSeq<'T>) : IConsumableSeq<'T> = DelayedEnumerable (delayed, 1) :> _ module internal GroupBy = - let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,ISeq<'Key*ISeq<'T>>,_>(Unchecked.defaultof<_>,Dictionary comparer) with + let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,IConsumableSeq<'Key*IConsumableSeq<'T>>,_>(Unchecked.defaultof<_>,Dictionary comparer) with override this.ProcessNext v = let safeKey = keyf v match this.State.TryGetValue safeKey with @@ -1020,24 +1044,24 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ ) - let inline byVal (projection:'T->'Key) (source:ISeq<'T>) = + let inline byVal (projection:'T->'Key) (source:IConsumableSeq<'T>) = delay (fun () -> impl HashIdentity.Structural<'Key> projection id source) - let inline byRef (projection:'T->'Key) (source:ISeq<'T>) = + let inline byRef (projection:'T->'Key) (source:IConsumableSeq<'T>) = delay (fun () -> impl (valueComparer<'Key> ()) (projection >> Value) (fun v -> v._1) source) [] - let inline internal groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T->'Key) (source:ISeq<'T>) = + let inline internal groupByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T->'Key) (source:IConsumableSeq<'T>) = GroupBy.byVal projection source [] - let inline internal groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T->'Key) (source:ISeq<'T>) = + let inline internal groupByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T->'Key) (source:IConsumableSeq<'T>) = GroupBy.byRef projection source module CountBy = - let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:ISeq<'T>) = - source.Fold (fun _ -> - { new FolderWithPostProcessing<'T,ISeq<'Key*int>,_>(Unchecked.defaultof<_>,Dictionary comparer) with + let inline private impl (comparer:IEqualityComparer<'SafeKey>) (keyf:'T->'SafeKey) (getKey:'SafeKey->'Key) (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumerWithPostProcessing<'T,IConsumableSeq<'Key*int>,_>(Unchecked.defaultof<_>,Dictionary comparer) with override this.ProcessNext v = let safeKey = keyf v this.State.[safeKey] <- @@ -1054,40 +1078,38 @@ namespace Microsoft.FSharp.Collections override this.OnDispose () = () } :> _ ) - let inline byVal (projection:'T->'Key) (source:ISeq<'T>) = + let inline byVal (projection:'T->'Key) (source:IConsumableSeq<'T>) = delay (fun () -> impl HashIdentity.Structural<'Key> projection id source) - let inline byRef (projection:'T->'Key) (source:ISeq<'T>) = + let inline byRef (projection:'T->'Key) (source:IConsumableSeq<'T>) = delay (fun () -> impl (valueComparer<'Key> ()) (projection >> Value) (fun v -> v._1) source) [] - let inline internal countByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T -> 'Key) (source:ISeq<'T>) = + let inline internal countByVal<'T,'Key when 'Key : equality and 'Key : struct> (projection:'T -> 'Key) (source:IConsumableSeq<'T>) = CountBy.byVal projection source [] - let inline internal countByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T -> 'Key) (source:ISeq<'T>) = + let inline internal countByRef<'T,'Key when 'Key : equality and 'Key : not struct> (projection:'T -> 'Key) (source:IConsumableSeq<'T>) = CountBy.byRef projection source [] - let internal length (source:ISeq<'T>) = + let internal length (source:IConsumableSeq<'T>) = match source with | :? EnumerableBase<'T> as s -> s.Length () | :? list<'T> as l -> l.Length - | _ -> Microsoft.FSharp.Primitives.Basics.ISeq.length source + | _ -> Basics.IConsumableSeq.length source [] - let internal toResizeArray (source:ISeq<'T>) = - source.Fold (fun _ -> - { new Folder<'T,ResizeArray<'T>>(ResizeArray ()) with + let internal toResizeArray (source:IConsumableSeq<'T>) = + source.Consume (fun _ -> + { new SeqConsumer<'T,ResizeArray<'T>>(ResizeArray ()) with override this.ProcessNext v = this.Result.Add v Unchecked.defaultof<_> (* return value unused in Fold context *) } :> _ ) [] - let internal toArray (source:ISeq<'T>) = - source - |> toResizeArray - |> fun a -> a.ToArray () + let internal toArray (source:IConsumableSeq<'T>) = + Basics.Array.ofConsumableSeq source [] let internal sortBy projection source = @@ -1118,7 +1140,7 @@ namespace Microsoft.FSharp.Collections ofResizeArrayUnchecked array) [] - let internal permute indexMap (source:ISeq<_>) = + let internal permute indexMap (source:IConsumableSeq<_>) = delay (fun () -> source |> toArray @@ -1126,7 +1148,7 @@ namespace Microsoft.FSharp.Collections |> ofArray) [] - let internal scanBack<'T,'State> folder (source:ISeq<'T>) (state:'State) : ISeq<'State> = + let internal scanBack<'T,'State> folder (source:IConsumableSeq<'T>) (state:'State) : IConsumableSeq<'State> = delay (fun () -> let array = source |> toArray Array.scanSubRight folder array 0 (array.Length - 1) state @@ -1139,7 +1161,7 @@ namespace Microsoft.FSharp.Collections state [] - let inline internal foldBack<'T,'State> folder (source: ISeq<'T>) (state:'State) = + let inline internal foldBack<'T,'State> folder (source: IConsumableSeq<'T>) (state:'State) = let arr = toResizeArray source let len = arr.Count foldArraySubRight folder arr 0 (len - 1) state @@ -1149,19 +1171,19 @@ namespace Microsoft.FSharp.Collections map2 (fun x y -> x,y) source1 source2 [] - let inline internal foldBack2<'T1,'T2,'State> folder (source1:ISeq<'T1>) (source2:ISeq<'T2>) (state:'State) = + let inline internal foldBack2<'T1,'T2,'State> folder (source1:IConsumableSeq<'T1>) (source2:IConsumableSeq<'T2>) (state:'State) = let zipped = zip source1 source2 foldBack ((<||) folder) zipped state [] - let inline internal reduceBack reduction (source:ISeq<'T>) = + let inline internal reduceBack reduction (source:IConsumableSeq<'T>) = let arr = toResizeArray source match arr.Count with | 0 -> invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString | len -> foldArraySubRight reduction arr 0 (len - 2) arr.[len - 1] [] - type internal CachedSeq<'T>(source:ISeq<'T>) = + type internal CachedSeq<'T>(source:IConsumableSeq<'T>) = let sync = obj () // Wrap a seq to ensure that it is enumerated just once and only as far as is necessary. @@ -1211,7 +1233,7 @@ namespace Microsoft.FSharp.Collections else None) - let cached : ISeq<'T> = new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityFactory.Instance, 1) :> _ + let cached : IConsumableSeq<'T> = new UnfoldEnumerable<'T,'T,int>(unfolding, 0, IdentityTransform.Instance, 1) :> _ interface System.IDisposable with member __.Dispose() = @@ -1230,39 +1252,39 @@ namespace Microsoft.FSharp.Collections interface System.Collections.IEnumerable with member __.GetEnumerator() = (cached:>IEnumerable).GetEnumerator() - interface ISeq<'T> with - member __.PushTransform next = cached.PushTransform next - member __.Fold f = cached.Fold f + interface IConsumableSeq<'T> with + member __.Transform next = cached.Transform next + member __.Consume f = cached.Consume f member this.Clear() = (this :> IDisposable).Dispose () [] - let internal cache (source:ISeq<'T>) : ISeq<'T> = + let internal cache (source:IConsumableSeq<'T>) : IConsumableSeq<'T> = new CachedSeq<_> (source) :> _ [] let internal collect mapping source = map mapping source |> concat [] - let internal allPairs (source1:ISeq<'T1>) (source2:ISeq<'T2>) : ISeq<'T1 * 'T2> = + let internal allPairs (source1:IConsumableSeq<'T1>) (source2:IConsumableSeq<'T2>) : IConsumableSeq<'T1 * 'T2> = checkNonNull "source1" source1 checkNonNull "source2" source2 let cached = cache source2 source1 |> collect (fun x -> cached |> map (fun y -> x,y)) [] - let internal toList (source : ISeq<'T>) = + let internal toList (source : IConsumableSeq<'T>) = match source with | :? list<'T> as lst -> lst - | _ -> Microsoft.FSharp.Primitives.Basics.List.ofISeq source + | _ -> Basics.List.ofConsumableSeq source [] - let replicate<'T> count (initial:'T) : ISeq<'T> = + let replicate<'T> count (initial:'T) : IConsumableSeq<'T> = if count < 0 then raise (ArgumentOutOfRangeException "count") - new InitEnumerable<'T,'T>(Nullable count, (fun _ -> initial), IdentityFactory.Instance, 1) :> _ + new InitEnumerable<'T,'T>(Nullable count, (fun _ -> initial), IdentityTransform.Instance, 1) :> _ [] - let internal isEmpty (source : ISeq<'T>) = + let internal isEmpty (source : IConsumableSeq<'T>) = match source with | :? list<'T> as lst -> lst.IsEmpty | _ -> @@ -1270,22 +1292,23 @@ namespace Microsoft.FSharp.Collections not (ie.MoveNext()) [] - let internal cast (source: IEnumerable) : ISeq<'T> = + let internal cast (source: IEnumerable) : IConsumableSeq<'T> = match source with - | :? ISeq<'T> as s -> s - | :? ISeq as s -> s |> map unbox // covariant on ref types + | :? IConsumableSeq<'T> as s -> s + | :? IConsumableSeq as s -> s |> map unbox // covariant on ref types | _ -> mkSeq (fun () -> IEnumerator.cast (source.GetEnumerator())) |> ofSeq [] - let internal chunkBySize chunkSize (source : ISeq<'T>) : ISeq<'T[]> = + let internal chunkBySize chunkSize (source : IConsumableSeq<'T>) : IConsumableSeq<'T[]> = if chunkSize <= 0 then invalidArgFmt "chunkSize" "{0}\nchunkSize = {1}" [|SR.GetString SR.inputMustBePositive; chunkSize|] - source.PushTransform { new ITransformFactory<'T,'T[]> with + source.Transform + { new ISeqTransform<'T,'T[]> with member __.Compose outOfBand pipeIdx next = { - new TransformWithPostProcessing<'T,'U,Values<'T[],int>>(next,Values<'T[],int>(Array.zeroCreateUnchecked chunkSize, 0)) with + new SeqTransformActivityWithPostProcessing<'T,'U,Values<'T[],int>>(next,Values<'T[],int>(Array.zeroCreateUnchecked chunkSize, 0)) with override this.ProcessNext (input:'T) : bool = this.State._1.[this.State._2] <- input this.State._2 <- this.State._2 + 1 @@ -1306,7 +1329,7 @@ namespace Microsoft.FSharp.Collections let internal mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) |> ofSeq [] - let internal splitInto count (source:ISeq<'T>) : ISeq<'T[]> = + let internal splitInto count (source:IConsumableSeq<'T>) : IConsumableSeq<'T[]> = if count <= 0 then invalidArgFmt "count" "{0}\ncount = {1}" [|SR.GetString SR.inputMustBePositive; count|] mkDelayedSeq (fun () -> @@ -1321,7 +1344,7 @@ namespace Microsoft.FSharp.Collections | Some x -> x [] - let internal findIndex predicate (source:ISeq<_>) = + let internal findIndex predicate (source:IConsumableSeq<_>) = use ie = source.GetEnumerator() let rec loop i = if ie.MoveNext() then @@ -1367,7 +1390,7 @@ namespace Microsoft.FSharp.Collections else nth (index-1) e [] - let internal item index (source : ISeq<'T>) = + let internal item index (source : IConsumableSeq<'T>) = if index < 0 then invalidArgInputMustBeNonNegative "index" index use e = source.GetEnumerator() nth index e @@ -1383,11 +1406,11 @@ namespace Microsoft.FSharp.Collections sortWith compareDescending source [] - let internal tryFindBack predicate (source : ISeq<'T>) = + let internal tryFindBack predicate (source : IConsumableSeq<'T>) = source |> toArray |> Array.tryFindBack predicate [] - let internal tryFindIndexBack predicate (source : ISeq<'T>) = + let internal tryFindIndexBack predicate (source : IConsumableSeq<'T>) = source |> toArray |> Array.tryFindIndexBack predicate [] diff --git a/src/fsharp/FSharp.Core/iseq.fsi b/src/fsharp/FSharp.Core/iseq.fsi index c990f87cf6d..774a27b81d7 100644 --- a/src/fsharp/FSharp.Core/iseq.fsi +++ b/src/fsharp/FSharp.Core/iseq.fsi @@ -10,7 +10,7 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.SeqComposition [] - module ISeq = + module IConsumableSeq = module Core = /// Values is a mutable struct. It can be embedded within the folder type /// if two values are required for the calculation. @@ -39,371 +39,379 @@ namespace Microsoft.FSharp.Collections /// An activity that transforms the input from 'T to 'U, using 'State. It's intended usage /// is as a base class for an object expression that will be created - /// in the ITransformFactory's Compose function. + /// in the ISeqTransform's Compose function. [] - type internal Transform<'T,'U,'State> = - inherit Activity<'T,'U> - new : next:Activity * 'State -> Transform<'T,'U,'State> + type internal SeqTransformActivity<'T,'U,'State> = + inherit SeqConsumerActivity<'T,'U> + new : next:SeqConsumerActivity * 'State -> SeqTransformActivity<'T,'U,'State> val mutable State : 'State - val private Next : Activity + val private Next : SeqConsumerActivity /// An activity that transforms the input from 'T to 'U, using 'State /// and performs some post processing on the pipeline, either in the case of the stream /// ending sucessfully or when disposed. It's intended usage /// is as a base class for an object expression that will be created - /// in the ITransformFactory's Compose function. + /// in the ISeqTransform's Compose function. [] - type internal TransformWithPostProcessing<'T,'U,'State> = - inherit Transform<'T,'U,'State> - new : next:Activity * 'State -> TransformWithPostProcessing<'T,'U,'State> + type internal SeqTransformActivityWithPostProcessing<'T,'U,'State> = + inherit SeqTransformActivity<'T,'U,'State> + new : next:SeqConsumerActivity * 'State -> SeqTransformActivityWithPostProcessing<'T,'U,'State> + + /// OnComplete is used to determine if the object has been processed correctly, + /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take + /// operation which didn't have a source at least as large as was required). It is + /// not called in the case of an exception being thrown whilst the stream is still + /// being processed. abstract OnComplete : PipeIdx -> unit - abstract OnDispose : unit -> unit + /// OnDispose is used to cleanup the stream. It is always called at the last operation + /// after the enumeration has completed. + abstract OnDispose : unit -> unit - /// Folder is a base class to assist with fold-like operations. It's intended usage + /// SeqConsumer is a base class to assist with fold-like operations. It's intended usage /// is as a base class for an object expression that will be used from within /// the Fold function. [] - type FolderWithState<'T,'Result,'State> = - inherit Folder<'T,'Result> - new : 'Result*'State -> FolderWithState<'T,'Result,'State> + type SeqConsumerWithState<'T,'Result,'State> = + inherit SeqConsumer<'T,'Result> + new : 'Result*'State -> SeqConsumerWithState<'T,'Result,'State> val mutable State : 'State - /// Folder is a base class to assist with fold-like operations + /// SeqConsumer is a base class to assist with fold-like operations /// and performs some post processing on the pipeline, either in the case of the stream /// ending sucessfully or when disposed. It's intended usage /// is as a base class for an object expression that will be used from within /// the Fold function. [] - type FolderWithPostProcessing<'T,'Result,'State> = - inherit FolderWithState<'T,'Result,'State> - new : 'Result*'State -> FolderWithPostProcessing<'T,'Result,'State> + type SeqConsumerWithPostProcessing<'T,'Result,'State> = + inherit SeqConsumerWithState<'T,'Result,'State> + new : 'Result*'State -> SeqConsumerWithPostProcessing<'T,'Result,'State> abstract OnDispose : unit -> unit abstract OnComplete : PipeIdx -> unit open Core - /// ofResizeArrayUnchecked creates an ISeq over a ResizeArray that accesses the underlying + /// ofResizeArrayUnchecked creates an IConsumableSeq over a ResizeArray that accesses the underlying /// structure via Index rather than via the GetEnumerator function. This provides faster access /// but doesn't check the version of the underlying object which means care has to be taken - /// to ensure that it is not modified which the result ISeq exists. + /// to ensure that it is not modified which the result IConsumableSeq exists. [] - val internal ofResizeArrayUnchecked : ResizeArray<'T> -> ISeq<'T> + val internal ofResizeArrayUnchecked : ResizeArray<'T> -> IConsumableSeq<'T> [] - val internal ofList : list<'T> -> ISeq<'T> + val internal ofList : list<'T> -> IConsumableSeq<'T> [] - val internal ofArray : array<'T> -> ISeq<'T> + val internal ofArray : array<'T> -> IConsumableSeq<'T> [] - val ofSeq : seq<'T> -> ISeq<'T> + val ofSeq : seq<'T> -> IConsumableSeq<'T> [] - val inline average : source: ISeq< ^T> -> ^T + val inline average : source: IConsumableSeq< ^T> -> ^T when 'T:(static member Zero : ^T) and 'T:(static member (+) : ^T * ^T -> ^T) and ^T:(static member DivideByInt : ^T * int -> ^T) [] - val inline averageBy : f:('T -> ^U) -> source:ISeq< 'T > -> ^U + val inline averageBy : f:('T -> ^U) -> source:IConsumableSeq< 'T > -> ^U when ^U:(static member Zero : ^U) and ^U:(static member (+) : ^U * ^U -> ^U) and ^U:(static member DivideByInt : ^U * int -> ^U) [] - val internal empty<'T> : ISeq<'T> + val internal empty<'T> : IConsumableSeq<'T> [] - val internal exactlyOne : ISeq<'T> -> 'T + val internal exactlyOne : IConsumableSeq<'T> -> 'T [] - val inline internal fold<'T,'State> : f:('State->'T->'State) -> seed:'State -> source:ISeq<'T> -> 'State + val inline internal fold<'T,'State> : f:('State->'T->'State) -> seed:'State -> source:IConsumableSeq<'T> -> 'State [] - val inline internal fold2<'T1,'T2,'State> : folder:('State->'T1->'T2->'State) -> state:'State -> source1: ISeq<'T1> -> source2: ISeq<'T2> -> 'State + val inline internal fold2<'T1,'T2,'State> : folder:('State->'T1->'T2->'State) -> state:'State -> source1: IConsumableSeq<'T1> -> source2: IConsumableSeq<'T2> -> 'State [] - val internal unfold : generator:('State -> option<'T*'State>) -> state:'State -> ISeq<'T> + val internal unfold : generator:('State -> option<'T*'State>) -> state:'State -> IConsumableSeq<'T> [] - val internal initInfinite : f:(int -> 'T) -> ISeq<'T> + val internal initInfinite : f:(int -> 'T) -> IConsumableSeq<'T> [] - val internal init : count:int -> f:(int -> 'T) -> ISeq<'T> + val internal init : count:int -> f:(int -> 'T) -> IConsumableSeq<'T> [] - val inline internal iter : f:('T -> unit) -> source:ISeq<'T> -> unit + val inline internal iter : action:('T -> unit) -> source:IConsumableSeq<'T> -> unit [] - val inline internal iter2 : f:('T->'U->unit) -> source1 : ISeq<'T> -> source2 : ISeq<'U> -> unit + val inline internal iter2 : action:('T->'U->unit) -> source1 : IConsumableSeq<'T> -> source2 : IConsumableSeq<'U> -> unit [] - val inline internal iteri2 : f:(int->'T->'U->unit) -> source1:ISeq<'T> -> source2:ISeq<'U> -> unit + val inline internal iteri2 : action:(int->'T->'U->unit) -> source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'U> -> unit [] - val internal tryHead : ISeq<'T> -> option<'T> + val internal tryHead : IConsumableSeq<'T> -> option<'T> [] - val internal head: source:ISeq<'T> -> 'T + val internal head: source:IConsumableSeq<'T> -> 'T [] - val inline internal iteri : f:(int -> 'T -> unit) -> source:ISeq<'T> -> unit + val inline internal iteri : action:(int -> 'T -> unit) -> source:IConsumableSeq<'T> -> unit [] - val inline internal except : itemsToExclude:seq<'T> -> source:ISeq<'T> -> ISeq<'T> when 'T:equality + val inline internal except : itemsToExclude:seq<'T> -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'T:equality [] - val inline internal exists : f:('T -> bool) -> source:ISeq<'T> -> bool + val inline internal exists : predicate:('T -> bool) -> source:IConsumableSeq<'T> -> bool [] - val inline internal exists2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool + val inline internal exists2 : predicate:('T->'U->bool) -> source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'U> -> bool [] - val inline contains : element:'T -> source:ISeq<'T> -> bool when 'T : equality + val inline contains : element:'T -> source:IConsumableSeq<'T> -> bool when 'T : equality [] - val inline internal forall : predicate:('T -> bool) -> source:ISeq<'T> -> bool + val inline internal forall : predicate:('T -> bool) -> source:IConsumableSeq<'T> -> bool [] - val inline internal forall2 : predicate:('T->'U->bool) -> source1:ISeq<'T> -> source2:ISeq<'U> -> bool + val inline internal forall2 : predicate:('T->'U->bool) -> source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'U> -> bool [] - val inline internal filter : f:('T -> bool) -> source:ISeq<'T> -> ISeq<'T> + val inline internal filter : predicate:('T -> bool) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val inline internal map : f:('T -> 'U) -> source:ISeq<'T> -> ISeq<'U> + val inline internal map : mapping:('T -> 'U) -> source:IConsumableSeq<'T> -> IConsumableSeq<'U> [] - val inline internal mapi : f:(int->'a->'b) -> source: ISeq<'a> -> ISeq<'b> + val inline internal mapi : mapping:(int->'a->'b) -> source: IConsumableSeq<'a> -> IConsumableSeq<'b> [] - val inline internal map2<'T,'U,'V> : map:('T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> + val inline internal map2<'T,'U,'V> : mapping:('T->'U->'V) -> source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'U> -> IConsumableSeq<'V> [] - val inline internal mapi2<'T,'U,'V> : map:(int -> 'T->'U->'V) -> source1:ISeq<'T> -> source2:ISeq<'U> -> ISeq<'V> + val inline internal mapi2<'T,'U,'V> : mapping:(int -> 'T->'U->'V) -> source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'U> -> IConsumableSeq<'V> [] - val inline internal map3<'T,'U,'V,'W> : map:('T->'U->'V->'W) -> source1:ISeq<'T> -> source2:ISeq<'U> -> source3:ISeq<'V> -> ISeq<'W> + val inline internal map3<'T,'U,'V,'W> : mapping:('T->'U->'V->'W) -> source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'U> -> source3:IConsumableSeq<'V> -> IConsumableSeq<'W> [] - val inline internal compareWith : f:('T->'T->int) -> source1 :ISeq<'T> -> source2:ISeq<'T> -> int + val inline internal compareWith : comparer:('T->'T->int) -> source1 :IConsumableSeq<'T> -> source2:IConsumableSeq<'T> -> int [] - val inline internal choose : f:('a->option<'b>) -> source: ISeq<'a> -> ISeq<'b> + val inline internal choose : f:('a->option<'b>) -> source: IConsumableSeq<'a> -> IConsumableSeq<'b> [] - val inline internal distinct : source:ISeq<'T> -> ISeq<'T> when 'T:equality + val inline internal distinct : source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'T:equality [] - val inline internal distinctBy : keyf:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key:equality + val inline internal distinctBy : keyf:('T->'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'Key:equality [] - val inline max : source:ISeq<'T> -> 'T when 'T:comparison + val inline max : source:IConsumableSeq<'T> -> 'T when 'T:comparison [] - val inline maxBy : f:('T->'U) -> source:ISeq<'T> -> 'T when 'U:comparison + val inline maxBy : f:('T->'U) -> source:IConsumableSeq<'T> -> 'T when 'U:comparison [] - val inline min : source:ISeq<'T> -> 'T when 'T:comparison + val inline min : source:IConsumableSeq<'T> -> 'T when 'T:comparison [] - val inline minBy : f:('T->'U) -> source:ISeq<'T> -> 'T when 'U:comparison + val inline minBy : f:('T->'U) -> source:IConsumableSeq<'T> -> 'T when 'U:comparison [] - val internal pairwise : source:ISeq<'T> -> ISeq<'T * 'T> + val internal pairwise : source:IConsumableSeq<'T> -> IConsumableSeq<'T * 'T> [] - val inline internal reduce : f:('T->'T->'T) -> source:ISeq<'T> -> 'T + val inline internal reduce : f:('T->'T->'T) -> source:IConsumableSeq<'T> -> 'T [] - val internal scan : folder:('State->'T->'State) -> initialState:'State -> source:ISeq<'T> -> ISeq<'State> + val internal scan : folder:('State->'T->'State) -> initialState:'State -> source:IConsumableSeq<'T> -> IConsumableSeq<'State> [] - val internal skip : skipCount:int -> source:ISeq<'T> -> ISeq<'T> + val internal skip : skipCount:int -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val inline internal skipWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> + val inline internal skipWhile : predicate:('T->bool) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val inline sum : source:ISeq<'T> -> 'T + val inline sum : source:IConsumableSeq<'T> -> 'T when 'T:(static member Zero : ^T) and 'T:(static member (+) : ^T * ^T -> ^T) [] - val inline sumBy : f :('T -> ^U) -> source:ISeq<'T> -> ^U + val inline sumBy : f :('T -> ^U) -> source:IConsumableSeq<'T> -> ^U when ^U:(static member Zero : ^U) and ^U:(static member (+) : ^U * ^U -> ^U) [] - val internal take : takeCount:int -> source:ISeq<'T> -> ISeq<'T> + val internal take : takeCount:int -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val inline internal takeWhile : predicate:('T->bool) -> source:ISeq<'T> -> ISeq<'T> + val inline internal takeWhile : predicate:('T->bool) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal tail : source:ISeq<'T> -> ISeq<'T> + val internal tail : source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal truncate : truncateCount:int -> source:ISeq<'T> -> ISeq<'T> + val internal truncate : truncateCount:int -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal indexed : source: ISeq<'a> -> ISeq + val internal indexed : source: IConsumableSeq<'a> -> IConsumableSeq [] - val internal tryItem : index:int -> source:ISeq<'T> -> option<'T> + val internal tryItem : index:int -> source:IConsumableSeq<'T> -> option<'T> [] - val inline internal tryPick : f:('T -> option<'U>) -> source:ISeq<'T> -> option<'U> + val inline internal tryPick : f:('T -> option<'U>) -> source:IConsumableSeq<'T> -> option<'U> [] - val inline internal tryFind : f:('T -> bool) -> source:ISeq<'T> -> option<'T> + val inline internal tryFind : f:('T -> bool) -> source:IConsumableSeq<'T> -> option<'T> [] - val inline internal tryFindIndex: predicate:('T->bool) -> source:ISeq<'T> -> option + val inline internal tryFindIndex: predicate:('T->bool) -> source:IConsumableSeq<'T> -> option [] - val internal last: source:ISeq<'T> -> 'T + val internal last: source:IConsumableSeq<'T> -> 'T [] - val internal tryLast : source:ISeq<'T> -> option<'T> + val internal tryLast : source:IConsumableSeq<'T> -> option<'T> [] - val internal windowed : windowSize:int -> source:ISeq<'T> -> ISeq> + val internal windowed : windowSize:int -> source:IConsumableSeq<'T> -> IConsumableSeq> [] - val internal concat : sources:ISeq<'Collection> -> ISeq<'T> when 'Collection :> ISeq<'T> + val internal concat : sources:IConsumableSeq<'Collection> -> IConsumableSeq<'T> when 'Collection :> IConsumableSeq<'T> [] - val internal append: source1:ISeq<'T> -> source2:ISeq<'T> -> ISeq<'T> + val internal append: source1:IConsumableSeq<'T> -> source2:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal delay : (unit -> ISeq<'T>) -> ISeq<'T> + val internal delay : (unit -> IConsumableSeq<'T>) -> IConsumableSeq<'T> [] - val inline internal groupByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : struct + val inline internal groupByVal : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * IConsumableSeq<'T>> when 'Key : equality and 'Key : struct [] - val inline internal groupByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality and 'Key : not struct + val inline internal groupByRef : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * IConsumableSeq<'T>> when 'Key : equality and 'Key : not struct [] - val inline internal countByVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : struct + val inline internal countByVal : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * int> when 'Key : equality and 'Key : struct [] - val inline internal countByRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality and 'Key : not struct + val inline internal countByRef : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * int> when 'Key : equality and 'Key : not struct [] - val internal length: source:ISeq<'T> -> int + val internal length: source:IConsumableSeq<'T> -> int [] - val internal toArray: source:ISeq<'T> -> array<'T> + val internal toArray: source:IConsumableSeq<'T> -> array<'T> [] - val internal toResizeArray: source:ISeq<'T> -> ResizeArray<'T> + val internal toResizeArray: source:IConsumableSeq<'T> -> ResizeArray<'T> [] - val internal sortBy : projection:('T->'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison + val internal sortBy : projection:('T->'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'Key : comparison [] - val internal sort : source:ISeq<'T> -> ISeq<'T> when 'T : comparison + val internal sort : source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'T : comparison [] - val sortWith : comparer:('T->'T->int) -> source:ISeq<'T> -> ISeq<'T> + val sortWith : comparer:('T->'T->int) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal rev: source:ISeq<'T> -> ISeq<'T> + val internal rev: source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal permute: indexMap:(int->int) -> source:ISeq<'T> -> ISeq<'T> + val internal permute: indexMap:(int->int) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal scanBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> ISeq<'State> + val internal scanBack<'T,'State> : folder:('T->'State->'State) -> source:IConsumableSeq<'T> -> state:'State -> IConsumableSeq<'State> [] - val internal zip: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> + val internal zip: source1:IConsumableSeq<'T1> -> source2:IConsumableSeq<'T2> -> IConsumableSeq<'T1 * 'T2> [] - val inline internal reduceBack: reduction:('T->'T->'T) -> source:ISeq<'T> -> 'T + val inline internal reduceBack: reduction:('T->'T->'T) -> source:IConsumableSeq<'T> -> 'T [] - val inline internal foldBack<'T,'State> : folder:('T->'State->'State) -> source:ISeq<'T> -> state:'State -> 'State + val inline internal foldBack<'T,'State> : folder:('T->'State->'State) -> source:IConsumableSeq<'T> -> state:'State -> 'State [] - val inline internal foldBack2<'T1,'T2,'State> : folder:('T1->'T2->'State->'State) -> source1:ISeq<'T1> -> source2:ISeq<'T2> -> state:'State -> 'State + val inline internal foldBack2<'T1,'T2,'State> : folder:('T1->'T2->'State->'State) -> source1:IConsumableSeq<'T1> -> source2:IConsumableSeq<'T2> -> state:'State -> 'State module internal GroupBy = - val inline byVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality - val inline byRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * ISeq<'T>> when 'Key : equality + val inline byVal : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * IConsumableSeq<'T>> when 'Key : equality + val inline byRef : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * IConsumableSeq<'T>> when 'Key : equality module internal CountBy = - val inline byVal : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality - val inline byRef : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'Key * int> when 'Key : equality + val inline byVal : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * int> when 'Key : equality + val inline byRef : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'Key * int> when 'Key : equality [] - val internal cache: source:ISeq<'T> -> ISeq<'T> + val internal cache: source:IConsumableSeq<'T> -> IConsumableSeq<'T> [] - val internal collect: mapping:('T -> 'Collection) -> source:ISeq<'T> -> ISeq<'U> when 'Collection :> ISeq<'U> + val internal collect: mapping:('T -> 'Collection) -> source:IConsumableSeq<'T> -> IConsumableSeq<'U> when 'Collection :> IConsumableSeq<'U> [] - val internal allPairs: source1:ISeq<'T1> -> source2:ISeq<'T2> -> ISeq<'T1 * 'T2> + val internal allPairs: source1:IConsumableSeq<'T1> -> source2:IConsumableSeq<'T2> -> IConsumableSeq<'T1 * 'T2> [] - val internal toList: source:ISeq<'T> -> 'T list + val internal toList: source:IConsumableSeq<'T> -> 'T list [] - val internal replicate: count:int -> initial:'T -> ISeq<'T> + val internal replicate: count:int -> initial:'T -> IConsumableSeq<'T> [] - val internal isEmpty: source:ISeq<'T> -> bool + val internal isEmpty: source:IConsumableSeq<'T> -> bool [] - val internal cast: source:IEnumerable -> ISeq<'T> + val internal cast: source:IEnumerable -> IConsumableSeq<'T> [] - val internal chunkBySize: chunkSize:int -> source:ISeq<'T> -> ISeq<'T[]> + val internal chunkBySize: chunkSize:int -> source:IConsumableSeq<'T> -> IConsumableSeq<'T[]> [] - val internal splitInto: count:int -> source:ISeq<'T> -> ISeq<'T[]> + val internal splitInto: count:int -> source:IConsumableSeq<'T> -> IConsumableSeq<'T[]> [] - val internal find: predicate:('T -> bool) -> source:ISeq<'T> -> 'T + val internal find: predicate:('T -> bool) -> source:IConsumableSeq<'T> -> 'T [] - val internal findBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T + val internal findBack: predicate:('T -> bool) -> source:IConsumableSeq<'T> -> 'T [] - val internal findIndex: predicate:('T -> bool) -> source:ISeq<'T> -> int + val internal findIndex: predicate:('T -> bool) -> source:IConsumableSeq<'T> -> int [] - val internal findIndexBack: predicate:('T -> bool) -> source:ISeq<'T> -> int + val internal findIndexBack: predicate:('T -> bool) -> source:IConsumableSeq<'T> -> int [] - val internal pick: chooser:('T -> 'U option) -> source:ISeq<'T> -> 'U + val internal pick: chooser:('T -> 'U option) -> source:IConsumableSeq<'T> -> 'U [] - val internal mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:ISeq<'T> -> ISeq<'Result> * 'State + val internal mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> source:IConsumableSeq<'T> -> IConsumableSeq<'Result> * 'State [] - val internal mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:ISeq<'T> -> state:'State -> ISeq<'Result> * 'State + val internal mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> source:IConsumableSeq<'T> -> state:'State -> IConsumableSeq<'Result> * 'State [] - val internal item: index:int -> source:ISeq<'T> -> 'T + val internal item: index:int -> source:IConsumableSeq<'T> -> 'T [] - val internal singleton: value:'T -> ISeq<'T> + val internal singleton: value:'T -> IConsumableSeq<'T> [] - val inline sortDescending : source:ISeq<'T> -> ISeq<'T> when 'T : comparison + val inline sortDescending : source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'T : comparison [] - val inline sortByDescending : projection:('T -> 'Key) -> source:ISeq<'T> -> ISeq<'T> when 'Key : comparison + val inline sortByDescending : projection:('T -> 'Key) -> source:IConsumableSeq<'T> -> IConsumableSeq<'T> when 'Key : comparison [] - val internal tryFindBack: predicate:('T -> bool) -> source:ISeq<'T> -> 'T option + val internal tryFindBack: predicate:('T -> bool) -> source:IConsumableSeq<'T> -> 'T option [] - val internal tryFindIndexBack : predicate:('T -> bool) -> source:ISeq<'T> -> int option + val internal tryFindIndexBack : predicate:('T -> bool) -> source:IConsumableSeq<'T> -> int option [] - val internal zip3: source1:ISeq<'T1> -> source2:ISeq<'T2> -> source3:ISeq<'T3> -> ISeq<'T1 * 'T2 * 'T3> + val internal zip3: source1:IConsumableSeq<'T1> -> source2:IConsumableSeq<'T2> -> source3:IConsumableSeq<'T3> -> IConsumableSeq<'T1 * 'T2 * 'T3> diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index 3d0f67ecda1..c0d7c26c17c 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -541,8 +541,9 @@ module internal List = res <- arr.[i] :: res res - type FoldToList<'T> () = - inherit Folder<'T, list<'T>>([]) + /// A consumer that collects elements as a list + type ConsumeToList<'T> () = + inherit SeqConsumer<'T, list<'T>>([]) let mutable first = true let mutable cons = Unchecked.defaultof<_> @@ -562,14 +563,14 @@ module internal List = if not first then setFreshConsTail cons [] - let ofISeq (s : ISeq<'T>) = - s.Fold (fun _ -> upcast FoldToList()) + let ofConsumableSeq (s : IConsumableSeq<'T>) = + s.Consume (fun _ -> upcast ConsumeToList()) let inline ofSeq (e : IEnumerable<'T>) = match e with | :? list<'T> as l -> l | :? ('T[]) as arr -> ofArray arr - | :? ISeq<'T> as s -> ofISeq s + | :? IConsumableSeq<'T> as s -> ofConsumableSeq s | _ -> use ie = e.GetEnumerator() if not (ie.MoveNext()) then [] @@ -1013,73 +1014,6 @@ module internal Array = open System.Collections.Generic open Microsoft.FSharp.Collections.SeqComposition -#if FX_NO_ARRAY_KEY_SORT - // Mimic behavior of BCL QSort routine, used under the hood by various array sorting APIs - let qsort<'Key,'Value>(keys : 'Key[], values : 'Value[], start : int, last : int, comparer : IComparer<'Key>) = - let valuesExist = - match values with - | null -> false - | _ -> true - - let swap (p1, p2) = - let tk = keys.[p1] - keys.[p1] <- keys.[p2] - keys.[p2] <- tk - if valuesExist then - let tv = values.[p1] - values.[p1] <- values.[p2] - values.[p2] <- tv - - let partition (left, right, pivot) = - let value = keys.[pivot] - swap (pivot, right) - let mutable store = left - - for i in left..(right - 1) do - if comparer.Compare(keys.[i],value) < 0 then - swap(i, store) - store <- store + 1 - - swap (store, right) - store - - let rec qs (left, right) = - if left < right then - let pivot = left + (right-left)/2 - let newpivot = partition(left,right,pivot) - qs(left,newpivot - 1) - qs(newpivot+1,right) - - qs(start, last) - - type System.Array with - static member Sort<'Key,'Value>(keys : 'Key[], values : 'Value[], comparer : IComparer<'Key>) = - let valuesExist = - match values with - | null -> false - | _ -> true - match keys,values with - | null,_ -> raise (ArgumentNullException()) - | _,_ when valuesExist && (keys.Length <> values.Length) -> raise (ArgumentException()) - | _,_ -> qsort(keys, values, 0, keys.Length-1, comparer) - - static member Sort<'Key,'Value when 'Key : comparison>(keys : 'Key[], values : 'Value[]) = - let valuesExist = - match values with - | null -> false - | _ -> true - match keys,values with - | null,_ -> raise (ArgumentNullException()) - | _,_ when valuesExist && (keys.Length <> values.Length) -> raise (ArgumentException()) - | _,_ -> qsort(keys,values,0,keys.Length-1,LanguagePrimitives.FastGenericComparer<'Key>) - - static member Sort<'Key,'Value>(keys : 'Key[], values : 'Value[], start : int, length : int, comparer : IComparer<'Key>) = - match keys with - | null -> raise (ArgumentNullException()) - | _ -> qsort(keys,values,start,start+length-1,comparer) -#else -#endif - let inline fastComparerForArraySort<'t when 't : comparison> () = LanguagePrimitives.FastGenericComparerCanBeNull<'t> @@ -1172,7 +1106,7 @@ module internal Array = res.[i - start] <- state res - let unstableSortInPlaceBy (projection: 'T -> 'U) (array : array<'T>) = + let unstableSortInPlaceBy (projection: 'T -> 'U) (array : 'T[]) = let len = array.Length if len < 2 then () else @@ -1181,19 +1115,19 @@ module internal Array = keys.[i] <- projection array.[i] Array.Sort<_,_>(keys, array, fastComparerForArraySort()) - let unstableSortInPlace (array : array<'T>) = + let unstableSortInPlace (array : 'T[]) = let len = array.Length if len < 2 then () else Array.Sort<_>(array, fastComparerForArraySort()) - let stableSortWithKeysAndComparer (cFast:IComparer<'Key>) (c:IComparer<'Key>) (array:array<'T>) (keys:array<'Key>) = + let stableSortWithKeysAndComparer (cFast:IComparer<'Key>) (c:IComparer<'Key>) (array:'T[]) (keys:array<'Key>) = // 'places' is an array or integers storing the permutation performed by the sort let places = zeroCreateUnchecked array.Length for i = 0 to array.Length - 1 do places.[i] <- i System.Array.Sort<_,_>(keys, places, cFast) // 'array2' is a copy of the original values - let array2 = (array.Clone() :?> array<'T>) + let array2 = (array.Clone() :?> 'T[]) // Walk through any chunks where the keys are equal let mutable i = 0 @@ -1212,12 +1146,12 @@ module internal Array = Array.Sort<_,_>(places, array, i, j-i, intCompare) i <- j - let stableSortWithKeys (array:array<'T>) (keys:array<'Key>) = + let stableSortWithKeys (array:'T[]) (keys:array<'Key>) = let cFast = fastComparerForArraySort() let c = LanguagePrimitives.FastGenericComparer<'Key> stableSortWithKeysAndComparer cFast c array keys - let stableSortInPlaceBy (projection: 'T -> 'U) (array : array<'T>) = + let stableSortInPlaceBy (projection: 'T -> 'U) (array : 'T[]) = let len = array.Length if len < 2 then () else @@ -1227,7 +1161,7 @@ module internal Array = keys.[i] <- projection array.[i] stableSortWithKeys array keys - let stableSortInPlace (array : array<'T>) = + let stableSortInPlace (array : 'T[]) = let len = array.Length if len < 2 then () else @@ -1239,13 +1173,13 @@ module internal Array = Array.Sort<_,_>(array, null) | _ -> // 'keys' is an array storing the projected keys - let keys = (array.Clone() :?> array<'T>) + let keys = (array.Clone() :?> 'T[]) stableSortWithKeys array keys - let stableSortInPlaceWith (comparer:'T -> 'T -> int) (array : array<'T>) = + let stableSortInPlaceWith (comparer:'T -> 'T -> int) (array : 'T[]) = let len = array.Length if len > 1 then - let keys = (array.Clone() :?> array<'T>) + let keys = (array.Clone() :?> 'T[]) let comparer = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(comparer) let c = { new IComparer<'T> with member __.Compare(x,y) = comparer.Invoke(x,y) } stableSortWithKeysAndComparer c c array keys @@ -1267,29 +1201,29 @@ module internal Array = let count = min count len let res = zeroCreateUnchecked count : 'T[][] let minChunkSize = len / count - let startIndex = ref 0 + let mutable startIndex = 0 for i = 0 to len % count - 1 do - res.[i] <- subUnchecked !startIndex (minChunkSize + 1) array - startIndex := !startIndex + minChunkSize + 1 + res.[i] <- subUnchecked startIndex (minChunkSize + 1) array + startIndex <- startIndex + minChunkSize + 1 for i = len % count to count - 1 do - res.[i] <- subUnchecked !startIndex minChunkSize array - startIndex := !startIndex + minChunkSize + res.[i] <- subUnchecked startIndex minChunkSize array + startIndex <- startIndex + minChunkSize res - type FoldToArray<'T> () = - inherit Folder<'T, array<'T>>(Unchecked.defaultof<_>) + type ConsumeToArray<'T> () = + inherit SeqConsumer<'T, 'T[]>(Unchecked.defaultof<_>) let mutable tmp = ResizeArray () override this.ProcessNext input = tmp.Add input - true (* result unused in fold *) + true (* result unused *) override this.ChainComplete _ = this.Result <- tmp.ToArray () - let ofISeq (s : ISeq<'T>) = - s.Fold (fun _ -> upcast FoldToArray()) + let ofConsumableSeq (s : IConsumableSeq<'T>) = + s.Consume (fun _ -> upcast ConsumeToArray()) let ofSeq (source : seq<'T>) = match source with @@ -1301,8 +1235,7 @@ module internal Array = let arr = zeroCreateUnchecked res.Count res.CopyTo(arr, 0) arr - | :? ISeq<'T> as s -> ofISeq s -#if !FSCORE_PORTABLE_OLD + | :? IConsumableSeq<'T> as s -> ofConsumableSeq s | :? IReadOnlyCollection<'T> as col -> let res = zeroCreateUnchecked col.Count : 'T[] let mutable idx = 0 @@ -1310,24 +1243,23 @@ module internal Array = res.[idx] <- x idx <- idx + 1 res -#endif | _ -> let res = ResizeArray source res.ToArray() - let toSeq (source : array<'T>) : seq<'T> = + let toSeq (source : 'T[]) : seq<'T> = { new IEnumerable<'T> with member this.GetEnumerator(): Collections.IEnumerator = (source:>System.Collections.IEnumerable).GetEnumerator () member this.GetEnumerator(): IEnumerator<'T> = (source:>IEnumerable<'T>).GetEnumerator () } -module internal ISeq = +module internal IConsumableSeq = open Microsoft.FSharp.Collections.SeqComposition - let length (source:ISeq<_>) = - source.Fold (fun _ -> - { new Folder<'T,int>(0) with + let length (source:IConsumableSeq<_>) = + source.Consume (fun _ -> + { new SeqConsumer<'T,int>(0) with override this.ProcessNext v = this.Result <- this.Result + 1 Unchecked.defaultof<_> (* return value unused in Fold context *) }) diff --git a/src/fsharp/FSharp.Core/local.fsi b/src/fsharp/FSharp.Core/local.fsi index 2100295fa65..08446419feb 100644 --- a/src/fsharp/FSharp.Core/local.fsi +++ b/src/fsharp/FSharp.Core/local.fsi @@ -62,7 +62,7 @@ module internal List = val take : int -> 'T list -> 'T list val takeWhile : ('T -> bool) -> 'T list -> 'T list val toArray : 'T list -> 'T[] - val ofISeq : ISeq<'T> -> 'T List + val ofConsumableSeq : IConsumableSeq<'T> -> 'T List val inline ofSeq : seq<'T> -> 'T List val splitAt : int -> 'T list -> ('T list * 'T list) val transpose : 'T list list -> 'T list list @@ -87,8 +87,9 @@ module internal Array = val stableSortInPlaceBy: projection:('T -> 'Key) -> array:'T[] -> unit when 'Key : comparison val stableSortInPlaceWith: comparer:('T -> 'T -> int) -> array:'T[] -> unit val stableSortInPlace: array:'T[] -> unit when 'T : comparison - val ofSeq : seq<'T> -> array<'T> - val toSeq : array<'T> -> seq<'T> + val ofSeq : seq<'T> -> 'T[] + val ofConsumableSeq : IConsumableSeq<'T> -> 'T[] + val toSeq : 'T[] -> seq<'T> -module internal ISeq = - val length : ISeq<'T> -> int \ No newline at end of file +module internal IConsumableSeq = + val length : IConsumableSeq<'T> -> int \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 054c68df83f..922f5a57bba 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -2979,36 +2979,36 @@ namespace Microsoft.FSharp.Collections.SeqComposition type PipeIdx = int - type IOutOfBand = + type ISeqConsumer = abstract StopFurtherProcessing : PipeIdx -> unit abstract ListenForStopFurtherProcessing : Action -> unit [] - type Activity() = + type SeqConsumerActivity() = abstract ChainComplete : PipeIdx -> unit abstract ChainDispose : unit -> unit [] - type Activity<'T> () = - inherit Activity() + type SeqConsumerActivity<'T> () = + inherit SeqConsumerActivity() abstract ProcessNext : input:'T -> bool [] - type Activity<'T,'U> () = - inherit Activity<'T>() + type SeqConsumerActivity<'T,'U> () = + inherit SeqConsumerActivity<'T>() [] - type Folder<'T,'Result>(initalResult:'Result) = - inherit Activity<'T,'T>() + type SeqConsumer<'T,'Result>(initalResult:'Result) = + inherit SeqConsumerActivity<'T,'T>() let mutable listeners = BasicInlinedOperations.unsafeDefault> let mutable result = initalResult let mutable haltedIdx = 0 - member __.Result with get () = result and set value = result <- value - member __.HaltedIdx with get () = haltedIdx + member __.Result with get() = result and set value = result <- value + member __.HaltedIdx = haltedIdx - interface IOutOfBand with + interface ISeqConsumer with member this.StopFurtherProcessing pipeIdx = let currentIdx = haltedIdx haltedIdx <- pipeIdx @@ -3023,13 +3023,13 @@ namespace Microsoft.FSharp.Collections.SeqComposition override this.ChainComplete _ = () override this.ChainDispose () = () - type ITransformFactory<'T,'U> = - abstract Compose<'V> : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + type ISeqTransform<'T,'U> = + abstract Compose<'V> : ISeqConsumer -> PipeIdx -> SeqConsumerActivity<'U,'V> -> SeqConsumerActivity<'T,'V> - type ISeq<'T> = + type IConsumableSeq<'T> = inherit IEnumerable<'T> - abstract member PushTransform<'U> : ITransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + abstract member Transform<'U> : ISeqTransform<'T,'U> -> IConsumableSeq<'U> + abstract member Consume<'Result> : getConsumer:(PipeIdx->SeqConsumer<'T,'Result>) -> 'Result namespace Microsoft.FSharp.Collections @@ -3055,7 +3055,7 @@ namespace Microsoft.FSharp.Collections type List<'T> = | ([]) : 'T list | (::) : Head: 'T * Tail: 'T list -> 'T list - interface Microsoft.FSharp.Collections.SeqComposition.ISeq<'T> + interface Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq<'T> interface System.Collections.Generic.IEnumerable<'T> interface System.Collections.IEnumerable interface System.Collections.Generic.IReadOnlyCollection<'T> @@ -3204,16 +3204,16 @@ namespace Microsoft.FSharp.Collections loop n l module ListSeqImplementation = - type ComposedFactory<'T,'U,'V> private (first:ITransformFactory<'T,'U>, second:ITransformFactory<'U,'V>) = - interface ITransformFactory<'T,'V> with - member this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + type CompositionTransform<'T,'U,'V> private (first:ISeqTransform<'T,'U>, second:ISeqTransform<'U,'V>) = + interface ISeqTransform<'T,'V> with + member this.Compose<'W> (outOfBand:ISeqConsumer) (pipeIdx:PipeIdx) (next:SeqConsumerActivity<'V,'W>) : SeqConsumerActivity<'T,'W> = first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - static member Combine (first:ITransformFactory<'T,'U>) (second:ITransformFactory<'U,'V>) : ITransformFactory<'T,'V> = - upcast ComposedFactory(first, second) + static member Combine (first:ISeqTransform<'T,'U>) (second:ISeqTransform<'U,'V>) : ISeqTransform<'T,'V> = + upcast CompositionTransform(first, second) type Result<'T>() = - inherit Folder<'T,'T>(unsafeDefault<'T>) + inherit SeqConsumer<'T,'T>(unsafeDefault<'T>) member val SeqState = 1(*NotStarted*) with get, set @@ -3221,7 +3221,7 @@ namespace Microsoft.FSharp.Collections this.Result <- input true - type ListEnumerator<'T,'U>(alist:list<'T>, activity:Activity<'T,'U>, result:Result<'U>) = + type ListEnumerator<'T,'U>(alist:list<'T>, activity:SeqConsumerActivity<'T,'U>, result:Result<'U>) = let mutable list = alist let rec moveNext current = @@ -3255,7 +3255,7 @@ namespace Microsoft.FSharp.Collections elif result.SeqState = 1(*NotStarted*) then PrivateListHelpers.notStarted() else PrivateListHelpers.alreadyFinished() - type ListEnumerable<'T,'U>(alist:list<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type ListEnumerable<'T,'U>(alist:list<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = interface System.Collections.IEnumerable with member this.GetEnumerator () : System.Collections.IEnumerator = upcast (this :> IEnumerable<'U>).GetEnumerator () @@ -3263,16 +3263,16 @@ namespace Microsoft.FSharp.Collections interface System.Collections.Generic.IEnumerable<'U> with member this.GetEnumerator () : System.Collections.Generic.IEnumerator<'U> = let result = Result<'U> () - let activity = transformFactory.Compose (result :> IOutOfBand) pipeIdx result + let activity = transform.Compose (result :> ISeqConsumer) pipeIdx result upcast (new ListEnumerator<'T,'U>(alist, activity, result)) - interface ISeq<'U> with - member __.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = - upcast (new ListEnumerable<'T,'V>(alist, ComposedFactory.Combine transformFactory next, pipeIdx+1)) + interface IConsumableSeq<'U> with + member __.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = + upcast (new ListEnumerable<'T,'V>(alist, CompositionTransform.Combine transform next, pipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + member this.Consume<'Result> (createFolder:PipeIdx->SeqConsumer<'U,'Result>) = let result = createFolder (pipeIdx+1) - let consumer = transformFactory.Compose (result :> IOutOfBand) pipeIdx result + let consumer = transform.Compose (result :> ISeqConsumer) pipeIdx result try let mutable lst = alist while @@ -3329,11 +3329,11 @@ namespace Microsoft.FSharp.Collections if i > j then [] else PrivateListHelpers.sliceTake (j-i) (PrivateListHelpers.sliceSkip i l) - interface ISeq<'T> with - member this.PushTransform<'U> (next:ITransformFactory<'T,'U>) = + interface IConsumableSeq<'T> with + member this.Transform<'U> (next:ISeqTransform<'T,'U>) = upcast (new ListSeqImplementation.ListEnumerable<'T,'U>(this, next, 1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = + member this.Consume<'Result> (createFolder:PipeIdx->SeqConsumer<'T,'Result>) = let result = createFolder 1 try let mutable lst = this @@ -4698,27 +4698,27 @@ namespace Microsoft.FSharp.Core | Running = 1 | Finished = 2 - type ComposedFactory<'T,'U,'V> private (first:ITransformFactory<'T,'U>, second:ITransformFactory<'U,'V>) = - interface ITransformFactory<'T,'V> with - member this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + type CompositionTransform<'T,'U,'V> private (first:ISeqTransform<'T,'U>, second:ISeqTransform<'U,'V>) = + interface ISeqTransform<'T,'V> with + member this.Compose<'W> (outOfBand:ISeqConsumer) (pipeIdx:PipeIdx) (next:SeqConsumerActivity<'V,'W>) : SeqConsumerActivity<'T,'W> = first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - static member Combine (first:ITransformFactory<'T,'U>) (second:ITransformFactory<'U,'V>) : ITransformFactory<'T,'V> = - upcast ComposedFactory(first, second) + static member Combine (first:ISeqTransform<'T,'U>) (second:ISeqTransform<'U,'V>) : ISeqTransform<'T,'V> = + upcast CompositionTransform(first, second) - type IdentityFactory<'T> private () = - static let singleton : ITransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + type IdentityTransform<'T> private () = + static let singleton : ISeqTransform<'T,'T> = upcast (IdentityTransform<'T>()) static member Instance = singleton - interface ITransformFactory<'T,'T> with - member __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + interface ISeqTransform<'T,'T> with + member __.Compose<'V> (_outOfBand:ISeqConsumer) (_pipeIdx:PipeIdx) (next:SeqConsumerActivity<'T,'V>) : SeqConsumerActivity<'T,'V> = next type SetResultToInput<'T>() = - inherit Folder<'T,'T>(Unchecked.defaultof<'T>) + inherit SeqConsumer<'T,'T>(Unchecked.defaultof<'T>) override this.ProcessNext (input:'T) : bool = this.Result <- input true - type SeqSourceEnumerator<'T,'U>(source:IEnumerator<'T>, activity:Activity<'T,'U>, folder:SetResultToInput<'U>) = + type SeqSourceEnumerator<'T,'U>(source:IEnumerator<'T>, activity:SeqConsumerActivity<'T,'U>, folder:SetResultToInput<'U>) = let mutable state = Mode.NotStarted let rec moveNext () = @@ -4755,41 +4755,41 @@ namespace Microsoft.FSharp.Core finally activity.ChainDispose () - type ISeqSource<'T> = + type IConsumableSeqSource<'T> = abstract member GetEnumerator : unit -> IEnumerator<'T> - abstract member Fold<'Result,'U> : f:(PipeIdx->Folder<'U,'Result>) -> ITransformFactory<'T,'U> -> PipeIdx -> 'Result + abstract member Consume<'Result,'U> : f:(PipeIdx->SeqConsumer<'U,'Result>) -> ISeqTransform<'T,'U> -> PipeIdx -> 'Result - type SeqSourceEnumerable<'T,'U>(source:ISeqSource<'T>, current:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = + type SeqSourceEnumerable<'T,'U>(source:IConsumableSeqSource<'T>, current:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = interface IEnumerable<'U> with member __.GetEnumerator () = let folder = SetResultToInput<'U>() - upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> IOutOfBand) pipeIdx folder, folder)) + upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> ISeqConsumer) pipeIdx folder, folder)) interface IEnumerable with member __.GetEnumerator () = let folder = SetResultToInput<'U>() - upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> IOutOfBand) pipeIdx folder, folder)) + upcast (new SeqSourceEnumerator<'T,'U>(source.GetEnumerator (), current.Compose (folder :> ISeqConsumer) pipeIdx folder, folder)) - interface ISeq<'U> with - member __.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = - upcast (new SeqSourceEnumerable<'T,'V>(source, ComposedFactory.Combine current next, pipeIdx+1)) + interface IConsumableSeq<'U> with + member __.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = + upcast (new SeqSourceEnumerable<'T,'V>(source, CompositionTransform.Combine current next, pipeIdx+1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - source.Fold f current pipeIdx + member this.Consume<'Result> (f:PipeIdx->SeqConsumer<'U,'Result>) = + source.Consume f current pipeIdx - type SeqSourceEnumerableThin<'U>(source:ISeqSource<'U>) = + type SeqSourceEnumerableThin<'U>(source:IConsumableSeqSource<'U>) = interface IEnumerable<'U> with member __.GetEnumerator () = source.GetEnumerator () interface IEnumerable with member __.GetEnumerator () = upcast (source.GetEnumerator ()) - interface ISeq<'U> with - member __.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member __.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new SeqSourceEnumerable<'U,'V>(source, next, 1)) - member this.Fold<'Result> (f:PipeIdx->Folder<'U,'Result>) = - source.Fold f IdentityFactory.Instance 1 + member this.Consume<'Result> (f:PipeIdx->SeqConsumer<'U,'Result>) = + source.Consume f IdentityTransform.Instance 1 [] type BaseRangeEnumerator<'T>() = @@ -5005,11 +5005,12 @@ namespace Microsoft.FSharp.Core false else false } - let source = { new ISeqSource<'T> with + let source = + { new IConsumableSeqSource<'T> with member __.GetEnumerator () = singleStepRangeEnumerator () - member __.Fold<'Result,'Output> (createFolder:PipeIdx->Folder<'Output,'Result>) (transformFactory:ITransformFactory<'T,'Output>) pipeIdx : 'Result = + member __.Consume<'Result,'Output> (createFolder:PipeIdx->SeqConsumer<'Output,'Result>) (transform:ISeqTransform<'T,'Output>) pipeIdx : 'Result = let result = createFolder (pipeIdx+1) - let consumer = transformFactory.Compose (result :> IOutOfBand) pipeIdx result + let consumer = transform.Compose (result :> ISeqConsumer) pipeIdx result try let mutable i : 'T = n while result.HaltedIdx = 0 && i <= m do diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 7199c36877c..b1b8124b088 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1755,65 +1755,73 @@ namespace Microsoft.FSharp.Collections.SeqComposition /// source of the chain. type PipeIdx = int - /// Used within the pipline to provide out of band communications - type IOutOfBand = + /// Represents the overall executing consumer and its chain of activities. Used within the + /// pipline to provide "out of band" communications affecting the overall Consume + /// operation, such as early termination. + type ISeqConsumer = + /// Stop the processing of any further items down the pipeline abstract StopFurtherProcessing : PipeIdx -> unit + /// Add a Action delegate that gets notified if StopFurtherProcessing is called abstract ListenForStopFurtherProcessing : Action -> unit - /// Activity is the root class for chains of activities. It is in a non-generic + /// SeqConsumerActivity is the root class for chains of activities. It is in a non-generic /// form so that it can be used by subsequent activities [] - type Activity = - /// OnComplete is used to determine if the object has been processed correctly, + type SeqConsumerActivity = + + /// ChainComplete is called at the end of processing and can + /// set the overall result. It can also determine if the object has been processed correctly, /// and possibly throw exceptions to denote incorrect application (i.e. such as a Take /// operation which didn't have a source at least as large as was required). It is /// not called in the case of an exception being thrown whilst the stream is still /// being processed. abstract ChainComplete : PipeIdx -> unit - /// OnDispose is used to cleanup the stream. It is always called at the last operation + + /// ChainDispose is used to cleanup the stream. It is always called at the last operation /// after the enumeration has completed. abstract ChainDispose : unit -> unit - /// Activity is the base class of all elements within the pipeline + /// SeqConsumerActivity is the base class of all elements within the pipeline [] - type Activity<'T> = - inherit Activity - new : unit -> Activity<'T> + type SeqConsumerActivity<'T> = + inherit SeqConsumerActivity + new : unit -> SeqConsumerActivity<'T> + + /// Process an element from the sequence abstract member ProcessNext : input:'T -> bool - /// Activity is the base class of all elements within the pipeline, carrying result type + /// SeqConsumerActivity is the base class of all elements within the pipeline, carrying result type [] - type Activity<'T,'U> = - inherit Activity<'T> - new : unit -> Activity<'T,'U> + type SeqConsumerActivity<'T,'U> = + inherit SeqConsumerActivity<'T> + new : unit -> SeqConsumerActivity<'T,'U> - /// Folder is a base class to assist with fold-like operations. It's intended usage + /// SeqConsumer is a base class to assist with fold-like operations. It's intended usage /// is as a base class for an object expression that will be used from within /// the Fold function. [] - type Folder<'T,'Result> = - inherit Activity<'T,'T> - new : 'Result -> Folder<'T,'Result> - interface IOutOfBand + type SeqConsumer<'T,'Result> = + inherit SeqConsumerActivity<'T,'T> + new : 'Result -> SeqConsumer<'T,'Result> + interface ISeqConsumer member Result : 'Result with get, set member HaltedIdx : PipeIdx with get override ChainComplete : PipeIdx -> unit override ChainDispose : unit -> unit - /// ITransformFactory provides composition of Activities. Its intended to have a specialization - /// for each type of ISeq Activity. ISeq's PushTransform method is used to build a stack + /// ISeqTransform provides composition of Activities. Its intended to have a specialization + /// for each type of SeqConsumerActivity. IConsumableSeq's Transform method is used to build a stack /// of Actvities that will be composed. - type ITransformFactory<'T,'U> = - abstract member Compose : IOutOfBand -> PipeIdx -> Activity<'U,'V> -> Activity<'T,'V> + type ISeqTransform<'T,'U> = + abstract member Compose : outOfBand: ISeqConsumer -> pipeIdx: PipeIdx -> activity: SeqConsumerActivity<'U,'V> -> SeqConsumerActivity<'T,'V> - /// ISeq<'T> is an extension to seq<'T> that provides the avilty to compose Activities - /// as well as Fold the current Activity pipeline. - type ISeq<'T> = + /// IConsumableSeq<'T> is an extension to seq<'T> that can be consumed using a composition of Activities. + type IConsumableSeq<'T> = inherit System.Collections.Generic.IEnumerable<'T> - abstract member PushTransform : ITransformFactory<'T,'U> -> ISeq<'U> - abstract member Fold<'Result> : f:(PipeIdx->Folder<'T,'Result>) -> 'Result + abstract member Transform<'U> : ISeqTransform<'T,'U> -> IConsumableSeq<'U> + abstract member Consume<'Result> : getConsumer:(PipeIdx -> SeqConsumer<'T,'Result>) -> 'Result namespace Microsoft.FSharp.Collections @@ -1867,7 +1875,7 @@ namespace Microsoft.FSharp.Collections /// The list with head appended to the front of tail. static member Cons : head:'T * tail:'T list -> 'T list - interface Microsoft.FSharp.Collections.SeqComposition.ISeq<'T> + interface Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq<'T> interface IEnumerable<'T> interface IEnumerable interface IReadOnlyCollection<'T> diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index b1cd0576c5b..6581de96610 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -48,19 +48,19 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.IEnumerator // these helpers are just to consolidate the null checking - let inline toISeq (source:seq<'T>) : ISeq<'T> = checkNonNull "source" source; ISeq.ofSeq source - let inline toISeq1 (source1:seq<'T>) : ISeq<'T> = checkNonNull "source1" source1; ISeq.ofSeq source1 - let inline toISeq2 (source2:seq<'T>) : ISeq<'T> = checkNonNull "source2" source2; ISeq.ofSeq source2 - let inline toISeq3 (source3:seq<'T>) : ISeq<'T> = checkNonNull "source3" source3; ISeq.ofSeq source3 - let inline toISeqs (sources:seq<'T>) : ISeq<'T> = checkNonNull "sources" sources; ISeq.ofSeq sources + let inline toIConsumableSeq (source:seq<'T>) : IConsumableSeq<'T> = checkNonNull "source" source; IConsumableSeq.ofSeq source + let inline toIConsumableSeq1 (source1:seq<'T>) : IConsumableSeq<'T> = checkNonNull "source1" source1; IConsumableSeq.ofSeq source1 + let inline toIConsumableSeq2 (source2:seq<'T>) : IConsumableSeq<'T> = checkNonNull "source2" source2; IConsumableSeq.ofSeq source2 + let inline toIConsumableSeq3 (source3:seq<'T>) : IConsumableSeq<'T> = checkNonNull "source3" source3; IConsumableSeq.ofSeq source3 + let inline toIConsumableSeqs (sources:seq<'T>) : IConsumableSeq<'T> = checkNonNull "sources" sources; IConsumableSeq.ofSeq sources - let getRaw (source:ISeq<_>) = + let getRaw (source:IConsumableSeq<_>) = match source with | :? Core.EnumerableBase<'T> as s -> s.GetRaw () | _ -> upcast source - let rawOrOriginal (raw:seq<_>) (original:ISeq<_>) = - if obj.ReferenceEquals (raw, original) then original else toISeq raw + let rawOrOriginal (raw:seq<_>) (original:IConsumableSeq<_>) = + if obj.ReferenceEquals (raw, original) then original else toIConsumableSeq raw let mkDelayedSeq (f: unit -> IEnumerable<'T>) = mkSeq (fun () -> f().GetEnumerator()) @@ -69,26 +69,26 @@ namespace Microsoft.FSharp.Collections [] let unfold generator state = - ISeq.unfold generator state :> seq<_> + IConsumableSeq.unfold generator state :> seq<_> [] let empty<'T> = (EmptyEnumerable :> seq<'T>) [] let initInfinite initializer = - ISeq.initInfinite initializer :> seq<_> + IConsumableSeq.initInfinite initializer :> seq<_> [] let init count initializer = - ISeq.init count initializer :> seq<_> + IConsumableSeq.init count initializer :> seq<_> [] let iter action (source:seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.iter action arr | :? list<'T> as lst -> List.iter action lst - | raw -> ISeq.iter action (rawOrOriginal raw original) + | raw -> IConsumableSeq.iter action (rawOrOriginal raw original) [] let item index (source : seq<'T>) = @@ -99,139 +99,139 @@ namespace Microsoft.FSharp.Collections [] let tryItem index (source : seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.tryItem index arr | :? list<'T> as lst -> List.tryItem index lst - | raw -> ISeq.tryItem index (rawOrOriginal raw original) + | raw -> IConsumableSeq.tryItem index (rawOrOriginal raw original) [] let nth index (source : seq<'T>) = item index source [] let iteri action (source:seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.iteri action arr | :? list<'T> as lst -> List.iteri action lst | raw -> let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt action - ISeq.iteri (fun idx a -> f.Invoke (idx,a)) (rawOrOriginal raw original) + IConsumableSeq.iteri (fun idx a -> f.Invoke (idx,a)) (rawOrOriginal raw original) [] let exists predicate (source:seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.exists predicate arr | :? list<'T> as lst -> List.exists predicate lst - | raw -> ISeq.exists predicate (rawOrOriginal raw original) + | raw -> IConsumableSeq.exists predicate (rawOrOriginal raw original) [] let inline contains value (source:seq<'T>) = - ISeq.contains value (toISeq source) + IConsumableSeq.contains value (toIConsumableSeq source) [] let forall predicate (source:seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.forall predicate arr | :? list<'T> as lst -> List.forall predicate lst - | raw -> ISeq.forall predicate (rawOrOriginal raw original) + | raw -> IConsumableSeq.forall predicate (rawOrOriginal raw original) [] let iter2 action (source1:seq<_>) (source2:seq<_>) = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt action - ISeq.iter2 (fun a b -> f.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) + IConsumableSeq.iter2 (fun a b -> f.Invoke(a,b)) (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) [] let iteri2 action (source1 : seq<_>) (source2 : seq<_>) = let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt action - ISeq.iteri2 (fun idx a b -> f.Invoke(idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) + IConsumableSeq.iteri2 (fun idx a b -> f.Invoke(idx,a,b)) (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) [] let filter predicate source = - ISeq.filter predicate (toISeq source) :> seq<_> + IConsumableSeq.filter predicate (toIConsumableSeq source) :> seq<_> [] let where predicate source = filter predicate source [] let map mapping source = - ISeq.map mapping (toISeq source) :> seq<_> + IConsumableSeq.map mapping (toIConsumableSeq source) :> seq<_> [] let mapi mapping source = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt mapping - ISeq.mapi (fun idx a ->f.Invoke(idx,a)) (toISeq source) :> seq<_> + IConsumableSeq.mapi (fun idx a ->f.Invoke(idx,a)) (toIConsumableSeq source) :> seq<_> [] let mapi2 mapping source1 source2 = let f = OptimizedClosures.FSharpFunc.Adapt mapping - ISeq.mapi2 (fun idx a b -> f.Invoke (idx,a,b)) (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> + IConsumableSeq.mapi2 (fun idx a b -> f.Invoke (idx,a,b)) (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) :> seq<_> [] let map2 mapping source1 source2 = - ISeq.map2 mapping (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> + IConsumableSeq.map2 mapping (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) :> seq<_> [] let map3 mapping source1 source2 source3 = - ISeq.map3 mapping (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> + IConsumableSeq.map3 mapping (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) (source3 |> toIConsumableSeq3) :> seq<_> [] let choose chooser source = - ISeq.choose chooser (toISeq source) :> seq<_> + IConsumableSeq.choose chooser (toIConsumableSeq source) :> seq<_> [] let indexed source = - ISeq.indexed (toISeq source) :> seq<_> + IConsumableSeq.indexed (toIConsumableSeq source) :> seq<_> [] let zip source1 source2 = - ISeq.zip (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> + IConsumableSeq.zip (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) :> seq<_> [] let zip3 source1 source2 source3 = - ISeq.zip3 (source1 |> toISeq1) (source2 |> toISeq2) (source3 |> toISeq3) :> seq<_> + IConsumableSeq.zip3 (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) (source3 |> toIConsumableSeq3) :> seq<_> [] let cast (source: IEnumerable) = - source |> ISeq.cast :> seq<_> + source |> IConsumableSeq.cast :> seq<_> [] let tryPick chooser (source : seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.tryPick chooser arr | :? list<'T> as lst -> List.tryPick chooser lst - | raw -> ISeq.tryPick chooser (rawOrOriginal raw original) + | raw -> IConsumableSeq.tryPick chooser (rawOrOriginal raw original) [] let pick chooser source = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.pick chooser arr | :? list<'T> as lst -> List.pick chooser lst - | raw -> ISeq.pick chooser (rawOrOriginal raw original) + | raw -> IConsumableSeq.pick chooser (rawOrOriginal raw original) [] let tryFind predicate (source : seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.tryFind predicate arr | :? list<'T> as lst -> List.tryFind predicate lst - | raw -> ISeq.tryFind predicate (rawOrOriginal raw original) + | raw -> IConsumableSeq.tryFind predicate (rawOrOriginal raw original) [] let find predicate source = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.find predicate arr | :? list<'T> as lst -> List.find predicate lst - | raw -> ISeq.find predicate (rawOrOriginal raw original) + | raw -> IConsumableSeq.find predicate (rawOrOriginal raw original) [] let take count (source : seq<'T>) = - ISeq.take count (toISeq source) :> seq<_> + IConsumableSeq.take count (toIConsumableSeq source) :> seq<_> [] let isEmpty (source : seq<'T>) = @@ -246,44 +246,44 @@ namespace Microsoft.FSharp.Collections [] let concat sources = - sources |> toISeqs |> ISeq.map toISeq |> ISeq.concat :> seq<_> + sources |> toIConsumableSeqs |> IConsumableSeq.map toIConsumableSeq |> IConsumableSeq.concat :> seq<_> [] let length (source : seq<'T>) = - ISeq.length (toISeq source) + IConsumableSeq.length (toIConsumableSeq source) [] let fold<'T,'State> folder (state:'State) (source:seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.fold folder state arr | :? list<'T> as lst -> List.fold folder state lst | raw -> let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder - ISeq.fold (fun acc item -> f.Invoke (acc, item)) state (rawOrOriginal raw original) + IConsumableSeq.fold (fun acc item -> f.Invoke (acc, item)) state (rawOrOriginal raw original) [] let fold2<'T1,'T2,'State> folder (state:'State) (source1:seq<'T1>) (source2:seq<'T2>) = let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt folder - ISeq.fold2 (fun acc item1 item2 -> f.Invoke (acc, item1, item2)) state (source1 |> toISeq1) (source2 |> toISeq2) + IConsumableSeq.fold2 (fun acc item1 item2 -> f.Invoke (acc, item1, item2)) state (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) [] let reduce reduction (source : seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.reduce reduction arr | :? list<'T> as lst -> List.reduce reduction lst | raw -> let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt reduction - ISeq.reduce (fun acc item -> f.Invoke (acc, item)) (rawOrOriginal raw original) + IConsumableSeq.reduce (fun acc item -> f.Invoke (acc, item)) (rawOrOriginal raw original) [] let replicate count initial = - ISeq.replicate count initial :> seq<_> + IConsumableSeq.replicate count initial :> seq<_> [] let append (source1: seq<'T>) (source2: seq<'T>) = - ISeq.append (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> + IConsumableSeq.append (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) :> seq<_> [] let collect mapping source = @@ -292,27 +292,27 @@ namespace Microsoft.FSharp.Collections [] let compareWith (comparer:'T->'T->int) (source1:seq<'T>) (source2:seq<'T>) = let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt comparer - ISeq.compareWith (fun a b -> f.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) + IConsumableSeq.compareWith (fun a b -> f.Invoke(a,b)) (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) [] let ofList (source : 'T list) = - ISeq.ofList source :> seq<_> + IConsumableSeq.ofList source :> seq<_> [] let toList (source : seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.toList arr | :? list<'T> as lst -> lst - | raw -> ISeq.toList (rawOrOriginal raw original) + | raw -> IConsumableSeq.toList (rawOrOriginal raw original) [] let ofArray (source : 'T array) = - ISeq.ofArray source :> seq<_> + IConsumableSeq.ofArray source :> seq<_> [] let toArray (source : seq<'T>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.copy arr | :? list<'T> as lst -> List.toArray lst @@ -322,76 +322,76 @@ namespace Microsoft.FSharp.Collections let arr = Microsoft.FSharp.Primitives.Basics.Array.zeroCreateUnchecked res.Count res.CopyTo(arr, 0) arr - | raw -> ISeq.toArray (rawOrOriginal raw original) + | raw -> IConsumableSeq.toArray (rawOrOriginal raw original) [] let foldBack<'T,'State> folder (source:seq<'T>) (state:'State) = - ISeq.foldBack folder (toISeq source) state + IConsumableSeq.foldBack folder (toIConsumableSeq source) state [] let foldBack2<'T1,'T2,'State> folder (source1:seq<'T1>) (source2:seq<'T2>) (state:'State) = - ISeq.foldBack2 folder (toISeq1 source1) (toISeq2 source2) state + IConsumableSeq.foldBack2 folder (toIConsumableSeq1 source1) (toIConsumableSeq2 source2) state [] let reduceBack reduction (source:seq<'T>) = - ISeq.reduceBack reduction (toISeq source) + IConsumableSeq.reduceBack reduction (toIConsumableSeq source) [] let singleton value = - ISeq.singleton value :> seq<_> + IConsumableSeq.singleton value :> seq<_> [] let truncate count (source: seq<'T>) = - ISeq.truncate count (toISeq source) :> seq<_> + IConsumableSeq.truncate count (toIConsumableSeq source) :> seq<_> [] let pairwise (source: seq<'T>) = - ISeq.pairwise (toISeq source) :> seq<_> + IConsumableSeq.pairwise (toIConsumableSeq source) :> seq<_> [] let scan<'T,'State> folder (state:'State) (source : seq<'T>) = - ISeq.scan folder state (toISeq source) :> seq<_> + IConsumableSeq.scan folder state (toIConsumableSeq source) :> seq<_> [] let tryFindBack predicate (source : seq<'T>) = - ISeq.tryFindBack predicate (toISeq source) + IConsumableSeq.tryFindBack predicate (toIConsumableSeq source) [] let findBack predicate source = - ISeq.findBack predicate (toISeq source) + IConsumableSeq.findBack predicate (toIConsumableSeq source) [] let scanBack<'T,'State> folder (source:seq<'T>) (state:'State) = - ISeq.scanBack folder (toISeq source) state :> seq<_> + IConsumableSeq.scanBack folder (toIConsumableSeq source) state :> seq<_> [] let findIndex predicate (source:seq<_>) = - ISeq.findIndex predicate (toISeq source) + IConsumableSeq.findIndex predicate (toIConsumableSeq source) [] let tryFindIndex predicate (source:seq<_>) = - ISeq.tryFindIndex predicate (toISeq source) + IConsumableSeq.tryFindIndex predicate (toIConsumableSeq source) [] let tryFindIndexBack predicate (source : seq<'T>) = - ISeq.tryFindIndexBack predicate (toISeq source) + IConsumableSeq.tryFindIndexBack predicate (toIConsumableSeq source) [] let findIndexBack predicate source = - ISeq.findIndexBack predicate (toISeq source) + IConsumableSeq.findIndexBack predicate (toIConsumableSeq source) // windowed : int -> seq<'T> -> seq<'T[]> [] let windowed windowSize (source: seq<_>) = - ISeq.windowed windowSize (toISeq source) :> seq<_> + IConsumableSeq.windowed windowSize (toIConsumableSeq source) :> seq<_> [] let cache (source : seq<'T>) = - ISeq.cache (toISeq source) :> seq<_> + IConsumableSeq.cache (toIConsumableSeq source) :> seq<_> [] let allPairs source1 source2 = - ISeq.allPairs (source1 |> toISeq1) (source2 |> toISeq2) :> seq<_> + IConsumableSeq.allPairs (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) :> seq<_> [] [] @@ -408,11 +408,11 @@ namespace Microsoft.FSharp.Collections #else if typeof<'Key>.IsValueType #endif - then source |> toISeq |> ISeq.GroupBy.byVal projection - else source |> toISeq |> ISeq.GroupBy.byRef projection + then source |> toIConsumableSeq |> IConsumableSeq.GroupBy.byVal projection + else source |> toIConsumableSeq |> IConsumableSeq.GroupBy.byRef projection grouped - |> ISeq.map (fun (key,value) -> key, value :> seq<_>) + |> IConsumableSeq.map (fun (key,value) -> key, value :> seq<_>) :> seq<_>) [] @@ -425,31 +425,31 @@ namespace Microsoft.FSharp.Collections [] let distinct source = - ISeq.distinct (toISeq source) :> seq<_> + IConsumableSeq.distinct (toIConsumableSeq source) :> seq<_> [] let distinctBy projection source = - ISeq.distinctBy projection (toISeq source) :> seq<_> + IConsumableSeq.distinctBy projection (toIConsumableSeq source) :> seq<_> [] let sortBy projection source = - ISeq.sortBy projection (toISeq source) :> seq<_> + IConsumableSeq.sortBy projection (toIConsumableSeq source) :> seq<_> [] let sort source = - ISeq.sort (toISeq source) :> seq<_> + IConsumableSeq.sort (toIConsumableSeq source) :> seq<_> [] let sortWith comparer source = - ISeq.sortWith comparer (toISeq source) :> seq<_> + IConsumableSeq.sortWith comparer (toIConsumableSeq source) :> seq<_> [] let inline sortByDescending projection source = - ISeq.sortByDescending projection (toISeq source) :> seq<_> + IConsumableSeq.sortByDescending projection (toIConsumableSeq source) :> seq<_> [] let inline sortDescending source = - ISeq.sortDescending (toISeq source) :> seq<_> + IConsumableSeq.sortDescending (toIConsumableSeq source) :> seq<_> [] let countBy (projection:'T->'Key) (source:seq<'T>) = @@ -458,136 +458,136 @@ namespace Microsoft.FSharp.Collections #else if typeof<'Key>.IsValueType #endif - then ISeq.CountBy.byVal projection (toISeq source) :> seq<_> - else ISeq.CountBy.byRef projection (toISeq source) :> seq<_> + then IConsumableSeq.CountBy.byVal projection (toIConsumableSeq source) :> seq<_> + else IConsumableSeq.CountBy.byRef projection (toIConsumableSeq source) :> seq<_> [] let inline sum (source: seq< ^a>) : ^a = - ISeq.sum (toISeq source) + IConsumableSeq.sum (toIConsumableSeq source) [] let inline sumBy (projection:'T-> ^U) (source:seq<'T>) : ^U = - ISeq.sumBy projection (toISeq source) + IConsumableSeq.sumBy projection (toIConsumableSeq source) [] let inline average (source:seq< ^a>) : ^a = - ISeq.average (toISeq source) + IConsumableSeq.average (toIConsumableSeq source) [] let inline averageBy (projection:'T-> ^U) (source:seq<'T>) : ^U = - ISeq.averageBy projection (toISeq source) + IConsumableSeq.averageBy projection (toIConsumableSeq source) [] let inline min (source:seq<_>) = - ISeq.min (toISeq source) + IConsumableSeq.min (toIConsumableSeq source) [] let inline minBy (projection:'T->'U) (source:seq<'T>) : 'T = - ISeq.minBy projection (toISeq source) + IConsumableSeq.minBy projection (toIConsumableSeq source) [] let inline max (source: seq<_>) = - ISeq.max (toISeq source) + IConsumableSeq.max (toIConsumableSeq source) [] let inline maxBy (projection:'T->'U) (source:seq<'T>) : 'T = - ISeq.maxBy projection (toISeq source) + IConsumableSeq.maxBy projection (toIConsumableSeq source) [] let takeWhile predicate (source: seq<_>) = - ISeq.takeWhile predicate (toISeq source) :> seq<_> + IConsumableSeq.takeWhile predicate (toIConsumableSeq source) :> seq<_> [] let skip count (source: seq<_>) = - ISeq.skip count (toISeq source) :> seq<_> + IConsumableSeq.skip count (toIConsumableSeq source) :> seq<_> [] let skipWhile predicate (source: seq<_>) = - ISeq.skipWhile predicate (toISeq source) :> seq<_> + IConsumableSeq.skipWhile predicate (toIConsumableSeq source) :> seq<_> [] let forall2 predicate (source1:seq<_>) (source2:seq<_>) = let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt predicate - ISeq.forall2 (fun a b -> p.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) + IConsumableSeq.forall2 (fun a b -> p.Invoke(a,b)) (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) [] let exists2 predicate (source1:seq<_>) (source2:seq<_>) = let p = OptimizedClosures.FSharpFunc<_,_,_>.Adapt predicate - ISeq.exists2 (fun a b -> p.Invoke(a,b)) (source1 |> toISeq1) (source2 |> toISeq2) + IConsumableSeq.exists2 (fun a b -> p.Invoke(a,b)) (source1 |> toIConsumableSeq1) (source2 |> toIConsumableSeq2) [] let head (source : seq<_>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.head arr | :? list<'T> as lst -> List.head lst - | raw -> ISeq.head (rawOrOriginal raw original) + | raw -> IConsumableSeq.head (rawOrOriginal raw original) [] let tryHead (source : seq<_>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.tryHead arr | :? list<'T> as lst -> List.tryHead lst - | raw -> ISeq.tryHead (rawOrOriginal raw original) + | raw -> IConsumableSeq.tryHead (rawOrOriginal raw original) [] let tail (source: seq<'T>) = - ISeq.tail (toISeq source) :> seq<_> + IConsumableSeq.tail (toIConsumableSeq source) :> seq<_> [] let last (source : seq<_>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.last arr | :? list<'T> as lst -> List.last lst - | raw -> ISeq.last (rawOrOriginal raw original) + | raw -> IConsumableSeq.last (rawOrOriginal raw original) [] let tryLast (source : seq<_>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.tryLast arr | :? list<'T> as lst -> List.tryLast lst - | raw -> ISeq.tryLast (rawOrOriginal raw original) + | raw -> IConsumableSeq.tryLast (rawOrOriginal raw original) [] let exactlyOne (source : seq<_>) = - let original = toISeq source + let original = toIConsumableSeq source match getRaw original with | :? array<'T> as arr -> Array.exactlyOne arr | :? list<'T> as lst -> List.exactlyOne lst - | raw -> ISeq.exactlyOne (rawOrOriginal raw original) + | raw -> IConsumableSeq.exactlyOne (rawOrOriginal raw original) [] let rev source = - ISeq.delay (fun () -> - let original = toISeq source + IConsumableSeq.delay (fun () -> + let original = toIConsumableSeq source match getRaw original with - | :? array<'T> as arr -> Array.rev arr |> ISeq.ofArray + | :? array<'T> as arr -> Array.rev arr |> IConsumableSeq.ofArray | :? list<'T> as lst -> List.rev lst :> _ - | raw -> ISeq.rev (rawOrOriginal raw original)) :> seq<_> + | raw -> IConsumableSeq.rev (rawOrOriginal raw original)) :> seq<_> [] let permute indexMap (source : seq<_>) = - ISeq.permute indexMap (toISeq source) :> seq<_> + IConsumableSeq.permute indexMap (toIConsumableSeq source) :> seq<_> [] let mapFold<'T,'State,'Result> (mapping:'State->'T->'Result*'State) state source = - ISeq.mapFold mapping state (toISeq source) |> fun (iseq, state) -> iseq :> seq<_>, state + IConsumableSeq.mapFold mapping state (toIConsumableSeq source) |> fun (iseq, state) -> iseq :> seq<_>, state [] let mapFoldBack<'T,'State,'Result> (mapping:'T->'State->'Result*'State) source state = - ISeq.mapFoldBack mapping (toISeq source) state |> fun (iseq, state) -> iseq :> seq<_>, state + IConsumableSeq.mapFoldBack mapping (toIConsumableSeq source) state |> fun (iseq, state) -> iseq :> seq<_>, state [] let except (itemsToExclude: seq<'T>) (source: seq<'T>) = - ISeq.except itemsToExclude (toISeq source) :> seq<_> + IConsumableSeq.except itemsToExclude (toIConsumableSeq source) :> seq<_> [] let chunkBySize chunkSize (source : seq<_>) = - ISeq.chunkBySize chunkSize (toISeq source) :> seq<_> + IConsumableSeq.chunkBySize chunkSize (toIConsumableSeq source) :> seq<_> [] let splitInto count source = - ISeq.splitInto count (toISeq source) :> seq<_> \ No newline at end of file + IConsumableSeq.splitInto count (toIConsumableSeq source) :> seq<_> \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index faaf0d5a09e..68458f0d7b2 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -139,6 +139,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition open System open System.Collections open System.Collections.Generic + open System.Runtime.InteropServices open Microsoft.FSharp.Core open Microsoft.FSharp.Collections open Microsoft.FSharp.Collections.IEnumerator @@ -159,25 +160,25 @@ namespace Microsoft.FSharp.Collections.SeqComposition module internal Closure = // F# inlines simple functions, which can mean that it some case you keep creating closures when - // a single funciton object would have done. This forces the compiler to create the object + // a single function object would have done. This forces the compiler to create the object let inline forceCapture<'a,'b> (f:'a->'b) : 'a->'b = (# "" f : 'a->'b #) - type IdentityFactory<'T> private () = - static let singleton : ITransformFactory<'T,'T> = upcast (IdentityFactory<'T>()) + type IdentityTransform<'T> private () = + static let singleton : ISeqTransform<'T,'T> = upcast (IdentityTransform<'T>()) static member Instance = singleton - interface ITransformFactory<'T,'T> with - member __.Compose<'V> (_outOfBand:IOutOfBand) (_pipeIdx:PipeIdx) (next:Activity<'T,'V>) : Activity<'T,'V> = next + interface ISeqTransform<'T,'T> with + member __.Compose<'V> (_outOfBand:ISeqConsumer) (_pipeIdx:PipeIdx) (next:SeqConsumerActivity<'T,'V>) : SeqConsumerActivity<'T,'V> = next - type ComposedFactory<'T,'U,'V> private (first:ITransformFactory<'T,'U>, second:ITransformFactory<'U,'V>) = - interface ITransformFactory<'T,'V> with - member this.Compose<'W> (outOfBand:IOutOfBand) (pipeIdx:PipeIdx) (next:Activity<'V,'W>) : Activity<'T,'W> = + type CompositionTransform<'T,'U,'V> private (first:ISeqTransform<'T,'U>, second:ISeqTransform<'U,'V>) = + interface ISeqTransform<'T,'V> with + member this.Compose<'W> (outOfBand:ISeqConsumer) (pipeIdx:PipeIdx) (next:SeqConsumerActivity<'V,'W>) : SeqConsumerActivity<'T,'W> = first.Compose outOfBand (pipeIdx-1) (second.Compose outOfBand pipeIdx next) - static member Combine (first:ITransformFactory<'T,'U>) (second:ITransformFactory<'U,'V>) : ITransformFactory<'T,'V> = - upcast ComposedFactory(first, second) + static member Combine (first:ISeqTransform<'T,'U>) (second:ISeqTransform<'U,'V>) : ISeqTransform<'T,'V> = + upcast CompositionTransform(first, second) type ISkipable = - // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip + // Seq.init(Infinite)? lazily uses Current. The only IConsumableSeq component that can do that is Skip // and it can only do it at the start of a sequence abstract CanSkip : unit -> bool @@ -209,12 +210,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition let derivedClassShouldImplement () = failwith "library implementation error: derived class should implement (should be abstract)" - abstract member Append : ISeq<'T> -> ISeq<'T> + abstract member Append : IConsumableSeq<'T> -> IConsumableSeq<'T> abstract member Length : unit -> int abstract member GetRaw : unit -> seq<'T> default this.Append source = upcast (AppendEnumerable [source; this]) - default this.Length () = Microsoft.FSharp.Primitives.Basics.ISeq.length this + default this.Length () = Microsoft.FSharp.Primitives.Basics.IConsumableSeq.length this default this.GetRaw () = upcast this interface IEnumerable with @@ -225,31 +226,31 @@ namespace Microsoft.FSharp.Collections.SeqComposition // fsharp doesn't allow abstract interface methods member this.GetEnumerator () : IEnumerator<'T> = derivedClassShouldImplement () - interface ISeq<'T> with + interface IConsumableSeq<'T> with // fsharp doesn't allow abstract interface methods - member __.PushTransform _ = derivedClassShouldImplement () - member __.Fold _ = derivedClassShouldImplement () + member __.Transform _ = derivedClassShouldImplement () + member __.Consume _ = derivedClassShouldImplement () - and [] SeqFactoryBase<'T,'U>(transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = + and [] SeqFactoryBase<'T,'U>(transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() - member __.CreateActivityPipeline<'Result> (folder:Folder<'U,'Result>) : Activity<'T,'U> = - transformFactory.Compose (folder :> IOutOfBand) pipeIdx folder + member __.CreateActivityPipeline<'Result> (consumer:SeqConsumer<'U,'Result>) : SeqConsumerActivity<'T,'U> = + transform.Compose (consumer :> ISeqConsumer) pipeIdx consumer - member this.CreatePipeline<'Result> (createFolder:PipeIdx->Folder<'U,'Result>, [] activity:byref>) = - let folder = createFolder (pipeIdx+1) - activity <- this.CreateActivityPipeline folder - folder + member this.CreatePipeline<'Result> (getConsumer:PipeIdx -> SeqConsumer<'U,'Result>, [] activity:byref>) = + let consumer = getConsumer (pipeIdx+1) + activity <- this.CreateActivityPipeline consumer + consumer - member __.Compose next = ComposedFactory.Combine transformFactory next + member __.Compose next = CompositionTransform.Combine transform next member __.PipeIdx = pipeIdx and [] EnumeratorBase<'T>() = - inherit Folder<'T,'T>(Unchecked.defaultof<'T>) + inherit SeqConsumer<'T,'T>(Unchecked.defaultof<'T>) member val SeqState = SeqProcessNextStates.NotStarted with get, set - abstract Activity : Activity + abstract Activity : SeqConsumerActivity override this.ProcessNext (input:'T) : bool = this.Result <- input @@ -276,9 +277,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition and VanillaEnumerator<'T,'U> private (source:IEnumerator<'T>) = inherit EnumeratorBase<'U>() - let mutable activity = Unchecked.defaultof> + let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = activity <- activity' override __.Activity = upcast activity @@ -311,18 +312,18 @@ namespace Microsoft.FSharp.Collections.SeqComposition enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator - and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Construct (enumerable.GetEnumerator()) this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new VanillaEnumerable<'T,'V>(enumerable, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result, consumer = this.CreatePipeline createFolder + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = + let result, consumer = this.CreatePipeline getConsumer try use enumerator = enumerable.GetEnumerator () while result.HaltedIdx = 0 && enumerator.MoveNext () do @@ -333,31 +334,31 @@ namespace Microsoft.FSharp.Collections.SeqComposition consumer.ChainDispose () result.Result - and ConcatCommon<'T>(consumer:Activity<'T>) = - inherit Folder<'T,NoValue>(Unchecked.defaultof<_>) + and ConcatCommon<'T>(consumer:SeqConsumerActivity<'T>) = + inherit SeqConsumer<'T,NoValue>(Unchecked.defaultof<_>) member __.Consumer = consumer override me.ProcessNext value = TailCall.avoid (consumer.ProcessNext value) - and ConcatFold<'T,'U,'Collection,'Result when 'Collection :> ISeq<'T>>(result:Folder<'U,'Result>, consumer:Activity<'T,'U>, common:Folder<'T,NoValue>) as this = - inherit Folder<'Collection, 'Result>(Unchecked.defaultof<_>) + and ConcatFold<'T,'U,'Collection,'Result when 'Collection :> IConsumableSeq<'T>>(result:SeqConsumer<'U,'Result>, consumer:SeqConsumerActivity<'T,'U>, common:SeqConsumer<'T,NoValue>) as this = + inherit SeqConsumer<'Collection, 'Result>(Unchecked.defaultof<_>) do - (this :> IOutOfBand).ListenForStopFurtherProcessing (fun idx -> - (result :> IOutOfBand).StopFurtherProcessing idx - (common :> IOutOfBand).StopFurtherProcessing PipeIdx.MinValue) + (this :> ISeqConsumer).ListenForStopFurtherProcessing (fun idx -> + (result :> ISeqConsumer).StopFurtherProcessing idx + (common :> ISeqConsumer).StopFurtherProcessing PipeIdx.MinValue) - (result :> IOutOfBand).ListenForStopFurtherProcessing (fun idx -> - (this :> IOutOfBand).StopFurtherProcessing idx - (common :> IOutOfBand).StopFurtherProcessing PipeIdx.MaxValue) + (result :> ISeqConsumer).ListenForStopFurtherProcessing (fun idx -> + (this :> ISeqConsumer).StopFurtherProcessing idx + (common :> ISeqConsumer).StopFurtherProcessing PipeIdx.MaxValue) let getCommonFolder = Closure.forceCapture (fun (_:PipeIdx) -> - (common :> IOutOfBand).StopFurtherProcessing 0 + (common :> ISeqConsumer).StopFurtherProcessing 0 common) override __.ProcessNext value = - value.Fold getCommonFolder |> ignore + value.Consume getCommonFolder |> ignore Unchecked.defaultof<_> (* return value unused in Fold context *) override this.ChainComplete _ = @@ -372,11 +373,11 @@ namespace Microsoft.FSharp.Collections.SeqComposition let main = sources.GetEnumerator () let mutable active = EmptyEnumerators.Element - let mutable activity = Unchecked.defaultof> + let mutable activity = Unchecked.defaultof> override __.Activity = upcast activity - member private __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = activity <- activity' member private this.MoveNext () = @@ -414,25 +415,25 @@ namespace Microsoft.FSharp.Collections.SeqComposition enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator - and ConcatEnumerable<'T,'U,'Collection when 'Collection :> ISeq<'T>> (sources:ISeq<'Collection>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + and ConcatEnumerable<'T,'U,'Collection when 'Collection :> IConsumableSeq<'T>> (sources:IConsumableSeq<'Collection>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = ConcatEnumerator<'T,'U,'Collection>.Construct sources this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - sources.Fold (fun lowerPipeIdx -> + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = + sources.Consume (fun lowerPipeIdx -> let thisPipeIdx = lowerPipeIdx + pipeIdx - let result = createFolder (thisPipeIdx+1) + let result = getConsumer (thisPipeIdx+1) - let outOfBand = result :> IOutOfBand + let outOfBand = result :> ISeqConsumer - let consumer = transformFactory.Compose outOfBand thisPipeIdx result + let consumer = transform.Compose outOfBand thisPipeIdx result let common = match box consumer with @@ -441,37 +442,35 @@ namespace Microsoft.FSharp.Collections.SeqComposition upcast ConcatFold (result, consumer, common)) - and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> (sources:'Sources, preEnumerate:'Sources->ISeq<'Collection>) = + and ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> IConsumableSeq<'T>> (sources:'Sources, preEnumerate:'Sources->IConsumableSeq<'Collection>) = inherit EnumerableBase<'T>() - member private __.Fatten : ISeq<'T> = upcast (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityFactory.Instance, 1)) + member private __.Fatten : IConsumableSeq<'T> = upcast (ConcatEnumerable<'T,'T,'Collection>(preEnumerate sources, IdentityTransform.Instance, 1)) interface IEnumerable<'T> with member this.GetEnumerator () = this.Fatten.GetEnumerator () - interface ISeq<'T> with - member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = + interface IConsumableSeq<'T> with + member this.Transform (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = upcast (ConcatEnumerable<'T,'V,'Collection>(preEnumerate sources, next, 1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - this.Fatten.Fold createFolder + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'T,'Result>) = + this.Fatten.Consume getConsumer - and AppendEnumerable<'T> (sources:list>) = - inherit ThinConcatEnumerable<'T, list>, ISeq<'T>>(sources, fun sources -> upcast (List.rev sources)) + and AppendEnumerable<'T> (sources:list>) = + inherit ThinConcatEnumerable<'T, list>, IConsumableSeq<'T>>(sources, fun sources -> upcast (List.rev sources)) override this.Append source = upcast (AppendEnumerable (source::sources)) /// ThinEnumerable is used when the IEnumerable provided to ofSeq is neither an array or a list type ThinEnumerable<'T>(enumerable:IEnumerable<'T>) = - inherit VanillaEnumerable<'T,'T>(enumerable, IdentityFactory.Instance, 0) + inherit VanillaEnumerable<'T,'T>(enumerable, IdentityTransform.Instance, 0) override __.Length () = match enumerable with | :? ICollection<'T> as a -> a.Count -#if !FSCORE_PORTABLE_OLD | :? IReadOnlyCollection<'T> as a -> a.Count -#endif | _ -> use e = enumerable.GetEnumerator () let mutable count = 0 @@ -484,13 +483,13 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> with member __.GetEnumerator () = enumerable.GetEnumerator () - type DelayedEnumerable<'T>(delayed:unit->ISeq<'T>, pipeIdx:PipeIdx) = + type DelayedEnumerable<'T>(delayed:unit->IConsumableSeq<'T>, pipeIdx:PipeIdx) = inherit EnumerableBase<'T>() override __.Length () = match delayed() with | :? EnumerableBase<'T> as s -> s.Length () - | s -> Microsoft.FSharp.Primitives.Basics.ISeq.length s + | s -> Microsoft.FSharp.Primitives.Basics.IConsumableSeq.length s override __.GetRaw () = match delayed() with @@ -500,17 +499,17 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> with member this.GetEnumerator () : IEnumerator<'T> = (delayed()).GetEnumerator () - interface ISeq<'T> with - member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = - upcast (new DelayedEnumerable<'U>((fun () -> (delayed()).PushTransform next), pipeIdx+1)) + interface IConsumableSeq<'T> with + member __.Transform (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = + upcast (new DelayedEnumerable<'U>((fun () -> (delayed()).Transform next), pipeIdx+1)) - member __.Fold<'Result> (f:PipeIdx->Folder<'T,'Result>) = - (delayed()).Fold f + member __.Consume<'Result> (f:PipeIdx->SeqConsumer<'T,'Result>) = + (delayed()).Consume f type EmptyEnumerable<'T> private () = inherit EnumerableBase<'T>() - static let singleton = EmptyEnumerable<'T>() :> ISeq<'T> + static let singleton = EmptyEnumerable<'T>() :> IConsumableSeq<'T> static member Instance = singleton override __.Length () = 0 @@ -520,12 +519,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition override this.Append source = source - interface ISeq<'T> with - member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = + interface IConsumableSeq<'T> with + member this.Transform (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = upcast (VanillaEnumerable<'T,'V>(this, next, 1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'T,'Result>) = + let result = getConsumer 1 try result.ChainComplete result.HaltedIdx finally @@ -536,9 +535,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit EnumeratorBase<'U>() let mutable idx = 0 - let mutable activity = Unchecked.defaultof> + let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = activity <- activity' override __.Activity = upcast activity @@ -565,18 +564,18 @@ namespace Microsoft.FSharp.Collections.SeqComposition enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator - type ArrayEnumerable<'T,'U>(array:array<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + type ArrayEnumerable<'T,'U>(array:array<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = ArrayEnumerator<'T,'U>.Construct array this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new ArrayEnumerable<'T,'V>(array, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result, consumer = this.CreatePipeline createFolder + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = + let result, consumer = this.CreatePipeline getConsumer try let array = array let mutable idx = 0 @@ -590,7 +589,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.Result type ThinArrayEnumerable<'T>(array:array<'T>) = - inherit ArrayEnumerable<'T,'T>(array, IdentityFactory.Instance, 0) + inherit ArrayEnumerable<'T,'T>(array, IdentityTransform.Instance, 0) override __.Length () = array.Length override __.GetRaw () = upcast array @@ -606,12 +605,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> with member this.GetEnumerator () = (new Singleton<'T>(item)) :> IEnumerator<'T> - interface ISeq<'T> with - member __.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = - ([item] :> ISeq<'T>).PushTransform next + interface IConsumableSeq<'T> with + member __.Transform (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = + ([item] :> IConsumableSeq<'T>).Transform next - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'T,'Result>) = + let result = getConsumer 1 try if result.HaltedIdx = 0 then result.ProcessNext item |> ignore @@ -625,9 +624,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition inherit EnumeratorBase<'U>() let mutable idx = 0 - let mutable activity = Unchecked.defaultof> + let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = activity <- activity' override __.Activity = upcast activity @@ -654,18 +653,18 @@ namespace Microsoft.FSharp.Collections.SeqComposition enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator - type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = ResizeArrayEnumerator<'T,'U>.Construct resizeArray this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result, consumer = this.CreatePipeline createFolder + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = + let result, consumer = this.CreatePipeline getConsumer try let array = resizeArray let mutable idx = 0 @@ -679,7 +678,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition result.Result type ThinResizeArrayEnumerable<'T>(resizeArray:ResizeArray<'T>) = - inherit ResizeArrayEnumerable<'T,'T>(resizeArray, IdentityFactory.Instance, 0) + inherit ResizeArrayEnumerable<'T,'T>(resizeArray, IdentityTransform.Instance, 0) override __.Length () = resizeArray.Count @@ -688,9 +687,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable current = state - let mutable activity = Unchecked.defaultof> + let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = activity <- activity' override __.Activity = upcast activity @@ -718,18 +717,18 @@ namespace Microsoft.FSharp.Collections.SeqComposition enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator - type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = UnfoldEnumerator<'T,'U,'GeneratorState>.Construct generator state this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result, consumer = this.CreatePipeline createFolder + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = + let result, consumer = this.CreatePipeline getConsumer try let generator = generator let rec iterate current = @@ -764,10 +763,10 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable maybeSkipping = true let mutable idx = -1 - let mutable activity = Unchecked.defaultof> + let mutable activity = Unchecked.defaultof> let mutable isSkipping = Unchecked.defaultofbool> - member private __.FinaliseConstruct(activity':Activity<'T,'U>) = + member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = activity <- activity' isSkipping <- @@ -809,19 +808,19 @@ namespace Microsoft.FSharp.Collections.SeqComposition enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator - type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = InitEnumerator<'T,'U>.Construct count f this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new InitEnumerable<'T,'V>(count, f, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let terminatingIdx = getInitTerminatingIdx count - let result, consumer = this.CreatePipeline createFolder + let result, consumer = this.CreatePipeline getConsumer try let firstIdx = match box consumer with @@ -934,12 +933,12 @@ namespace Microsoft.FSharp.Collections.SeqComposition // in the way presented, but it's possible. upto (if count.HasValue then Some (count.Value-1) else None) f - interface ISeq<'T> with - member this.PushTransform (next:ITransformFactory<'T,'U>) : ISeq<'U> = + interface IConsumableSeq<'T> with + member this.Transform (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = upcast (InitEnumerable<'T,'V>(count, f, next, pipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'T,'Result>) = + let result = getConsumer 1 try use enumerator = (this:>IEnumerable<'T>).GetEnumerator () while result.HaltedIdx = 0 && enumerator.MoveNext () do @@ -1187,15 +1186,15 @@ namespace Microsoft.FSharp.Core.CompilerServices | :? GeneratedSequenceBase<'T> as g when not active.CheckClose -> g | e -> GeneratedSequenceBase.CreateRedirect e active - static member Fold<'U, 'Result> (result:Folder<'U,'Result>) (consumer:Activity<'T,'U>) (active:GeneratedSequenceBase<'T>) = + static member Consume<'U, 'Result> (result:SeqConsumer<'U,'Result>) (consumer:SeqConsumerActivity<'T,'U>) (active:GeneratedSequenceBase<'T>) = if result.HaltedIdx = 0 then let mutable target = null match active.GenerateNext (&target) with | 1 -> consumer.ProcessNext active.LastGenerated |> ignore - GeneratedSequenceBase.Fold result consumer active + GeneratedSequenceBase.Consume result consumer active | 2 -> - GeneratedSequenceBase.Fold result consumer (GeneratedSequenceBase.GetRedirect target active) + GeneratedSequenceBase.Consume result consumer (GeneratedSequenceBase.GetRedirect target active) | _ (*0*) -> () static member Count (active:GeneratedSequenceBase<'T>) count = @@ -1233,16 +1232,16 @@ namespace Microsoft.FSharp.Core.CompilerServices member x.Reset() = raise <| new System.NotSupportedException() - interface ISeq<'T> with - member this.PushTransform<'U> (next:ITransformFactory<'T,'U>) : ISeq<'U> = + interface IConsumableSeq<'T> with + member this.Transform<'U> (next:ISeqTransform<'T,'U>) : IConsumableSeq<'U> = upcast (new GeneratedSequenceBaseEnumerable<'T,'U>(this, next, 1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'T,'Result>) = - let result = createFolder 1 + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'T,'Result>) = + let result = getConsumer 1 try use maybeGeneratedSequenceBase = this.GetFreshEnumerator () match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Fold result result e + | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Consume result result e | e -> while result.HaltedIdx = 0 && e.MoveNext () do result.ProcessNext e.Current |> ignore @@ -1262,22 +1261,22 @@ namespace Microsoft.FSharp.Core.CompilerServices count <- count + 1 count - and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transformFactory:ITransformFactory<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transformFactory, pipeIdx) + and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Construct (generatedSequence.GetFreshEnumerator()) this - interface ISeq<'U> with - member this.PushTransform (next:ITransformFactory<'U,'V>) : ISeq<'V> = + interface IConsumableSeq<'U> with + member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, this.Compose next, this.PipeIdx+1)) - member this.Fold<'Result> (createFolder:PipeIdx->Folder<'U,'Result>) = - let result, consumer = this.CreatePipeline createFolder + member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = + let result, consumer = this.CreatePipeline getConsumer try use maybeGeneratedSequenceBase = generatedSequence.GetFreshEnumerator () match maybeGeneratedSequenceBase with - | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Fold result consumer e + | :? GeneratedSequenceBase<'T> as e -> GeneratedSequenceBase.Consume result consumer e | e -> while result.HaltedIdx = 0 && e.MoveNext () do consumer.ProcessNext e.Current |> ignore diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 3e3ffcef68c..910b5df984f 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -71,43 +71,43 @@ namespace Microsoft.FSharp.Collections.SeqComposition [] type internal EnumerableBase<'T> = new : unit -> EnumerableBase<'T> - abstract member Append : ISeq<'T> -> ISeq<'T> + abstract member Append : IConsumableSeq<'T> -> IConsumableSeq<'T> abstract member Length : unit -> int abstract member GetRaw : unit -> seq<'T> - default Append : ISeq<'T> -> ISeq<'T> + default Append : IConsumableSeq<'T> -> IConsumableSeq<'T> default Length : unit -> int default GetRaw : unit -> seq<'T> - interface ISeq<'T> + interface IConsumableSeq<'T> [] type internal SeqFactoryBase<'T,'U> = inherit EnumerableBase<'U> - new : ITransformFactory<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> + new : ISeqTransform<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> [] - type internal IdentityFactory<'T> = - interface ITransformFactory<'T,'T> - static member Instance : ITransformFactory<'T,'T> + type internal IdentityTransform<'T> = + interface ISeqTransform<'T,'T> + static member Instance : ISeqTransform<'T,'T> type internal ISkipable = - // Seq.init(Infinite)? lazily uses Current. The only ISeq component that can do that is Skip + // Seq.init(Infinite)? lazily uses Current. The only IConsumableSeq component that can do that is Skip // and it can only do it at the start of a sequence abstract CanSkip : unit -> bool - type internal ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> ISeq<'T>> = + type internal ThinConcatEnumerable<'T, 'Sources, 'Collection when 'Collection :> IConsumableSeq<'T>> = inherit EnumerableBase<'T> - new : 'Sources * ('Sources->ISeq<'Collection>) -> ThinConcatEnumerable<'T, 'Sources, 'Collection> - interface ISeq<'T> + new : 'Sources * ('Sources->IConsumableSeq<'Collection>) -> ThinConcatEnumerable<'T, 'Sources, 'Collection> + interface IConsumableSeq<'T> type internal AppendEnumerable<'T> = - inherit ThinConcatEnumerable<'T, list>, ISeq<'T>> - new : list> -> AppendEnumerable<'T> - override Append : ISeq<'T> -> ISeq<'T> + inherit ThinConcatEnumerable<'T, list>, IConsumableSeq<'T>> + new : list> -> AppendEnumerable<'T> + override Append : IConsumableSeq<'T> -> IConsumableSeq<'T> type internal ResizeArrayEnumerable<'T,'U> = inherit SeqFactoryBase<'T,'U> - new : ResizeArray<'T> * ITransformFactory<'T,'U> * PipeIdx -> ResizeArrayEnumerable<'T,'U> - interface ISeq<'U> + new : ResizeArray<'T> * ISeqTransform<'T,'U> * PipeIdx -> ResizeArrayEnumerable<'T,'U> + interface IConsumableSeq<'U> type internal ThinResizeArrayEnumerable<'T> = inherit ResizeArrayEnumerable<'T,'T> @@ -115,8 +115,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal ArrayEnumerable<'T,'U> = inherit SeqFactoryBase<'T,'U> - new : array<'T> * ITransformFactory<'T,'U> * PipeIdx -> ArrayEnumerable<'T,'U> - interface ISeq<'U> + new : array<'T> * ISeqTransform<'T,'U> * PipeIdx -> ArrayEnumerable<'T,'U> + interface IConsumableSeq<'U> type internal ThinArrayEnumerable<'T> = inherit ArrayEnumerable<'T, 'T> @@ -125,8 +125,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal VanillaEnumerable<'T,'U> = inherit SeqFactoryBase<'T,'U> - new : IEnumerable<'T> * ITransformFactory<'T,'U> * PipeIdx -> VanillaEnumerable<'T,'U> - interface ISeq<'U> + new : IEnumerable<'T> * ISeqTransform<'T,'U> * PipeIdx -> VanillaEnumerable<'T,'U> + interface IConsumableSeq<'U> type internal ThinEnumerable<'T> = inherit VanillaEnumerable<'T,'T> @@ -135,34 +135,34 @@ namespace Microsoft.FSharp.Collections.SeqComposition type internal UnfoldEnumerable<'T,'U,'GeneratorState> = inherit SeqFactoryBase<'T,'U> - new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*ITransformFactory<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> - interface ISeq<'U> + new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*ISeqTransform<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> + interface IConsumableSeq<'U> type internal InitEnumerableDecider<'T> = inherit EnumerableBase<'T> new : Nullable* (int->'T) * PipeIdx -> InitEnumerableDecider<'T> - interface ISeq<'T> + interface IConsumableSeq<'T> type internal SingletonEnumerable<'T> = inherit EnumerableBase<'T> new : 'T -> SingletonEnumerable<'T> - interface ISeq<'T> + interface IConsumableSeq<'T> type internal InitEnumerable<'T,'U> = inherit SeqFactoryBase<'T,'U> - new : Nullable * (int->'T) * ITransformFactory<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> - interface ISeq<'U> + new : Nullable * (int->'T) * ISeqTransform<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> + interface IConsumableSeq<'U> type internal DelayedEnumerable<'T> = inherit EnumerableBase<'T> - new : (unit->ISeq<'T>) * PipeIdx -> DelayedEnumerable<'T> - interface ISeq<'T> + new : (unit->IConsumableSeq<'T>) * PipeIdx -> DelayedEnumerable<'T> + interface IConsumableSeq<'T> type internal EmptyEnumerable<'T> = inherit EnumerableBase<'T> private new : unit -> EmptyEnumerable<'T> - static member Instance : ISeq<'T> - interface ISeq<'T> + static member Instance : IConsumableSeq<'T> + interface IConsumableSeq<'T> namespace Microsoft.FSharp.Core.CompilerServices @@ -253,4 +253,4 @@ namespace Microsoft.FSharp.Core.CompilerServices interface IEnumerator<'T> interface IEnumerator interface IDisposable - interface SeqComposition.ISeq<'T> + interface SeqComposition.IConsumableSeq<'T> diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj index 0e208168800..6fc317c620f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj @@ -94,9 +94,9 @@ - - - + + + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule.fs new file mode 100644 index 00000000000..01ae6508b98 --- /dev/null +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule.fs @@ -0,0 +1,1170 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FSharp.Core.UnitTests.FSharp_Core.Microsoft_FSharp_Collections + +open System +open NUnit.Framework + +open FSharp.Core.UnitTests.LibraryTestFx + +#if IConsumableSeqIsPublic + +// Various tests for the: +// Microsoft.FSharp.Collections.iseq type + +(* +[Test Strategy] +Make sure each method works on: +* Integer IConsumableSeq (value type) +* String IConsumableSeq (reference type) +* Empty IConsumableSeq (0 elements) +* Null IConsumableSeq (null) +*) + +type iseq<'a> = FSharp.Collections.SeqComposition.IConsumableSeq<'a> + +[] +type IConsumableSeqModule() = + let iseq (x:seq<_>) = x |> IConsumableSeq.ofSeq + + [] + member this.AllPairs() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.allPairs (iseq [1..7]) (iseq [11..17]) + let expectedInt = + iseq <| seq { for i in 1..7 do + for j in 11..17 do + yield i, j } + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr = IConsumableSeq.allPairs (iseq ["str3";"str4"]) (iseq ["str1";"str2"]) + let expectedStr = iseq ["str3","str1";"str3","str2";"str4","str1";"str4","str2"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + VerifySeqsEqual IConsumableSeq.empty <| IConsumableSeq.allPairs IConsumableSeq.empty IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty <| IConsumableSeq.allPairs (iseq { 1..7 }) IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty <| IConsumableSeq.allPairs IConsumableSeq.empty (iseq { 1..7 }) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.allPairs null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.allPairs null (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.allPairs (iseq [1..7]) null |> ignore) + () + + [] + member this.CachedSeq_Clear() = + + let evaluatedItems : int list ref = ref [] + let cachedSeq = + IConsumableSeq.initInfinite (fun i -> evaluatedItems := i :: !evaluatedItems; i) + |> IConsumableSeq.cache + + // Verify no items have been evaluated from the IConsumableSeq yet + Assert.AreEqual(List.length !evaluatedItems, 0) + + // Force evaluation of 10 elements + IConsumableSeq.take 10 cachedSeq + |> IConsumableSeq.toList + |> ignore + + // verify ref clear switch length + Assert.AreEqual(List.length !evaluatedItems, 10) + + // Force evaluation of 10 elements + IConsumableSeq.take 10 cachedSeq + |> IConsumableSeq.toList + |> ignore + + // Verify ref clear switch length (should be cached) + Assert.AreEqual(List.length !evaluatedItems, 10) + + + // Clear + (box cachedSeq :?> System.IDisposable) .Dispose() + + // Force evaluation of 10 elements + IConsumableSeq.take 10 cachedSeq + |> IConsumableSeq.toList + |> ignore + + // Verify length of evaluatedItemList is 20 + Assert.AreEqual(List.length !evaluatedItems, 20) + () + + [] + member this.Append() = + + // empty IConsumableSeq + let emptySeq1 = IConsumableSeq.empty + let emptySeq2 = IConsumableSeq.empty + let appendEmptySeq = IConsumableSeq.append emptySeq1 emptySeq2 + let expectResultEmpty = IConsumableSeq.empty + + VerifySeqsEqual expectResultEmpty appendEmptySeq + + // Integer IConsumableSeq + let integerSeq1:iseq = iseq [0..4] + let integerSeq2:iseq = iseq [5..9] + + let appendIntergerSeq = IConsumableSeq.append integerSeq1 integerSeq2 + + let expectResultInteger = iseq <| seq { for i in 0..9 -> i} + + VerifySeqsEqual expectResultInteger appendIntergerSeq + + + // String IConsumableSeq + let stringSeq1:iseq = iseq ["1";"2"] + let stringSeq2:iseq = iseq ["3";"4"] + + let appendStringSeq = IConsumableSeq.append stringSeq1 stringSeq2 + + let expectedResultString = iseq ["1";"2";"3";"4"] + + VerifySeqsEqual expectedResultString appendStringSeq + + // null IConsumableSeq + let nullSeq1 = iseq [null;null] + + let nullSeq2 =iseq [null;null] + + let appendNullSeq = IConsumableSeq.append nullSeq1 nullSeq2 + + let expectedResultNull = iseq [ null;null;null;null] + + VerifySeqsEqual expectedResultNull appendNullSeq + + () + + [] + member this.replicate() = + // replicate should create multiple copies of the given value + Assert.IsTrue(IConsumableSeq.isEmpty <| IConsumableSeq.replicate 0 null) + Assert.IsTrue(IConsumableSeq.isEmpty <| IConsumableSeq.replicate 0 1) + Assert.AreEqual(null, IConsumableSeq.head <| IConsumableSeq.replicate 1 null) + Assert.AreEqual(["1";"1"],IConsumableSeq.replicate 2 "1" |> IConsumableSeq.toList) + + CheckThrowsArgumentException (fun () -> IConsumableSeq.replicate -1 null |> ignore) + + + [] + member this.Average() = + // empty IConsumableSeq + let emptySeq:iseq = IConsumableSeq.empty + + CheckThrowsArgumentException (fun () -> IConsumableSeq.average emptySeq |> ignore) + + + // double IConsumableSeq + let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] + + let averageDouble = IConsumableSeq.average doubleSeq + + Assert.IsFalse( averageDouble <> 2.5) + + // float32 IConsumableSeq + let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] + + let averageFloat = IConsumableSeq.average floatSeq + + Assert.IsFalse( averageFloat <> 5.0f) + + // decimal IConsumableSeq + let decimalSeq:iseq = iseq [ 0M;19M;19.03M] + + let averageDecimal = IConsumableSeq.average decimalSeq + + Assert.IsFalse( averageDecimal <> 12.676666666666666666666666667M ) + + //// null IConsumableSeq + //let nullSeq:iseq = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.average nullSeq |> ignore) + () + + + [] + member this.AverageBy() = + // empty IConsumableSeq + let emptySeq:iseq = IConsumableSeq.empty + + CheckThrowsArgumentException (fun () -> IConsumableSeq.averageBy (fun x -> x+1.0) emptySeq |> ignore) + + // double IConsumableSeq + let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] + + let averageDouble = IConsumableSeq.averageBy (fun x -> x-2.0) doubleSeq + + Assert.IsFalse( averageDouble <> 0.5 ) + + // float32 IConsumableSeq + let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] + + let averageFloat = IConsumableSeq.averageBy (fun x -> x*3.3f) floatSeq + + Assert.IsFalse( averageFloat <> 16.5f ) + + // decimal IConsumableSeq + let decimalSeq:iseq = iseq [ 0M;19M;19.03M] + + let averageDecimal = IConsumableSeq.averageBy (fun x -> x/10.7M) decimalSeq + + Assert.IsFalse( averageDecimal <> 1.1847352024922118380062305296M ) + + //// null IConsumableSeq + //let nullSeq:iseq = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.averageBy (fun (x:double)->x+4.0) nullSeq |> ignore) + () + + [] + member this.Cache() = + // empty IConsumableSeq + let emptySeq:iseq = IConsumableSeq.empty + + let cacheEmpty = IConsumableSeq.cache emptySeq + + let expectedResultEmpty = IConsumableSeq.empty + + VerifySeqsEqual expectedResultEmpty cacheEmpty + + // double IConsumableSeq + let doubleSeq:iseq = iseq [1.0;2.2;2.5;4.3] + + let cacheDouble = IConsumableSeq.cache doubleSeq + + VerifySeqsEqual doubleSeq cacheDouble + + + // float32 IConsumableSeq + let floatSeq:iseq = iseq [ 2.0f;4.4f;5.0f;8.6f] + + let cacheFloat = IConsumableSeq.cache floatSeq + + VerifySeqsEqual floatSeq cacheFloat + + // decimal IConsumableSeq + let decimalSeq:iseq = iseq [ 0M; 19M; 19.03M] + + let cacheDecimal = IConsumableSeq.cache decimalSeq + + VerifySeqsEqual decimalSeq cacheDecimal + + // null IConsumableSeq + let nullSeq = iseq [null] + + let cacheNull = IConsumableSeq.cache nullSeq + + VerifySeqsEqual nullSeq cacheNull + () + + [] + member this.Case() = + + // integer IConsumableSeq + let integerArray = [|1;2|] + let integerSeq = IConsumableSeq.cast integerArray + + let expectedIntegerSeq = iseq [1;2] + + VerifySeqsEqual expectedIntegerSeq integerSeq + + // string IConsumableSeq + let stringArray = [|"a";"b"|] + let stringSeq = IConsumableSeq.cast stringArray + + let expectedStringSeq = iseq["a";"b"] + + VerifySeqsEqual expectedStringSeq stringSeq + + // empty IConsumableSeq + let emptySeq = IConsumableSeq.cast IConsumableSeq.empty + let expectedEmptySeq = IConsumableSeq.empty + + VerifySeqsEqual expectedEmptySeq IConsumableSeq.empty + + // null IConsumableSeq + let nullArray = [|null;null|] + let NullSeq = IConsumableSeq.cast nullArray + let expectedNullSeq = iseq [null;null] + + VerifySeqsEqual expectedNullSeq NullSeq + + CheckThrowsExn(fun () -> + let strings = + integerArray + |> IConsumableSeq.cast + for o in strings do ()) + + CheckThrowsExn(fun () -> + let strings = + integerArray + |> IConsumableSeq.cast + :> System.Collections.IEnumerable // without this upcast the for loop throws, so it should with this upcast too + for o in strings do ()) + + () + + [] + member this.Choose() = + + // int IConsumableSeq + let intSeq = iseq [1..20] + let funcInt x = if (x%5=0) then Some x else None + let intChoosed = IConsumableSeq.choose funcInt intSeq + let expectedIntChoosed = iseq <| seq { for i = 1 to 4 do yield i*5} + + + + VerifySeqsEqual expectedIntChoosed intChoosed + + // string IConsumableSeq + let stringSrc = iseq ["list";"List"] + let funcString x = match x with + | "list"-> Some x + | "List" -> Some x + | _ -> None + let strChoosed = IConsumableSeq.choose funcString stringSrc + let expectedStrChoose = iseq ["list";"List"] + + VerifySeqsEqual expectedStrChoose strChoosed + + // empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let emptyChoosed = IConsumableSeq.choose funcInt emptySeq + + let expectedEmptyChoose = IConsumableSeq.empty + + VerifySeqsEqual expectedEmptyChoose emptySeq + + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.choose funcInt nullSeq |> ignore) + () + + [] + member this.ChunkBySize() = + + let verify expected actual = + IConsumableSeq.zip expected actual + |> IConsumableSeq.iter ((<||) VerifySeqsEqual) + + // int IConsumableSeq + verify (iseq [[1..4];[5..8]]) <| IConsumableSeq.chunkBySize 4 (iseq {1..8}) + verify (iseq [[1..4];[5..8];[9..10]]) <| IConsumableSeq.chunkBySize 4 (iseq {1..10}) + verify (iseq [[1]; [2]; [3]; [4]]) <| IConsumableSeq.chunkBySize 1 (iseq {1..4}) + + IConsumableSeq.chunkBySize 2 (IConsumableSeq.initInfinite id) + |> IConsumableSeq.take 3 + |> verify (iseq [[0;1];[2;3];[4;5]]) + + IConsumableSeq.chunkBySize 1 (IConsumableSeq.initInfinite id) + |> IConsumableSeq.take 5 + |> verify (iseq [[0];[1];[2];[3];[4]]) + + // string IConsumableSeq + verify (iseq [["a"; "b"];["c";"d"];["e"]]) <| IConsumableSeq.chunkBySize 2 (iseq ["a";"b";"c";"d";"e"]) + + // empty IConsumableSeq + verify IConsumableSeq.empty <| IConsumableSeq.chunkBySize 3 IConsumableSeq.empty + + //// null IConsumableSeq + //let nullSeq:iseq<_> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.chunkBySize 3 nullSeq |> ignore) + + // invalidArg + CheckThrowsArgumentException (fun () -> IConsumableSeq.chunkBySize 0 (iseq {1..10}) |> ignore) + CheckThrowsArgumentException (fun () -> IConsumableSeq.chunkBySize -1 (iseq {1..10}) |> ignore) + + () + + [] + member this.SplitInto() = + + let verify expected actual = + IConsumableSeq.zip expected actual + |> IConsumableSeq.iter ((<||) VerifySeqsEqual) + + // int IConsumableSeq + IConsumableSeq.splitInto 3 (iseq {1..10}) |> verify (iseq [ {1..4}; {5..7}; {8..10} ]) + IConsumableSeq.splitInto 3 (iseq {1..11}) |> verify (iseq [ {1..4}; {5..8}; {9..11} ]) + IConsumableSeq.splitInto 3 (iseq {1..12}) |> verify (iseq [ {1..4}; {5..8}; {9..12} ]) + + IConsumableSeq.splitInto 4 (iseq {1..5}) |> verify (iseq [ [1..2]; [3]; [4]; [5] ]) + IConsumableSeq.splitInto 20 (iseq {1..4}) |> verify (iseq [ [1]; [2]; [3]; [4] ]) + + // string IConsumableSeq + IConsumableSeq.splitInto 3 (iseq ["a";"b";"c";"d";"e"]) |> verify (iseq [ ["a"; "b"]; ["c";"d"]; ["e"] ]) + + // empty IConsumableSeq + VerifySeqsEqual [] <| IConsumableSeq.splitInto 3 (iseq []) + + //// null IConsumableSeq + //let nullSeq:iseq<_> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.splitInto 3 nullSeq |> ignore) + + // invalidArg + CheckThrowsArgumentException (fun () -> IConsumableSeq.splitInto 0 (iseq [1..10]) |> ignore) + CheckThrowsArgumentException (fun () -> IConsumableSeq.splitInto -1 (iseq [1..10]) |> ignore) + + () + + [] + member this.Compare() = + + // int IConsumableSeq + let intSeq1 = iseq [1;3;7;9] + let intSeq2 = iseq [2;4;6;8] + let funcInt x y = if (x>y) then x else 0 + let intcompared = IConsumableSeq.compareWith funcInt intSeq1 intSeq2 + + Assert.IsFalse( intcompared <> 7 ) + + // string IConsumableSeq + let stringSeq1 = iseq ["a"; "b"] + let stringSeq2 = iseq ["c"; "d"] + let funcString x y = match (x,y) with + | "a", "c" -> 0 + | "b", "d" -> 1 + |_ -> -1 + let strcompared = IConsumableSeq.compareWith funcString stringSeq1 stringSeq2 + Assert.IsFalse( strcompared <> 1 ) + + // empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let emptycompared = IConsumableSeq.compareWith funcInt emptySeq emptySeq + + Assert.IsFalse( emptycompared <> 0 ) + + //// null IConsumableSeq + //let nullSeq:iseq = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.compareWith funcInt nullSeq emptySeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.compareWith funcInt emptySeq nullSeq |> ignore) + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.compareWith funcInt nullSeq nullSeq |> ignore) + + () + + [] + member this.Concat() = + // integer IConsumableSeq + let seqInt = + iseq <| seq { for i in 0..9 do + yield iseq <| seq {for j in 0..9 do + yield i*10+j}} + let conIntSeq = IConsumableSeq.concat seqInt + let expectedIntSeq = iseq <| seq { for i in 0..99 do yield i} + + VerifySeqsEqual expectedIntSeq conIntSeq + + // string IConsumableSeq + let strSeq = + iseq <| seq { for a in 'a' .. 'b' do + for b in 'a' .. 'b' do + yield iseq [a; b] } + + let conStrSeq = IConsumableSeq.concat strSeq + let expectedStrSeq = iseq ['a';'a';'a';'b';'b';'a';'b';'b';] + VerifySeqsEqual expectedStrSeq conStrSeq + + // Empty IConsumableSeq + let emptySeqs = iseq [iseq[ IConsumableSeq.empty;IConsumableSeq.empty];iseq[ IConsumableSeq.empty;IConsumableSeq.empty]] + let conEmptySeq = IConsumableSeq.concat emptySeqs + let expectedEmptySeq =iseq <| seq { for i in 1..4 do yield IConsumableSeq.empty} + + VerifySeqsEqual expectedEmptySeq conEmptySeq + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.concat nullSeq |> ignore) + + () + + [] + member this.CountBy() = + // integer IConsumableSeq + let funcIntCount_by (x:int) = x%3 + let seqInt = + iseq <| seq { for i in 0..9 do + yield i} + let countIntSeq = IConsumableSeq.countByVal funcIntCount_by seqInt + + let expectedIntSeq = iseq [0,4;1,3;2,3] + + VerifySeqsEqual expectedIntSeq countIntSeq + + // string IConsumableSeq + let funcStrCount_by (s:string) = s.IndexOf("key") + let strSeq = iseq [ "key";"blank key";"key";"blank blank key"] + + let countStrSeq = IConsumableSeq.countByVal funcStrCount_by strSeq + let expectedStrSeq = iseq [0,2;6,1;12,1] + VerifySeqsEqual expectedStrSeq countStrSeq + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let countEmptySeq = IConsumableSeq.countByVal funcIntCount_by emptySeq + let expectedEmptySeq =iseq [] + + VerifySeqsEqual expectedEmptySeq countEmptySeq + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.countBy funcIntCount_by nullSeq |> ignore) + () + + [] + member this.Distinct() = + + // integer IConsumableSeq + let IntDistinctSeq = + iseq <| seq { for i in 0..9 do + yield i % 3 } + + let DistinctIntSeq = IConsumableSeq.distinct IntDistinctSeq + + let expectedIntSeq = iseq [0;1;2] + + VerifySeqsEqual expectedIntSeq DistinctIntSeq + + // string IConsumableSeq + let strDistinctSeq = iseq ["elementDup"; "ele1"; "ele2"; "elementDup"] + + let DistnctStrSeq = IConsumableSeq.distinct strDistinctSeq + let expectedStrSeq = iseq ["elementDup"; "ele1"; "ele2"] + VerifySeqsEqual expectedStrSeq DistnctStrSeq + + // Empty IConsumableSeq + let emptySeq : iseq = IConsumableSeq.empty + let distinctEmptySeq : iseq = IConsumableSeq.distinct emptySeq + let expectedEmptySeq : iseq = iseq [] + + VerifySeqsEqual expectedEmptySeq distinctEmptySeq + + //// null IConsumableSeq + //let nullSeq:iseq = null + + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.distinct nullSeq |> ignore) + () + + [] + member this.DistinctBy () = + // integer IConsumableSeq + let funcInt x = x % 3 + let IntDistinct_bySeq = + iseq <| seq { for i in 0..9 do + yield i } + + let distinct_byIntSeq = IConsumableSeq.distinctBy funcInt IntDistinct_bySeq + + let expectedIntSeq = iseq [0;1;2] + + VerifySeqsEqual expectedIntSeq distinct_byIntSeq + + // string IConsumableSeq + let funcStrDistinct (s:string) = s.IndexOf("key") + let strSeq = iseq [ "key"; "blank key"; "key dup"; "blank key dup"] + + let DistnctStrSeq = IConsumableSeq.distinctBy funcStrDistinct strSeq + let expectedStrSeq = iseq ["key"; "blank key"] + VerifySeqsEqual expectedStrSeq DistnctStrSeq + + // Empty IConsumableSeq + let emptySeq : iseq = IConsumableSeq.empty + let distinct_byEmptySeq : iseq = IConsumableSeq.distinctBy funcInt emptySeq + let expectedEmptySeq : iseq = iseq [] + + VerifySeqsEqual expectedEmptySeq distinct_byEmptySeq + + //// null IConsumableSeq + //let nullSeq : iseq<'a> = null + + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.distinctBy funcInt nullSeq |> ignore) + () + + [] + member this.Except() = + // integer IConsumableSeq + let intSeq1 = iseq <| seq { yield! {1..100} + yield! {1..100} } + let intSeq2 = {1..10} + let expectedIntSeq = {11..100} + + VerifySeqsEqual expectedIntSeq <| IConsumableSeq.except intSeq2 intSeq1 + + // string IConsumableSeq + let strSeq1 = iseq ["a"; "b"; "c"; "d"; "a"] + let strSeq2 = iseq ["b"; "c"] + let expectedStrSeq = iseq ["a"; "d"] + + VerifySeqsEqual expectedStrSeq <| IConsumableSeq.except strSeq2 strSeq1 + + // double IConsumableSeq + // Sequences with nan do not behave, due to the F# generic equality comparisons +// let floatSeq1 = iseq [1.0; 1.0; System.Double.MaxValue; nan; nan] +// +// VerifySeqsEqual [1.0; System.Double.MaxValue; nan; nan] <| IConsumableSeq.except [] floatSeq1 +// VerifySeqsEqual [1.0; System.Double.MaxValue] <| IConsumableSeq.except [nan] floatSeq1 + + // empty IConsumableSeq + let emptyIntSeq = IConsumableSeq.empty + VerifySeqsEqual {1..100} <| IConsumableSeq.except emptyIntSeq intSeq1 + VerifySeqsEqual emptyIntSeq <| IConsumableSeq.except intSeq1 emptyIntSeq + VerifySeqsEqual emptyIntSeq <| IConsumableSeq.except emptyIntSeq emptyIntSeq + VerifySeqsEqual emptyIntSeq <| IConsumableSeq.except intSeq1 intSeq1 + + //// null IConsumableSeq + //let nullSeq : iseq = null + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.except nullSeq emptyIntSeq |> ignore) + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.except emptyIntSeq nullSeq |> ignore) + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.except nullSeq nullSeq |> ignore) + + () + + [] + member this.Exists() = + + // Integer IConsumableSeq + let funcInt x = (x % 2 = 0) + let IntexistsSeq = + iseq <| seq { for i in 0..9 do + yield i} + + let ifExistInt = IConsumableSeq.exists funcInt IntexistsSeq + + Assert.IsTrue( ifExistInt) + + // String IConsumableSeq + let funcStr (s:string) = s.Contains("key") + let strSeq = iseq ["key"; "blank key"] + + let ifExistStr = IConsumableSeq.exists funcStr strSeq + + Assert.IsTrue( ifExistStr) + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let ifExistsEmpty = IConsumableSeq.exists funcInt emptySeq + + Assert.IsFalse( ifExistsEmpty) + + + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.exists funcInt nullSeq |> ignore) + () + + [] + member this.Exists2() = + // Integer IConsumableSeq + let funcInt x y = (x+y)%3=0 + let Intexists2Seq1 = iseq [1;3;7] + let Intexists2Seq2 = iseq [1;6;3] + + let ifExist2Int = IConsumableSeq.exists2 funcInt Intexists2Seq1 Intexists2Seq2 + Assert.IsTrue( ifExist2Int) + + // String IConsumableSeq + let funcStr s1 s2 = ((s1 + s2) = "CombinedString") + let strSeq1 = iseq [ "Combined"; "Not Combined"] + let strSeq2 = iseq ["String"; "Other String"] + let ifexists2Str = IConsumableSeq.exists2 funcStr strSeq1 strSeq2 + Assert.IsTrue(ifexists2Str) + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let ifexists2Empty = IConsumableSeq.exists2 funcInt emptySeq emptySeq + Assert.IsFalse( ifexists2Empty) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.exists2 funcInt nullSeq nullSeq |> ignore) + () + + + [] + member this.Filter() = + // integer IConsumableSeq + let funcInt x = if (x % 5 = 0) then true else false + let IntSeq = + iseq <| seq { for i in 1..20 do + yield i } + + let filterIntSeq = IConsumableSeq.filter funcInt IntSeq + + let expectedfilterInt = iseq [ 5;10;15;20] + + VerifySeqsEqual expectedfilterInt filterIntSeq + + // string IConsumableSeq + let funcStr (s:string) = s.Contains("Expected Content") + let strSeq = iseq [ "Expected Content"; "Not Expected"; "Expected Content"; "Not Expected"] + + let filterStrSeq = IConsumableSeq.filter funcStr strSeq + + let expectedfilterStr = iseq ["Expected Content"; "Expected Content"] + + VerifySeqsEqual expectedfilterStr filterStrSeq + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let filterEmptySeq = IConsumableSeq.filter funcInt emptySeq + + let expectedEmptySeq =iseq [] + + VerifySeqsEqual expectedEmptySeq filterEmptySeq + + + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.filter funcInt nullSeq |> ignore) + () + + [] + member this.Find() = + + // integer IConsumableSeq + let funcInt x = if (x % 5 = 0) then true else false + let IntSeq = + iseq <| seq { for i in 1..20 do + yield i } + + let findInt = IConsumableSeq.find funcInt IntSeq + Assert.AreEqual(findInt, 5) + + // string IConsumableSeq + let funcStr (s:string) = s.Contains("Expected Content") + let strSeq = iseq [ "Expected Content";"Not Expected"] + + let findStr = IConsumableSeq.find funcStr strSeq + Assert.AreEqual(findStr, "Expected Content") + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + + CheckThrowsKeyNotFoundException(fun () -> IConsumableSeq.find funcInt emptySeq |> ignore) + + // null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.find funcInt nullSeq |> ignore) + () + + [] + member this.FindBack() = + // integer IConsumableSeq + let funcInt x = x % 5 = 0 + Assert.AreEqual(20, IConsumableSeq.findBack funcInt <| (iseq <| seq { 1..20 })) + Assert.AreEqual(15, IConsumableSeq.findBack funcInt <| (iseq <| seq { 1..19 })) + Assert.AreEqual(5, IConsumableSeq.findBack funcInt <| (iseq <| seq { 5..9 })) + + // string IConsumableSeq + let funcStr (s:string) = s.Contains("Expected") + let strSeq = iseq [ "Not Expected"; "Expected Content"] + let findStr = IConsumableSeq.findBack funcStr strSeq + Assert.AreEqual("Expected Content", findStr) + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + CheckThrowsKeyNotFoundException(fun () -> IConsumableSeq.findBack funcInt emptySeq |> ignore) + + // Not found + let emptySeq = IConsumableSeq.empty + CheckThrowsKeyNotFoundException(fun () -> iseq <| seq { 1..20 } |> IConsumableSeq.findBack (fun _ -> false) |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.findBack funcInt nullSeq |> ignore) + () + + [] + member this.FindIndex() = + + // integer IConsumableSeq + let digits = [1 .. 100] |> IConsumableSeq.ofList + let idx = digits |> IConsumableSeq.findIndex (fun i -> i.ToString().Length > 1) + Assert.AreEqual(idx, 9) + + // empty IConsumableSeq + CheckThrowsKeyNotFoundException(fun () -> IConsumableSeq.findIndex (fun i -> true) IConsumableSeq.empty |> ignore) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.findIndex (fun i -> true) null |> ignore) + () + + [] + member this.Permute() = + let mapIndex i = (i + 1) % 4 + + // integer iseq + let intSeq = iseq <| seq { 1..4 } + let resultInt = IConsumableSeq.permute mapIndex intSeq + VerifySeqsEqual (iseq [4;1;2;3]) resultInt + + // string iseq + let resultStr = IConsumableSeq.permute mapIndex (iseq [|"Lists"; "are"; "commonly"; "list" |]) + VerifySeqsEqual (iseq ["list"; "Lists"; "are"; "commonly" ]) resultStr + + // empty iseq + let resultEpt = IConsumableSeq.permute mapIndex (iseq [||]) + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null iseq + //let nullSeq = null:string[] + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.permute mapIndex nullSeq |> ignore) + + // argument exceptions + CheckThrowsArgumentException (fun () -> IConsumableSeq.permute (fun _ -> 10) (iseq [0..9]) |> IConsumableSeq.iter ignore) + CheckThrowsArgumentException (fun () -> IConsumableSeq.permute (fun _ -> 0) (iseq [0..9]) |> IConsumableSeq.iter ignore) + () + + [] + member this.FindIndexBack() = + // integer IConsumableSeq + let digits = iseq <| seq { 1..100 } + let idx = digits |> IConsumableSeq.findIndexBack (fun i -> i.ToString().Length = 1) + Assert.AreEqual(idx, 8) + + // string IConsumableSeq + let funcStr (s:string) = s.Contains("Expected") + let strSeq = iseq [ "Not Expected"; "Expected Content" ] + let findStr = IConsumableSeq.findIndexBack funcStr strSeq + Assert.AreEqual(1, findStr) + + // empty IConsumableSeq + CheckThrowsKeyNotFoundException(fun () -> IConsumableSeq.findIndexBack (fun i -> true) IConsumableSeq.empty |> ignore) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.findIndexBack (fun i -> true) null |> ignore) + () + + [] + member this.Pick() = + + let digits = [| 1 .. 10 |] |> IConsumableSeq.ofArray + let result = IConsumableSeq.pick (fun i -> if i > 5 then Some(i.ToString()) else None) digits + Assert.AreEqual(result, "6") + + // Empty iseq (Bugged, 4173) + CheckThrowsKeyNotFoundException (fun () -> IConsumableSeq.pick (fun i -> Some('a')) (iseq ([| |] : int[])) |> ignore) + + //// Null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.pick (fun i -> Some(i + 0)) null |> ignore) + () + + [] + member this.Fold() = + let funcInt x y = x+y + + let IntSeq = + iseq <| seq { for i in 1..10 do + yield i} + + let foldInt = IConsumableSeq.fold funcInt 1 IntSeq + if foldInt <> 56 then Assert.Fail() + + // string IConsumableSeq + let funcStr (x:string) (y:string) = x+y + let strSeq = iseq ["B"; "C"; "D" ; "E"] + let foldStr = IConsumableSeq.fold funcStr "A" strSeq + + if foldStr <> "ABCDE" then Assert.Fail() + + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let foldEmpty = IConsumableSeq.fold funcInt 1 emptySeq + if foldEmpty <> 1 then Assert.Fail() + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.fold funcInt 1 nullSeq |> ignore) + () + + + + [] + member this.Fold2() = + Assert.AreEqual([(3,5); (2,3); (1,1)],IConsumableSeq.fold2 (fun acc x y -> (x,y)::acc) [] (iseq [ 1..3 ]) (iseq [1..2..6])) + + // integer List + let funcInt x y z = x + y + z + let resultInt = IConsumableSeq.fold2 funcInt 9 (iseq [ 1..10 ]) (iseq [1..2..20]) + Assert.AreEqual(164, resultInt) + + // string List + let funcStr x y z = x + y + z + let resultStr = IConsumableSeq.fold2 funcStr "*" (iseq ["a"; "b"; "c" ; "d" ]) (iseq ["A"; "B"; "C" ; "D" ] ) + Assert.AreEqual("*aAbBcCdD", resultStr) + + // empty List + let emptyArr:int list = [ ] + let resultEpt = IConsumableSeq.fold2 funcInt 5 (iseq emptyArr) (iseq emptyArr) + Assert.AreEqual(5, resultEpt) + + Assert.AreEqual(0,IConsumableSeq.fold2 funcInt 0 IConsumableSeq.empty (iseq [1])) + Assert.AreEqual(-1,IConsumableSeq.fold2 funcInt -1 (iseq [1]) IConsumableSeq.empty) + + Assert.AreEqual(2,IConsumableSeq.fold2 funcInt 0 (iseq [1;2]) (iseq [1])) + Assert.AreEqual(4,IConsumableSeq.fold2 funcInt 0 (iseq [1]) (iseq [3;6])) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.fold2 funcInt 0 nullSeq (iseq [1]) |> ignore) + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.fold2 funcInt 0 (iseq [1]) nullSeq |> ignore) + () + + [] + member this.FoldBack() = + // int IConsumableSeq + let funcInt x y = x-y + let IntSeq = iseq <| seq { 1..4 } + let foldInt = IConsumableSeq.foldBack funcInt IntSeq 6 + Assert.AreEqual((1-(2-(3-(4-6)))), foldInt) + + // string IConsumableSeq + let funcStr (x:string) (y:string) = y.Remove(0,x.Length) + let strSeq = iseq [ "A"; "B"; "C"; "D" ] + let foldStr = IConsumableSeq.foldBack funcStr strSeq "ABCDE" + Assert.AreEqual("E", foldStr) + + // single element + let funcStr2 elem acc = sprintf "%s%s" elem acc + let strSeq2 = iseq [ "A" ] + let foldStr2 = IConsumableSeq.foldBack funcStr2 strSeq2 "X" + Assert.AreEqual("AX", foldStr2) + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let foldEmpty = IConsumableSeq.foldBack funcInt emptySeq 1 + Assert.AreEqual(1, foldEmpty) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.foldBack funcInt nullSeq 1 |> ignore) + + // Validate that foldBack with the cons operator and the empty list returns a copy of the sequence + let cons x y = x :: y + let identityFoldr = IConsumableSeq.foldBack cons IntSeq [] + Assert.AreEqual([1;2;3;4], identityFoldr) + + () + + [] + member this.foldBack2() = + // int IConsumableSeq + let funcInt x y z = x + y + z + let intSeq = iseq <| seq { 1..10 } + let resultInt = IConsumableSeq.foldBack2 funcInt intSeq (iseq <| seq { 1..2..20 }) 9 + Assert.AreEqual(164, resultInt) + + // string IConsumableSeq + let funcStr = sprintf "%s%s%s" + let strSeq = iseq [ "A"; "B"; "C"; "D" ] + let resultStr = IConsumableSeq.foldBack2 funcStr strSeq (iseq [ "a"; "b"; "c"; "d"]) "*" + Assert.AreEqual("AaBbCcDd*", resultStr) + + // single element + let strSeqSingle = iseq [ "X" ] + Assert.AreEqual("XAZ", IConsumableSeq.foldBack2 funcStr strSeqSingle strSeq "Z") + Assert.AreEqual("AXZ", IConsumableSeq.foldBack2 funcStr strSeq strSeqSingle "Z") + Assert.AreEqual("XYZ", IConsumableSeq.foldBack2 funcStr strSeqSingle (iseq [ "Y" ]) "Z") + + // empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + Assert.AreEqual(1, IConsumableSeq.foldBack2 funcInt emptySeq emptySeq 1) + Assert.AreEqual(1, IConsumableSeq.foldBack2 funcInt emptySeq intSeq 1) + Assert.AreEqual(1, IConsumableSeq.foldBack2 funcInt intSeq emptySeq 1) + + // infinite IConsumableSeq + let infiniteSeq = IConsumableSeq.initInfinite (fun i -> 2 * i + 1) + Assert.AreEqual(164, IConsumableSeq.foldBack2 funcInt intSeq infiniteSeq 9) + Assert.AreEqual(164, IConsumableSeq.foldBack2 funcInt infiniteSeq intSeq 9) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.foldBack2 funcInt nullSeq intSeq 1 |> ignore) + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.foldBack2 funcInt intSeq nullSeq 1 |> ignore) + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.foldBack2 funcInt nullSeq nullSeq 1 |> ignore) + + () + + [] + member this.ForAll() = + + let funcInt x = if x%2 = 0 then true else false + let IntSeq = + iseq <| seq { for i in 1..10 do + yield i*2} + let for_allInt = IConsumableSeq.forall funcInt IntSeq + + if for_allInt <> true then Assert.Fail() + + + // string IConsumableSeq + let funcStr (x:string) = x.Contains("a") + let strSeq = iseq ["a"; "ab"; "abc" ; "abcd"] + let for_allStr = IConsumableSeq.forall funcStr strSeq + + if for_allStr <> true then Assert.Fail() + + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let for_allEmpty = IConsumableSeq.forall funcInt emptySeq + + if for_allEmpty <> true then Assert.Fail() + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.forall funcInt nullSeq |> ignore) + () + + [] + member this.ForAll2() = + + let funcInt x y = if (x+y)%2 = 0 then true else false + let IntSeq = + iseq <| seq { for i in 1..10 do + yield i} + + let for_all2Int = IConsumableSeq.forall2 funcInt IntSeq IntSeq + + if for_all2Int <> true then Assert.Fail() + + // string IConsumableSeq + let funcStr (x:string) (y:string) = (x+y).Length = 5 + let strSeq1 = iseq ["a"; "ab"; "abc" ; "abcd"] + let strSeq2 = iseq ["abcd"; "abc"; "ab" ; "a"] + let for_all2Str = IConsumableSeq.forall2 funcStr strSeq1 strSeq2 + + if for_all2Str <> true then Assert.Fail() + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let for_all2Empty = IConsumableSeq.forall2 funcInt emptySeq emptySeq + + if for_all2Empty <> true then Assert.Fail() + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.forall2 funcInt nullSeq nullSeq |> ignore) + + [] + member this.GroupBy() = + + let funcInt x = x%5 + + let IntSeq = + iseq <| seq { for i in 0 .. 9 do + yield i } + + let group_byInt = IConsumableSeq.groupByVal funcInt IntSeq |> IConsumableSeq.map (fun (i, v) -> i, IConsumableSeq.toList v) + + let expectedIntSeq = + iseq <| seq { for i in 0..4 do + yield i, [i; i+5] } + + VerifySeqsEqual group_byInt expectedIntSeq + + // string IConsumableSeq + let funcStr (x:string) = x.Length + let strSeq = iseq ["length7"; "length 8"; "length7" ; "length 9"] + + let group_byStr = IConsumableSeq.groupByVal funcStr strSeq |> IConsumableSeq.map (fun (i, v) -> i, IConsumableSeq.toList v) + let expectedStrSeq = + iseq <| seq { + yield 7, ["length7"; "length7"] + yield 8, ["length 8"] + yield 9, ["length 9"] } + + VerifySeqsEqual expectedStrSeq group_byStr + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let group_byEmpty = IConsumableSeq.groupByVal funcInt emptySeq + let expectedEmptySeq = iseq [] + + VerifySeqsEqual expectedEmptySeq group_byEmpty + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //let group_byNull = IConsumableSeq.groupBy funcInt nullSeq + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.iter (fun _ -> ()) group_byNull) + () + + [] + member this.DisposalOfUnstartedEnumerator() = + let run = ref false + let f() = iseq <| seq { + try + () + finally + run := true + } + + f().GetEnumerator().Dispose() + Assert.IsFalse(!run) + + [] + member this.WeirdLocalNames() = + + let f pc = iseq <| seq { + yield pc + yield (pc+1) + yield (pc+2) + } + + let l = f 3 |> IConsumableSeq.toList + Assert.AreEqual([3;4;5], l) + + let f i = iseq <| seq { + let pc = i*2 + yield pc + yield (pc+1) + yield (pc+2) + } + let l = f 3 |> IConsumableSeq.toList + Assert.AreEqual([6;7;8], l) + + [] + member this.Contains() = + + // Integer IConsumableSeq + let intSeq = iseq <| seq { 0..9 } + + let ifContainsInt = IConsumableSeq.contains 5 intSeq + + Assert.IsTrue(ifContainsInt) + + // String IConsumableSeq + let strSeq = iseq ["key"; "blank key"] + + let ifContainsStr = IConsumableSeq.contains "key" strSeq + + Assert.IsTrue(ifContainsStr) + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + let ifContainsEmpty = IConsumableSeq.contains 5 emptySeq + + Assert.IsFalse(ifContainsEmpty) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.contains 5 nullSeq |> ignore) + +#endif \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule2.fs new file mode 100644 index 00000000000..300f7fcebfa --- /dev/null +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqModule2.fs @@ -0,0 +1,1845 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FSharp.Core.UnitTests.FSharp_Core.Microsoft_FSharp_Collections + +open System +open NUnit.Framework + +open FSharp.Core.UnitTests.LibraryTestFx + +#if IConsumableSeqIsPublic + +//type iseq<'a> = IConsumableSeq.Core.IConsumableSeq<'a> + +type IConsumableSeqWindowedTestInput<'t> = + { + InputSeq : iseq<'t> + WindowSize : int + ExpectedSeq : iseq<'t[]> + Exception : Type option + } + +[] +type IConsumableSeqModule2() = + let iseq (x:seq<_>) = x |> IConsumableSeq.ofSeq + + [] + member this.Hd() = + + let IntSeq = + iseq <| seq { for i in 0 .. 9 do + yield i } + + if IConsumableSeq.head IntSeq <> 0 then Assert.Fail() + + // string IConsumableSeq + let strSeq = iseq ["first"; "second"; "third"] + if IConsumableSeq.head strSeq <> "first" then Assert.Fail() + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + CheckThrowsArgumentException ( fun() -> IConsumableSeq.head emptySeq) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.head nullSeq) + () + + [] + member this.TryHead() = + // int IConsumableSeq + let IntSeq = + iseq <| seq { for i in 0 .. 9 -> i } + + let intResult = IConsumableSeq.tryHead IntSeq + + // string IConsumableSeq + let strResult = IConsumableSeq.tryHead (iseq ["first"; "second"; "third"]) + Assert.AreEqual("first", strResult.Value) + + // Empty IConsumableSeq + let emptyResult = IConsumableSeq.tryHead IConsumableSeq.empty + Assert.AreEqual(None, emptyResult) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.head nullSeq) + () + + [] + member this.Tl() = + // integer iseq + let resultInt = IConsumableSeq.tail <| (iseq <| seq { 1..10 } ) + Assert.AreEqual(Array.ofSeq (iseq <| seq { 2..10 }), Array.ofSeq resultInt) + + // string iseq + let resultStr = IConsumableSeq.tail <| (iseq <| seq { yield "a"; yield "b"; yield "c"; yield "d" }) + Assert.AreEqual(Array.ofSeq (iseq <| seq { yield "b"; yield "c" ; yield "d" }), Array.ofSeq resultStr) + + // 1-element iseq + let resultStr2 = IConsumableSeq.tail <| (iseq <| seq { yield "a" }) + Assert.AreEqual(Array.ofSeq (IConsumableSeq.empty : iseq), Array.ofSeq resultStr2) + + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.tail null |> ignore) + CheckThrowsArgumentException(fun () -> IConsumableSeq.tail IConsumableSeq.empty |> IConsumableSeq.iter (fun _ -> failwith "Should not be reached")) + () + + [] + member this.Last() = + + let IntSeq = + iseq <| seq { for i in 0 .. 9 do + yield i } + + if IConsumableSeq.last IntSeq <> 9 then Assert.Fail() + + // string IConsumableSeq + let strSeq = iseq ["first"; "second"; "third"] + if IConsumableSeq.last strSeq <> "third" then Assert.Fail() + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + CheckThrowsArgumentException ( fun() -> IConsumableSeq.last emptySeq) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.last nullSeq) + () + + [] + member this.TryLast() = + + let IntSeq = + iseq <| seq { for i in 0 .. 9 -> i } + + let intResult = IConsumableSeq.tryLast IntSeq + Assert.AreEqual(9, intResult.Value) + + // string IConsumableSeq + let strResult = IConsumableSeq.tryLast (iseq ["first"; "second"; "third"]) + Assert.AreEqual("third", strResult.Value) + + // Empty IConsumableSeq + let emptyResult = IConsumableSeq.tryLast IConsumableSeq.empty + Assert.IsTrue(emptyResult.IsNone) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.tryLast nullSeq |> ignore) + () + + [] + member this.ExactlyOne() = + + let IntSeq = + iseq <| seq { for i in 7 .. 7 do + yield i } + + if IConsumableSeq.exactlyOne IntSeq <> 7 then Assert.Fail() + + // string IConsumableSeq + let strSeq = iseq ["second"] + if IConsumableSeq.exactlyOne strSeq <> "second" then Assert.Fail() + + // Empty IConsumableSeq + let emptySeq = IConsumableSeq.empty + CheckThrowsArgumentException ( fun() -> IConsumableSeq.exactlyOne emptySeq) + + // non-singleton IConsumableSeq + let emptySeq = IConsumableSeq.empty + CheckThrowsArgumentException ( fun() -> IConsumableSeq.exactlyOne (iseq [ 0 .. 1 ]) |> ignore ) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.exactlyOne nullSeq) + () + + + [] + member this.Init() = + + let funcInt x = x + let init_finiteInt = IConsumableSeq.init 9 funcInt + let expectedIntSeq = iseq [ 0..8] + + VerifySeqsEqual expectedIntSeq init_finiteInt + + + // string IConsumableSeq + let funcStr x = x.ToString() + let init_finiteStr = IConsumableSeq.init 5 funcStr + let expectedStrSeq = iseq ["0";"1";"2";"3";"4"] + + VerifySeqsEqual expectedStrSeq init_finiteStr + + // null IConsumableSeq + let funcNull x = null + let init_finiteNull = IConsumableSeq.init 3 funcNull + let expectedNullSeq = iseq [ null;null;null] + + VerifySeqsEqual expectedNullSeq init_finiteNull + () + + [] + member this.InitInfinite() = + + let funcInt x = x + let init_infiniteInt = IConsumableSeq.initInfinite funcInt + let resultint = IConsumableSeq.find (fun x -> x =100) init_infiniteInt + + Assert.AreEqual(100,resultint) + + + // string IConsumableSeq + let funcStr x = x.ToString() + let init_infiniteStr = IConsumableSeq.initInfinite funcStr + let resultstr = IConsumableSeq.find (fun x -> x = "100") init_infiniteStr + + Assert.AreEqual("100",resultstr) + + + [] + member this.IsEmpty() = + + //iseq int + let seqint = iseq [1;2;3] + let is_emptyInt = IConsumableSeq.isEmpty seqint + + Assert.IsFalse(is_emptyInt) + + //iseq str + let seqStr = iseq["first";"second"] + let is_emptyStr = IConsumableSeq.isEmpty seqStr + + Assert.IsFalse(is_emptyInt) + + //iseq empty + let seqEmpty = IConsumableSeq.empty + let is_emptyEmpty = IConsumableSeq.isEmpty seqEmpty + Assert.IsTrue(is_emptyEmpty) + + ////iseq null + //let seqnull:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.isEmpty seqnull |> ignore) + () + + [] + member this.Iter() = + //iseq int + let seqint = iseq [ 1..3] + let cacheint = ref 0 + + let funcint x = cacheint := !cacheint + x + IConsumableSeq.iter funcint seqint + Assert.AreEqual(6,!cacheint) + + //iseq str + let seqStr = iseq ["first";"second"] + let cachestr =ref "" + let funcstr x = cachestr := !cachestr+x + IConsumableSeq.iter funcstr seqStr + + Assert.AreEqual("firstsecond",!cachestr) + + // empty array + let emptyseq = IConsumableSeq.empty + let resultEpt = ref 0 + IConsumableSeq.iter (fun x -> Assert.Fail()) emptyseq + + //// null seqay + //let nullseq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.iter funcint nullseq |> ignore) + () + + [] + member this.Iter2() = + + //iseq int + let seqint = iseq [ 1..3] + let cacheint = ref 0 + + let funcint x y = cacheint := !cacheint + x+y + IConsumableSeq.iter2 funcint seqint seqint + Assert.AreEqual(12,!cacheint) + + //iseq str + let seqStr = iseq ["first";"second"] + let cachestr =ref "" + let funcstr x y = cachestr := !cachestr+x+y + IConsumableSeq.iter2 funcstr seqStr seqStr + + Assert.AreEqual("firstfirstsecondsecond",!cachestr) + + // empty array + let emptyseq = IConsumableSeq.empty + let resultEpt = ref 0 + IConsumableSeq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq + + //// null seqay + //let nullseq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.iter2 funcint nullseq nullseq |> ignore) + + () + + [] + member this.Iteri() = + + // iseq int + let seqint = iseq [ 1..10] + let cacheint = ref 0 + + let funcint x y = cacheint := !cacheint + x+y + IConsumableSeq.iteri funcint seqint + Assert.AreEqual(100,!cacheint) + + // iseq str + let seqStr = iseq ["first";"second"] + let cachestr =ref 0 + let funcstr (x:int) (y:string) = cachestr := !cachestr+ x + y.Length + IConsumableSeq.iteri funcstr seqStr + + Assert.AreEqual(12,!cachestr) + + // empty array + let emptyseq = IConsumableSeq.empty + let resultEpt = ref 0 + IConsumableSeq.iteri funcint emptyseq + Assert.AreEqual(0,!resultEpt) + + //// null seqay + //let nullseq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.iteri funcint nullseq |> ignore) + () + + [] + member this.Iteri2() = + + //iseq int + let seqint = iseq [ 1..3] + let cacheint = ref 0 + + let funcint x y z = cacheint := !cacheint + x + y + z + IConsumableSeq.iteri2 funcint seqint seqint + Assert.AreEqual(15,!cacheint) + + //iseq str + let seqStr = iseq ["first";"second"] + let cachestr = ref 0 + let funcstr (x:int) (y:string) (z:string) = cachestr := !cachestr + x + y.Length + z.Length + IConsumableSeq.iteri2 funcstr seqStr seqStr + + Assert.AreEqual(23,!cachestr) + + // empty iseq + let emptyseq = IConsumableSeq.empty + let resultEpt = ref 0 + IConsumableSeq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq + + //// null iseq + //let nullseq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.iteri2 funcint nullseq nullseq |> ignore) + + // len1 <> len2 + let shorterSeq = iseq <| seq { 1..3 } + let longerSeq = iseq <| seq { 2..2..100 } + + let testSeqLengths seq1 seq2 = + let cache = ref 0 + let f x y z = cache := !cache + x + y + z + IConsumableSeq.iteri2 f seq1 seq2 + !cache + + Assert.AreEqual(21, testSeqLengths shorterSeq longerSeq) + Assert.AreEqual(21, testSeqLengths longerSeq shorterSeq) + + () + + [] + member this.Length() = + + // integer iseq + let resultInt = IConsumableSeq.length (iseq {1..8}) + if resultInt <> 8 then Assert.Fail() + + // string IConsumableSeq + let resultStr = IConsumableSeq.length (iseq ["Lists"; "are"; "commonly" ; "list" ]) + if resultStr <> 4 then Assert.Fail() + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.length IConsumableSeq.empty + if resultEpt <> 0 then Assert.Fail() + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.length nullSeq |> ignore) + + () + + [] + member this.Map() = + + // integer IConsumableSeq + let funcInt x = + match x with + | _ when x % 2 = 0 -> 10*x + | _ -> x + + let resultInt = IConsumableSeq.map funcInt (iseq { 1..10 }) + let expectedint = iseq [1;20;3;40;5;60;7;80;9;100] + + VerifySeqsEqual expectedint resultInt + + // string IConsumableSeq + let funcStr (x:string) = x.ToLower() + let resultStr = IConsumableSeq.map funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedSeq = iseq ["lists"; "are"; "commonly" ; "list"] + + VerifySeqsEqual expectedSeq resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.map funcInt IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.map funcStr nullSeq |> ignore) + + () + + [] + member this.Map2() = + // integer IConsumableSeq + let funcInt x y = x+y + let resultInt = IConsumableSeq.map2 funcInt (iseq { 1..10 }) (iseq {2..2..20}) + let expectedint = iseq [3;6;9;12;15;18;21;24;27;30] + + VerifySeqsEqual expectedint resultInt + + // string IConsumableSeq + let funcStr (x:int) (y:string) = x+y.Length + let resultStr = IConsumableSeq.map2 funcStr (iseq[3;6;9;11]) (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedSeq = iseq [8;9;17;15] + + VerifySeqsEqual expectedSeq resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.map2 funcInt IConsumableSeq.empty IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //let validSeq = iseq [1] + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.map2 funcInt nullSeq validSeq |> ignore) + + () + + [] + member this.Map3() = + // Integer iseq + let funcInt a b c = (a + b) * c + let resultInt = IConsumableSeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..9 }) (iseq { 3..10 }) + let expectedInt = iseq [9; 20; 35; 54; 77; 104; 135; 170] + VerifySeqsEqual expectedInt resultInt + + // First iseq is shorter + VerifySeqsEqual (iseq [9; 20]) (IConsumableSeq.map3 funcInt (iseq { 1..2 }) (iseq { 2..9 }) (iseq { 3..10 })) + // Second iseq is shorter + VerifySeqsEqual (iseq [9; 20; 35]) (IConsumableSeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..4 }) (iseq { 3..10 })) + // Third iseq is shorter + VerifySeqsEqual (iseq [9; 20; 35; 54]) (IConsumableSeq.map3 funcInt (iseq { 1..8 }) (iseq { 2..6 }) (iseq { 3..6 })) + + // String iseq + let funcStr a b c = a + b + c + let resultStr = IConsumableSeq.map3 funcStr (iseq ["A";"B";"C";"D"]) (iseq ["a";"b";"c";"d"]) (iseq ["1";"2";"3";"4"]) + let expectedStr = iseq ["Aa1";"Bb2";"Cc3";"Dd4"] + VerifySeqsEqual expectedStr resultStr + + // Empty iseq + let resultEmpty = IConsumableSeq.map3 funcStr IConsumableSeq.empty IConsumableSeq.empty IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEmpty + + //// Null iseq + //let nullSeq = null : iseq<_> + //let nonNullSeq = iseq [1] + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.map3 funcInt nullSeq nonNullSeq nullSeq |> ignore) + + () + + [] + member this.MapFold() = + // integer IConsumableSeq + let funcInt acc x = if x % 2 = 0 then 10*x, acc + 1 else x, acc + let resultInt,resultIntAcc = IConsumableSeq.mapFold funcInt 100 <| (iseq <| seq { 1..10 }) + VerifySeqsEqual (iseq [ 1;20;3;40;5;60;7;80;9;100 ]) resultInt + Assert.AreEqual(105, resultIntAcc) + + // string IConsumableSeq + let funcStr acc (x:string) = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x + let resultStr,resultStrAcc = IConsumableSeq.mapFold funcStr "" <| iseq [ "";"BB";"C";"" ] + VerifySeqsEqual (iseq [ "empty";"bb";"c";"empty" ]) resultStr + Assert.AreEqual("BBC", resultStrAcc) + + // empty IConsumableSeq + let resultEpt,resultEptAcc = IConsumableSeq.mapFold funcInt 100 IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + Assert.AreEqual(100, resultEptAcc) + + //// null IConsumableSeq + //let nullArr = null:iseq + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.mapFold funcStr "" nullArr |> ignore) + + () + + [] + member this.MapFoldBack() = + // integer IConsumableSeq + let funcInt x acc = if acc < 105 then 10*x, acc + 2 else x, acc + let resultInt,resultIntAcc = IConsumableSeq.mapFoldBack funcInt (iseq <| seq { 1..10 }) 100 + VerifySeqsEqual (iseq [ 1;2;3;4;5;6;7;80;90;100 ]) resultInt + Assert.AreEqual(106, resultIntAcc) + + // string IConsumableSeq + let funcStr (x:string) acc = match x.Length with 0 -> "empty", acc | _ -> x.ToLower(), sprintf "%s%s" acc x + let resultStr,resultStrAcc = IConsumableSeq.mapFoldBack funcStr (iseq [ "";"BB";"C";"" ]) "" + VerifySeqsEqual (iseq [ "empty";"bb";"c";"empty" ]) resultStr + Assert.AreEqual("CBB", resultStrAcc) + + // empty IConsumableSeq + let resultEpt,resultEptAcc = IConsumableSeq.mapFoldBack funcInt IConsumableSeq.empty 100 + VerifySeqsEqual IConsumableSeq.empty resultEpt + Assert.AreEqual(100, resultEptAcc) + + //// null IConsumableSeq + //let nullArr = null:iseq + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.mapFoldBack funcStr nullArr "" |> ignore) + + () + + member private this.MapWithSideEffectsTester (map : (int -> int) -> iseq -> iseq) expectExceptions = + let i = ref 0 + let f x = i := !i + 1; x*x + let e = ((iseq [1;2]) |> map f).GetEnumerator() + + if expectExceptions then + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2, !i) + if expectExceptions then + CheckThrowsInvalidOperationExn (fun _ -> e.Current |> ignore) + Assert.AreEqual(2, !i) + + + i := 0 + let e = ((iseq []) |> map f).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + + member private this.MapWithExceptionTester (map : (int -> int) -> iseq -> iseq) = + let raiser x = if x > 0 then raise(NotSupportedException()) else x + let e = (map raiser (iseq [0; 1])).GetEnumerator() + Assert.IsTrue(e.MoveNext()) // should not throw + Assert.AreEqual(0, e.Current) + CheckThrowsNotSupportedException(fun _ -> e.MoveNext() |> ignore) + Assert.AreEqual(0, e.Current) // should not throw + + [] + member this.MapWithSideEffects () = + this.MapWithSideEffectsTester IConsumableSeq.map true + + [] + member this.MapWithException () = + this.MapWithExceptionTester IConsumableSeq.map + + + [] + member this.SingletonCollectWithSideEffects () = + this.MapWithSideEffectsTester (fun f-> IConsumableSeq.collect (f >> IConsumableSeq.singleton)) true + + [] + member this.SingletonCollectWithException () = + this.MapWithExceptionTester (fun f-> IConsumableSeq.collect (f >> IConsumableSeq.singleton)) + +#if !FX_NO_LINQ + [] + member this.SystemLinqSelectWithSideEffects () = + this.MapWithSideEffectsTester (fun f s -> iseq <| System.Linq.Enumerable.Select(s, Func<_,_>(f))) false + + [] + member this.SystemLinqSelectWithException () = + this.MapWithExceptionTester (fun f s -> iseq <| System.Linq.Enumerable.Select(s, Func<_,_>(f))) +#endif + + [] + member this.MapiWithSideEffects () = + let i = ref 0 + let f _ x = i := !i + 1; x*x + let e = ((iseq [1;2]) |> IConsumableSeq.mapi f).GetEnumerator() + + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2, !i) + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(2, !i) + + i := 0 + let e = ((iseq []) |> IConsumableSeq.mapi f).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + [] + member this.Map2WithSideEffects () = + let i = ref 0 + let f x y = i := !i + 1; x*x + let e = (IConsumableSeq.map2 f (iseq [1;2]) (iseq [1;2])).GetEnumerator() + + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2,!i) + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(2, !i) + + i := 0 + let e = (IConsumableSeq.map2 f (iseq []) (iseq [])).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + [] + member this.Mapi2WithSideEffects () = + let i = ref 0 + let f _ x y = i := !i + 1; x*x + let e = (IConsumableSeq.mapi2 f (iseq [1;2]) (iseq [1;2])).GetEnumerator() + + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(0, !i) + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + let _ = e.Current + Assert.AreEqual(1, !i) + + if not (e.MoveNext()) then Assert.Fail() + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + let _ = e.Current + Assert.AreEqual(2, !i) + + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(2,!i) + CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) + Assert.AreEqual(2, !i) + + i := 0 + let e = (IConsumableSeq.mapi2 f (iseq []) (iseq [])).GetEnumerator() + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + if e.MoveNext() then Assert.Fail() + Assert.AreEqual(0,!i) + + [] + member this.Collect() = + // integer IConsumableSeq + let funcInt x = iseq [x+1] + let resultInt = IConsumableSeq.collect funcInt (iseq { 1..10 }) + + let expectedint = iseq <| seq {2..11} + + VerifySeqsEqual expectedint resultInt + +//#if !FX_NO_CHAR_PARSE +// // string IConsumableSeq +// let funcStr (y:string) = y+"ist" + +// let resultStr = IConsumableSeq.collect funcStr (iseq ["L"]) + + +// let expectedSeq = iseq ['L';'i';'s';'t'] + +// VerifySeqsEqual expectedSeq resultStr +//#endif + // empty IConsumableSeq + let resultEpt = IConsumableSeq.collect funcInt IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.collect funcInt nullSeq |> ignore) + + () + + [] + member this.Mapi() = + + // integer IConsumableSeq + let funcInt x y = x+y + let resultInt = IConsumableSeq.mapi funcInt (iseq { 10..2..20 } ) + let expectedint = iseq [10;13;16;19;22;25] + + VerifySeqsEqual expectedint resultInt + + // string IConsumableSeq + let funcStr (x:int) (y:string) =x+y.Length + + let resultStr = IConsumableSeq.mapi funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedStr = iseq [5;4;10;7] + + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.mapi funcInt IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.mapi funcInt nullSeq |> ignore) + + () + + [] + member this.Mapi2() = + // integer IConsumableSeq + let funcInt x y z = x+y+z + let resultInt = IConsumableSeq.mapi2 funcInt (iseq { 1..10 }) (iseq {2..2..20}) + let expectedint = iseq [3;7;11;15;19;23;27;31;35;39] + + VerifySeqsEqual expectedint resultInt + + // string IConsumableSeq + let funcStr (x:int) (y:int) (z:string) = x+y+z.Length + let resultStr = IConsumableSeq.mapi2 funcStr (iseq[3;6;9;11]) (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + let expectedSeq = iseq [8;10;19;18] + + VerifySeqsEqual expectedSeq resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.mapi2 funcInt IConsumableSeq.empty IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //let validSeq = iseq [1] + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.mapi2 funcInt nullSeq validSeq |> ignore) + + // len1 <> len2 + let shorterSeq = iseq <| seq { 1..10 } + let longerSeq = iseq <| seq { 2..20 } + + let testSeqLengths seq1 seq2 = + let f x y z = x + y + z + IConsumableSeq.mapi2 f seq1 seq2 + + VerifySeqsEqual (iseq [3;6;9;12;15;18;21;24;27;30]) (testSeqLengths shorterSeq longerSeq) + VerifySeqsEqual (iseq [3;6;9;12;15;18;21;24;27;30]) (testSeqLengths longerSeq shorterSeq) + + [] + member this.Indexed() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.indexed (iseq { 10..2..20 }) + let expectedint = iseq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)] + + VerifySeqsEqual expectedint resultInt + + // string IConsumableSeq + let resultStr = IConsumableSeq.indexed (iseq ["Lists"; "Are"; "Commonly"; "List" ]) + let expectedStr = iseq [(0,"Lists");(1,"Are");(2,"Commonly");(3,"List")] + + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.indexed IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.indexed nullSeq |> ignore) + + () + + [] + member this.Max() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.max (iseq { 10..20 } ) + + Assert.AreEqual(20,resultInt) + + // string IConsumableSeq + + let resultStr = IConsumableSeq.max (iseq ["Lists"; "Are"; "MaxString" ; "List" ]) + Assert.AreEqual("MaxString",resultStr) + + // empty IConsumableSeq + CheckThrowsArgumentException(fun () -> IConsumableSeq.max ( IConsumableSeq.empty : iseq) |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.max nullSeq |> ignore) + + () + + [] + member this.MaxBy() = + + // integer IConsumableSeq + let funcInt x = x % 8 + let resultInt = IConsumableSeq.maxBy funcInt (iseq { 2..2..20 } ) + Assert.AreEqual(6,resultInt) + + // string IConsumableSeq + let funcStr (x:string) =x.Length + let resultStr = IConsumableSeq.maxBy funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + Assert.AreEqual("Commonly",resultStr) + + // empty IConsumableSeq + CheckThrowsArgumentException (fun () -> IConsumableSeq.maxBy funcInt (IConsumableSeq.empty : iseq) |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.maxBy funcInt nullSeq |> ignore) + + () + + [] + member this.MinBy() = + + // integer IConsumableSeq + let funcInt x = x % 8 + let resultInt = IConsumableSeq.minBy funcInt (iseq { 2..2..20 } ) + Assert.AreEqual(8,resultInt) + + // string IConsumableSeq + let funcStr (x:string) =x.Length + let resultStr = IConsumableSeq.minBy funcStr (iseq ["Lists"; "Are"; "Commonly" ; "List" ]) + Assert.AreEqual("Are",resultStr) + + // empty IConsumableSeq + CheckThrowsArgumentException (fun () -> IConsumableSeq.minBy funcInt (IConsumableSeq.empty : iseq) |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.minBy funcInt nullSeq |> ignore) + + () + + + [] + member this.Min() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.min (iseq { 10..20 } ) + Assert.AreEqual(10,resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.min (iseq ["Lists"; "Are"; "minString" ; "List" ]) + Assert.AreEqual("Are",resultStr) + + // empty IConsumableSeq + CheckThrowsArgumentException (fun () -> IConsumableSeq.min (IConsumableSeq.empty : iseq) |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.min nullSeq |> ignore) + + () + + [] + member this.Item() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.item 3 (iseq { 10..20 }) + Assert.AreEqual(13, resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.item 2 (iseq ["Lists"; "Are"; "Cool" ; "List" ]) + Assert.AreEqual("Cool", resultStr) + + // empty IConsumableSeq + CheckThrowsArgumentException(fun () -> IConsumableSeq.item 0 (IConsumableSeq.empty : iseq) |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () ->IConsumableSeq.item 3 nullSeq |> ignore) + + // Negative index + for i = -1 downto -10 do + CheckThrowsArgumentException (fun () -> IConsumableSeq.item i (iseq { 10 .. 20 }) |> ignore) + + // Out of range + for i = 11 to 20 do + CheckThrowsArgumentException (fun () -> IConsumableSeq.item i (iseq { 10 .. 20 }) |> ignore) + + [] + member this.``item should fail with correct number of missing elements``() = + try + IConsumableSeq.item 0 (iseq (Array.zeroCreate 0)) |> ignore + failwith "error expected" + with + | exn when exn.Message.Contains("seq was short by 1 element") -> () + + try + IConsumableSeq.item 2 (iseq (Array.zeroCreate 0)) |> ignore + failwith "error expected" + with + | exn when exn.Message.Contains("seq was short by 3 elements") -> () + + [] + member this.Of_Array() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.ofArray [|1..10|] + let expectedInt = {1..10} + + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr = IConsumableSeq.ofArray [|"Lists"; "Are"; "ofArrayString" ; "List" |] + let expectedStr = iseq ["Lists"; "Are"; "ofArrayString" ; "List" ] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.ofArray [| |] + VerifySeqsEqual resultEpt IConsumableSeq.empty + + () + + [] + member this.Of_List() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.ofList [1..10] + let expectedInt = {1..10} + + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + + let resultStr =IConsumableSeq.ofList ["Lists"; "Are"; "ofListString" ; "List" ] + let expectedStr = iseq ["Lists"; "Are"; "ofListString" ; "List" ] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.ofList [] + VerifySeqsEqual resultEpt IConsumableSeq.empty + () + + + [] + member this.Pairwise() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.pairwise (iseq {1..3}) + + let expectedInt = iseq [1,2;2,3] + + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.pairwise (iseq ["str1"; "str2";"str3" ]) + let expectedStr = iseq ["str1","str2";"str2","str3"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.pairwise (iseq [] ) + VerifySeqsEqual resultEpt IConsumableSeq.empty + + () + + [] + member this.Reduce() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.reduce (fun x y -> x/y) (iseq [5*4*3*2; 4;3;2;1]) + Assert.AreEqual(5,resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) (iseq ["ABCDE";"A"; "B"; "C" ; "D" ]) + Assert.AreEqual("E",resultStr) + + // empty IConsumableSeq + CheckThrowsArgumentException (fun () -> IConsumableSeq.reduce (fun x y -> x/y) IConsumableSeq.empty |> ignore) + + //// null IConsumableSeq + //let nullSeq : iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.reduce (fun (x:string) (y:string) -> x.Remove(0,y.Length)) nullSeq |> ignore) + () + + [] + member this.ReduceBack() = + // int IConsumableSeq + let funcInt x y = x - y + let IntSeq = iseq <| seq { 1..4 } + let reduceInt = IConsumableSeq.reduceBack funcInt IntSeq + Assert.AreEqual((1-(2-(3-4))), reduceInt) + + // string IConsumableSeq + let funcStr (x:string) (y:string) = y.Remove(0,x.Length) + let strSeq = iseq [ "A"; "B"; "C"; "D" ; "ABCDE" ] + let reduceStr = IConsumableSeq.reduceBack funcStr strSeq + Assert.AreEqual("E", reduceStr) + + // string IConsumableSeq + let funcStr2 elem acc = sprintf "%s%s" elem acc + let strSeq2 = iseq [ "A" ] + let reduceStr2 = IConsumableSeq.reduceBack funcStr2 strSeq2 + Assert.AreEqual("A", reduceStr2) + + // Empty IConsumableSeq + CheckThrowsArgumentException (fun () -> IConsumableSeq.reduceBack funcInt IConsumableSeq.empty |> ignore) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.reduceBack funcInt nullSeq |> ignore) + + () + + [] + member this.Rev() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.rev (iseq [5;4;3;2;1]) + VerifySeqsEqual (iseq[1;2;3;4;5]) resultInt + + // string IConsumableSeq + let resultStr = IConsumableSeq.rev (iseq ["A"; "B"; "C" ; "D" ]) + VerifySeqsEqual (iseq["D";"C";"B";"A"]) resultStr + + // empty IConsumableSeq + VerifySeqsEqual IConsumableSeq.empty (IConsumableSeq.rev IConsumableSeq.empty) + + //// null IConsumableSeq + //let nullSeq : iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.rev nullSeq |> ignore) + () + + [] + member this.Scan() = + // integer IConsumableSeq + let funcInt x y = x+y + let resultInt = IConsumableSeq.scan funcInt 9 (iseq {1..10}) + let expectedInt = iseq [9;10;12;15;19;24;30;37;45;54;64] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let funcStr x y = x+y + let resultStr =IConsumableSeq.scan funcStr "x" (iseq ["str1"; "str2";"str3" ]) + + let expectedStr = iseq ["x";"xstr1"; "xstr1str2";"xstr1str2str3"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.scan funcInt 5 IConsumableSeq.empty + + VerifySeqsEqual resultEpt (iseq [ 5]) + + //// null IConsumableSeq + //let seqNull:iseq<'a> = null + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.scan funcInt 5 seqNull |> ignore) + () + + [] + member this.ScanBack() = + // integer IConsumableSeq + let funcInt x y = x+y + let resultInt = IConsumableSeq.scanBack funcInt (iseq { 1..10 }) 9 + let expectedInt = iseq [64;63;61;58;54;49;43;36;28;19;9] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let funcStr x y = x+y + let resultStr = IConsumableSeq.scanBack funcStr (iseq ["A";"B";"C";"D"]) "X" + let expectedStr = iseq ["ABCDX";"BCDX";"CDX";"DX";"X"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.scanBack funcInt IConsumableSeq.empty 5 + let expectedEpt = iseq [5] + VerifySeqsEqual expectedEpt resultEpt + + //// null IConsumableSeq + //let seqNull:iseq<'a> = null + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.scanBack funcInt seqNull 5 |> ignore) + + // exception cases + let funcEx x (s:'State) = raise <| new System.FormatException() : 'State + // calling scanBack with funcEx does not throw + let resultEx = IConsumableSeq.scanBack funcEx (iseq <| seq {1..10}) 0 + // reading from resultEx throws + CheckThrowsFormatException(fun() -> IConsumableSeq.head resultEx |> ignore) + + // Result consumes entire input sequence as soon as it is accesses an element + let i = ref 0 + let funcState x s = (i := !i + x); x+s + let resultState = IConsumableSeq.scanBack funcState (iseq <| seq {1..3}) 0 + Assert.AreEqual(0, !i) + use e = resultState.GetEnumerator() + Assert.AreEqual(6, !i) + + () + + [] + member this.Singleton() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.singleton 1 + + let expectedInt = iseq [1] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.singleton "str1" + let expectedStr = iseq ["str1"] + VerifySeqsEqual expectedStr resultStr + + // null IConsumableSeq + let resultNull = IConsumableSeq.singleton null + let expectedNull = iseq [null] + VerifySeqsEqual expectedNull resultNull + () + + + [] + member this.Skip() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.skip 2 (iseq [1;2;3;4]) + let expectedInt = iseq [3;4] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.skip 2 (iseq ["str1";"str2";"str3";"str4"]) + let expectedStr = iseq ["str3";"str4"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.skip 0 IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.skip 1 null |> ignore) + () + + [] + member this.Skip_While() = + + // integer IConsumableSeq + let funcInt x = (x < 3) + let resultInt = IConsumableSeq.skipWhile funcInt (iseq [1;2;3;4;5;6]) + let expectedInt = iseq [3;4;5;6] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let funcStr (x:string) = x.Contains(".") + let resultStr =IConsumableSeq.skipWhile funcStr (iseq [".";"asdfasdf.asdfasdf";"";"";"";"";"";"";"";"";""]) + let expectedStr = iseq ["";"";"";"";"";"";"";"";""] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.skipWhile funcInt IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.skipWhile funcInt null |> ignore) + () + + [] + member this.Sort() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.sort (iseq [1;3;2;4;6;5;7]) + let expectedInt = {1..7} + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + + let resultStr =IConsumableSeq.sort (iseq ["str1";"str3";"str2";"str4"]) + let expectedStr = iseq ["str1";"str2";"str3";"str4"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.sort IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.sort null |> ignore) + () + + [] + member this.SortBy() = + + // integer IConsumableSeq + let funcInt x = Math.Abs(x-5) + let resultInt = IConsumableSeq.sortBy funcInt (iseq [1;2;4;5;7]) + let expectedInt = iseq [5;4;7;2;1] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let funcStr (x:string) = x.IndexOf("key") + let resultStr =IConsumableSeq.sortBy funcStr (iseq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) + + let expectedStr = iseq ["(key)str";"s(key)tr";"st(key)r";"str(key)"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.sortBy funcInt IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.sortBy funcInt null |> ignore) + () + + [] + member this.SortDescending() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.sortDescending (iseq [1;3;2;Int32.MaxValue;4;6;Int32.MinValue;5;7;0]) + let expectedInt = iseq <| seq { + yield Int32.MaxValue; + yield! iseq{ 7..-1..0 } + yield Int32.MinValue + } + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + + let resultStr = IConsumableSeq.sortDescending (iseq ["str1";null;"str3";"";"Str1";"str2";"str4"]) + let expectedStr = iseq ["str4";"str3";"str2";"str1";"Str1";"";null] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.sortDescending IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + // tuple IConsumableSeq + let tupSeq = (iseq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) + let resultTup = IConsumableSeq.sortDescending tupSeq + let expectedTup = (iseq[(2,"x");(2,"b");(2,"a");(1,"x");(1,"d");(1,"b");(1,"a")]) + VerifySeqsEqual expectedTup resultTup + + // float IConsumableSeq + let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon + let floatSeq = iseq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] + let resultFloat = IConsumableSeq.sortDescending floatSeq + let expectedFloat = iseq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] + VerifySeqsEqual expectedFloat resultFloat + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.sort null |> ignore) + () + + [] + member this.SortByDescending() = + + // integer IConsumableSeq + let funcInt x = Math.Abs(x-5) + let resultInt = IConsumableSeq.sortByDescending funcInt (iseq [1;2;4;5;7]) + let expectedInt = iseq [1;2;7;4;5] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let funcStr (x:string) = x.IndexOf("key") + let resultStr =IConsumableSeq.sortByDescending funcStr (iseq ["st(key)r";"str(key)";"s(key)tr";"(key)str"]) + + let expectedStr = iseq ["str(key)";"st(key)r";"s(key)tr";"(key)str"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.sortByDescending funcInt IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + // tuple IConsumableSeq + let tupSeq = (iseq[(2,"a");(1,"d");(1,"b");(1,"a");(2,"x");(2,"b");(1,"x")]) + let resultTup = IConsumableSeq.sortByDescending snd tupSeq + let expectedTup = (iseq[(2,"x");(1,"x");(1,"d");(1,"b");(2,"b");(2,"a");(1,"a")]) + VerifySeqsEqual expectedTup resultTup + + // float IConsumableSeq + let minFloat,maxFloat,epsilon = System.Double.MinValue,System.Double.MaxValue,System.Double.Epsilon + let floatSeq = iseq [0.0; 0.5; 2.0; 1.5; 1.0; minFloat;maxFloat;epsilon;-epsilon] + let resultFloat = IConsumableSeq.sortByDescending id floatSeq + let expectedFloat = iseq [maxFloat; 2.0; 1.5; 1.0; 0.5; epsilon; 0.0; -epsilon; minFloat; ] + VerifySeqsEqual expectedFloat resultFloat + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.sortByDescending funcInt null |> ignore) + () + + member this.SortWith() = + + // integer IConsumableSeq + let intComparer a b = compare (a%3) (b%3) + let resultInt = IConsumableSeq.sortWith intComparer (iseq <| seq {0..10}) + let expectedInt = iseq [0;3;6;9;1;4;7;10;2;5;8] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr = IConsumableSeq.sortWith compare (iseq ["str1";"str3";"str2";"str4"]) + let expectedStr = iseq ["str1";"str2";"str3";"str4"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.sortWith intComparer IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.sortWith intComparer null |> ignore) + + () + + [] + member this.Sum() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.sum (iseq [1..10]) + Assert.AreEqual(55,resultInt) + + // float32 IConsumableSeq + let floatSeq = (iseq [ 1.2f;3.5f;6.7f ]) + let resultFloat = IConsumableSeq.sum floatSeq + if resultFloat <> 11.4f then Assert.Fail() + + // double IConsumableSeq + let doubleSeq = (iseq [ 1.0;8.0 ]) + let resultDouble = IConsumableSeq.sum doubleSeq + if resultDouble <> 9.0 then Assert.Fail() + + // decimal IConsumableSeq + let decimalSeq = (iseq [ 0M;19M;19.03M ]) + let resultDecimal = IConsumableSeq.sum decimalSeq + if resultDecimal <> 38.03M then Assert.Fail() + + + // empty float32 IConsumableSeq + let emptyFloatSeq = IConsumableSeq.empty + let resultEptFloat = IConsumableSeq.sum emptyFloatSeq + if resultEptFloat <> 0.0f then Assert.Fail() + + // empty double IConsumableSeq + let emptyDoubleSeq = IConsumableSeq.empty + let resultDouEmp = IConsumableSeq.sum emptyDoubleSeq + if resultDouEmp <> 0.0 then Assert.Fail() + + // empty decimal IConsumableSeq + let emptyDecimalSeq = IConsumableSeq.empty + let resultDecEmp = IConsumableSeq.sum emptyDecimalSeq + if resultDecEmp <> 0M then Assert.Fail() + + () + + [] + member this.SumBy() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.sumBy int (iseq [1..10]) + Assert.AreEqual(55,resultInt) + + // float32 IConsumableSeq + let floatSeq = (iseq [ 1.2f;3.5f;6.7f ]) + let resultFloat = IConsumableSeq.sumBy float32 floatSeq + if resultFloat <> 11.4f then Assert.Fail() + + // double IConsumableSeq + let doubleSeq = (iseq [ 1.0;8.0 ]) + let resultDouble = IConsumableSeq.sumBy double doubleSeq + if resultDouble <> 9.0 then Assert.Fail() + + // decimal IConsumableSeq + let decimalSeq = (iseq [ 0M;19M;19.03M ]) + let resultDecimal = IConsumableSeq.sumBy decimal decimalSeq + if resultDecimal <> 38.03M then Assert.Fail() + + // empty float32 IConsumableSeq + let emptyFloatSeq = IConsumableSeq.empty + let resultEptFloat = IConsumableSeq.sumBy float32 emptyFloatSeq + if resultEptFloat <> 0.0f then Assert.Fail() + + // empty double IConsumableSeq + let emptyDoubleSeq = IConsumableSeq.empty + let resultDouEmp = IConsumableSeq.sumBy double emptyDoubleSeq + if resultDouEmp <> 0.0 then Assert.Fail() + + // empty decimal IConsumableSeq + let emptyDecimalSeq = IConsumableSeq.empty + let resultDecEmp = IConsumableSeq.sumBy decimal emptyDecimalSeq + if resultDecEmp <> 0M then Assert.Fail() + + () + + [] + member this.Take() = + // integer IConsumableSeq + + let resultInt = IConsumableSeq.take 3 (iseq [1;2;4;5;7]) + + let expectedInt = iseq [1;2;4] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + + let resultStr =IConsumableSeq.take 2(iseq ["str1";"str2";"str3";"str4"]) + + let expectedStr = iseq ["str1";"str2"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.take 0 IConsumableSeq.empty + + VerifySeqsEqual resultEpt IConsumableSeq.empty + + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.take 1 null |> ignore) + () + + [] + member this.takeWhile() = + // integer IConsumableSeq + let funcInt x = (x < 6) + let resultInt = IConsumableSeq.takeWhile funcInt (iseq [1;2;4;5;6;7]) + + let expectedInt = iseq [1;2;4;5] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let funcStr (x:string) = (x.Length < 4) + let resultStr =IConsumableSeq.takeWhile funcStr (iseq ["a"; "ab"; "abc"; "abcd"; "abcde"]) + + let expectedStr = iseq ["a"; "ab"; "abc"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.takeWhile funcInt IConsumableSeq.empty + VerifySeqsEqual resultEpt IConsumableSeq.empty + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.takeWhile funcInt null |> ignore) + () + + [] + member this.ToArray() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.toArray(iseq [1;2;4;5;7]) + + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + // string IConsumableSeq + let resultStr =IConsumableSeq.toArray (iseq ["str1";"str2";"str3"]) + + let expectedStr = [|"str1";"str2";"str3"|] + Assert.AreEqual(expectedStr,resultStr) + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.toArray IConsumableSeq.empty + Assert.AreEqual([||],resultEpt) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.toArray null |> ignore) + () + + [] + member this.ToArrayFromICollection() = + let inputCollection = ResizeArray(iseq [1;2;4;5;7]) + let resultInt = IConsumableSeq.toArray((iseq inputCollection)) + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToArrayEmptyInput() = + let resultInt = IConsumableSeq.toArray(IConsumableSeq.empty) + let expectedInt = Array.empty + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToArrayFromArray() = + let resultInt = IConsumableSeq.toArray((iseq [|1;2;4;5;7|])) + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToArrayFromList() = + let resultInt = IConsumableSeq.toArray((iseq [1;2;4;5;7])) + let expectedInt = [|1;2;4;5;7|] + Assert.AreEqual(expectedInt,resultInt) + + [] + member this.ToList() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.toList (iseq [1;2;4;5;7]) + let expectedInt = [1;2;4;5;7] + Assert.AreEqual(expectedInt,resultInt) + + // string IConsumableSeq + let resultStr =IConsumableSeq.toList (iseq ["str1";"str2";"str3"]) + let expectedStr = ["str1";"str2";"str3"] + Assert.AreEqual(expectedStr,resultStr) + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.toList IConsumableSeq.empty + Assert.AreEqual([],resultEpt) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.toList null |> ignore) + () + + [] + member this.Truncate() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.truncate 3 (iseq [1;2;4;5;7]) + let expectedInt = [1;2;4] + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.truncate 2 (iseq ["str1";"str2";"str3"]) + let expectedStr = ["str1";"str2"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.truncate 0 IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.truncate 1 null |> ignore) + + // negative count + VerifySeqsEqual IConsumableSeq.empty <| IConsumableSeq.truncate -1 (iseq [1;2;4;5;7]) + VerifySeqsEqual IConsumableSeq.empty <| IConsumableSeq.truncate System.Int32.MinValue (iseq [1;2;4;5;7]) + + () + + [] + member this.tryFind() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.tryFind (fun x -> (x%2=0)) (iseq [1;2;4;5;7]) + Assert.AreEqual(Some(2), resultInt) + + // integer IConsumableSeq - None + let resultInt = IConsumableSeq.tryFind (fun x -> (x%2=0)) (iseq [1;3;5;7]) + Assert.AreEqual(None, resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.tryFind (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str2";"str3"]) + Assert.AreEqual(Some("str2"),resultStr) + + // string IConsumableSeq - None + let resultStr = IConsumableSeq.tryFind (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str4";"str3"]) + Assert.AreEqual(None,resultStr) + + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.tryFind (fun x -> (x%2=0)) IConsumableSeq.empty + Assert.AreEqual(None,resultEpt) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.tryFind (fun x -> (x%2=0)) null |> ignore) + () + + [] + member this.TryFindBack() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.tryFindBack (fun x -> (x%2=0)) (iseq [1;2;4;5;7]) + Assert.AreEqual(Some 4, resultInt) + + // integer IConsumableSeq - None + let resultInt = IConsumableSeq.tryFindBack (fun x -> (x%2=0)) (iseq [1;3;5;7]) + Assert.AreEqual(None, resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.tryFindBack (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str2";"str2x";"str3"]) + Assert.AreEqual(Some "str2x", resultStr) + + // string IConsumableSeq - None + let resultStr = IConsumableSeq.tryFindBack (fun (x:string) -> x.Contains("2")) (iseq ["str1";"str4";"str3"]) + Assert.AreEqual(None, resultStr) + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.tryFindBack (fun x -> (x%2=0)) IConsumableSeq.empty + Assert.AreEqual(None, resultEpt) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.tryFindBack (fun x -> (x%2=0)) null |> ignore) + () + + [] + member this.TryFindIndex() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.tryFindIndex (fun x -> (x % 5 = 0)) (iseq [8; 9; 10]) + Assert.AreEqual(Some(2), resultInt) + + // integer IConsumableSeq - None + let resultInt = IConsumableSeq.tryFindIndex (fun x -> (x % 5 = 0)) (iseq [9;3;11]) + Assert.AreEqual(None, resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str2"; "str3"]) + Assert.AreEqual(Some(1),resultStr) + + // string IConsumableSeq - None + let resultStr = IConsumableSeq.tryFindIndex (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str4"; "str3"]) + Assert.AreEqual(None,resultStr) + + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.tryFindIndex (fun x -> (x%2=0)) IConsumableSeq.empty + Assert.AreEqual(None, resultEpt) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.tryFindIndex (fun x -> (x % 2 = 0)) null |> ignore) + () + + [] + member this.TryFindIndexBack() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.tryFindIndexBack (fun x -> (x % 5 = 0)) (iseq [5; 9; 10; 12]) + Assert.AreEqual(Some(2), resultInt) + + // integer IConsumableSeq - None + let resultInt = IConsumableSeq.tryFindIndexBack (fun x -> (x % 5 = 0)) (iseq [9;3;11]) + Assert.AreEqual(None, resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str2"; "str2x"; "str3"]) + Assert.AreEqual(Some(2), resultStr) + + // string IConsumableSeq - None + let resultStr = IConsumableSeq.tryFindIndexBack (fun (x:string) -> x.Contains("2")) (iseq ["str1"; "str4"; "str3"]) + Assert.AreEqual(None, resultStr) + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.tryFindIndexBack (fun x -> (x%2=0)) IConsumableSeq.empty + Assert.AreEqual(None, resultEpt) + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.tryFindIndexBack (fun x -> (x % 2 = 0)) null |> ignore) + () + + [] + member this.Unfold() = + // integer IConsumableSeq + + let resultInt = IConsumableSeq.unfold (fun x -> if x = 1 then Some(7,2) else None) 1 + + VerifySeqsEqual (iseq [7]) resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.unfold (fun (x:string) -> if x.Contains("unfold") then Some("a","b") else None) "unfold" + VerifySeqsEqual (iseq ["a"]) resultStr + () + + + [] + member this.Windowed() = + + let testWindowed config = + try + config.InputSeq + |> IConsumableSeq.windowed config.WindowSize + |> VerifySeqsEqual config.ExpectedSeq + with + | _ when Option.isNone config.Exception -> Assert.Fail() + | e when e.GetType() = (Option.get config.Exception) -> () + | _ -> Assert.Fail() + + { + InputSeq = iseq [1..10] + WindowSize = 1 + ExpectedSeq = iseq <| seq { for i in 1..10 do yield [| i |] } + Exception = None + } |> testWindowed + { + InputSeq = iseq [1..10] + WindowSize = 5 + ExpectedSeq = iseq <| seq { for i in 1..6 do yield [| i; i+1; i+2; i+3; i+4 |] } + Exception = None + } |> testWindowed + { + InputSeq = iseq [1..10] + WindowSize = 10 + ExpectedSeq = iseq <| seq { yield [| 1 .. 10 |] } + Exception = None + } |> testWindowed + { + InputSeq = iseq [1..10] + WindowSize = 25 + ExpectedSeq = IConsumableSeq.empty + Exception = None + } |> testWindowed + { + InputSeq = iseq ["str1";"str2";"str3";"str4"] + WindowSize = 2 + ExpectedSeq = iseq [ [|"str1";"str2"|];[|"str2";"str3"|];[|"str3";"str4"|]] + Exception = None + } |> testWindowed + { + InputSeq = IConsumableSeq.empty + WindowSize = 2 + ExpectedSeq = IConsumableSeq.empty + Exception = None + } |> testWindowed + //{ + // InputSeq = null + // WindowSize = 2 + // ExpectedSeq = IConsumableSeq.empty + // Exception = Some typeof + //} |> testWindowed + { + InputSeq = iseq [1..10] + WindowSize = 0 + ExpectedSeq = IConsumableSeq.empty + Exception = Some typeof + } |> testWindowed + + () + + [] + member this.Zip() = + + // integer IConsumableSeq + let resultInt = IConsumableSeq.zip (iseq [1..7]) (iseq [11..17]) + let expectedInt = + iseq <| seq { for i in 1..7 do + yield i, i+10 } + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.zip (iseq ["str3";"str4"]) (iseq ["str1";"str2"]) + let expectedStr = iseq ["str3","str1";"str4","str2"] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.zip IConsumableSeq.empty IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip null (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip (iseq [1..7]) null |> ignore) + () + + [] + member this.Zip3() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.zip3 (iseq [1..7]) (iseq [11..17]) (iseq [21..27]) + let expectedInt = + iseq <| seq { for i in 1..7 do + yield i, (i + 10), (i + 20) } + VerifySeqsEqual expectedInt resultInt + + // string IConsumableSeq + let resultStr =IConsumableSeq.zip3 (iseq ["str1";"str2"]) (iseq ["str11";"str12"]) (iseq ["str21";"str22"]) + let expectedStr = iseq ["str1","str11","str21";"str2","str12","str22" ] + VerifySeqsEqual expectedStr resultStr + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.zip3 IConsumableSeq.empty IConsumableSeq.empty IConsumableSeq.empty + VerifySeqsEqual IConsumableSeq.empty resultEpt + + //// null IConsumableSeq + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip3 null null null |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip3 null (iseq [1..7]) (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip3 (iseq [1..7]) null (iseq [1..7]) |> ignore) + //CheckThrowsArgumentNullException(fun() -> IConsumableSeq.zip3 (iseq [1..7]) (iseq [1..7]) null |> ignore) + () + + [] + member this.tryPick() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.tryPick (fun x-> if x = 1 then Some("got") else None) (iseq [1..5]) + + Assert.AreEqual(Some("got"),resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.tryPick (fun x-> if x = "Are" then Some("got") else None) (iseq ["Lists"; "Are"]) + Assert.AreEqual(Some("got"),resultStr) + + // empty IConsumableSeq + let resultEpt = IConsumableSeq.tryPick (fun x-> if x = 1 then Some("got") else None) IConsumableSeq.empty + Assert.IsNull(resultEpt) + + //// null IConsumableSeq + //let nullSeq : iseq<'a> = null + //let funcNull x = Some(1) + + //CheckThrowsArgumentNullException(fun () -> IConsumableSeq.tryPick funcNull nullSeq |> ignore) + + () + + [] + member this.tryItem() = + // integer IConsumableSeq + let resultInt = IConsumableSeq.tryItem 3 (iseq { 10..20 }) + Assert.AreEqual(Some(13), resultInt) + + // string IConsumableSeq + let resultStr = IConsumableSeq.tryItem 2 (iseq ["Lists"; "Are"; "Cool"; "List" ]) + Assert.AreEqual(Some("Cool"), resultStr) + + // empty IConsumableSeq + let resultEmpty = IConsumableSeq.tryItem 0 IConsumableSeq.empty + Assert.AreEqual(None, resultEmpty) + + //// null IConsumableSeq + //let nullSeq:iseq<'a> = null + //CheckThrowsArgumentNullException (fun () -> IConsumableSeq.tryItem 3 nullSeq |> ignore) + + // Negative index + let resultNegativeIndex = IConsumableSeq.tryItem -1 (iseq { 10..20 }) + Assert.AreEqual(None, resultNegativeIndex) + + // Index greater than length + let resultIndexGreater = IConsumableSeq.tryItem 31 (iseq { 10..20 }) + Assert.AreEqual(None, resultIndexGreater) + +#endif \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqProperties.fs similarity index 54% rename from src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs rename to tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqProperties.fs index 49170f565a7..a792f456218 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ISeqProperties.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/IConsumableSeqProperties.fs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -module FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections.ISeqProperties +module FSharp.Core.UnitTests.FSharp_Core.Microsoft_FSharp_Collections.IConsumableSeqProperties open System open System.Collections.Generic @@ -8,35 +8,35 @@ open NUnit.Framework open FsCheck open Utils -#if ISeqIsPublic +#if IConsumableSeqIsPublic let sortByStable<'a when 'a : comparison> (xs : 'a []) = - let indexed = xs|> ISeq.ofSeq |> ISeq.indexed - let sorted = indexed |> ISeq.sortBy snd + let indexed = xs|> IConsumableSeq.ofSeq |> IConsumableSeq.indexed + let sorted = indexed |> IConsumableSeq.sortBy snd isStable sorted [] -let ``ISeq.sortBy is stable`` () = +let ``IConsumableSeq.sortBy is stable`` () = Check.QuickThrowOnFailure sortByStable Check.QuickThrowOnFailure sortByStable let sortWithStable<'a when 'a : comparison> (xs : 'a []) = - let indexed = xs |> ISeq.ofSeq |> ISeq.indexed |> Seq.toList - let sorted = indexed |> ISeq.ofSeq |> ISeq.sortWith (fun x y -> compare (snd x) (snd y)) + let indexed = xs |> IConsumableSeq.ofSeq |> IConsumableSeq.indexed |> Seq.toList + let sorted = indexed |> IConsumableSeq.ofSeq |> IConsumableSeq.sortWith (fun x y -> compare (snd x) (snd y)) isStable sorted [] -let ``ISeq.sortWithStable is stable`` () = +let ``IConsumableSeq.sortWithStable is stable`` () = Check.QuickThrowOnFailure sortWithStable Check.QuickThrowOnFailure sortWithStable let distinctByStable<'a when 'a : comparison> (xs : 'a []) = - let indexed = xs|> ISeq.ofSeq |> ISeq.indexed - let sorted = indexed |> ISeq.distinctBy snd + let indexed = xs|> IConsumableSeq.ofSeq |> IConsumableSeq.indexed + let sorted = indexed |> IConsumableSeq.distinctBy snd isStable sorted [] -let ``ISeq.distinctBy is stable`` () = +let ``IConsumableSeq.distinctBy is stable`` () = Check.QuickThrowOnFailure distinctByStable Check.QuickThrowOnFailure distinctByStable diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs index 518216455b9..1ee84dc4fd1 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs @@ -294,193 +294,193 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult get_Result() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult get_Result() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 -Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] -Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T3]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cast[T](System.Collections.IEnumerable) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TCollection]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Empty[T]() -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfArray[T](T[]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Replicate[T](Int32, T) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Singleton[T](T) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], TState) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TResult get_Result() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TResult get_Result() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void set_Result(TResult) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: Void .ctor(a) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: b _2 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: c _3 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.IConsumableSeqModule+Core +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[a]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T3]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Cast[T](System.Collections.IEnumerable) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TCollection]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Empty[T]() +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfArray[T](T[]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Replicate[T](Int32, T) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Singleton[T](T) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[V]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[a]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[a]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) @@ -614,28 +614,28 @@ Microsoft.FSharp.Collections.MapModule: TResult Pick[TKey,T,TResult](Microsoft.F Microsoft.FSharp.Collections.MapModule: TState FoldBack[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T], TState) Microsoft.FSharp.Collections.MapModule: TState Fold[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]]], TState, Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) Microsoft.FSharp.Collections.MapModule: Void Iterate[TKey,T](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) -Microsoft.FSharp.Collections.SeqComposition.Activity: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void .ctor() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void ChainDispose() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() @@ -645,24 +645,24 @@ Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult get_Result() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) -Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) -Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) -Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: TResult get_Result() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void .ctor(TResult) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void set_Result(TResult) +Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) +Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Transform[TResult](Microsoft.FSharp.Collections.SeqComposition.ISeqTransform`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]]) +Microsoft.FSharp.Collections.SeqComposition.ISeqTransform`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer, Int32, Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[TResult,V]) Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1123,7 +1123,7 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean get_C Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GenerateNext(System.Collections.Generic.IEnumerable`1[T] ByRef) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHashCode() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() -Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerable`1[T] GetRaw() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs index 439839fcc9c..e64bd957ce8 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs @@ -281,68 +281,68 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult get_Result() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult get_Result() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] -Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TResult get_Result() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TResult get_Result() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void set_Result(TResult) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.IConsumableSeqModule+Core +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) @@ -476,28 +476,28 @@ Microsoft.FSharp.Collections.MapModule: TResult Pick[TKey,T,TResult](Microsoft.F Microsoft.FSharp.Collections.MapModule: TState FoldBack[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T], TState) Microsoft.FSharp.Collections.MapModule: TState Fold[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]]], TState, Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) Microsoft.FSharp.Collections.MapModule: Void Iterate[TKey,T](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) -Microsoft.FSharp.Collections.SeqComposition.Activity: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void .ctor() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void ChainDispose() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() @@ -507,24 +507,24 @@ Microsoft.FSharp.Collections.SeqComposition.Core: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core: Microsoft.FSharp.Collections.SeqComposition.Core+NoValue Microsoft.FSharp.Collections.SeqComposition.Core: System.String ToString() Microsoft.FSharp.Collections.SeqComposition.Core: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 HaltedIdx -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult Result -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: TResult get_Result() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TResult) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) -Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) -Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) -Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Int32 HaltedIdx +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: TResult Result +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: TResult get_Result() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void .ctor(TResult) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]: Void set_Result(TResult) +Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) +Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Transform[TResult](Microsoft.FSharp.Collections.SeqComposition.ISeqTransform`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2[T,TResult]]) +Microsoft.FSharp.Collections.SeqComposition.ISeqTransform`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer, Int32, Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[TResult,V]) Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1032,7 +1032,7 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean get_C Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GenerateNext(System.Collections.Generic.IEnumerable`1[T] ByRef) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHashCode() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() -Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerable`1[T] GetRaw() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl index 961d2fa6c8a..ada52d441bc 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl @@ -805,7 +805,7 @@ } // end of class 'numSum@22-1' .class auto autochar serializable sealed nested assembly beforefieldinit specialname 'numSum@22-3' - extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2 { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection @@ -822,7 +822,7 @@ IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::projection IL_0007: ldarg.0 IL_0008: ldc.i4.0 - IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::.ctor(!1) IL_000e: ldarg.0 IL_000f: pop IL_0010: ret @@ -836,13 +836,13 @@ .line 100001,100001 : 0,0 '' IL_0000: ldarg.0 IL_0001: ldarg.0 - IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::get_Result() IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-3'::projection IL_000d: ldarg.1 IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0013: add.ovf - IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) + IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::set_Result(!1) IL_0019: nop .line 22,22 : 9,16 '' IL_001a: ldc.i4.0 @@ -852,7 +852,7 @@ } // end of class 'numSum@22-3' .class auto ansi serializable sealed nested assembly beforefieldinit 'numSum@22-2' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) @@ -866,14 +866,14 @@ // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'numSum@22-2'::projection IL_000d: ret } // end of method 'numSum@22-2'::.ctor - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2 Invoke(int32 _arg1) cil managed { // Code size 12 (0xc) @@ -1274,7 +1274,7 @@ } // end of class 'totalChars@31-1' .class auto autochar serializable sealed nested assembly beforefieldinit specialname 'totalChars@31-3' - extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2 { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection @@ -1291,7 +1291,7 @@ IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::projection IL_0007: ldarg.0 IL_0008: ldc.i4.0 - IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::.ctor(!1) IL_000e: ldarg.0 IL_000f: pop IL_0010: ret @@ -1305,13 +1305,13 @@ .line 100001,100001 : 0,0 '' IL_0000: ldarg.0 IL_0001: ldarg.0 - IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::get_Result() IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-3'::projection IL_000d: ldarg.1 IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0013: add.ovf - IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) + IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::set_Result(!1) IL_0019: nop .line 31,31 : 9,25 '' IL_001a: ldc.i4.0 @@ -1321,7 +1321,7 @@ } // end of class 'totalChars@31-3' .class auto ansi serializable sealed nested assembly beforefieldinit 'totalChars@31-2' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) @@ -1335,14 +1335,14 @@ // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'totalChars@31-2'::projection IL_000d: ret } // end of method 'totalChars@31-2'::.ctor - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2 Invoke(int32 _arg1) cil managed { // Code size 12 (0xc) @@ -1851,7 +1851,7 @@ } // end of class 'sum@43-1' .class auto autochar serializable sealed nested assembly beforefieldinit specialname 'sum@43-3' - extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + extends class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2 { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection @@ -1868,7 +1868,7 @@ IL_0002: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::projection IL_0007: ldarg.0 IL_0008: ldc.i4.0 - IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::.ctor(!1) + IL_0009: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::.ctor(!1) IL_000e: ldarg.0 IL_000f: pop IL_0010: ret @@ -1882,13 +1882,13 @@ .line 100001,100001 : 0,0 '' IL_0000: ldarg.0 IL_0001: ldarg.0 - IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::get_Result() + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::get_Result() IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-3'::projection IL_000d: ldarg.1 IL_000e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_0013: add.ovf - IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2::set_Result(!1) + IL_0014: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2::set_Result(!1) IL_0019: nop .line 43,43 : 13,33 '' IL_001a: ldc.i4.0 @@ -1898,7 +1898,7 @@ } // end of class 'sum@43-3' .class auto ansi serializable sealed nested assembly beforefieldinit 'sum@43-2' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 projection .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) @@ -1912,14 +1912,14 @@ // Code size 14 (0xe) .maxstack 8 IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 Linq101Aggregates01/'sum@43-2'::projection IL_000d: ret } // end of method 'sum@43-2'::.ctor - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.Folder`2 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.SeqConsumer`2 Invoke(int32 _arg1) cil managed { // Code size 12 (0xc) @@ -2007,10 +2007,10 @@ .line 100001,100001 : 0,0 '' IL_0042: nop IL_0043: ldloc.s V_6 - IL_0045: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0045: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1 [FSharp.Core]Microsoft.FSharp.Collections.IConsumableSeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) IL_004a: ldloc.s V_5 IL_004c: newobj instance void Linq101Aggregates01/'sum@43-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0051: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0051: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) IL_0056: stloc.1 .line 45,45 : 9,28 '' IL_0057: ldarg.0 @@ -8204,10 +8204,10 @@ .line 100001,100001 : 0,0 '' IL_00e3: nop IL_00e4: ldloc.s V_25 - IL_00e6: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_00e6: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1 [FSharp.Core]Microsoft.FSharp.Collections.IConsumableSeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) IL_00eb: ldloc.s V_24 IL_00ed: newobj instance void Linq101Aggregates01/'numSum@22-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_00f2: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_00f2: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) IL_00f7: dup IL_00f8: stsfld int32 ''.$Linq101Aggregates01::numSum@19 IL_00fd: stloc.3 @@ -8260,10 +8260,10 @@ .line 100001,100001 : 0,0 '' IL_016b: nop IL_016c: ldloc.s V_30 - IL_016e: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1 [FSharp.Core]Microsoft.FSharp.Collections.ISeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_016e: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1 [FSharp.Core]Microsoft.FSharp.Collections.IConsumableSeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) IL_0173: ldloc.s V_29 IL_0175: newobj instance void Linq101Aggregates01/'totalChars@31-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_017a: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.ISeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_017a: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) IL_017f: dup IL_0180: stsfld int32 ''.$Linq101Aggregates01::totalChars@28 IL_0185: stloc.s totalChars diff --git a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs index 2c4fa48462b..a7645182481 100644 --- a/tests/fsharpqa/Source/Misc/LongSourceFile01.fs +++ b/tests/fsharpqa/Source/Misc/LongSourceFile01.fs @@ -247,193 +247,193 @@ Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityC Microsoft.FSharp.Collections.HashIdentity: System.Collections.Generic.IEqualityComparer`1[T] Structural[T]() Microsoft.FSharp.Collections.HashIdentity: System.String ToString() Microsoft.FSharp.Collections.HashIdentity: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TResult get_Result() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 HaltedIdx -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult Result -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TResult get_Result() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState]: Void set_Result(TResult) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState]: Void OnDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: TState State -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.Activity, TState) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: Void .ctor(a) -Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: Void .ctor(a, b) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: a _1 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: b _2 -Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c]: c _3 -Microsoft.FSharp.Collections.ISeqModule+Core: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule+Core: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+FolderWithState`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+TransformWithPostProcessing`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Transform`3[T,TResult,TState] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Value`1[a] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`2[a,b] -Microsoft.FSharp.Collections.ISeqModule+Core: Microsoft.FSharp.Collections.ISeqModule+Core+Values`3[a,b,c] -Microsoft.FSharp.Collections.ISeqModule+Core: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule+Core: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Int32 GetHashCode() -Microsoft.FSharp.Collections.ISeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.ISeqModule+Core -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T3]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Cast[T](System.Collections.IEnumerable) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TCollection]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Empty[T]() -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfArray[T](T[]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Replicate[T](Int32, T) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Singleton[T](T) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[V]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[a]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: System.String ToString() -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: System.Type GetType() -Microsoft.FSharp.Collections.ISeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2]) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T2], TState) -Microsoft.FSharp.Collections.ISeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], TState) -Microsoft.FSharp.Collections.ISeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult]) -Microsoft.FSharp.Collections.ISeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) -Microsoft.FSharp.Collections.ISeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TResult get_Result() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState]: Void set_Result(TResult) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 HaltedIdx +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Int32 get_HaltedIdx() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TResult Result +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TResult get_Result() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void .ctor(TResult, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState]: Void set_Result(TResult) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void OnComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState]: Void OnDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: TState State +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Void .ctor(Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity, TState) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState]: Void ChainDispose() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: Void .ctor(a) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: Void .ctor(a, b) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b]: b _2 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: Void .ctor(a, b, c) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: a _1 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: b _2 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c]: c _3 +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqConsumerWithState`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+SeqTransformActivityWithPostProcessing`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Transform`3[T,TResult,TState] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Value`1[a] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`2[a,b] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: Microsoft.FSharp.Collections.IConsumableSeqModule+Core+Values`3[a,b,c] +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule+Core: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Exists2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean ForAll2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,System.Boolean]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Boolean IsEmpty[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 CompareWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 FindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 FindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 GetHashCode() +Microsoft.FSharp.Collections.IConsumableSeqModule: Int32 Length[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.IConsumableSeqModule+Core +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[System.Int32,a]] Indexed[a](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[a]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[T,T]] Pairwise[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[T1,T2]] AllPairs[T1,T2](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[T1,T2]] Zip[T1,T2](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]]] GroupByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]]] GroupByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,System.Int32]] CountByRef[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`2[TKey,System.Int32]] CountByVal[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[System.Tuple`3[T1,T2,T3]] Zip3[T1,T2,T3](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T3]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Collect[T,TCollection,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TCollection], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TState] ScanBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TState] Scan[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T[]] ChunkBySize[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T[]] SplitInto[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T[]] Windowed[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Append[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Cache[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Cast[T](System.Collections.IEnumerable) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Concat[TCollection,T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TCollection]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Delay[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] DistinctBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Distinct[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Empty[T]() +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Except[T](System.Collections.Generic.IEnumerable`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] InitializeInfinite[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Initialize[T](Int32, Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfArray[T](T[]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfList[T](Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfResizeArrayUnchecked[T](System.Collections.Generic.List`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] OfSeq[T](System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Permute[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,System.Int32], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Replicate[T](Int32, T) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Reverse[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Singleton[T](T) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SkipWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Skip[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortByDescending[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortBy[T,TKey](Microsoft.FSharp.Core.FSharpFunc`2[T,TKey], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortDescending[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] SortWith[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Int32]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Sort[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Tail[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] TakeWhile[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Take[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Truncate[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Unfold[TState,T](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[T,TState]]], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[V] Map2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[V] MapIndexed2[T,TResult,V](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,V]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[W] Map3[T,TResult,V,W](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.FSharpFunc`2[V,W]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[V]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[b] Choose[a,b](Microsoft.FSharp.Core.FSharpFunc`2[a,Microsoft.FSharp.Core.FSharpOption`1[b]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[a]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[b] MapIndexed[a,b](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[a,b]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[a]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryItem[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryLast[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.String ToString() +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult],TState] MapFoldBack[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,System.Tuple`2[TResult,TState]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Tuple`2[Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult],TState] MapFold[T,TState,TResult](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,System.Tuple`2[TResult,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: System.Type GetType() +Microsoft.FSharp.Collections.IConsumableSeqModule: T Average[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T ExactlyOne[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Head[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Item[T](Int32, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Last[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T MaxBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Max[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T MinBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Min[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T ReduceBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Reduce[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[T,T]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T Sum[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult AverageBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult Pick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TResult SumBy[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState Fold2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TState]]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2]) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState FoldBack2[T1,T2,TState](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T1], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T2], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], TState) +Microsoft.FSharp.Collections.IConsumableSeqModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: T[] ToArray[T](Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void Iterate2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void IterateIndexed2[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Core.Unit]]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void IterateIndexed[T](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) +Microsoft.FSharp.Collections.IConsumableSeqModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Contains[T](T, Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.ListModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], Microsoft.FSharp.Collections.FSharpList`1[T1], Microsoft.FSharp.Collections.FSharpList`1[T2]) @@ -530,28 +530,28 @@ Microsoft.FSharp.Collections.MapModule: TResult Pick[TKey,T,TResult](Microsoft.F Microsoft.FSharp.Collections.MapModule: TState FoldBack[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T], TState) Microsoft.FSharp.Collections.MapModule: TState Fold[TKey,T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]]], TState, Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) Microsoft.FSharp.Collections.MapModule: Void Iterate[TKey,T](Microsoft.FSharp.Core.FSharpFunc`2[TKey,Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit]], Microsoft.FSharp.Collections.FSharpMap`2[TKey,T]) -Microsoft.FSharp.Collections.SeqComposition.Activity: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void .ctor() -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity`1[T]: Void ChainDispose() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean Equals(System.Object) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Boolean ProcessNext(T) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Int32 GetHashCode() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.String ToString() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: System.Type GetType() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void .ctor() -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainComplete(Int32) -Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,TResult]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`1[T]: Void ChainDispose() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Boolean Equals(System.Object) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Boolean ProcessNext(T) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: System.String ToString() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: System.Type GetType() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void .ctor() +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void ChainComplete(Int32) +Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,TResult]: Void ChainDispose() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: Int32 GetHashCode() Microsoft.FSharp.Collections.SeqComposition.Core+NoValue: System.String ToString() @@ -574,11 +574,11 @@ Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void .ctor(TRes Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainComplete(Int32) Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void ChainDispose() Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]: Void set_Result(TResult) -Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) -Microsoft.FSharp.Collections.SeqComposition.IOutOfBand: Void StopFurtherProcessing(Int32) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[TResult] PushTransform[TResult](Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]) -Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) -Microsoft.FSharp.Collections.SeqComposition.ITransformFactory`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.Activity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.IOutOfBand, Int32, Microsoft.FSharp.Collections.SeqComposition.Activity`2[TResult,V]) +Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer: Void ListenForStopFurtherProcessing(System.Action`1[System.Int32]) +Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer: Void StopFurtherProcessing(Int32) +Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[TResult] Transform[TResult](Microsoft.FSharp.Collections.SeqComposition.ISeqTransform`2[T,TResult]) +Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]: TResult Fold[TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Int32,Microsoft.FSharp.Collections.SeqComposition.Folder`2[T,TResult]]) +Microsoft.FSharp.Collections.SeqComposition.ISeqTransform`2[T,TResult]: Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[T,V] Compose[V](Microsoft.FSharp.Collections.SeqComposition.ISeqConsumer, Int32, Microsoft.FSharp.Collections.SeqComposition.SeqConsumerActivity`2[TResult,V]) Microsoft.FSharp.Collections.SeqModule: Boolean Contains[T](T, System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Boolean Equals(System.Object) Microsoft.FSharp.Collections.SeqModule: Boolean Exists2[T1,T2](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,System.Boolean]], System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IEnumerable`1[T2]) @@ -1026,7 +1026,7 @@ Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Boolean get_C Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GenerateNext(System.Collections.Generic.IEnumerable`1[T] ByRef) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 GetHashCode() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Int32 Length() -Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.ISeq`1[T]) +Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T] Append(Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1[T]) Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerator`1[T] GetFreshEnumerator() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.Collections.Generic.IEnumerable`1[T] GetRaw() Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T]: System.String ToString() From ff55a3ca846cfac4fbb5b916bf197536b1f4433f Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 8 May 2018 18:07:33 +0100 Subject: [PATCH 118/120] a little cleanup --- src/fsharp/FSharp.Core/seq.fs | 41 ++++----------- src/fsharp/FSharp.Core/seqcore.fs | 82 +++++++++++++++--------------- src/fsharp/FSharp.Core/seqcore.fsi | 14 ++--- 3 files changed, 59 insertions(+), 78 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 6581de96610..976c589b966 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -1,31 +1,5 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -namespace Microsoft.FSharp.Collections - #nowarn "52" // The value has been copied to ensure the original is not mutated by this operation - - open System - open System.Diagnostics - open System.Collections - open System.Collections.Generic - open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Core.Operators - open Microsoft.FSharp.Control - open Microsoft.FSharp.Collections - - module Internal = - module IEnumerator = - open Microsoft.FSharp.Collections.IEnumerator - - let rec nth index (e : IEnumerator<'T>) = - if not (e.MoveNext()) then - let shortBy = index + 1 - invalidArgFmt "index" - "{0}\nseq was short by {1} {2}" - [|SR.GetString SR.notEnoughElements; shortBy; (if shortBy = 1 then "element" else "elements")|] - if index = 0 then e.Current - else nth (index-1) e - namespace Microsoft.FSharp.Collections open System open System.Diagnostics @@ -38,15 +12,13 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Control open Microsoft.FSharp.Collections + open Microsoft.FSharp.Collections.IEnumerator open Microsoft.FSharp.Collections.SeqComposition [] [] module Seq = - open Microsoft.FSharp.Collections.Internal - open Microsoft.FSharp.Collections.IEnumerator - // these helpers are just to consolidate the null checking let inline toIConsumableSeq (source:seq<'T>) : IConsumableSeq<'T> = checkNonNull "source" source; IConsumableSeq.ofSeq source let inline toIConsumableSeq1 (source1:seq<'T>) : IConsumableSeq<'T> = checkNonNull "source1" source1; IConsumableSeq.ofSeq source1 @@ -90,12 +62,21 @@ namespace Microsoft.FSharp.Collections | :? list<'T> as lst -> List.iter action lst | raw -> IConsumableSeq.iter action (rawOrOriginal raw original) + let rec enumeratorItem index (e : IEnumerator<'T>) = + if not (e.MoveNext()) then + let shortBy = index + 1 + invalidArgFmt "index" + "{0}\nseq was short by {1} {2}" + [|SR.GetString SR.notEnoughElements; shortBy; (if shortBy = 1 then "element" else "elements")|] + if index = 0 then e.Current + else enumeratorItem (index-1) e + [] let item index (source : seq<'T>) = checkNonNull "source" source if index < 0 then invalidArgInputMustBeNonNegative "index" index use e = source.GetEnumerator() - IEnumerator.nth index e + enumeratorItem index e [] let tryItem index (source : seq<'T>) = diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 68458f0d7b2..05ab0c2ca6a 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -231,7 +231,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition member __.Transform _ = derivedClassShouldImplement () member __.Consume _ = derivedClassShouldImplement () - and [] SeqFactoryBase<'T,'U>(transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = + and [] EnumerableWithTransform<'T,'U>(transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = inherit EnumerableBase<'U>() member __.CreateActivityPipeline<'Result> (consumer:SeqConsumer<'U,'Result>) : SeqConsumerActivity<'T,'U> = @@ -242,7 +242,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition activity <- this.CreateActivityPipeline consumer consumer - member __.Compose next = CompositionTransform.Combine transform next + member __.ComposeWith next = CompositionTransform.Combine transform next member __.PipeIdx = pipeIdx @@ -279,8 +279,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = - activity <- activity' + member private __.FinaliseConstruct(actualActivity: SeqConsumerActivity<'T,'U>) = + activity <- actualActivity override __.Activity = upcast activity @@ -307,20 +307,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition finally activity.ChainDispose () - static member Construct (source:IEnumerator<'T>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + static member Create (source:IEnumerator<'T>) (factory:EnumerableWithTransform<'T,'U>) : IEnumerator<'U> = let enumerator = new VanillaEnumerator<'T,'U>(source) enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator and VanillaEnumerable<'T,'U>(enumerable:IEnumerable<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Construct (enumerable.GetEnumerator()) this + member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Create (enumerable.GetEnumerator()) this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new VanillaEnumerable<'T,'V>(enumerable, this.Compose next, this.PipeIdx+1)) + upcast (new VanillaEnumerable<'T,'V>(enumerable, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let result, consumer = this.CreatePipeline getConsumer @@ -377,8 +377,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition override __.Activity = upcast activity - member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = - activity <- activity' + member private __.FinaliseConstruct(actualActivity: SeqConsumerActivity<'T,'U>) = + activity <- actualActivity member private this.MoveNext () = if this.HaltedIdx <> 0 then false @@ -410,20 +410,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition finally activity.ChainDispose () - static member Construct (sources:IEnumerable<'Collection>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + static member Create (sources:IEnumerable<'Collection>) (factory:EnumerableWithTransform<'T,'U>) : IEnumerator<'U> = let enumerator = new ConcatEnumerator<'T,'U,'Collection>(sources) enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator and ConcatEnumerable<'T,'U,'Collection when 'Collection :> IConsumableSeq<'T>> (sources:IConsumableSeq<'Collection>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = ConcatEnumerator<'T,'U,'Collection>.Construct sources this + member this.GetEnumerator () = ConcatEnumerator<'T,'U,'Collection>.Create sources this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, this.Compose next, this.PipeIdx+1)) + upcast (new ConcatEnumerable<'T,'V,'Collection>(sources, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = sources.Consume (fun lowerPipeIdx -> @@ -537,8 +537,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable idx = 0 let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = - activity <- activity' + member private __.FinaliseConstruct(actualActivity: SeqConsumerActivity<'T,'U>) = + activity <- actualActivity override __.Activity = upcast activity @@ -559,20 +559,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition this.SeqState <- SeqProcessNextStates.InProcess this.MoveNext () - static member Construct (array:array<'T>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + static member Create (array:array<'T>) (factory:EnumerableWithTransform<'T,'U>) : IEnumerator<'U> = let enumerator = new ArrayEnumerator<'T,'U>(array) enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator type ArrayEnumerable<'T,'U>(array:array<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = ArrayEnumerator<'T,'U>.Construct array this + member this.GetEnumerator () = ArrayEnumerator<'T,'U>.Create array this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new ArrayEnumerable<'T,'V>(array, this.Compose next, this.PipeIdx+1)) + upcast (new ArrayEnumerable<'T,'V>(array, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let result, consumer = this.CreatePipeline getConsumer @@ -626,8 +626,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable idx = 0 let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = - activity <- activity' + member private __.FinaliseConstruct(actualActivity: SeqConsumerActivity<'T,'U>) = + activity <- actualActivity override __.Activity = upcast activity @@ -648,20 +648,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition this.SeqState <- SeqProcessNextStates.InProcess this.MoveNext () - static member Construct (array:ResizeArray<'T>) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + static member Create (array:ResizeArray<'T>) (factory:EnumerableWithTransform<'T,'U>) : IEnumerator<'U> = let enumerator = new ResizeArrayEnumerator<'T,'U>(array) enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator type ResizeArrayEnumerable<'T,'U>(resizeArray:ResizeArray<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = ResizeArrayEnumerator<'T,'U>.Construct resizeArray this + member this.GetEnumerator () = ResizeArrayEnumerator<'T,'U>.Create resizeArray this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, this.Compose next, this.PipeIdx+1)) + upcast (new ResizeArrayEnumerable<'T,'V>(resizeArray, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let result, consumer = this.CreatePipeline getConsumer @@ -689,8 +689,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable activity = Unchecked.defaultof> - member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = - activity <- activity' + member private __.FinaliseConstruct(actualActivity: SeqConsumerActivity<'T,'U>) = + activity <- actualActivity override __.Activity = upcast activity @@ -712,20 +712,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition this.SeqState <- SeqProcessNextStates.InProcess this.MoveNext () - static member Construct (generator:'State->option<'T*'State>) (state:'State) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + static member Create (generator:'State->option<'T*'State>) (state:'State) (factory:EnumerableWithTransform<'T,'U>) : IEnumerator<'U> = let enumerator = new UnfoldEnumerator<'T,'U,'State>(generator, state) enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator type UnfoldEnumerable<'T,'U,'GeneratorState>(generator:'GeneratorState->option<'T*'GeneratorState>, state:'GeneratorState, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = UnfoldEnumerator<'T,'U,'GeneratorState>.Construct generator state this + member this.GetEnumerator () = UnfoldEnumerator<'T,'U,'GeneratorState>.Create generator state this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, this.Compose next, this.PipeIdx+1)) + upcast (new UnfoldEnumerable<'T,'V,'GeneratorState>(generator, state, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let result, consumer = this.CreatePipeline getConsumer @@ -766,8 +766,8 @@ namespace Microsoft.FSharp.Collections.SeqComposition let mutable activity = Unchecked.defaultof> let mutable isSkipping = Unchecked.defaultofbool> - member private __.FinaliseConstruct(activity':SeqConsumerActivity<'T,'U>) = - activity <- activity' + member private __.FinaliseConstruct(actualActivity: SeqConsumerActivity<'T,'U>) = + activity <- actualActivity isSkipping <- match box activity with @@ -803,20 +803,20 @@ namespace Microsoft.FSharp.Collections.SeqComposition this.SeqState <- SeqProcessNextStates.InProcess this.MoveNext () - static member Construct (count:Nullable) (f:int->'T) (factory:SeqFactoryBase<'T,'U>) : IEnumerator<'U> = + static member Create (count:Nullable) (f:int->'T) (factory:EnumerableWithTransform<'T,'U>) : IEnumerator<'U> = let enumerator = new InitEnumerator<'T,'U>(count, f) enumerator.FinaliseConstruct (factory.CreateActivityPipeline enumerator) upcast enumerator type InitEnumerable<'T,'U>(count:Nullable, f:int->'T, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = InitEnumerator<'T,'U>.Construct count f this + member this.GetEnumerator () = InitEnumerator<'T,'U>.Create count f this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new InitEnumerable<'T,'V>(count, f, this.Compose next, this.PipeIdx+1)) + upcast (new InitEnumerable<'T,'V>(count, f, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let terminatingIdx = getInitTerminatingIdx count @@ -1262,14 +1262,14 @@ namespace Microsoft.FSharp.Core.CompilerServices count and GeneratedSequenceBaseEnumerable<'T,'U>(generatedSequence:GeneratedSequenceBase<'T>, transform:ISeqTransform<'T,'U>, pipeIdx:PipeIdx) = - inherit SeqFactoryBase<'T,'U>(transform, pipeIdx) + inherit EnumerableWithTransform<'T,'U>(transform, pipeIdx) interface IEnumerable<'U> with - member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Construct (generatedSequence.GetFreshEnumerator()) this + member this.GetEnumerator () = VanillaEnumerator<'T,'U>.Create (generatedSequence.GetFreshEnumerator()) this interface IConsumableSeq<'U> with member this.Transform (next:ISeqTransform<'U,'V>) : IConsumableSeq<'V> = - upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, this.Compose next, this.PipeIdx+1)) + upcast (new GeneratedSequenceBaseEnumerable<'T,'V>(generatedSequence, this.ComposeWith next, this.PipeIdx+1)) member this.Consume<'Result> (getConsumer:PipeIdx->SeqConsumer<'U,'Result>) = let result, consumer = this.CreatePipeline getConsumer diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 910b5df984f..67fac9f730a 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -80,9 +80,9 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IConsumableSeq<'T> [] - type internal SeqFactoryBase<'T,'U> = + type internal EnumerableWithTransform<'T,'U> = inherit EnumerableBase<'U> - new : ISeqTransform<'T,'U> * PipeIdx -> SeqFactoryBase<'T,'U> + new : ISeqTransform<'T,'U> * PipeIdx -> EnumerableWithTransform<'T,'U> [] type internal IdentityTransform<'T> = @@ -105,7 +105,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition override Append : IConsumableSeq<'T> -> IConsumableSeq<'T> type internal ResizeArrayEnumerable<'T,'U> = - inherit SeqFactoryBase<'T,'U> + inherit EnumerableWithTransform<'T,'U> new : ResizeArray<'T> * ISeqTransform<'T,'U> * PipeIdx -> ResizeArrayEnumerable<'T,'U> interface IConsumableSeq<'U> @@ -114,7 +114,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition new : ResizeArray<'T> -> ThinResizeArrayEnumerable<'T> type internal ArrayEnumerable<'T,'U> = - inherit SeqFactoryBase<'T,'U> + inherit EnumerableWithTransform<'T,'U> new : array<'T> * ISeqTransform<'T,'U> * PipeIdx -> ArrayEnumerable<'T,'U> interface IConsumableSeq<'U> @@ -124,7 +124,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> type internal VanillaEnumerable<'T,'U> = - inherit SeqFactoryBase<'T,'U> + inherit EnumerableWithTransform<'T,'U> new : IEnumerable<'T> * ISeqTransform<'T,'U> * PipeIdx -> VanillaEnumerable<'T,'U> interface IConsumableSeq<'U> @@ -134,7 +134,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IEnumerable<'T> type internal UnfoldEnumerable<'T,'U,'GeneratorState> = - inherit SeqFactoryBase<'T,'U> + inherit EnumerableWithTransform<'T,'U> new : ('GeneratorState->option<'T*'GeneratorState>)*'GeneratorState*ISeqTransform<'T,'U>*PipeIdx -> UnfoldEnumerable<'T,'U,'GeneratorState> interface IConsumableSeq<'U> @@ -149,7 +149,7 @@ namespace Microsoft.FSharp.Collections.SeqComposition interface IConsumableSeq<'T> type internal InitEnumerable<'T,'U> = - inherit SeqFactoryBase<'T,'U> + inherit EnumerableWithTransform<'T,'U> new : Nullable * (int->'T) * ISeqTransform<'T,'U> * PipeIdx -> InitEnumerable<'T,'U> interface IConsumableSeq<'U> From 8275872834601c8e9506e21e2c8d9ec9ae936eb2 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 8 May 2018 18:15:49 +0100 Subject: [PATCH 119/120] cleanup seqcore.fsi a little --- src/fsharp/FSharp.Core/seq.fs | 2 +- src/fsharp/FSharp.Core/seqcore.fs | 7 ---- src/fsharp/FSharp.Core/seqcore.fsi | 62 +++++++++--------------------- 3 files changed, 20 insertions(+), 51 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 976c589b966..a8527838418 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -44,7 +44,7 @@ namespace Microsoft.FSharp.Collections IConsumableSeq.unfold generator state :> seq<_> [] - let empty<'T> = (EmptyEnumerable :> seq<'T>) + let empty<'T> = (IConsumableSeq.empty<'T> :> seq<'T>) [] let initInfinite initializer = diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index 05ab0c2ca6a..70d502ea6db 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -56,13 +56,6 @@ namespace Microsoft.FSharp.Collections let Empty<'T> () = (new EmptyEnumerator<'T>() :> IEnumerator<'T>) - [] - type EmptyEnumerable<'T> = - | EmptyEnumerable - interface IEnumerable<'T> with - member x.GetEnumerator() = Empty<'T>() - interface IEnumerable with - member x.GetEnumerator() = (Empty<'T>() :> IEnumerator) let readAndClear r = lock r (fun () -> match !r with None -> None | Some _ as res -> r := None; res) diff --git a/src/fsharp/FSharp.Core/seqcore.fsi b/src/fsharp/FSharp.Core/seqcore.fsi index 67fac9f730a..04a1f810d8a 100644 --- a/src/fsharp/FSharp.Core/seqcore.fsi +++ b/src/fsharp/FSharp.Core/seqcore.fsi @@ -6,54 +6,30 @@ namespace Microsoft.FSharp.Collections open System.Collections.Generic open Microsoft.FSharp.Core open Microsoft.FSharp.Collections + module internal IEnumerator = - val noReset : unit -> 'a - val notStarted : unit -> 'a - val alreadyFinished : unit -> 'a + + val noReset : unit -> 'T + + val notStarted : unit -> 'T + + val alreadyFinished : unit -> 'T + val check : started:bool -> unit + val dispose : r:System.IDisposable -> unit - val cast : - e:System.Collections.IEnumerator -> - System.Collections.Generic.IEnumerator<'T> - [] - type EmptyEnumerator<'T> = - class - interface System.IDisposable - interface System.Collections.IEnumerator - interface System.Collections.Generic.IEnumerator<'T> - new : unit -> EmptyEnumerator<'T> - end + + val cast : e:System.Collections.IEnumerator -> System.Collections.Generic.IEnumerator<'T> + val Empty : unit -> System.Collections.Generic.IEnumerator<'T> - [] - type EmptyEnumerable<'T> = - | EmptyEnumerable - with - interface System.Collections.IEnumerable - interface System.Collections.Generic.IEnumerable<'T> - end - - val readAndClear : r:'a option ref -> 'a option - val generateWhileSome : - openf:(unit -> 'a) -> - compute:('a -> 'U option) -> - closef:('a -> unit) -> System.Collections.Generic.IEnumerator<'U> - [] - type Singleton<'T> = - class - interface System.IDisposable - interface System.Collections.IEnumerator - interface System.Collections.Generic.IEnumerator<'T> - new : v:'T -> Singleton<'T> - end + val Singleton : x:'T -> System.Collections.Generic.IEnumerator<'T> - val EnumerateThenFinally : - f:(unit -> unit) -> - e:System.Collections.Generic.IEnumerator<'T> -> - System.Collections.Generic.IEnumerator<'T> - val inline checkNonNull : argName:string -> arg:'a -> unit - val mkSeq : - f:(unit -> System.Collections.Generic.IEnumerator<'U>) -> - System.Collections.Generic.IEnumerable<'U> + + val EnumerateThenFinally : f:(unit -> unit) -> e:System.Collections.Generic.IEnumerator<'T> -> System.Collections.Generic.IEnumerator<'T> + + val inline checkNonNull : argName:string -> arg:'T -> unit + + val mkSeq : f:(unit -> System.Collections.Generic.IEnumerator<'U>) -> System.Collections.Generic.IEnumerable<'U> namespace Microsoft.FSharp.Collections.SeqComposition From 03694e3303f40b6d0e482c48914512f82e08f178 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 9 May 2018 11:24:17 +0100 Subject: [PATCH 120/120] fix build --- .../FSharp.Core/FSharp.Core.fsproj | 21 +- src/fsharp/FSharp.Core/seq.fs | 3 +- .../Linq101Aggregates01.il.bsl | 824 +++++++++--------- 3 files changed, 417 insertions(+), 431 deletions(-) diff --git a/src/buildfromsource/FSharp.Core/FSharp.Core.fsproj b/src/buildfromsource/FSharp.Core/FSharp.Core.fsproj index 25663e35f1b..20cd0e2f9ca 100644 --- a/src/buildfromsource/FSharp.Core/FSharp.Core.fsproj +++ b/src/buildfromsource/FSharp.Core/FSharp.Core.fsproj @@ -64,33 +64,31 @@ Collections/collections.fs - - + Collections/list.fsi - + Collections/list.fs - + Collections/array.fsi - + Collections/array.fs - + Collections/seqcore.fsi Collections/seqcore.fs - - + Collections/iseq.fsi - + Collections/iseq.fs - + Collections/seq.fsi @@ -115,8 +113,7 @@ Collections/array.fs - - Collections/array3.fsi + Collections/array.fsi Collections/array3.fs diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index a8527838418..9c4dcbd9484 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -44,7 +44,8 @@ namespace Microsoft.FSharp.Collections IConsumableSeq.unfold generator state :> seq<_> [] - let empty<'T> = (IConsumableSeq.empty<'T> :> seq<'T>) + let empty<'T> = + IConsumableSeq.empty<'T> :> seq<'T> [] let initInfinite initializer = diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl index ada52d441bc..06526385baa 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 + .ver 4:4:3:0 } .assembly extern Utils { @@ -38,20 +38,20 @@ } .mresource public FSharpSignatureData.Linq101Aggregates01 { - // Offset: 0x00000000 Length: 0x00000610 + // Offset: 0x00000000 Length: 0x00000614 } .mresource public FSharpOptimizationData.Linq101Aggregates01 { // Offset: 0x00000618 Length: 0x00000211 } .module Linq101Aggregates01.exe -// MVID: {59B770B7-D281-4783-A745-0383B770B759} +// MVID: {5AF1FE1B-D281-4783-A745-03831BFEF15A} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x013F0000 +// Image base: 0x03330000 // =============== CLASS MEMBERS DECLARATION =================== @@ -116,7 +116,7 @@ // Code size 191 (0xbf) .maxstack 6 .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 100001,100001 : 0,0 'C:\\src\\manofstick\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\QueryExpressionStepping\\Linq101Aggregates01.fs' + .line 100001,100001 : 0,0 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\QueryExpressionStepping\\Linq101Aggregates01.fs' IL_0000: ldarg.0 IL_0001: ldfld int32 Linq101Aggregates01/uniqueFactors@12::pc IL_0006: ldc.i4.1 @@ -2010,7 +2010,7 @@ IL_0045: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1 [FSharp.Core]Microsoft.FSharp.Collections.IConsumableSeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) IL_004a: ldloc.s V_5 IL_004c: newobj instance void Linq101Aggregates01/'sum@43-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0051: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0051: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Consume(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) IL_0056: stloc.1 .line 45,45 : 9,28 '' IL_0057: ldarg.0 @@ -8026,7 +8026,7 @@ .method public static void main@() cil managed { .entrypoint - // Code size 1735 (0x6c7) + // Code size 1719 (0x6b7) .maxstack 13 .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 factorsOf300, [1] int32 uniqueFactors, @@ -8066,33 +8066,29 @@ [35] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_35, [36] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_36, [37] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_37, - [38] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_38, - [39] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_39, - [40] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_40, - [41] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_41, - [42] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_42, - [43] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_43, - [44] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_44, - [45] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_45, - [46] float64 V_46, - [47] float64 V_47, - [48] int32 V_48, - [49] float64 V_49, - [50] int32 V_50, - [51] class [mscorlib]System.IDisposable V_51, - [52] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_52, - [53] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_53, - [54] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable> V_54, - [55] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64> V_55, - [56] class [mscorlib]System.Collections.Generic.IEnumerable`1> V_56, - [57] class [mscorlib]System.Collections.Generic.IEnumerator`1> V_57, - [58] float64 V_58, - [59] float64 V_59, - [60] int32 V_60, - [61] float64 V_61, - [62] int32 V_62, - [63] class [mscorlib]System.IDisposable V_63, - [64] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_64) + [38] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 V_38, + [39] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_39, + [40] class [mscorlib]System.Collections.Generic.IEnumerable`1 V_40, + [41] class [mscorlib]System.Collections.Generic.IEnumerator`1 V_41, + [42] float64 V_42, + [43] float64 V_43, + [44] int32 V_44, + [45] float64 V_45, + [46] int32 V_46, + [47] class [mscorlib]System.IDisposable V_47, + [48] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_48, + [49] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_49, + [50] class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable> V_50, + [51] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64> V_51, + [52] class [mscorlib]System.Collections.Generic.IEnumerable`1> V_52, + [53] class [mscorlib]System.Collections.Generic.IEnumerator`1> V_53, + [54] float64 V_54, + [55] float64 V_55, + [56] int32 V_56, + [57] float64 V_57, + [58] int32 V_58, + [59] class [mscorlib]System.IDisposable V_59, + [60] class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder V_60) .line 8,8 : 1,31 '' IL_0000: ldc.i4.2 IL_0001: ldc.i4.2 @@ -8207,7 +8203,7 @@ IL_00e6: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1 [FSharp.Core]Microsoft.FSharp.Collections.IConsumableSeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) IL_00eb: ldloc.s V_24 IL_00ed: newobj instance void Linq101Aggregates01/'numSum@22-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_00f2: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_00f2: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Consume(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) IL_00f7: dup IL_00f8: stsfld int32 ''.$Linq101Aggregates01::numSum@19 IL_00fd: stloc.3 @@ -8263,7 +8259,7 @@ IL_016e: call class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1 [FSharp.Core]Microsoft.FSharp.Collections.IConsumableSeqModule::OfSeq(class [mscorlib]System.Collections.Generic.IEnumerable`1) IL_0173: ldloc.s V_29 IL_0175: newobj instance void Linq101Aggregates01/'totalChars@31-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_017a: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_017a: callvirt instance !!0 class [FSharp.Core]Microsoft.FSharp.Collections.SeqComposition.IConsumableSeq`1::Consume(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) IL_017f: dup IL_0180: stsfld int32 ''.$Linq101Aggregates01::totalChars@28 IL_0185: stloc.s totalChars @@ -8304,507 +8300,499 @@ IL_01eb: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories@37 IL_01f0: stloc.s categories IL_01f2: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_01f7: stloc.s V_32 - IL_01f9: ldloc.s V_32 + IL_01f7: ldc.i4.0 + IL_01f8: ldc.i4.0 + IL_01f9: ldnull + IL_01fa: ldc.i4.0 IL_01fb: ldc.i4.0 - IL_01fc: ldc.i4.0 - IL_01fd: ldnull - IL_01fe: ldc.i4.0 - IL_01ff: ldc.i4.0 - IL_0200: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, + IL_01fc: newobj instance void Linq101Aggregates01/minNum@49::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_0205: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_020a: newobj instance void Linq101Aggregates01/'minNum@49-1'::.ctor() - IL_020f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0201: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0206: newobj instance void Linq101Aggregates01/'minNum@49-1'::.ctor() + IL_020b: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0214: dup - IL_0215: stsfld int32 ''.$Linq101Aggregates01::minNum@49 - IL_021a: stloc.s minNum - IL_021c: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0221: stloc.s V_33 - IL_0223: ldloc.s V_33 - IL_0225: ldnull - IL_0226: ldnull - IL_0227: ldnull - IL_0228: ldc.i4.0 - IL_0229: ldnull - IL_022a: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, + IL_0210: dup + IL_0211: stsfld int32 ''.$Linq101Aggregates01::minNum@49 + IL_0216: stloc.s minNum + IL_0218: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_021d: ldnull + IL_021e: ldnull + IL_021f: ldnull + IL_0220: ldc.i4.0 + IL_0221: ldnull + IL_0222: newobj instance void Linq101Aggregates01/shortestWord@52::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_022f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0234: newobj instance void Linq101Aggregates01/'shortestWord@52-1'::.ctor() - IL_0239: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0227: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_022c: newobj instance void Linq101Aggregates01/'shortestWord@52-1'::.ctor() + IL_0231: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MinBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_023e: dup - IL_023f: stsfld int32 ''.$Linq101Aggregates01::shortestWord@52 - IL_0244: stloc.s shortestWord + IL_0236: dup + IL_0237: stsfld int32 ''.$Linq101Aggregates01::shortestWord@52 + IL_023c: stloc.s shortestWord .line 55,61 : 1,21 '' - IL_0246: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_024b: stloc.s V_34 - IL_024d: ldloc.s V_34 - IL_024f: ldloc.s V_34 - IL_0251: ldloc.s V_34 - IL_0253: ldloc.s V_34 - IL_0255: ldloc.s V_34 - IL_0257: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_025c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0261: ldloc.s V_34 - IL_0263: newobj instance void Linq101Aggregates01/categories2@57::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0268: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_023e: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0243: stloc.s V_32 + IL_0245: ldloc.s V_32 + IL_0247: ldloc.s V_32 + IL_0249: ldloc.s V_32 + IL_024b: ldloc.s V_32 + IL_024d: ldloc.s V_32 + IL_024f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_0254: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0259: ldloc.s V_32 + IL_025b: newobj instance void Linq101Aggregates01/categories2@57::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0260: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_026d: newobj instance void Linq101Aggregates01/'categories2@58-1'::.ctor() - IL_0272: newobj instance void Linq101Aggregates01/'categories2@58-2'::.ctor() - IL_0277: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0265: newobj instance void Linq101Aggregates01/'categories2@58-1'::.ctor() + IL_026a: newobj instance void Linq101Aggregates01/'categories2@58-2'::.ctor() + IL_026f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_027c: ldloc.s V_34 - IL_027e: newobj instance void Linq101Aggregates01/'categories2@58-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0283: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0274: ldloc.s V_32 + IL_0276: newobj instance void Linq101Aggregates01/'categories2@58-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_027b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0288: newobj instance void Linq101Aggregates01/'categories2@60-4'::.ctor() - IL_028d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0280: newobj instance void Linq101Aggregates01/'categories2@60-4'::.ctor() + IL_0285: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0292: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0297: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_029c: dup - IL_029d: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories2@55 - IL_02a2: stloc.s categories2 + IL_028a: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_028f: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0294: dup + IL_0295: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories2@55 + IL_029a: stloc.s categories2 .line 64,71 : 1,21 '' - IL_02a4: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_02a9: stloc.s V_35 - IL_02ab: ldloc.s V_35 - IL_02ad: ldloc.s V_35 - IL_02af: ldloc.s V_35 - IL_02b1: ldloc.s V_35 - IL_02b3: ldloc.s V_35 - IL_02b5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_02ba: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_02bf: ldloc.s V_35 - IL_02c1: newobj instance void Linq101Aggregates01/categories3@66::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_02c6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_029c: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_02a1: stloc.s V_33 + IL_02a3: ldloc.s V_33 + IL_02a5: ldloc.s V_33 + IL_02a7: ldloc.s V_33 + IL_02a9: ldloc.s V_33 + IL_02ab: ldloc.s V_33 + IL_02ad: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_02b2: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_02b7: ldloc.s V_33 + IL_02b9: newobj instance void Linq101Aggregates01/categories3@66::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_02be: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_02cb: newobj instance void Linq101Aggregates01/'categories3@67-1'::.ctor() - IL_02d0: newobj instance void Linq101Aggregates01/'categories3@67-2'::.ctor() - IL_02d5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02c3: newobj instance void Linq101Aggregates01/'categories3@67-1'::.ctor() + IL_02c8: newobj instance void Linq101Aggregates01/'categories3@67-2'::.ctor() + IL_02cd: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_02da: ldloc.s V_35 - IL_02dc: newobj instance void Linq101Aggregates01/'categories3@67-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_02e1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02d2: ldloc.s V_33 + IL_02d4: newobj instance void Linq101Aggregates01/'categories3@67-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_02d9: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_02e6: newobj instance void Linq101Aggregates01/'categories3@70-4'::.ctor() - IL_02eb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_02de: newobj instance void Linq101Aggregates01/'categories3@70-4'::.ctor() + IL_02e3: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_02f0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_02f5: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_02fa: dup - IL_02fb: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories3@64 - IL_0300: stloc.s categories3 - IL_0302: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0307: stloc.s V_36 - IL_0309: ldloc.s V_36 - IL_030b: ldc.i4.0 - IL_030c: ldc.i4.0 - IL_030d: ldnull - IL_030e: ldc.i4.0 - IL_030f: ldc.i4.0 - IL_0310: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, + IL_02e8: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_02ed: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_02f2: dup + IL_02f3: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories3@64 + IL_02f8: stloc.s categories3 + IL_02fa: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_02ff: ldc.i4.0 + IL_0300: ldc.i4.0 + IL_0301: ldnull + IL_0302: ldc.i4.0 + IL_0303: ldc.i4.0 + IL_0304: newobj instance void Linq101Aggregates01/maxNum@74::.ctor(int32, int32, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, int32) - IL_0315: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_031a: newobj instance void Linq101Aggregates01/'maxNum@74-1'::.ctor() - IL_031f: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0309: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_030e: newobj instance void Linq101Aggregates01/'maxNum@74-1'::.ctor() + IL_0313: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0324: dup - IL_0325: stsfld int32 ''.$Linq101Aggregates01::maxNum@74 - IL_032a: stloc.s maxNum - IL_032c: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0331: stloc.s V_37 - IL_0333: ldloc.s V_37 - IL_0335: ldnull - IL_0336: ldnull - IL_0337: ldnull - IL_0338: ldc.i4.0 - IL_0339: ldnull - IL_033a: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, + IL_0318: dup + IL_0319: stsfld int32 ''.$Linq101Aggregates01::maxNum@74 + IL_031e: stloc.s maxNum + IL_0320: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0325: ldnull + IL_0326: ldnull + IL_0327: ldnull + IL_0328: ldc.i4.0 + IL_0329: ldnull + IL_032a: newobj instance void Linq101Aggregates01/longestLength@77::.ctor(string, string, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, string) - IL_033f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0344: newobj instance void Linq101Aggregates01/'longestLength@77-1'::.ctor() - IL_0349: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_032f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0334: newobj instance void Linq101Aggregates01/'longestLength@77-1'::.ctor() + IL_0339: callvirt instance !!2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::MaxBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_034e: dup - IL_034f: stsfld int32 ''.$Linq101Aggregates01::longestLength@77 - IL_0354: stloc.s longestLength + IL_033e: dup + IL_033f: stsfld int32 ''.$Linq101Aggregates01::longestLength@77 + IL_0344: stloc.s longestLength .line 80,86 : 1,21 '' - IL_0356: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_035b: stloc.s V_38 - IL_035d: ldloc.s V_38 - IL_035f: ldloc.s V_38 - IL_0361: ldloc.s V_38 - IL_0363: ldloc.s V_38 - IL_0365: ldloc.s V_38 - IL_0367: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_036c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0371: ldloc.s V_38 - IL_0373: newobj instance void Linq101Aggregates01/categories4@82::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0378: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0346: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_034b: stloc.s V_34 + IL_034d: ldloc.s V_34 + IL_034f: ldloc.s V_34 + IL_0351: ldloc.s V_34 + IL_0353: ldloc.s V_34 + IL_0355: ldloc.s V_34 + IL_0357: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_035c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0361: ldloc.s V_34 + IL_0363: newobj instance void Linq101Aggregates01/categories4@82::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0368: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_037d: newobj instance void Linq101Aggregates01/'categories4@83-1'::.ctor() - IL_0382: newobj instance void Linq101Aggregates01/'categories4@83-2'::.ctor() - IL_0387: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_036d: newobj instance void Linq101Aggregates01/'categories4@83-1'::.ctor() + IL_0372: newobj instance void Linq101Aggregates01/'categories4@83-2'::.ctor() + IL_0377: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_038c: ldloc.s V_38 - IL_038e: newobj instance void Linq101Aggregates01/'categories4@83-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_0393: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_037c: ldloc.s V_34 + IL_037e: newobj instance void Linq101Aggregates01/'categories4@83-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0383: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0398: newobj instance void Linq101Aggregates01/'categories4@85-4'::.ctor() - IL_039d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0388: newobj instance void Linq101Aggregates01/'categories4@85-4'::.ctor() + IL_038d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_03a2: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_03a7: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_03ac: dup - IL_03ad: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories4@80 - IL_03b2: stloc.s categories4 + IL_0392: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_0397: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_039c: dup + IL_039d: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories4@80 + IL_03a2: stloc.s categories4 .line 89,96 : 1,21 '' - IL_03b4: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_03b9: stloc.s V_39 - IL_03bb: ldloc.s V_39 - IL_03bd: ldloc.s V_39 - IL_03bf: ldloc.s V_39 - IL_03c1: ldloc.s V_39 - IL_03c3: ldloc.s V_39 - IL_03c5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_03ca: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_03cf: ldloc.s V_39 - IL_03d1: newobj instance void Linq101Aggregates01/categories5@91::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_03d6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03a4: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_03a9: stloc.s V_35 + IL_03ab: ldloc.s V_35 + IL_03ad: ldloc.s V_35 + IL_03af: ldloc.s V_35 + IL_03b1: ldloc.s V_35 + IL_03b3: ldloc.s V_35 + IL_03b5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_03ba: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_03bf: ldloc.s V_35 + IL_03c1: newobj instance void Linq101Aggregates01/categories5@91::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_03c6: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_03db: newobj instance void Linq101Aggregates01/'categories5@92-1'::.ctor() - IL_03e0: newobj instance void Linq101Aggregates01/'categories5@92-2'::.ctor() - IL_03e5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03cb: newobj instance void Linq101Aggregates01/'categories5@92-1'::.ctor() + IL_03d0: newobj instance void Linq101Aggregates01/'categories5@92-2'::.ctor() + IL_03d5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_03ea: ldloc.s V_39 - IL_03ec: newobj instance void Linq101Aggregates01/'categories5@92-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_03f1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03da: ldloc.s V_35 + IL_03dc: newobj instance void Linq101Aggregates01/'categories5@92-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_03e1: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`3,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_03f6: newobj instance void Linq101Aggregates01/'categories5@95-4'::.ctor() - IL_03fb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_03e6: newobj instance void Linq101Aggregates01/'categories5@95-4'::.ctor() + IL_03eb: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal,class [mscorlib]System.Collections.Generic.IEnumerable`1>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0400: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_0405: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_040a: dup - IL_040b: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories5@89 - IL_0410: stloc.s categories5 + IL_03f0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2>,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_03f5: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_03fa: dup + IL_03fb: stsfld class [mscorlib]System.Tuple`2>[] ''.$Linq101Aggregates01::categories5@89 + IL_0400: stloc.s categories5 .line 99,99 : 1,66 '' - IL_0412: ldc.r8 5. - IL_041b: ldc.r8 4. - IL_0424: ldc.r8 1. - IL_042d: ldc.r8 3. - IL_0436: ldc.r8 9. - IL_043f: ldc.r8 8. - IL_0448: ldc.r8 6. - IL_0451: ldc.r8 7. - IL_045a: ldc.r8 2. - IL_0463: ldc.r8 0.0 - IL_046c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0471: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0402: ldc.r8 5. + IL_040b: ldc.r8 4. + IL_0414: ldc.r8 1. + IL_041d: ldc.r8 3. + IL_0426: ldc.r8 9. + IL_042f: ldc.r8 8. + IL_0438: ldc.r8 6. + IL_0441: ldc.r8 7. + IL_044a: ldc.r8 2. + IL_0453: ldc.r8 0.0 + IL_045c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0461: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0476: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0466: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_047b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_046b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0480: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0470: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0485: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0475: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_048a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_047a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_048f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_047f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0494: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0484: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0499: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0489: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_049e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_048e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_04a3: dup - IL_04a4: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers2@99 - IL_04a9: stloc.s numbers2 - IL_04ab: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_04b0: stloc.s V_40 - IL_04b2: ldloc.s V_40 - IL_04b4: stloc.s V_41 - IL_04b6: ldc.r8 0.0 - IL_04bf: ldc.r8 0.0 - IL_04c8: ldnull - IL_04c9: ldc.i4.0 - IL_04ca: ldc.r8 0.0 - IL_04d3: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, + IL_0493: dup + IL_0494: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$Linq101Aggregates01::numbers2@99 + IL_0499: stloc.s numbers2 + IL_049b: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_04a0: stloc.s V_36 + IL_04a2: ldloc.s V_36 + IL_04a4: stloc.s V_37 + IL_04a6: ldc.r8 0.0 + IL_04af: ldc.r8 0.0 + IL_04b8: ldnull + IL_04b9: ldc.i4.0 + IL_04ba: ldc.r8 0.0 + IL_04c3: newobj instance void Linq101Aggregates01/averageNum@100::.ctor(float64, float64, class [mscorlib]System.Collections.Generic.IEnumerator`1, int32, float64) - IL_04d8: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_04dd: stloc.s V_42 - IL_04df: newobj instance void Linq101Aggregates01/'averageNum@100-1'::.ctor() - IL_04e4: stloc.s V_43 - IL_04e6: ldloc.s V_42 - IL_04e8: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() - IL_04ed: stloc.s V_44 - IL_04ef: ldloc.s V_44 - IL_04f1: box class [mscorlib]System.Collections.Generic.IEnumerable`1 - IL_04f6: brfalse.s IL_04fa - - IL_04f8: br.s IL_0505 + IL_04c8: newobj instance void class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_04cd: stloc.s V_38 + IL_04cf: newobj instance void Linq101Aggregates01/'averageNum@100-1'::.ctor() + IL_04d4: stloc.s V_39 + IL_04d6: ldloc.s V_38 + IL_04d8: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2::get_Source() + IL_04dd: stloc.s V_40 + IL_04df: ldloc.s V_40 + IL_04e1: box class [mscorlib]System.Collections.Generic.IEnumerable`1 + IL_04e6: brfalse.s IL_04ea + + IL_04e8: br.s IL_04f5 .line 100001,100001 : 0,0 '' - IL_04fa: ldstr "source" - IL_04ff: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_0504: throw + IL_04ea: ldstr "source" + IL_04ef: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_04f4: throw .line 100001,100001 : 0,0 '' - IL_0505: nop - IL_0506: ldloc.s V_44 - IL_0508: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_050d: stloc.s V_45 + IL_04f5: nop + IL_04f6: ldloc.s V_40 + IL_04f8: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_04fd: stloc.s V_41 .try { - IL_050f: ldc.r8 0.0 - IL_0518: stloc.s V_47 - IL_051a: ldc.i4.0 - IL_051b: stloc.s V_48 - IL_051d: ldloc.s V_45 - IL_051f: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_0524: brfalse.s IL_0542 - - IL_0526: ldloc.s V_47 - IL_0528: ldloc.s V_43 - IL_052a: ldloc.s V_45 - IL_052c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0531: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0536: add - IL_0537: stloc.s V_47 + IL_04ff: ldc.r8 0.0 + IL_0508: stloc.s V_43 + IL_050a: ldc.i4.0 + IL_050b: stloc.s V_44 + IL_050d: ldloc.s V_41 + IL_050f: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_0514: brfalse.s IL_0532 + + IL_0516: ldloc.s V_43 + IL_0518: ldloc.s V_39 + IL_051a: ldloc.s V_41 + IL_051c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0521: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0526: add + IL_0527: stloc.s V_43 .line 100,100 : 47,58 '' - IL_0539: ldloc.s V_48 - IL_053b: ldc.i4.1 - IL_053c: add - IL_053d: stloc.s V_48 + IL_0529: ldloc.s V_44 + IL_052b: ldc.i4.1 + IL_052c: add + IL_052d: stloc.s V_44 .line 100001,100001 : 0,0 '' - IL_053f: nop - IL_0540: br.s IL_051d + IL_052f: nop + IL_0530: br.s IL_050d - IL_0542: ldloc.s V_48 - IL_0544: brtrue.s IL_0548 + IL_0532: ldloc.s V_44 + IL_0534: brtrue.s IL_0538 - IL_0546: br.s IL_054a + IL_0536: br.s IL_053a - IL_0548: br.s IL_0555 + IL_0538: br.s IL_0545 .line 100001,100001 : 0,0 '' - IL_054a: ldstr "source" - IL_054f: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_0554: throw + IL_053a: ldstr "source" + IL_053f: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_0544: throw .line 100001,100001 : 0,0 '' - IL_0555: nop - IL_0556: ldloc.s V_47 - IL_0558: stloc.s V_49 - IL_055a: ldloc.s V_48 - IL_055c: stloc.s V_50 - IL_055e: ldloc.s V_49 - IL_0560: ldloc.s V_50 - IL_0562: conv.r8 - IL_0563: div - IL_0564: stloc.s V_46 - IL_0566: leave.s IL_0586 + IL_0545: nop + IL_0546: ldloc.s V_43 + IL_0548: stloc.s V_45 + IL_054a: ldloc.s V_44 + IL_054c: stloc.s V_46 + IL_054e: ldloc.s V_45 + IL_0550: ldloc.s V_46 + IL_0552: conv.r8 + IL_0553: div + IL_0554: stloc.s V_42 + IL_0556: leave.s IL_0576 } // end .try finally { - IL_0568: ldloc.s V_45 - IL_056a: isinst [mscorlib]System.IDisposable - IL_056f: stloc.s V_51 - IL_0571: ldloc.s V_51 - IL_0573: brfalse.s IL_0577 + IL_0558: ldloc.s V_41 + IL_055a: isinst [mscorlib]System.IDisposable + IL_055f: stloc.s V_47 + IL_0561: ldloc.s V_47 + IL_0563: brfalse.s IL_0567 - IL_0575: br.s IL_0579 + IL_0565: br.s IL_0569 - IL_0577: br.s IL_0583 + IL_0567: br.s IL_0573 .line 100001,100001 : 0,0 '' - IL_0579: ldloc.s V_51 - IL_057b: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0580: ldnull - IL_0581: pop - IL_0582: endfinally + IL_0569: ldloc.s V_47 + IL_056b: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0570: ldnull + IL_0571: pop + IL_0572: endfinally .line 100001,100001 : 0,0 '' - IL_0583: ldnull - IL_0584: pop - IL_0585: endfinally + IL_0573: ldnull + IL_0574: pop + IL_0575: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_0586: ldloc.s V_46 - IL_0588: dup - IL_0589: stsfld float64 ''.$Linq101Aggregates01::averageNum@100 - IL_058e: stloc.s averageNum - IL_0590: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_0595: stloc.s V_52 - IL_0597: ldloc.s V_52 - IL_0599: stloc.s V_53 - IL_059b: ldloc.s V_52 - IL_059d: ldloc.s V_52 - IL_059f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_words() - IL_05a4: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_05a9: ldloc.s V_52 - IL_05ab: newobj instance void Linq101Aggregates01/averageLength@105::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_05b0: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0576: ldloc.s V_42 + IL_0578: dup + IL_0579: stsfld float64 ''.$Linq101Aggregates01::averageNum@100 + IL_057e: stloc.s averageNum + IL_0580: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_0585: stloc.s V_48 + IL_0587: ldloc.s V_48 + IL_0589: stloc.s V_49 + IL_058b: ldloc.s V_48 + IL_058d: ldloc.s V_48 + IL_058f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_words() + IL_0594: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0599: ldloc.s V_48 + IL_059b: newobj instance void Linq101Aggregates01/averageLength@105::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_05a0: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_05b5: stloc.s V_54 - IL_05b7: newobj instance void Linq101Aggregates01/'averageLength@107-1'::.ctor() - IL_05bc: stloc.s V_55 - IL_05be: ldloc.s V_54 - IL_05c0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_05c5: stloc.s V_56 - IL_05c7: ldloc.s V_56 - IL_05c9: box class [mscorlib]System.Collections.Generic.IEnumerable`1> - IL_05ce: brfalse.s IL_05d2 - - IL_05d0: br.s IL_05dd + IL_05a5: stloc.s V_50 + IL_05a7: newobj instance void Linq101Aggregates01/'averageLength@107-1'::.ctor() + IL_05ac: stloc.s V_51 + IL_05ae: ldloc.s V_50 + IL_05b0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_05b5: stloc.s V_52 + IL_05b7: ldloc.s V_52 + IL_05b9: box class [mscorlib]System.Collections.Generic.IEnumerable`1> + IL_05be: brfalse.s IL_05c2 + + IL_05c0: br.s IL_05cd .line 100001,100001 : 0,0 '' - IL_05d2: ldstr "source" - IL_05d7: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) - IL_05dc: throw + IL_05c2: ldstr "source" + IL_05c7: newobj instance void [mscorlib]System.ArgumentNullException::.ctor(string) + IL_05cc: throw .line 100001,100001 : 0,0 '' - IL_05dd: nop - IL_05de: ldloc.s V_56 - IL_05e0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1>::GetEnumerator() - IL_05e5: stloc.s V_57 + IL_05cd: nop + IL_05ce: ldloc.s V_52 + IL_05d0: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1>::GetEnumerator() + IL_05d5: stloc.s V_53 .try { - IL_05e7: ldc.r8 0.0 - IL_05f0: stloc.s V_59 - IL_05f2: ldc.i4.0 - IL_05f3: stloc.s V_60 - IL_05f5: ldloc.s V_57 - IL_05f7: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - IL_05fc: brfalse.s IL_061a - - IL_05fe: ldloc.s V_59 - IL_0600: ldloc.s V_55 - IL_0602: ldloc.s V_57 - IL_0604: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1>::get_Current() - IL_0609: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64>::Invoke(!0) - IL_060e: add - IL_060f: stloc.s V_59 + IL_05d7: ldc.r8 0.0 + IL_05e0: stloc.s V_55 + IL_05e2: ldc.i4.0 + IL_05e3: stloc.s V_56 + IL_05e5: ldloc.s V_53 + IL_05e7: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_05ec: brfalse.s IL_060a + + IL_05ee: ldloc.s V_55 + IL_05f0: ldloc.s V_51 + IL_05f2: ldloc.s V_53 + IL_05f4: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1>::get_Current() + IL_05f9: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,float64>::Invoke(!0) + IL_05fe: add + IL_05ff: stloc.s V_55 .line 107,107 : 9,21 '' - IL_0611: ldloc.s V_60 - IL_0613: ldc.i4.1 - IL_0614: add - IL_0615: stloc.s V_60 + IL_0601: ldloc.s V_56 + IL_0603: ldc.i4.1 + IL_0604: add + IL_0605: stloc.s V_56 .line 100001,100001 : 0,0 '' - IL_0617: nop - IL_0618: br.s IL_05f5 + IL_0607: nop + IL_0608: br.s IL_05e5 - IL_061a: ldloc.s V_60 - IL_061c: brtrue.s IL_0620 + IL_060a: ldloc.s V_56 + IL_060c: brtrue.s IL_0610 - IL_061e: br.s IL_0622 + IL_060e: br.s IL_0612 - IL_0620: br.s IL_062d + IL_0610: br.s IL_061d .line 100001,100001 : 0,0 '' - IL_0622: ldstr "source" - IL_0627: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) - IL_062c: throw + IL_0612: ldstr "source" + IL_0617: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) + IL_061c: throw .line 100001,100001 : 0,0 '' - IL_062d: nop - IL_062e: ldloc.s V_59 - IL_0630: stloc.s V_61 - IL_0632: ldloc.s V_60 - IL_0634: stloc.s V_62 - IL_0636: ldloc.s V_61 - IL_0638: ldloc.s V_62 - IL_063a: conv.r8 - IL_063b: div - IL_063c: stloc.s V_58 - IL_063e: leave.s IL_065e + IL_061d: nop + IL_061e: ldloc.s V_55 + IL_0620: stloc.s V_57 + IL_0622: ldloc.s V_56 + IL_0624: stloc.s V_58 + IL_0626: ldloc.s V_57 + IL_0628: ldloc.s V_58 + IL_062a: conv.r8 + IL_062b: div + IL_062c: stloc.s V_54 + IL_062e: leave.s IL_064e } // end .try finally { - IL_0640: ldloc.s V_57 - IL_0642: isinst [mscorlib]System.IDisposable - IL_0647: stloc.s V_63 - IL_0649: ldloc.s V_63 - IL_064b: brfalse.s IL_064f + IL_0630: ldloc.s V_53 + IL_0632: isinst [mscorlib]System.IDisposable + IL_0637: stloc.s V_59 + IL_0639: ldloc.s V_59 + IL_063b: brfalse.s IL_063f - IL_064d: br.s IL_0651 + IL_063d: br.s IL_0641 - IL_064f: br.s IL_065b + IL_063f: br.s IL_064b .line 100001,100001 : 0,0 '' - IL_0651: ldloc.s V_63 - IL_0653: callvirt instance void [mscorlib]System.IDisposable::Dispose() - IL_0658: ldnull - IL_0659: pop - IL_065a: endfinally + IL_0641: ldloc.s V_59 + IL_0643: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0648: ldnull + IL_0649: pop + IL_064a: endfinally .line 100001,100001 : 0,0 '' - IL_065b: ldnull - IL_065c: pop - IL_065d: endfinally + IL_064b: ldnull + IL_064c: pop + IL_064d: endfinally .line 100001,100001 : 0,0 '' } // end handler - IL_065e: ldloc.s V_58 - IL_0660: dup - IL_0661: stsfld float64 ''.$Linq101Aggregates01::averageLength@103 - IL_0666: stloc.s averageLength + IL_064e: ldloc.s V_54 + IL_0650: dup + IL_0651: stsfld float64 ''.$Linq101Aggregates01::averageLength@103 + IL_0656: stloc.s averageLength .line 111,117 : 1,21 '' - IL_0668: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() - IL_066d: stloc.s V_64 - IL_066f: ldloc.s V_64 - IL_0671: ldloc.s V_64 - IL_0673: ldloc.s V_64 - IL_0675: ldloc.s V_64 - IL_0677: ldloc.s V_64 - IL_0679: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() - IL_067e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_0683: ldloc.s V_64 - IL_0685: newobj instance void Linq101Aggregates01/categories6@113::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_068a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_0658: call class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_query() + IL_065d: stloc.s V_60 + IL_065f: ldloc.s V_60 + IL_0661: ldloc.s V_60 + IL_0663: ldloc.s V_60 + IL_0665: ldloc.s V_60 + IL_0667: ldloc.s V_60 + IL_0669: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 Linq101Aggregates01::get_products() + IL_066e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Source(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_0673: ldloc.s V_60 + IL_0675: newobj instance void Linq101Aggregates01/categories6@113::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_067a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_068f: newobj instance void Linq101Aggregates01/'categories6@114-1'::.ctor() - IL_0694: newobj instance void Linq101Aggregates01/'categories6@114-2'::.ctor() - IL_0699: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_067f: newobj instance void Linq101Aggregates01/'categories6@114-1'::.ctor() + IL_0684: newobj instance void Linq101Aggregates01/'categories6@114-2'::.ctor() + IL_0689: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,!!3> [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::GroupValBy(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_069e: ldloc.s V_64 - IL_06a0: newobj instance void Linq101Aggregates01/'categories6@114-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) - IL_06a5: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_068e: ldloc.s V_60 + IL_0690: newobj instance void Linq101Aggregates01/'categories6@114-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder) + IL_0695: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::For,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2,valuetype [mscorlib]System.Decimal>,object>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_06aa: newobj instance void Linq101Aggregates01/'categories6@116-4'::.ctor() - IL_06af: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, + IL_069a: newobj instance void Linq101Aggregates01/'categories6@116-4'::.ctor() + IL_069f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2 [FSharp.Core]Microsoft.FSharp.Linq.QueryBuilder::Select,valuetype [mscorlib]System.Decimal>,class [mscorlib]System.Collections.IEnumerable,class [mscorlib]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_06b4: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() - IL_06b9: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) - IL_06be: dup - IL_06bf: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories6@111 - IL_06c4: stloc.s categories6 - IL_06c6: ret + IL_06a4: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerable`1 class [FSharp.Core]Microsoft.FSharp.Linq.QuerySource`2,class [mscorlib]System.Collections.IEnumerable>::get_Source() + IL_06a9: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray>(class [mscorlib]System.Collections.Generic.IEnumerable`1) + IL_06ae: dup + IL_06af: stsfld class [mscorlib]System.Tuple`2[] ''.$Linq101Aggregates01::categories6@111 + IL_06b4: stloc.s categories6 + IL_06b6: ret } // end of method $Linq101Aggregates01::main@ } // end of class ''.$Linq101Aggregates01