From 182be684e2f0d284f60bafa640b2ae604e81c9b9 Mon Sep 17 00:00:00 2001 From: wale ALASHE Date: Sat, 26 Oct 2019 04:54:59 +0100 Subject: [PATCH] Update seq.mapi['t,'u]-function-[fsharp].md i tried to add an example to make it easier to follow. although i see that the example is making use of another method in the Sequence module, i'm not sure how easy it will be to understand. --- .../seq.mapi['t,'u]-function-[fsharp].md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/conceptual/seq.mapi['t,'u]-function-[fsharp].md b/docs/conceptual/seq.mapi['t,'u]-function-[fsharp].md index 70661701..5fc41557 100644 --- a/docs/conceptual/seq.mapi['t,'u]-function-[fsharp].md +++ b/docs/conceptual/seq.mapi['t,'u]-function-[fsharp].md @@ -55,6 +55,21 @@ The result sequence. ## Remarks This function is named `MapIndexed` in compiled assemblies. If you are accessing the function from a .NET language other than F#, or through reflection, use this name. +## Example +``` +let text = "hello" +Seq.mapi (fun i c -> sprintf "%d - %c" i c) text |> Seq.iter (fun s -> printfn "%s" s) +``` + +**Output** + +``` +0 - h +1 - e +2 - l +3 - l +4 - o +``` ## Platforms Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2