Skip to content

Commit

Permalink
forall is consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent c0e8525 commit ab9f2a7
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,18 @@ let ``foldBack2 is consistent`` () =
Check.QuickThrowOnFailure foldBack2<float,float,int>
Check.QuickThrowOnFailure foldBack2<float,float,string>

let forall<'a when 'a : equality> (xs : 'a []) f =
let s = xs |> Seq.forall f
let l = xs |> List.ofArray |> List.forall f
let a = xs |> Array.forall f
s = a && l = a

[<Test>]
let ``forall is consistent`` () =
Check.QuickThrowOnFailure forall<int>
Check.QuickThrowOnFailure forall<string>
Check.QuickThrowOnFailure forall<NormalFloat>

let indexed<'a when 'a : equality> (xs : 'a []) =
let s = xs |> Seq.indexed
let l = xs |> List.ofArray |> List.indexed
Expand Down

0 comments on commit ab9f2a7

Please sign in to comment.