Skip to content

Instantly share code, notes, and snippets.

@mat3u
Last active August 29, 2015 14:14
Show Gist options
  • Save mat3u/ca8eed1f1ae831ef0a9a to your computer and use it in GitHub Desktop.
Save mat3u/ca8eed1f1ae831ef0a9a to your computer and use it in GitHub Desktop.
let rec unzip3<'a, 'b, 'c> ((A: 'a list), (B: 'b list), (C: 'c list)) (tuples: (('a * 'b * 'c) list)) : ('a list) * ('b list) * ('c list) =
match tuples with
| (a: 'a, b: 'b, c: 'c)::tail -> unzip3 (a ++ A, b ++ B, c ++ C) tail
| [] -> (A, B, C)
let rec unzip3 (A, B, C) tuples =
match tuples with
| (a: 'a, b: 'b, c: 'c)::tail -> unzip3 (a :: A, b :: B, c :: C) tail
| [] -> (A, B, C)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment