From 67e9cf8ea21ac829612e6e0ce2488c4748667a2a Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Wed, 1 Feb 2023 17:28:08 +0000 Subject: Fix changelog --- CHANGELOG.md | 2 +- src/gleam/map.gleam | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f881fd..e7251eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- The `list` module gains the `group` function. - The `dynamic` module is able to decode simple JavaScript objects to maps. So, the behaviour of the `field` and `object` functions are consistent. @@ -25,7 +26,6 @@ `utf_codepoint_to_int` functions. - Fixed `string.inspect`'s escaping of `"`, `\`, `\n`, `\r`, `\r\n`, and `\t`, which in turn fixes `io.debug`'s output of such strings. -- The `list` module gains the `group` function. - The `bit_string` function in the `dynamic` module now knows how to handle JavaScript `Uint8Array`s. diff --git a/src/gleam/map.gleam b/src/gleam/map.gleam index a1b7523..fd9f961 100644 --- a/src/gleam/map.gleam +++ b/src/gleam/map.gleam @@ -265,16 +265,16 @@ if erlang { } if javascript { - fn do_reverse_acc(remaining, accumulator) { + fn reverse_and_concat(remaining, accumulator) { case remaining { [] -> accumulator - [item, ..rest] -> do_reverse_acc(rest, [item, ..accumulator]) + [item, ..rest] -> reverse_and_concat(rest, [item, ..accumulator]) } } fn do_keys_acc(list: List(#(k, v)), acc: List(k)) -> List(k) { case list { - [] -> do_reverse_acc(acc, []) + [] -> reverse_and_concat(acc, []) [x, ..xs] -> do_keys_acc(xs, [x.0, ..acc]) } } @@ -312,7 +312,7 @@ if erlang { if javascript { fn do_values_acc(list: List(#(k, v)), acc: List(v)) -> List(v) { case list { - [] -> do_reverse_acc(acc, []) + [] -> reverse_and_concat(acc, []) [x, ..xs] -> do_values_acc(xs, [x.1, ..acc]) } } -- cgit v1.2.3