diff options
author | Giacomo Cavalieri <giacomo.cavalieri@icloud.com> | 2023-05-26 12:09:54 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-05-27 11:22:20 +0100 |
commit | ad97fe52dbcf9c110f459fda98b25b0c787372ea (patch) | |
tree | b8d631c0ac1ce59fe1b354d54279942f29d7e9b6 /src | |
parent | f2edd4d15e08a5f73d9f69d5f486ea0ca705017e (diff) | |
download | gleam_stdlib-ad97fe52dbcf9c110f459fda98b25b0c787372ea.tar.gz gleam_stdlib-ad97fe52dbcf9c110f459fda98b25b0c787372ea.zip |
Add labels and clearer names to `list.zip` and `list.zip_strict`
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/list.gleam | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 8b0b875..7265016 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -982,8 +982,8 @@ fn do_zip(xs: List(a), ys: List(b), acc: List(#(a, b))) -> List(#(a, b)) { /// [#(1, 3), #(2, 4)] /// ``` /// -pub fn zip(xs: List(a), ys: List(b)) -> List(#(a, b)) { - do_zip(xs, ys, []) +pub fn zip(list: List(a), with other: List(b)) -> List(#(a, b)) { + do_zip(list, other, []) } /// Takes two lists and returns a single list of 2-element tuples. @@ -1013,11 +1013,11 @@ pub fn zip(xs: List(a), ys: List(b)) -> List(#(a, b)) { /// ``` /// pub fn strict_zip( - l1: List(a), - l2: List(b), + list: List(a), + with other: List(b), ) -> Result(List(#(a, b)), LengthMismatch) { - case length(of: l1) == length(of: l2) { - True -> Ok(zip(l1, l2)) + case length(of: list) == length(of: other) { + True -> Ok(zip(list, other)) False -> Error(LengthMismatch) } } |