Skip to content

Commit

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

let unzip3<'a when 'a : equality> (xs:('a*'a*'a) []) =
// no seq version
let l = runAndCheckErrorType (fun () -> List.unzip3 (List.ofSeq xs) |> fun (a,b,c) -> List.toArray a, List.toArray b, List.toArray c)
let a = runAndCheckErrorType (fun () -> Array.unzip3 xs)
l = a

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

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

0 comments on commit ec7ba49

Please sign in to comment.