File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,9 @@ type Iterate =
45
45
static member Iterate ( x : Choice < 'T , 'E > , action ) = match x with Choice1Of2 x -> action x | _ -> ()
46
46
static member Iterate ( KeyValue ( _ : 'Key , x : 'T ), action ) = action x : unit
47
47
static member Iterate ( x : Map < 'Key , 'T > , action ) = Map.iter ( const' action) x
48
+ static member Iterate ( x : IDictionary < 'Key , 'T >, action ) = Dict.iterValues action x
48
49
static member Iterate ( x : Dictionary < 'Key , 'T > , action ) = Dictionary.iterValues action x
50
+ static member Iterate ( x : IReadOnlyDictionary < 'Key , 'T >, action ) = IReadOnlyDictionary.iterValues action x
49
51
static member Iterate ( x : _ ResizeArray , action ) = ResizeArray.iter action x
50
52
51
53
// Restricted
Original file line number Diff line number Diff line change @@ -487,6 +487,22 @@ module Functor =
487
487
let nel = zip ( NonEmptyList.ofList [ 1 ; 2 ]) ( NonEmptyList.ofList [ " a" ; " b" ; " c" ])
488
488
CollectionAssert.AreEqual ( NonEmptyList.ofList [ 1 , " a" ; 2 , " b" ], nel)
489
489
490
+ [<Test>]
491
+ let iterTests () =
492
+ let li = [ 1 , 2 ; 3 , 4 ]
493
+ let di : Dictionary < int , int > = ofList li
494
+ let id = dict li
495
+ let ir = readOnlyDict li
496
+ let ma = Map.ofList li
497
+
498
+ let r = ResizeArray< string> []
499
+
500
+ iter ( r.Add << string) di
501
+ iter ( r.Add << string) id
502
+ iter ( r.Add << string) ir
503
+ iter ( r.Add << string) ma
504
+ CollectionAssert.AreEqual ( ResizeArray [ " 2" ; " 4" ; " 2" ; " 4" ; " 2" ; " 4" ; " 2" ; " 4" ], r)
505
+
490
506
491
507
492
508
module Foldable =
You can’t perform that action at this time.
0 commit comments