File tree 2 files changed +19
-0
lines changed
2 files changed +19
-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,23 @@ 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 di = new Dictionary< int, int>()
493
+ di.Add ( 1 , 2 )
494
+ di.Add ( 3 , 4 )
495
+ let id = dict [ 1 , 2 ; 3 , 4 ]
496
+ let ir = readOnlyDict [ 1 , 2 ; 3 , 4 ]
497
+ let ma = Map.ofList [ 1 , 2 ; 3 , 4 ]
498
+
499
+ let r = ResizeArray< string> []
500
+
501
+ iter ( fun x -> r.Add ( string x)) di
502
+ iter ( fun x -> r.Add ( string x)) id
503
+ iter ( fun x -> r.Add ( string x)) ir
504
+ iter ( fun x -> r.Add ( string x)) map
505
+ CollectionAssert.AreEqual ( ResizeArray [ " 2" ; " 4" ; " 2" ; " 4" ; " 2" ; " 4" ; " 2" ; " 4" ], r)
506
+
490
507
491
508
492
509
module Foldable =
You can’t perform that action at this time.
0 commit comments