다음을 통해 공유


Seq.exists<'T> 함수(F#)

시퀀스에 지정한 조건자를 만족하는 요소가 있는지 테스트합니다.

네임스페이스/모듈 경로: Microsoft.FSharp.Collections.Seq

어셈블리: FSharp.Core(FSharp.Core.dll)

// Signature:
Seq.exists : ('T -> bool) -> seq<'T> -> bool

// Usage:
Seq.exists predicate source

매개 변수

  • predicate
    형식: 'T ->bool

    입력 시퀀스의 각 항목을 테스트하는 함수입니다.

  • source
    형식: seq<'T>

    입력 시퀀스입니다.

예외

Exception

조건

ArgumentNullException

입력 시퀀스가 null이면 throw됩니다.

반환 값

조건자는 입력 시퀀스의 요소에 적용됩니다.적용 결과 true가 한 번이라도 반환되면 전체 결과가 true가 되며 더 이상 요소가 테스트되지 않습니다.그렇지 않으면 false을 반환합니다.

설명

컴파일된 어셈블리에서 이 함수의 이름은 Exists입니다.F# 이외의 언어에서 함수에 액세스하거나 리플렉션을 통해 함수에 액세스하는 경우 이 이름을 사용합니다.

예제

다음 코드에서는 Seq.exists을 사용하는 방법을 보여 줍니다.

// Use Seq.exists to determine whether there is an element of a sequence
// that satisfies a given Boolean expression.
// containsNumber returns true if any of the elements of the supplied sequence match 
// the supplied number.
let containsNumber number seq1 = Seq.exists (fun elem -> elem = number) seq1
let seq0to3 = seq {0 .. 3}
printfn "For sequence %A, contains zero is %b" seq0to3 (containsNumber 0 seq0to3)

Output

  

플랫폼

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

버전 정보

F# 코어 라이브러리 버전

지원: 2.0, 4.0, 노트북

참고 항목

참조

Collections.Seq 모듈(F#)

Microsoft.FSharp.Collections 네임스페이스(F#)