File tree Expand file tree Collapse file tree
src/FSharpx.Core/Collections Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,8 +14,15 @@ module ResizeArray =
1414 let length ( arr : ResizeArray < 'T >) = arr.Count
1515 let get ( arr : ResizeArray < 'T >) ( n : int ) = arr.[ n]
1616 let set ( arr : ResizeArray < 'T >) ( n : int ) ( x : 'T ) = arr.[ n] <- x
17- let create ( n : int ) x = new ResizeArray<_> ( seq { for _ in 1 .. n -> x })
18- let init ( n : int ) ( f : int -> 'T ) = new ResizeArray<_> ( seq { for i in 0 .. n-1 -> f i })
17+ let create ( n : int ) x =
18+ let arr = ResizeArray<_>( n)
19+ for i= 0 to n-1 do arr.Add x
20+ arr
21+
22+ let init ( n : int ) ( f : int -> 'T ) =
23+ let arr = ResizeArray<_>( n)
24+ for i= 0 to n-1 do arr.Add ( f i)
25+ arr
1926
2027 let blit ( arr1 : ResizeArray < 'T >) start1 ( arr2 : ResizeArray < 'T >) start2 len =
2128 if start1 < 0 then invalidArg " start1" " index must be positive"
You can’t perform that action at this time.
0 commit comments