chore: converted acceptance tests 5-7

This commit is contained in:
microproofs
2023-04-19 20:03:27 -04:00
parent c2ee631d07
commit 672a900243
9 changed files with 374 additions and 140 deletions

View File

@@ -1,11 +1,15 @@
pub fn unzip(xs: List<(a, b)>) -> (List<a>, List<b>) {
when xs is {
[] ->
([], [])
[] -> ([], [])
[(a, b), ..rest] -> {
let (a_tail, b_tail) =
unzip(rest)
let (a_tail, b_tail) = unzip(rest)
([a, ..a_tail], [b, ..b_tail])
}
}
}
test unzip1() {
let x = [(3, #"55"), (4, #"7799")]
unzip(x) == ([3, 4], [#"55", #"7799"])
}