File tree Expand file tree Collapse file tree
src/FSharp.Control.AsyncSeq
tests/FSharp.Control.AsyncSeq.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -321,6 +321,13 @@ module AsyncSeq =
321321 /// be asked for the next element after the processing of an element completes ) .
322322 val mapiAsync : mapping :( int64 -> 'T -> Async < 'U >) -> source : AsyncSeq < 'T > -> AsyncSeq < 'U >
323323
324+ /// Builds a new asynchronous sequence whose elements are generated by
325+ /// applying the specified function to all elements of the input sequence.
326+ ///
327+ /// The specified function is synchronous ( and the input sequence will
328+ /// be asked for the next element after the processing of an element completes ) .
329+ val mapi : mapping :( int64 -> 'T -> 'U ) -> source : AsyncSeq < 'T > -> AsyncSeq < 'U >
330+
324331 [< System.Obsolete ( "Renamed to mapiAsync ") >]
325332 val zipWithIndexAsync : mapping :( int64 -> 'T -> Async < 'U >) -> source : AsyncSeq < 'T > -> AsyncSeq < 'U >
326333
Original file line number Diff line number Diff line change @@ -1378,6 +1378,20 @@ let ``AsyncSeq.unfoldAsync should be iterable in finite resources``() =
13781378
13791379
13801380
1381+ [<Test>]
1382+ let ``AsyncSeq.mapi should work`` () =
1383+ for i in 0 .. 100 do
1384+ let ls = List.init i ( fun x -> x + 100 )
1385+ let expected =
1386+ ls
1387+ |> List.mapi ( fun i x -> sprintf " %i _%i " i x)
1388+ let actual =
1389+ ls
1390+ |> AsyncSeq.ofSeq
1391+ |> AsyncSeq.mapi ( fun i x -> sprintf " %i _%i " i x)
1392+ |> AsyncSeq.toList
1393+ Assert.AreEqual( expected, actual)
1394+
13811395
13821396[<Test>]
13831397let ``AsyncSeq.take should work`` () =
You can’t perform that action at this time.
0 commit comments