Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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

Creates a new collection whose elements are the results of applying the given function to the corresponding elements of the three collections simultaneously.

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

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

// Signature:
List.map3 : ('T1 -> 'T2 -> 'T3 -> 'U) -> 'T1 list -> 'T2 list -> 'T3 list -> 'U list

// Usage:
List.map3 mapping list1 list2 list3

mapping

Type: 'T1 -> 'T2 -> 'T3 -> 'U

The function to transform triples of elements from the input lists.

list1

Type: 'T1 list

The first input list.

list2

Type: 'T2 list

The second input list.

list3

Type: 'T3 list

The third input list.

The list of transformed elements.

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

The following code example illustrates the use of List.map3.

let list1 = [1; 2; 3]
let list2 = [4; 5; 6]
let newList = List.map3 (fun x y z -> x + y + z) list1 list2 [2; 3; 4]
printfn "%A" newList

Output

[7; 10; 13]

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

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft