Share via


Array.zip3<'T1,'T2,'T3> Function (F#)

Combines three arrays into an array of tuples with three elements. The three arrays must have equal lengths, otherwise an ArgumentException is raised.

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

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

// Signature:
Array.zip3 : 'T1 [] -> 'T2 [] -> 'T3 [] -> ('T1 * 'T2 * 'T3) []

// Usage:
Array.zip3 array1 array2 array3

Parameters

  • array1
    Type: 'T1[]

    The first input array.

  • array2
    Type: 'T2[]

    The second input array.

  • array3
    Type: 'T3[]

    The third input array.

Exceptions

Exception

Condition

ArgumentException

Thrown when the input arrays differ in length.

Return Value

The array of tupled elements.

Remarks

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

Example

The following code shows how to use Array.zip3.

let array1 = [| 1; 2; 3 |]
let array2 = [| -1; -2; -3 |]
let array3 = [| "horse"; "dog"; "elephant" |]
let arrayZip3 = Array.zip3 array1 array2 array3
printfn "%A" arrayZip3

Output

[|(1, -1, "horse"); (2, -2, "dog"); (3, -3, "elephant")|]

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

Reference

Collections.Array Module (F#)

Microsoft.FSharp.Collections Namespace (F#)