Seq.forall<'T> Function (F#)
Visual Studio 2012
Tests if all elements of the sequence satisfy the given predicate.
Namespace/Module Path: Microsoft.FSharp.Collections.Seq
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
Seq.forall : ('T -> bool) -> seq<'T> -> bool
// Usage:
Seq.forall predicate source
The following code shows how to use Seq.forall.
// This function can be used on any sequence, so the same function // works with both lists and arrays. let allPositive coll = Seq.forall (fun elem -> elem > 0) coll printfn "%A" (allPositive [| 0; 1; 2; 3 |]) printfn "%A" (allPositive [ 1; 2; 3 ])
Output
false true