Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Latest commit

 

History

History
89 lines (55 loc) · 2.14 KB

list.mapi2['t1,'t2,'u]-function-[fsharp].md

File metadata and controls

89 lines (55 loc) · 2.14 KB
title description keywords author manager ms.date ms.topic ms.prod ms.technology ms.assetid
List.mapi2<'T1,'T2,'U> Function (F#)
List.mapi2<'T1,'T2,'U> Function (F#)
visual f#, f#, functional programming
dend
danielfe
05/16/2016
language-reference
visual-studio-dev14
devlang-fsharp
18316575-2a76-4312-a934-818bebb4ae3a

List.mapi2<'T1,'T2,'U> Function (F#)

Like List.mapi, but mapping corresponding elements from two lists. The lists must have equal lengths.

Namespace/Module Path: Microsoft.FSharp.Collections.List

Assembly: FSharp.Core (in FSharp.Core.dll)

Syntax

// Signature:
List.mapi2 : (int -> 'T1 -> 'T2 -> 'U) -> 'T1 list -> 'T2 list -> 'U list

// Usage:
List.mapi2 mapping list1 list2

Parameters

mapping Type: int-> 'T1 -> 'T2 -> 'U

The function to transform pairs of elements from the two lists and their index.

list1 Type: 'T1list

The first input list.

list2 Type: 'T2list

The second input list.

Return Value

The list of transformed elements.

Exceptions

Exception Condition
ArgumentException Thrown when the input lists differ in length.

Remarks

This function is named MapIndexed2 in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.

Example

[!code-fsharpMain]

Output

[0; 7; 18]

Platforms

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Collections.List Module (F#)

Microsoft.FSharp.Collections Namespace (F#)