Skip to content

Commit

Permalink
exists and forall are dual
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent ab9f2a7 commit c1f56f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ let ``find and exists work similar`` () =
Check.QuickThrowOnFailure find_and_exists<string>
Check.QuickThrowOnFailure find_and_exists<NormalFloat>

let exists_and_forall<'a when 'a : comparison> (xs : list<'a>) (F (_, predicate)) =
let a = List.forall (predicate >> not) xs
let b = List.exists predicate xs
a = not b

[<Test>]
let ``exists and forall are dual`` () =
Check.QuickThrowOnFailure exists_and_forall<int>
Check.QuickThrowOnFailure exists_and_forall<string>
Check.QuickThrowOnFailure exists_and_forall<NormalFloat>

let findBack_and_exists<'a when 'a : comparison> (xs : list<'a>) f =
let a =
try
Expand Down

0 comments on commit c1f56f2

Please sign in to comment.