aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gleam/iterator.gleam8
-rw-r--r--src/gleam/list.gleam6
2 files changed, 2 insertions, 12 deletions
diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam
index 3fa74d0..7e16121 100644
--- a/src/gleam/iterator.gleam
+++ b/src/gleam/iterator.gleam
@@ -664,7 +664,6 @@ pub fn zip(left: Iterator(a), right: Iterator(b)) -> Iterator(tuple(a, b)) {
type ChunkBy(element, key) {
AnotherBy(List(element), key, element, fn() -> Action(element))
LastBy(List(element))
- NoneBy
}
fn next_chunk_by(
@@ -674,11 +673,7 @@ fn next_chunk_by(
current_chunk: List(element),
) -> ChunkBy(element, key) {
case continuation() {
- Stop ->
- case current_chunk {
- [] -> NoneBy
- remaining -> LastBy(list.reverse(remaining))
- }
+ Stop -> LastBy(list.reverse(current_chunk))
Continue(e, next) -> {
let key = f(e)
case key == previous_key {
@@ -696,7 +691,6 @@ fn do_chunk_by(
previous_element: element,
) -> Action(List(element)) {
case next_chunk_by(continuation, f, previous_key, [previous_element]) {
- NoneBy -> Stop
LastBy(chunk) -> Continue(chunk, stop)
AnotherBy(chunk, key, el, next) ->
Continue(chunk, fn() { do_chunk_by(next, f, key, el) })
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam
index 9572e36..df62886 100644
--- a/src/gleam/list.gleam
+++ b/src/gleam/list.gleam
@@ -1278,11 +1278,7 @@ fn do_chunk_by(
acc: List(List(a)),
) -> List(List(a)) {
case list {
- [] ->
- case current_chunk {
- [] -> reverse(acc)
- remaining -> reverse([reverse(remaining), ..acc])
- }
+ [] -> reverse([reverse(current_chunk), ..acc])
[head, ..tail] -> {
let key = f(head)
case key == previous_key {