Seq.forall2<'T1,'T2> Function (F#)
Visual Studio 2012
Tests whether all the pairs of elements drawn from the two sequences satisfy the given predicate. If one sequence is shorter than the other then the remaining elements of the longer sequence are ignored.
Namespace/Module Path: Microsoft.FSharp.Collections.Seq
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
Seq.forall2 : ('T1 -> 'T2 -> bool) -> seq<'T1> -> seq<'T2> -> bool
// Usage:
Seq.forall2 predicate source1 source2
The following code shows how to use Seq.forall2.
// This function can be used on any sequence, so the same function // works with both lists and arrays. let allEqual coll = Seq.forall2 (fun elem1 elem2 -> elem1 = elem2) coll printfn "%A" (allEqual [| 1; 2 |] [| 1; 2 |]) printfn "%A" (allEqual [ 1; 2 ] [ 2; 1 ])
Output
true false