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

업데이트: 2010년 8월

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

네임스페이스/모듈 경로: 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

Condition

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 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

버전 정보

F# 런타임

지원되는 버전: 2.0, 4.0

Silverlight

지원되는 버전: 3

참고 항목

참조

Collections.Seq 모듈(F#)

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

변경 기록

날짜

변경 내용

이유

2010년 8월

코드 예제를 추가했습니다.

향상된 기능 관련 정보