Skip to content

Commit

Permalink
find and exists work similar
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent 655d7e4 commit 73dd273
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ let ``filter and except work similar`` () =
Check.QuickThrowOnFailure filter_and_except<string>
Check.QuickThrowOnFailure filter_and_except<NormalFloat>

let find_and_exists<'a when 'a : comparison> (xs : list<'a>) f =
let a =
try
List.find f xs |> ignore
true
with
| _ -> false
let b = List.exists f xs
a = b

[<Test>]
let ``find and exists work similar`` () =
Check.QuickThrowOnFailure find_and_exists<int>
Check.QuickThrowOnFailure find_and_exists<string>
Check.QuickThrowOnFailure find_and_exists<NormalFloat>


let distinct_works_like_set<'a when 'a : comparison> (xs : 'a list) =
let a = List.distinct xs
Expand Down

0 comments on commit 73dd273

Please sign in to comment.