diff options
author | J.J <thechairman@thechairman.info> | 2023-12-17 20:33:33 -0500 |
---|---|---|
committer | J.J <thechairman@thechairman.info> | 2023-12-17 20:33:33 -0500 |
commit | 7213ca083d121bb9e6876d2ddb4b25ee09d954bb (patch) | |
tree | d33e02e185705da07014f41e65550629db477e5d /aoc2023/src/day15 | |
parent | 774dede7c2f4a02ed9a588cff08a79e1f8cf3217 (diff) | |
download | gleam_aoc-7213ca083d121bb9e6876d2ddb4b25ee09d954bb.tar.gz gleam_aoc-7213ca083d121bb9e6876d2ddb4b25ee09d954bb.zip |
running updated gleam formatter
Diffstat (limited to 'aoc2023/src/day15')
-rw-r--r-- | aoc2023/src/day15/solve.gleam | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/aoc2023/src/day15/solve.gleam b/aoc2023/src/day15/solve.gleam index 2d863b5..a7d250c 100644 --- a/aoc2023/src/day15/solve.gleam +++ b/aoc2023/src/day15/solve.gleam @@ -12,13 +12,13 @@ fn split(input: String) -> List(String) { } fn hash_algorithm(str: String) -> Int { - str - |> string.to_utf_codepoints() - |> list.map(string.utf_codepoint_to_int) - |> list.fold(0, fn(acc, c) { - let assert Ok(acc) = int.modulo({ acc + c } * 17, 256) - acc - }) + let codepoints = + str + |> string.to_utf_codepoints() + |> list.map(string.utf_codepoint_to_int) + use acc, c <- list.fold(codepoints, 0) + let assert Ok(acc) = int.modulo({ acc + c } * 17, 256) + acc } pub fn part1(input: String) -> String { |