diff options
author | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-02-22 13:34:58 +0100 |
---|---|---|
committer | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-02-22 13:34:58 +0100 |
commit | 5746dbca0ddaef455b6f26fba3945f3533d0b2c1 (patch) | |
tree | 855e48c9d25a0136351947dfe17140d40568e8fd /aoc-2020-gleam/src/days/day05.gleam | |
parent | ed0763c9dce58a53715415f31146b6f670519d76 (diff) | |
download | gleam_aoc2020-5746dbca0ddaef455b6f26fba3945f3533d0b2c1.tar.gz gleam_aoc2020-5746dbca0ddaef455b6f26fba3945f3533d0b2c1.zip |
Add aliases to long imports
Diffstat (limited to 'aoc-2020-gleam/src/days/day05.gleam')
-rw-r--r-- | aoc-2020-gleam/src/days/day05.gleam | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/aoc-2020-gleam/src/days/day05.gleam b/aoc-2020-gleam/src/days/day05.gleam index f655be9..b1471f9 100644 --- a/aoc-2020-gleam/src/days/day05.gleam +++ b/aoc-2020-gleam/src/days/day05.gleam @@ -1,31 +1,31 @@ import gleam/io import gleam/int -import gleam/string import gleam/list import gleam/set +import gleam/string as str import gleam/iterator as iter -import ext/resultx +import ext/resultx as resx import util/input_util fn get_seat_id(pass: String) -> Int { pass - |> string.to_graphemes + |> str.to_graphemes |> list.map(with: fn(grapheme) { case grapheme { "F" | "L" -> "0" "B" | "R" -> "1" } }) - |> string.concat + |> str.concat |> int.base_parse(2) - |> resultx.force_unwrap + |> resx.assert_unwrap } fn part1(lines: List(String)) -> Int { lines |> list.map(with: get_seat_id) |> list.reduce(with: int.max) - |> resultx.force_unwrap + |> resx.assert_unwrap } fn part2(lines: List(String)) -> Int { @@ -40,7 +40,7 @@ fn part2(lines: List(String)) -> Int { in: iter.range(from: 1, to: 1023), one_that: fn(id) { occupied(id - 1) && !occupied(id) && occupied(id + 1) }, ) - |> resultx.force_unwrap + |> resx.assert_unwrap } pub fn run() -> Nil { |